Here's Gerrit's patch

/Marcus

Hi,

as said attached the patch to fix the validateAllGLObject problems.

kind regards,
 gerrit


commit 7cedc8a6a470559b52d01242e0e525b57dd86783
Author: gerrit <[email protected]>
Date:   Thu Apr 16 14:26:09 2009 +0800

    fixed: make sure shader programs are validated before the object is linked on
           all pathes. (Thanks to Marcus Lindblom for finding a path that does not)
         : some typos in OSGWindow

diff --git a/Source/System/State/Shader/Chunks/OSGShaderExecutableChunk.cpp b/Source/System/State/Shader/Chunks/OSGShaderExecutableChunk.cpp
index 82aa254..a10f621 100644
--- a/Source/System/State/Shader/Chunks/OSGShaderExecutableChunk.cpp
+++ b/Source/System/State/Shader/Chunks/OSGShaderExecutableChunk.cpp
@@ -242,6 +242,8 @@ UInt32 ShaderExecutableChunk::handleGL(DrawEnv                 *pEnv,
             
             for(; fIt != fEnd; ++fIt)
             {
+                (*fIt)->validate(pEnv);
+
                 GLuint uiShader = 
                     GLuint(pWin->getGLObjectId((*fIt)->getGLId()));
 
@@ -254,6 +256,8 @@ UInt32 ShaderExecutableChunk::handleGL(DrawEnv                 *pEnv,
             
             for(; gIt != gEnd; ++gIt)
             {
+                (*gIt)->validate(pEnv);
+
                 GLuint uiShader = 
                     GLuint(pWin->getGLObjectId((*gIt)->getGLId()));
 
@@ -266,6 +270,8 @@ UInt32 ShaderExecutableChunk::handleGL(DrawEnv                 *pEnv,
             
             for(; vIt != vEnd; ++vIt)
             {
+                (*vIt)->validate(pEnv);
+
                 GLuint uiShader = 
                     GLuint(pWin->getGLObjectId((*vIt)->getGLId()));
 
@@ -516,6 +522,7 @@ void ShaderExecutableChunk::dump(      UInt32    ,
 void ShaderExecutableChunk::activate(DrawEnv    *pEnv,              
                                      UInt32      uiIdx)
 {
+#if 0
     FragmentShaderIt fIt  = _mfFragmentShader.begin();
     FragmentShaderIt fEnd = _mfFragmentShader.end  ();
 
@@ -539,6 +546,7 @@ void ShaderExecutableChunk::activate(DrawEnv    *pEnv,
     {
         (*vIt)->validate(pEnv);
     }
+#endif
       
     Window *pWin    = pEnv->getWindow();
 
diff --git a/Source/System/State/Shader/SHL/OSGSimpleSHLChunk.cpp b/Source/System/State/Shader/SHL/OSGSimpleSHLChunk.cpp
index 5f177c5..fc8f52a 100644
--- a/Source/System/State/Shader/SHL/OSGSimpleSHLChunk.cpp
+++ b/Source/System/State/Shader/SHL/OSGSimpleSHLChunk.cpp
@@ -136,6 +136,8 @@ UInt32 SimpleSHLChunk::handleGL(DrawEnv                 *pEnv,
             
             for(; fIt != fEnd; ++fIt)
             {
+                (*fIt)->validate(pEnv);
+
                 GLuint uiShader = 
                     GLuint(pWin->getGLObjectId((*fIt)->getGLId()));
 
@@ -148,6 +150,8 @@ UInt32 SimpleSHLChunk::handleGL(DrawEnv                 *pEnv,
             
             for(; gIt != gEnd; ++gIt)
             {
+                (*gIt)->validate(pEnv);
+
                 GLuint uiShader = 
                     GLuint(pWin->getGLObjectId((*gIt)->getGLId()));
 
@@ -160,6 +164,8 @@ UInt32 SimpleSHLChunk::handleGL(DrawEnv                 *pEnv,
             
             for(; vIt != vEnd; ++vIt)
             {
+                (*vIt)->validate(pEnv);
+
                 GLuint uiShader = 
                     GLuint(pWin->getGLObjectId((*vIt)->getGLId()));
 
@@ -534,6 +540,7 @@ void SimpleSHLChunk::changed(ConstFieldMaskArg whichField,
 void SimpleSHLChunk::activate(DrawEnv    *pEnv,              
                               UInt32      uiIdx)
 {
+#if 0
     FragmentShaderIt fIt  = _mfFragmentShader.begin();
     FragmentShaderIt fEnd = _mfFragmentShader.end  ();
 
@@ -557,6 +564,7 @@ void SimpleSHLChunk::activate(DrawEnv    *pEnv,
     {
         (*vIt)->validate(pEnv);
     }
+#endif
       
     Window *pWin    = pEnv->getWindow();
 
diff --git a/Source/System/State/Shader/SHL/testSHLEarth.cpp b/Source/System/State/Shader/SHL/testSHLEarth.cpp
index 1d254b1..e50f973 100644
--- a/Source/System/State/Shader/SHL/testSHLEarth.cpp
+++ b/Source/System/State/Shader/SHL/testSHLEarth.cpp
@@ -175,6 +175,9 @@ int doMain(int argc, char **argv)
     // show the whole scene
     _mgr->showAll();
 
+    OSG::commitChanges();
+    gwin->validateAllGLObjects();
+
     return 0;
 }
 
diff --git a/Source/System/State/Shader/SHL/testSHLEarth_compat.cpp b/Source/System/State/Shader/SHL/testSHLEarth_compat.cpp
index 30d6bf0..b3bff8a 100644
--- a/Source/System/State/Shader/SHL/testSHLEarth_compat.cpp
+++ b/Source/System/State/Shader/SHL/testSHLEarth_compat.cpp
@@ -178,6 +178,10 @@ int doMain(int argc, char **argv)
     // show the whole scene
     _mgr->showAll();
 
+
+    OSG::commitChanges();
+    gwin->validateAllGLObjects();
+
     return 0;
 }
 
diff --git a/Source/System/Window/Base/OSGWindow.cpp b/Source/System/Window/Base/OSGWindow.cpp
index 9f2aa68..becdef6 100644
--- a/Source/System/Window/Base/OSGWindow.cpp
+++ b/Source/System/Window/Base/OSGWindow.cpp
@@ -724,9 +724,10 @@ void OSG::Window::validateAllGLObjects(void)
             validateGLObject(i, &oEnv);
     
         frameExit();
+        deactivate();
     }   
     else if((_sfPartitionDrawMode.getValue() & 
-              PartitionDrawMask               ) == SequentialPartitionDraw)
+              PartitionDrawMask               ) == ParallelPartitionDraw)
     {
     }
     else
@@ -1824,7 +1825,7 @@ void OSG::Window::render(RenderActionBase *action)
         frameExit(); // after frame cleanup: delete dead GL objects
     }
     else if((_sfPartitionDrawMode.getValue() & 
-              PartitionDrawMask               ) == SequentialPartitionDraw)
+              PartitionDrawMask               ) == ParallelPartitionDraw)
     {
         doActivate ();
         doFrameInit();    // query recently registered GL extensions
@@ -1851,7 +1852,7 @@ void OSG::Window::renderNoFinish(RenderActionBase *action)
         renderAllViewports(action);
     }
     else if((_sfPartitionDrawMode.getValue() & 
-              PartitionDrawMask               ) == SequentialPartitionDraw)
+              PartitionDrawMask               ) == ParallelPartitionDraw)
     {
         doActivate ();
         doFrameInit();    // query recently registered GL extensions
@@ -1876,7 +1877,7 @@ void OSG::Window::frameFinish(bool bActivate)
         frameExit(); // after frame cleanup: delete dead GL objects
     }
     else if((_sfPartitionDrawMode.getValue() & 
-              PartitionDrawMask               ) == SequentialPartitionDraw)
+              PartitionDrawMask               ) == ParallelPartitionDraw)
     {
         if(bActivate == true)
             doActivate();
@@ -1900,7 +1901,7 @@ void OSG::Window::runFrameExit(void)
         deactivate();
     }
     else if((_sfPartitionDrawMode.getValue() & 
-              PartitionDrawMask               ) == SequentialPartitionDraw)
+              PartitionDrawMask               ) == ParallelPartitionDraw)
     {
         doActivate ();
         doFrameExit();    // after frame cleanup: delete GL objects, if needed
@@ -1972,7 +1973,7 @@ void OSG::Window::doRenderAllViewports(RenderActionBase *action)
             action->setDrawPartPar(true);
         }
         else if((_sfPartitionDrawMode.getValue() & 
-                 PartitionDrawMask               ) == SequentialPartitionDraw)
+                 PartitionDrawMask               ) == ParallelPartitionDraw)
         {
             action->setDrawPartPar(false);
         }

------------------------------------------------------------------------------
Crystal Reports &#45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty&#45;free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to