Description
Given a global extern resource with an auto-assigned or user assigned resource register, reassigning the variable to a different resource (e.g. from ResourceDescriptorHeap) results in the "external declaration is unused" validation error, even if the resource is used prior to assignment.
Steps to Reproduce
CE link
RWByteAddressBuffer buffer : register(u0);
[numthreads(8, 8, 1)]
void CSMain(uint3 id : SV_DispatchThreadID)
{
buffer.Store(id.x, 0);
buffer = ResourceDescriptorHeap[0];
buffer.Store(id.x, 0);
}
Actual Behavior
error: validation errors
<source>:1: error: External declaration '\01?buffer@@3URWByteAddressBuffer@@A' is unused.
Validation failed.
Note that this may be intended behavior (understandably), however, I think in this case the error message is misleading and should directly indicate that this sort of reassignment is forbidden if so.
Environment
- DXC version 1.7.2207
- Host Operating System Windows
Description
Given a global
externresource with an auto-assigned or user assigned resource register, reassigning the variable to a different resource (e.g. fromResourceDescriptorHeap) results in the "external declaration is unused" validation error, even if the resource is used prior to assignment.Steps to Reproduce
CE link
Actual Behavior
Note that this may be intended behavior (understandably), however, I think in this case the error message is misleading and should directly indicate that this sort of reassignment is forbidden if so.
Environment