Skip to content

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

@matyalatte

Description

@matyalatte

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

Metadata

Metadata

Assignees

Labels

bugBug, regression, crashspirvWork related to SPIR-V

Type

No type

Projects

Status

New

Status

Triaged

Relationships

None yet

Development

No branches or pull requests

Issue actions