Generate an error if the vertex shader does not write to gl_Position.
authorBrian <brian@yutani.localnet.net>
Wed, 7 Mar 2007 14:52:24 +0000 (07:52 -0700)
committerBrian <brian@yutani.localnet.net>
Wed, 7 Mar 2007 14:52:24 +0000 (07:52 -0700)
src/mesa/shader/slang/slang_link.c

index 8f924739b49ef0f26647a1e2c72e1df3a09285fa..e564d6d57671521fd3757e89fcb8ff277e17a03f 100644 (file)
@@ -548,8 +548,19 @@ _slang_link(GLcontext *ctx,
       }
    }
 
-   if (shProg->VertexProgram)
+   if (shProg->VertexProgram) {
       _slang_update_inputs_outputs(&shProg->VertexProgram->Base);
+      if (!(shProg->VertexProgram->Base.OutputsWritten & VERT_RESULT_HPOS)) {
+         /* the vertex program did not compute a vertex position */
+         if (shProg->InfoLog) {
+            _mesa_free(shProg->InfoLog);
+         }
+         shProg->InfoLog
+            = _mesa_strdup("gl_Position was not written by vertex shader");
+         shProg->LinkStatus = GL_FALSE;
+         return;
+      }
+   }
    if (shProg->FragmentProgram)
       _slang_update_inputs_outputs(&shProg->FragmentProgram->Base);