DirectXShaderCompiler
DirectXShaderCompiler copied to clipboard
Report error on local variables with resource binding
Description DXC should report error on local variable with resource binding.
Steps to Reproduce
For cs_6_5
this reports an error local resource not guaranteed to map to unique global resource.
https://godbolt.org/z/qhP8dqbed
[numthreads(4,1,1)]
void main() {
RWBuffer<int> buf : register(u0);
buf[0] = 1;
}
For cs_6_6
it does not report an error, generatesannotateHandle
without createHandle
, and the resource binding is not captured in metadata.
https://godbolt.org/z/xcadsEjzr
For lib_6_6 it also does not report an error, produces annotateHandle
and createHandleForLib
, and the resource binding is not captured in metadata.
https://godbolt.org/z/MWzdTEb6q
export int foo() {
RWBuffer<int> buf : register(u0);
return buf.Load(0);
}
Actual Behavior Local resources with bindings should not be allowed and the compiler should report an error.
Environment
- DXC main as od 10/16/2024
- Windows 11 / Compiler Explorer