DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

WaveMatch with a vector input value

Open StarsX opened this issue 2 years ago • 2 comments

The spec. of SM6.5 says: uint4 WaveMatch( val ) ...

val can be any expression which evaluates to any of the currently supported primitive data types (e.g. float4, uint2, etc.).

in https://microsoft.github.io/DirectX-Specs/d3d/HLSL_ShaderModel6_5.html

However, when I use WaveMatch(uint4), it shows a validation error: 1>Content\Shaders/ImpactRange.hlsli(59,18): error G315CBA34: Instructions must be of an allowed type. 1>note: at '%1219 = insertvalue %dx.types.fouri32 %1214, i32 %1218, 0' in block '#33' of function 'main'.

The error is only reported by the debug mode (disable optimization and enable debug info). Under release mode, it is silent. Anyway, after seeing this error, I even doubt whether dxcompiler really allows and has implemented uint4 val following the spec. description.

StarsX avatar May 04 '23 01:05 StarsX

Repro link: https://godbolt.org/z/xjxe85z7z

The value isn't getting scalarized. Might need a custom scalarization pass for non-optimized builds

pow2clk avatar Oct 31 '23 15:10 pow2clk

We expect that this will not be an issue in clang; setting to dormant in case someone wants to tackle fixing this in DXC.

damyanp avatar Sep 19 '24 17:09 damyanp