Skip to content

Commit

Permalink
Fixed oDepth usage in GLSL profile.
Browse files Browse the repository at this point in the history
oDepth register is a float, not a vec4, so we need to handle swizzles
 appropriately.

--HG--
branch : trunk
  • Loading branch information
icculus committed May 10, 2008
1 parent 4ddaf19 commit 573cc3e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mojoshader.c
Expand Up @@ -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
Expand Down

0 comments on commit 573cc3e

Please sign in to comment.