llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.77k stars 11.9k forks source link

[HLSL] Add diagnostics for Buffers/RWBuffers with invalid element types #75676

Open bogner opened 10 months ago

bogner commented 10 months ago

There's a specific closed set of types that are valid as element types for TypedBuffer types, which includes int/uint of sizes 16/32/64, half, float, and double. If someone writes RWBuffer<MyCustomType> we should reject it and give the user a nice diagnostic.

AC:

davidcook-msft commented 10 months ago

Moved to low as this currently does not happen and the DXIL validator will catch it, but we would rather catch it prior to the validator

bogner commented 10 months ago

We could arguably implement this simply by decorating the resource classes with an appropriate concept (something along the lines of https://godbolt.org/z/Y3sezEe36)