James-Jones / HLSLCrossCompiler

Other
468 stars 81 forks source link

HLSL exp2(x) and log2(x) compiled incorrectly to GLSL exp(x) and log(x) #15

Closed lbavoil closed 10 years ago

lbavoil commented 10 years ago

FXC compiles:

So DXASM exp and log instructions really are base-2 exp & log functions.

But HLSLcc is translating OPCODE_LOG to "log" and OPCODE_EXP to "exp".

Instead, I think it should be translating OPCODE_LOG to "log2" and OPCODE_EXP to "exp2", like this, in src / toGLSLInstruction.c:

case OPCODE_LOG:
    {
        CallHelper1(psContext, "log2", psInst, 0, 1);
        break;
    }
    case OPCODE_EXP:
    {
        CallHelper1(psContext, "exp2", psInst, 0, 1);
        break;
    }
James-Jones commented 10 years ago

Done