microsoft / microsoft/DirectXShaderCompiler

[SPIR-V] Comparison and bitwise operators over matrices are not implemented

Open
#8,021 0 comments 0 reactions 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.