microsoft / microsoft/DirectXShaderCompiler
[SPIR-V] Comparison and bitwise operators over matrices are not implemented
Open
@s-perron is already working on this.
Since Jan 5, 2026.
bug
spirv
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
Comparison operators (==, !=, >=, <=, >, <) and bitwise operators (>>, <<, |, &) are not implemented for matrices in SPIR-V.
(I want to run shaders of DirectXTex with Vulkan, but currently I have to modify many lines since they use unsupported operators. It would be great if dxc could handle them properly.)
Steps to Reproduce
https://godbolt.org/z/jYzfMcT6r
[numthreads(256, 1, 1)]
void main(in uint3 threadId : SV_DispatchThreadID) {
uint2x3 a = {1,3,5,2,4,6};
uint2x3 b = a == 2;
uint2x3 c = a != 2;
uint2x3 d = a > 2;
uint2x3 e = a < 2;
uint2x3 f = a >= 2;
uint2x3 g = a <= 2;
uint2x3 h = a >> 2;
uint2x3 i = a << 2;
uint2x3 j = a | 2;
uint2x3 k = a & 2;
}
Actual Behavior
<source>:4:17: error: binary operator '==' over matrix type unimplemented
uint2x3 b = a == 2;
^~~~~~
<source>:5:17: error: binary operator '!=' over matrix type unimplemented
uint2x3 c = a != 2;
^~~~~~
<source>:6:17: error: binary operator '>' over matrix type unimplemented
uint2x3 d = a > 2;
^~~~~
<source>:7:17: error: binary operator '<' over matrix type unimplemented
uint2x3 e = a < 2;
^~~~~
<source>:8:17: error: binary operator '>=' over matrix type unimplemented
uint2x3 f = a >= 2;
^~~~~~
<source>:9:17: error: binary operator '<=' over matrix type unimplemented
uint2x3 g = a <= 2;
^~~~~~
<source>:10:17: error: binary operator '>>' over matrix type unimplemented
uint2x3 h = a >> 2;
^~~~~~
<source>:11:17: error: binary operator '<<' over matrix type unimplemented
uint2x3 i = a << 2;
^~~~~~
<source>:12:17: error: binary operator '|' over matrix type unimplemented
uint2x3 j = a | 2;
^~~~~
<source>:13:17: error: binary operator '&' over matrix type unimplemented
uint2x3 k = a & 2;
^~~~~
Environment
- DXC version: trunk
- Host Operating System: Windows11
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.