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
Set ARRAY_INTERPOLATORS to 1 to demonstrate the problem.
Set INLINE_EVAL_AT_SAMPLE to 1 to work around the problem.
The bug happens when an array interpolant is passed to a function which then calls EvaluateAttributeAtSample on it.
Using a non-array interpolant works.
Inlining the code into the “Main” entry point also works.
Steps to Reproduce
This is code that's in the above godbolt link:
// The entry point and target profile are needed to compile this example:// -T ps_6_6 -E PSMain// Enabling this causes a compiler error#defineARRAY_INTERPOLANTS (1)
// Enabling this works around the compiler error when ARRAY_INTERPOLANTS is on#defineINLINE_EVAL_AT_SAMPLE (0)
struct PSInput
{
#if ARRAY_INTERPOLANTS
float3 x[4] : TEST;
#elsefloat3 x0 : TEST0;
float3 x1 : TEST1;
float3 x2 : TEST2;
float3 x3 : TEST3;
#endif
};
PSInput EvalInterpAtSample(PSInput I, int S)
{
PSInput O = I;
#if ARRAY_INTERPOLANTS
[unroll]
for( int i =0; i<4; ++i)
{
O.x[i] = EvaluateAttributeAtSample(O.x[i],S);
}
#else
O.x0 = EvaluateAttributeAtSample(O.x0,S);
O.x1 = EvaluateAttributeAtSample(O.x1,S);
O.x2 = EvaluateAttributeAtSample(O.x2,S);
O.x3 = EvaluateAttributeAtSample(O.x3,S);
#endifreturn O;
}
voidPSMain(
float4 Position : SV_Position,
PSInput input,
outfloat3 OutColor : SV_Target0
)
{
OutColor = 0;
[unroll]
for ( uint i=0; i <4; ++i)
{
#if INLINE_EVAL_AT_SAMPLE
PSInput I = input;
#if ARRAY_INTERPOLANTS
I.x[0] = EvaluateAttributeAtSample(input.x[0],i);
I.x[1] = EvaluateAttributeAtSample(input.x[1],i);
I.x[2] = EvaluateAttributeAtSample(input.x[2],i);
I.x[3] = EvaluateAttributeAtSample(input.x[3],i);
#else
I.x0 = EvaluateAttributeAtSample(I.x0,i);
I.x1 = EvaluateAttributeAtSample(I.x1,i);
I.x2 = EvaluateAttributeAtSample(I.x2,i);
I.x3 = EvaluateAttributeAtSample(I.x3,i);
#endif#else
PSInput I = EvalInterpAtSample(input,i);
#endif #if ARRAY_INTERPOLANTS
OutColor += I.x[0] + I.x[1] + I.x[2] + I.x[3];
#else
OutColor += I.x0 + I.x1 + I.x2 + I.x3;
#endif
}
}
Actual Behavior
Compilation fails with the following error, although the user believes the code is valid:
error: attribute evaluation can only be done on values taken directly from inputs.
O.x[i] = EvaluateAttributeAtSample(O.x[i],S);
Environment
DXC version: all versions currently supported by godbolt
Host Operating System windows
The text was updated successfully, but these errors were encountered:
Description
User sees a compilation error when using EvaluateAttributeAtSample in certain cases where they would not expect it to fail.
They're able to reproduce this in all versions of DXC here:
https://godbolt.org/z/7PGn6Ts6z
Set ARRAY_INTERPOLATORS to 1 to demonstrate the problem.
Set INLINE_EVAL_AT_SAMPLE to 1 to work around the problem.
The bug happens when an array interpolant is passed to a function which then calls EvaluateAttributeAtSample on it.
Using a non-array interpolant works.
Inlining the code into the “Main” entry point also works.
Steps to Reproduce
This is code that's in the above godbolt link:
Actual Behavior
Compilation fails with the following error, although the user believes the code is valid:
Environment
The text was updated successfully, but these errors were encountered: