Backend resource cleanup bug
mrduda opened this issue · 0 comments
mrduda commented
Hi,
I found a little yet annoying bug which causes severe issues after calling destroy() with px_render::Pipeline and subsequent call of createPipeline. There's one line missing in DestroyBackEndResource(), right after you call glDeleteProgram:
GLCHECK(glDeleteProgram(b->pipelines[pos].program));
b->pipelines[pos].program = 0; // <---- this one is required
Without this you'll get a lot of OpenGL errors by using deleted and reused Pipeline (since createPipeline reuses previously deleted Pipeline), because this check in ChangePipeline will always fail to execute the inner code in the if() block:
if (pi.second->program == 0) {