I really like this project. I have tried to run HLSLcc on a large amount of shaders and want to give you feedback on a few issues I have come across:
In decode.c, DeocdeInstruction(), the "case OPCODE_SINCOS:" should set "psInst->ui32FirstSrc = 2;" since the D3D ASM op SINCOS has two outputs and one input.
A second issue with SINCOS is in toGLSLInstruction.c, TranslateInstruction(), the result of the operation is not swizzled. I had a case where the HLSL code had "float2 = sin(float2)" which after the cross compile resulted in an 'error C7011: implicit cast from "vec4" to "vec2" '
I'm not sure, but perhaps the "TranslateOperand" for "//Dest cos" should use TO_FLAG_DESTINATION? The code is in the same place as the issue above.
Another small thing I discovered was that OPCODE_DERIV_RTX is handled, but OPCODE_DERIV_RTX_COARSE and OPCODE_DERIV_RTX_FINE are not. I just added them to the switch cases where they were missing to be handled the same way as OPCODE_DERIV_RTX, and it all worked.
There are a few more problems which I still have not analyzed properly, and I have not yet run any of the produced GLSL shaders so I might have more feedback later.
I really like this project. I have tried to run HLSLcc on a large amount of shaders and want to give you feedback on a few issues I have come across:
Another small thing I discovered was that OPCODE_DERIV_RTX is handled, but OPCODE_DERIV_RTX_COARSE and OPCODE_DERIV_RTX_FINE are not. I just added them to the switch cases where they were missing to be handled the same way as OPCODE_DERIV_RTX, and it all worked.
There are a few more problems which I still have not analyzed properly, and I have not yet run any of the produced GLSL shaders so I might have more feedback later.