Hi,
 
I found a bug related to the removal of uniforms.
 
bool ShaderProgramVariables::subMapVariable(const Char8   *name,
                                                  MFInt32 *pVarLoc,
                                                  MFInt32 *pProcVarLoc)
 
does not truely removed the uniform variables, it sets their slot NULL/-1. There's a #if 0 block which did a true erase operation but its not used at the moment.
The next call to SimpleSHLChunk::updateVariableLocations crashes when trying to update the former removed uniform. Fix is attached.
 
Thanks,
Michael
 
 
 
@@ -1280,6 +1292,9 @@ void SimpleSHLChunk::updateVariableLocations(DrawEnv *pEnv,
 
         for(; mVarIt != mVarEnd; ++mVarIt, ++mLocIt)
         {
+            if( (*mVarIt) == NULL ) // empty slot; uniform was removed here..
+                continue;
+
             *mLocIt = osgGlGetUniformLocation(uiProgram,
                                               (*mVarIt)->getName().c_str());
         }
 
 
 
@@ -1280,6 +1292,9 @@ void SimpleSHLChunk::updateVariableLocations(DrawEnv *pEnv,
 
         for(; mVarIt != mVarEnd; ++mVarIt, ++mLocIt)
         {
+			if( (*mVarIt) == NULL ) // empty slot; uniform was removed here..
+				continue;
+
             *mLocIt = osgGlGetUniformLocation(uiProgram,
                                               (*mVarIt)->getName().c_str());
         }
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to