From 8dbd6316d277d2f9cbf85e7e61f2541421e01292 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 17 Nov 2014 18:24:34 +0200 Subject: [PATCH] Always update program uniforms if uniform names have changed It's possible for pu.used to be zero, in which case the original code would never update it. --- source/programdata.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/programdata.cpp b/source/programdata.cpp index 65e660f0..4b39d196 100644 --- a/source/programdata.cpp +++ b/source/programdata.cpp @@ -265,14 +265,15 @@ void ProgramData::apply() const Program::LayoutHash layout = prog->get_uniform_layout_hash(); ProgramUniforms &pu = programs[layout]; - if((dirty&pu.used)|pu.dirty) + Mask force_dirty = (dirty==ALL_ONES ? ALL_ONES : 0U); + Mask affected = (dirty&pu.used) | force_dirty; + if(affected|pu.dirty) { /* If the global dirty flag affects this program, add it to per-program dirty flags and clear the global flag. A previously unseen program will always cause this to happen. */ - if(dirty&pu.used) + if(affected) { - Mask force_dirty = (dirty==ALL_ONES ? ALL_ONES : 0U); for(BlockMap::iterator i=blocks.begin(); i!=blocks.end(); ++i) i->second.dirty |= (dirty&i->second.used) | force_dirty; for(ProgramMap::iterator i=programs.begin(); i!=programs.end(); ++i) -- 2.45.2