Skip to content

Commit

Permalink
Don't encode invalid programs as valid unrelated programs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Sami Kyöstilä committed Aug 14, 2020
1 parent 9991b63 commit d4225d1
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/bgfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1247,11 +1247,7 @@ namespace bgfx
UniformBuffer* uniformBuffer = m_frame->m_uniformBuffer[m_uniformIdx];
m_uniformEnd = uniformBuffer->getPos();

m_key.m_program = isValid(_program)
? _program
: ProgramHandle{0}
;

m_key.m_program = _program;
m_key.m_view = _id;

SortKey::Enum type = SortKey::SortProgram;
Expand Down

0 comments on commit d4225d1

Please sign in to comment.