microsoft / hlsl-specs

HLSL Specifications
MIT License
116 stars 29 forks source link

Error on cbuffer variable initializer #259

Open llvm-beanz opened 2 months ago

llvm-beanz commented 2 months ago

Is your feature request related to a problem? Please describe. For 9 years DXC has silently ignored initializers on cbuffer values. It's time to make that an error.

Describe the solution you'd like If a shader initializes a cbuffer member or other global constant that gets folded into a cbuffer the compiler should emit an error.

Describe alternatives you've considered We could make it a warning, but since we really do nothing with the value IMO it's better to error to force users to deal with it.

Additional context Related issue: https://github.com/microsoft/DirectXShaderCompiler/issues/2384