From 1b38ab51f2561f0c4a025531bb78808c2ff12fa8 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 6 Apr 2008 10:02:45 -0400 Subject: [PATCH] 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. --HG-- branch : trunk --- mojoshader.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mojoshader.c b/mojoshader.c index da50ab2f..0d972fea 100644 --- a/mojoshader.c +++ b/mojoshader.c @@ -2635,12 +2635,16 @@ static void emit_GLSL_DP2ADD(Context *ctx) 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 @@ static const Instruction instructions[] = 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),