Skip to content

Commit

Permalink
[spirv-reader][ir] Handle GLSL 450 MatrixInverse
Browse files Browse the repository at this point in the history
The SPIR-V `MatrixInverse` method does not have an equivalent in WGSL.
Add a polyfill for the allowed `2x2`, `3x3` and `4x4` matrix variants.

Bug: 42250952
Change-Id: I1f73bdb974ad4bf5f51af886f7776c6174e3a6cb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/220874
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
  • Loading branch information
dj2 authored and Dawn LUCI CQ committed Jan 14, 2025
1 parent cb97388 commit b3fb1e2
Show file tree
Hide file tree
Showing 14 changed files with 1,173 additions and 223 deletions.
3 changes: 3 additions & 0 deletions src/tint/lang/spirv/builtin_fn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ const char* str(BuiltinFn i) {
return "vector_times_scalar";
case BuiltinFn::kNormalize:
return "normalize";
case BuiltinFn::kInverse:
return "inverse";
case BuiltinFn::kSdot:
return "sdot";
case BuiltinFn::kUdot:
Expand Down Expand Up @@ -164,6 +166,7 @@ tint::core::ir::Instruction::Accesses GetSideEffects(BuiltinFn fn) {
case BuiltinFn::kUdot:
case BuiltinFn::kNone:
case BuiltinFn::kNormalize:
case BuiltinFn::kInverse:
break;
}
return core::ir::Instruction::Accesses{};
Expand Down
1 change: 1 addition & 0 deletions src/tint/lang/spirv/builtin_fn.cc.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ tint::core::ir::Instruction::Accesses GetSideEffects(BuiltinFn fn) {
case BuiltinFn::kUdot:
case BuiltinFn::kNone:
case BuiltinFn::kNormalize:
case BuiltinFn::kInverse:
break;
}
return core::ir::Instruction::Accesses{};
Expand Down
1 change: 1 addition & 0 deletions src/tint/lang/spirv/builtin_fn.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ enum class BuiltinFn : uint8_t {
kVectorTimesMatrix,
kVectorTimesScalar,
kNormalize,
kInverse,
kSdot,
kUdot,
kNone,
Expand Down
Loading

0 comments on commit b3fb1e2

Please sign in to comment.