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
GetAttributeAtVertex() doesn't work on function parameters #6220
gaav-repro.hlsl:19:14: error: attribute evaluation can only be done on values taken directly from inputs.
float4 a3 = GetAttributeAtVertex(vs.PackedTexCoords[index], 2);
^
gaav-repro.hlsl:18:14: error: attribute evaluation can only be done on values taken directly from inputs.
float4 a2 = GetAttributeAtVertex(vs.PackedTexCoords[index], 1);
^
gaav-repro.hlsl:17:14: error: attribute evaluation can only be done on values taken directly from inputs.
float4 a1 = GetAttributeAtVertex(vs.PackedTexCoords[index], 0);
^
Note that moving the GetAttributeAtVertex calls to be inside MainPS can compile successfully.
Environment
DXC version dxcompiler.dll: 1.7 - 1.7.2308.7 (69e54e2); dxil.dll: 1.7(101.7.2308.12)
Unfortunately, this one is not sound language-wise, and tricky to support. It's likely going to be considered by-design.
The language semantics are such that you could not use GetAttributeAtVertex anywhere but inside the main entry point function. This intrinsic doesn’t operate on the value read from the interpolant, but does something special to point the intrinsic at the right input interpolant location. I think making this work language-wise would require reference support for your called function.
That said, it wouldn't be impossible for the compiler to make this work as long as inlining and optimizations performed at some early stage ensured that the intrinsic could tunnel directly to the input interpolant before we processed the function inputs. However, this is not something DXC does, and it's not something DXC is likely to do.
Activity
tex3d commentedon Jan 30, 2024
Unfortunately, this one is not sound language-wise, and tricky to support. It's likely going to be considered by-design.
The language semantics are such that you could not use GetAttributeAtVertex anywhere but inside the main entry point function. This intrinsic doesn’t operate on the value read from the interpolant, but does something special to point the intrinsic at the right input interpolant location. I think making this work language-wise would require reference support for your called function.
That said, it wouldn't be impossible for the compiler to make this work as long as inlining and optimizations performed at some early stage ensured that the intrinsic could tunnel directly to the input interpolant before we processed the function inputs. However, this is not something DXC does, and it's not something DXC is likely to do.
pow2clk commentedon Jan 31, 2024
Here is the godbolt link: https://godbolt.org/z/z9bYK4sb9
Note that using shader model 6.6 resolves the issue and may be an acceptable workaround
[Sema] Requires nointerpolation on GetAttributeAtVertex param #0
[Sema] Requires nointerpolation on GetAttributeAtVertex param #0
[Sema] Requires nointerpolation on GetAttributeAtVertex param #0
[Sema] Requires nointerpolation on GetAttributeAtVertex param #0
[Sema] Requires nointerpolation on GetAttributeAtVertex param #0
[SPIR-V][Sema] Requires nointerpolation on GetAttributeAtVertex param…