Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Dynamic Texture update method to consider the invertY argument. #1187

Conversation

SergioRZMasson
Copy link
Contributor

Overview

When calling DynamicTexture.update with values given to the invertY argument nothing happens in Babylon Native. The invertY arguments get completely ignored by the NativeEngine.

See #1186

Implementation

I'm adding a code path where the CPU flips the texture in the Y axis. Maybe there is a better way to do this completely on the GPU but this implementation should be good enough for users to have the expected behavior while we improve it with a more performant version.

Fixes #1186

{
bgfx::Encoder* encoder = m_update.GetUpdateToken().GetEncoder();
GetBoundFrameBuffer(*encoder).Blit(*encoder, textureDestination->Handle(), 0, 0, textureSource->Handle());

// Flip texture in memory (maybe there is a way for bgfx to allow flipping to happen on the GPU?)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to CPU seems like it's unnecessary. At worst case, we should be able to flip using a shader?

@bghgary
Copy link
Contributor

bghgary commented Oct 4, 2023

Closing for now. We can reopen once we are ready to work on the issue again.

@bghgary bghgary closed this Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dynamic Texture update does not consider invertY argument values
2 participants