[SPIR-V] GetAttributeAtVertex on struct member without nointerpolation fails validation
Description Follow-up from #6041
Steps to Reproduce
dxc -T ps_6_6 -spirv
struct S {
float4 a : COLOR;
};
float compute(nointerpolation float4 a) {
return GetAttributeAtVertex(a, 2)[0];
}
float4 main(S s) : SV_TARGET
{
return float4(0, 0, 0, compute(s.a));
}
Actual Behavior Once https://github.com/microsoft/DirectXShaderCompiler/pull/6041 is merged, the above sample will fail at validation for both DXIL and SPIR-V, but the SPIR-V backend needs better error messaging.
DXIL:
error: validation errors
<source>:6:10: error: Attribute COLOR must have nointerpolation mode in order to use GetAttributeAtVertex function.
note: at '%1 = call float @dx.op.attributeAtVertex.f32(i32 137, i32 0, i32 0, i8 0, i8 2)' in block '#0' of function 'main'.
Validation failed.
SPIR-V:
fatal error: generated SPIR-V is invalid: Result type (OpTypeVector) does not match the type that results from indexing into the composite (OpTypeFloat).
%13 = OpCompositeExtract %v4float %12 2
I think this is a duplicate of #6220. @sudonatalie can you confirm and close if so?
@pow2clk Thanks for the reference! I'll keep this one open since the issue we wanted to highlight here is that the SPIR-V error messaging specifically is poor, but how we fix that might be dependent on #6220 is decided.
Related: https://github.com/microsoft/hlsl-specs/issues/181