Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed the GLSL LIT opcode.
Clearly we never pushed this through a GLSL compiler before.  :)
  • Loading branch information
icculus committed Apr 13, 2012
1 parent 3c68e5f commit 2218816
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mojoshader.c
Expand Up @@ -2756,18 +2756,18 @@ static void emit_GLSL_LOG(Context *ctx)

static void emit_GLSL_LIT_helper(Context *ctx)
{
const char *maxp = "127.9961f"; // value from the dx9 reference.
const char *maxp = "127.9961"; // value from the dx9 reference.

if (ctx->glsl_generated_lit_opcode)
return;

ctx->glsl_generated_lit_opcode = 1;

push_output(ctx, &ctx->helpers);
output_line(ctx, "const vec4 LIT(const vec4 src)");
output_line(ctx, "vec4 LIT(const vec4 src)");
output_line(ctx, "{"); ctx->indent++;
output_line(ctx, "const float power = clamp(src.w, -%s, %s);",maxp,maxp);
output_line(ctx, "vec4 retval(1.0, 0.0, 0.0, 1.0)");
output_line(ctx, "float power = clamp(src.w, -%s, %s);",maxp,maxp);
output_line(ctx, "vec4 retval = vec4(1.0, 0.0, 0.0, 1.0);");
output_line(ctx, "if (src.x > 0.0) {"); ctx->indent++;
output_line(ctx, "retval.y = src.x;");
output_line(ctx, "if (src.y > 0.0) {"); ctx->indent++;
Expand Down

0 comments on commit 2218816

Please sign in to comment.