KhronosGroup / glslang

Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
Other
2.95k stars 819 forks source link

Unknown HLSL function attributes are reported as empty string '' #1678

Open onitake opened 5 years ago

onitake commented 5 years ago

When compiling HLSL shaders to Vulkan SPIR-V, unknown or unsupported attributes are reported as the empty string (''). This makes it harder to find the source of the problem.

Example:

[earlydepthstencil]
float main() : SV_Target {
    return 1.0;
}

Compiled with:

glslangValidator -V test.frag.hlsl -e main -o test.spv

Output:

test.frag.hlsl
WARNING: test.frag.hlsl:3: '' : attribute does not apply to entry point 

The unsupported attribute here is [earlydepthstencil] - it would be helpful if this was printed.

johnkslang commented 5 years ago

The text has long been forgotten at that point.

There should be some bidirectional map connecting these, used both at parse time and warning time. That would clean up the long if-then-else chain and enable your request.