A little more work on MOJOSHADER_glLinkProgram(). trunk
authorRyan C. Gordon <icculus@icculus.org>
Sun, 27 Apr 2008 01:22:06 -0400
branchtrunk
changeset 204 5055ac80916e
parent 203 ff983e373e37
child 205 8583f89985df
A little more work on MOJOSHADER_glLinkProgram(). Still not complete!
mojoshader_opengl.c
--- a/mojoshader_opengl.c	Sun Apr 27 00:44:18 2008 -0400
+++ b/mojoshader_opengl.c	Sun Apr 27 01:22:06 2008 -0400
@@ -251,15 +251,23 @@
 
     // !!! FIXME: alloc retval.
 
-    retval->vertex = vshader;
-    retval->fragment = pshader;
-    retval->handle = program;
-    retval->refcount = 1;
+    retval = (MOJOSHADER_glProgram *) Malloc(sizeof (MOJOSHADER_glProgram));
+    if (retval == NULL)
+        pglDeleteObjectARB(program);
+    else
+    {
+        retval->vertex = vshader;
+        retval->fragment = pshader;
+        retval->handle = program;
+        retval->refcount = 1;
+    } // else
 
     if (vshader != NULL)
         vshader->refcount++;
     if (pshader != NULL)
         pshader->refcount++;
+
+    return retval;
 } // MOJOSHADER_glLinkProgram