Shader_Minifier
Shader_Minifier copied to clipboard
`precise` modifier in HLSL function return type crashes parser
Minimal example HLSL compute shader:
RWTexture2D<float4> res;
precise float MakePrecise(in precise float v) {
precise float pv = v;
return pv;
}
[numthreads(8, 8, 4)]
void Main (uint3 dtid : SV_DispatchThreadID)
{
res[dtid.xy] = float4(MakePrecise(1), 0, 0, 1);
}
Crashes with the error
precise float MakePrecise(in precise float v) {
^
Expecting: Type qualifier or ';'
Removing the precise modifier from the return type causes the shader to parse correctly e.g. this works as expected
RWTexture2D<float4> res;
float MakePrecise(in precise float v) {
precise float pv = v;
return pv;
}
[numthreads(8, 8, 4)]
void Main (uint3 dtid : SV_DispatchThreadID)
{
res[dtid.xy] = float4(MakePrecise(1), 0, 0, 1);
}