Skip to content

Add boolean comparison operator support for HLSL Matrix #172341

@farzonl

Description

@farzonl

Support these:

https://hlsl.godbolt.org/z/7MsKo1ooj

export bool4x4 AndOp(bool4x4 a, bool4x4 b) {
  return and(a,b);
}

export bool3x3 OrOp(bool3x3 a, bool3x3 b) {
  return or(a,b);
}

Error on these:
https://hlsl.godbolt.org/z/Y73hG34Kq

export bool4x4 AndOp(bool4x4 a, bool4x4 b) {
  return a && b;
}

export bool3x3 OrOp(bool3x3 a, bool3x3 b) {
  return a || b;
}
export bool4x4 AndOp(bool4x4 a, bool4x4 b) {
  return a && b;
}

export bool3x3 OrOp(bool3x3 a, bool3x3 b) {
  return a || b;
}
<source>:2:12: error: operands for short-circuiting logical binary operator must be scalar, for non-scalar types use 'and'
  return a && b;
         ~~^~~~
         and(a, b)
<source>:6:12: error: operands for short-circuiting logical binary operator must be scalar, for non-scalar types use 'or'
  return a || b;
         ~~^~~~
         or(a, b)

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Support

Type

No type

Projects

Status

Active

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions