Implemented DSX and DSY in the GLSL profile. trunk
authorRyan C. Gordon <icculus@icculus.org>
Sun, 06 Apr 2008 10:02:45 -0400
branchtrunk
changeset 115 ad3ee4c3b59c
parent 114 3b8cf84b46b8
child 116 db1b5b55af46
Implemented DSX and DSY in the GLSL profile. I _think_ these are direct mappings to GLSL built-in functions, but I'm not sure here...msdn is really vague about exactly what equation should be used.
mojoshader.c
--- a/mojoshader.c	Sun Apr 06 09:54:25 2008 -0400
+++ b/mojoshader.c	Sun Apr 06 10:02:45 2008 -0400
@@ -2635,12 +2635,16 @@
 
 static void emit_GLSL_DSX(Context *ctx)
 {
-    fail(ctx, "unimplemented.");  // !!! FIXME
+    const char *src0 = make_GLSL_sourcearg_string(ctx, 0);
+    const char *code = make_GLSL_destarg_assign(ctx, 0, "dFdx(%s)", src0);
+    output_line(ctx, "%s", code);
 } // emit_GLSL_DSX
 
 static void emit_GLSL_DSY(Context *ctx)
 {
-    fail(ctx, "unimplemented.");  // !!! FIXME
+    const char *src0 = make_GLSL_sourcearg_string(ctx, 0);
+    const char *code = make_GLSL_destarg_assign(ctx, 0, "dFdy(%s)", src0);
+    output_line(ctx, "%s", code);
 } // emit_GLSL_DSY
 
 static void emit_GLSL_TEXLDD(Context *ctx)
@@ -3497,8 +3501,8 @@
     INSTRUCTION(CMP, 4, DSSS, MOJOSHADER_TYPE_ANY),
     INSTRUCTION(BEM, 3, DSS, MOJOSHADER_TYPE_ANY),
     INSTRUCTION(DP2ADD, 4, DSSS, MOJOSHADER_TYPE_ANY),
-    INSTRUCTION(DSX, 2, DS, MOJOSHADER_TYPE_ANY),
-    INSTRUCTION(DSY, 2, DS, MOJOSHADER_TYPE_ANY),
+    INSTRUCTION(DSX, 2, DS, MOJOSHADER_TYPE_PIXEL),
+    INSTRUCTION(DSY, 2, DS, MOJOSHADER_TYPE_PIXEL),
     INSTRUCTION(TEXLDD, 5, DSSSS, MOJOSHADER_TYPE_ANY),
     INSTRUCTION_STATE(SETP, 3, DSS, MOJOSHADER_TYPE_ANY),
     INSTRUCTION(TEXLDL, 3, DSS, MOJOSHADER_TYPE_ANY),