James-Jones / HLSLCrossCompiler

Other
467 stars 81 forks source link

Simplistic shader failing #6

Closed Tisten closed 10 years ago

Tisten commented 10 years ago

This shader does not compile with HLSLcc. It is intended for HLSL shader model 4 and I'm trying to convert it to GLSL 410:

Texture2D Tex; float4 main(float4 pos : SV_Position) : SV_Target { int3 texCoord = int3(int2(pos.xy), 0); return Tex.Load(texCoord); }

James-Jones commented 10 years ago

I expect this to work now. But there is an issue that I am aware of which will present itself here if you make a small change to the texCoord variable so it is calculated as int3 texCoord = int3(pos.x, 1, 2); The GLSL shader created from that will not contain the literal constants 1 and 2 because HLSLcc is not yet reliably able to work out that they are integer when they are sources for a mov instruction (which moves raw bits instead of typed data), Instead 1 and 2 will be treated as a floating point encoding and end up as 0 in this case.