mojoshader.c
branchtrunk
changeset 145 5325c8d6077c
parent 144 2483576e1281
child 148 645003ec6623
--- a/mojoshader.c	Fri Apr 18 22:00:19 2008 -0400
+++ b/mojoshader.c	Sat Apr 19 01:31:47 2008 -0400
@@ -4233,6 +4233,16 @@
 
 static MOJOSHADER_attribute *build_attributes(Context *ctx)
 {
+    if (ctx->shader_type == MOJOSHADER_TYPE_PIXEL)
+    {
+        if (ctx->attribute_count > 0)
+            fail(ctx, "BUG: pixel shader shouldn't have vertex attributes");
+        return NULL;  // nothing to do for pixel shaders.
+    } // if
+
+    if (ctx->attribute_count == 0)
+        return NULL;  // nothing to do.
+
     MOJOSHADER_attribute *retval = (MOJOSHADER_attribute *)
              Malloc(ctx, sizeof (MOJOSHADER_attribute) * ctx->attribute_count);