From 573cc3ef95e08ac7650470323e20ec85ffbf18c0 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 9 May 2008 23:06:12 -0400 Subject: [PATCH] Fixed oDepth usage in GLSL profile. oDepth register is a float, not a vec4, so we need to handle swizzles appropriately. --HG-- branch : trunk --- mojoshader.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mojoshader.c b/mojoshader.c index f6690951..8619bc58 100644 --- a/mojoshader.c +++ b/mojoshader.c @@ -2349,7 +2349,14 @@ static void emit_GLSL_NOP(Context *ctx) static void emit_GLSL_MOV(Context *ctx) { - const char *src0 = make_GLSL_srcarg_string_masked(ctx, 0); + const char *src0 = NULL; + + // oDepth is a float, not a vec4, but the writemask is .xyzw ... tweak it. + if (ctx->dest_arg.regtype == REG_TYPE_DEPTHOUT) + src0 = make_GLSL_srcarg_string_x(ctx, 0); + else + src0 = make_GLSL_srcarg_string_masked(ctx, 0); + const char *code = make_GLSL_destarg_assign(ctx, "%s", src0); output_line(ctx, "%s", code); } // emit_GLSL_MOV