Also link programs when testing for shader compile errors. trunk
authorRyan C. Gordon <icculus@icculus.org>
Thu, 31 Jul 2008 17:43:38 -0400
branchtrunk
changeset 437 a97a9b21087b
parent 436 304072996bda
child 438 73492129c1af
Also link programs when testing for shader compile errors.
finderrors.c
--- a/finderrors.c	Wed Jul 30 05:11:15 2008 -0400
+++ b/finderrors.c	Thu Jul 31 17:43:38 2008 -0400
@@ -79,8 +79,20 @@
     if (shader == NULL)
         report("FAIL: %s %s\n", fname, MOJOSHADER_glGetError());
     else
-        report("PASS: %s\n", fname);
-    MOJOSHADER_glDeleteShader(shader);
+    {
+        const MOJOSHADER_parseData *pd = MOJOSHADER_glGetShaderParseData(shader);
+        MOJOSHADER_glShader *v = (pd->shader_type == MOJOSHADER_TYPE_VERTEX) ? shader : NULL;
+        MOJOSHADER_glShader *p = (pd->shader_type == MOJOSHADER_TYPE_PIXEL) ? shader : NULL;
+        MOJOSHADER_glProgram *program = MOJOSHADER_glLinkProgram(v, p);
+        if (program == NULL)
+            report("FAIL: %s %s\n", fname, MOJOSHADER_glGetError());
+        else
+        {
+            report("PASS: %s\n", fname);
+            MOJOSHADER_glDeleteProgram(program);
+        } // else
+        MOJOSHADER_glDeleteShader(shader);
+    }
     #else
     const MOJOSHADER_parseData *pd = MOJOSHADER_parse(profile, buf, rc, 0, 0, 0);
     if (pd->error != NULL)