bgfx
bgfx copied to clipboard
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 by the renderer.
This patch changes invalid programs to be encoded as invalid programs, so the renderer can properly ignore them.
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.
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?