You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[SPIR-V] EvaluateAttribute* on a 16-bit input emits invalid InterpolateAt* #9180
With -spirv -enable-16bit-types, calling EvaluateAttributeAtSample,EvaluateAttributeCentroid or EvaluateAttributeSnapped on a half pixel shader input fails to compile. DXC emits a GLSL.std.450 InterpolateAt* instruction with a half result type, and its own SPIR-V validation rejects
it. The same shaders compile to DXIL, and the 32-bit versions compile to SPIR-V.
fatal error: generated SPIR-V is invalid: GLSL.std.450 InterpolateAtSample: expected Result Type to be a 32-bit float scalar or vector type
%25 = OpExtInst %half %1 InterpolateAtSample %in_var_ATTR0 %uint_1
note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues with source code if possible
Expected
The shader compiles to valid SPIR-V, as it does for DXIL. In GLSL.std.450, InterpolateAtCentroid, InterpolateAtSample and InterpolateAtOffset take only 32-bit float scalars or vectors. A 16-bit interpolant is valid only with SPV_AMD_gpu_shader_half_float, which DXC does not enable here. Possible fixes:
Interpolate at 32 bits and convert the result to half (OpFConvert).
Emit SPV_AMD_gpu_shader_half_float when it is available.
Report a clear front-end diagnostic instead of emitting invalid SPIR-V.
Related: #2500 (16-bit GLSL.std.450 instructions requiring SPV_AMD_gpu_shader_half_float), which notes that the interpolation
instructions still need that extension.
Activity