Browse Source

Safety check to skip renderpath commands with no output names, could cause out-of-bounds indexing.

Lasse Öörni 12 years ago
parent
commit
4aeeefdd38
1 changed files with 4 additions and 2 deletions
  1. 4 2
      Source/Engine/Graphics/View.cpp

+ 4 - 2
Source/Engine/Graphics/View.cpp

@@ -1274,7 +1274,8 @@ void View::ExecuteRenderPathCommands()
                 viewportModified = false;
                 viewportModified = false;
             }
             }
 
 
-            // Check if current command begins / continues the pingpong chain
+            // Check if current command begins / continues the pingpong chain. The final command in the renderpath ends the chain
+            // by rendering to the destination render target again
             if (CheckPingpong(i))
             if (CheckPingpong(i))
             {
             {
                 isPingponging = true;
                 isPingponging = true;
@@ -1570,7 +1571,8 @@ void View::RenderQuad(RenderPathCommand& command)
 
 
 bool View::IsNecessary(const RenderPathCommand& command)
 bool View::IsNecessary(const RenderPathCommand& command)
 {
 {
-    return command.enabled_ && (command.type_ != CMD_SCENEPASS || !batchQueues_[command.pass_].IsEmpty());
+    return command.enabled_ && command.outputNames_.Size() && (command.type_ != CMD_SCENEPASS ||
+        !batchQueues_[command.pass_].IsEmpty());
 }
 }
 
 
 bool View::CheckViewportRead(const RenderPathCommand& command)
 bool View::CheckViewportRead(const RenderPathCommand& command)