Work on pixel shader DCL emitters. trunk
authorRyan C. Gordon <icculus@icculus.org>
Thu, 08 May 2008 18:14:09 -0400
branchtrunk
changeset 300 4ad0179b6ebf
parent 299 3dd6c79dfabe
child 301 cfd2b7ea6796
Work on pixel shader DCL emitters.
mojoshader.c
--- a/mojoshader.c	Thu May 08 17:40:49 2008 -0400
+++ b/mojoshader.c	Thu May 08 18:14:09 2008 -0400
@@ -2304,35 +2304,27 @@
 
         else
         {
-            fail(ctx, "unknown attribute register");
+            fail(ctx, "unknown vertex shader attribute register");
         } // else
     } // if
 
-#if 0 // !!! FIXME: write me.
     else if (shader_is_pixel(ctx))
     {
-        if (regtype == REG_TYPE_SAMPLER)
-        {
-            switch ((const TextureType) usage)
-            {
-                case TEXTURE_TYPE_2D: usage_str = "_2d"; break;
-                case TEXTURE_TYPE_CUBE: usage_str = "_cube"; break;
-                case TEXTURE_TYPE_VOLUME: usage_str = "_volume"; break;
-                default: fail(ctx, "unknown sampler texture type"); return;
-            } // switch
-        } // if
-
-        else if (regtype == REG_TYPE_COLOROUT)
-        {
-            retval = "oC";
-        } // else if
+        // samplers DCLs get handled in emit_GLSL_uniform().
+
+        if (regtype == REG_TYPE_COLOROUT)
+            usage_str = "gl_FragColor";
 
         else if (regtype == REG_TYPE_DEPTHOUT)
-        {
-            retval = "oDepth";
-        } // else if
+            usage_str = "gl_FragDepth";
+
+        else
+            fail(ctx, "unknown pixel shader attribute register");
+
+        push_output(ctx, &ctx->globals);
+        output_line(ctx, "#define %s %s", varname, usage_str);
+        pop_output(ctx);
     } // else if
-#endif
 
     else
     {