Don't encode invalid programs as valid unrelated programs

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.
This commit is contained in:
Sami Kyöstilä 2020-08-14 18:18:30 +01:00
parent 115661d158
commit fdd469962a

View File

@ -1247,11 +1247,7 @@ namespace bgfx
UniformBuffer* uniformBuffer = m_frame->m_uniformBuffer[m_uniformIdx]; UniformBuffer* uniformBuffer = m_frame->m_uniformBuffer[m_uniformIdx];
m_uniformEnd = uniformBuffer->getPos(); m_uniformEnd = uniformBuffer->getPos();
m_key.m_program = isValid(_program) m_key.m_program = _program;
? _program
: ProgramHandle{0}
;
m_key.m_view = _id; m_key.m_view = _id;
SortKey::Enum type = SortKey::SortProgram; SortKey::Enum type = SortKey::SortProgram;