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

Don't encode invalid programs as valid unrelated programs #2231

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

skyostil
Copy link
Contributor

When an invalid program is submitted with bgfx::touch(), it gets encoded
as program index 0 by the command encoder. Since program 0 can be a
valid program (typically it's the debug text blitter program), this can
result in garbage being drawn by the renderer.

This patch changes invalid programs to be encoded as invalid programs,
so the renderer can properly ignore them.

@skyostil
Copy link
Contributor Author

Not sure if this is the right fix, but I noticed the GL renderer turning bgfx::touch() into actual rendering calls using geometry from another draw call.

Sami Kyöstilä added 2 commits September 30, 2020 23:23
When an invalid program is submitted with bgfx::touch(), it gets encoded
as program index 0 by the command encoder. Since program 0 can be a
valid program (typically it's the debug text blitter program), this can
result in garbage being drawn if no other rendering is submitted for the
same view.

This patch changes invalid programs to be encoded as invalid programs,
so the renderer can properly ignore them.
When an invalid program handle is encoded (e.g., with handle 0xffff), it
will overflow the space reserved for program handles in the sorting key.
This patch fixes the issue by turning any out-of-range program handles
back to invalid handles when decoding sorting keys.
@skyostil
Copy link
Contributor Author

I noticed that even with my earlier fix the decoder doesn't recognize invalid programs correctly, so I made a follow-up. Does this seem right, or am I missing something about how bgfx::touch() works?

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.

1 participant