DecomposeStridedMatrix: Avoid reserved keyword

The `mat` token is a reserved keyword in WGSL, so don't try to create
identifiers that using it.

Bug: tint:1438
Change-Id: If3840aff35ab0ea937df776cd95920dd55157d9f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80960
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price 2022-02-17 20:43:19 +00:00
parent 67f5c715a9
commit 7161ae55c2
7 changed files with 20 additions and 20 deletions

View File

@ -179,7 +179,7 @@ void DecomposeStridedMatrix::Run(CloneContext& ctx,
auto matrix = [&] { return CreateASTTypeFor(ctx, info.matrix); };
auto array = [&] { return info.array(ctx.dst); };
auto mat = ctx.dst->Sym("mat");
auto mat = ctx.dst->Sym("m");
ast::ExpressionList columns(info.matrix->columns());
for (uint32_t i = 0; i < static_cast<uint32_t>(columns.size()); i++) {
columns[i] = ctx.dst->IndexAccessor(mat, i);

View File

@ -394,8 +394,8 @@ struct S {
@group(0) @binding(0) var<storage, read_write> s : S;
fn mat2x2_stride_32_to_arr(mat : mat2x2<f32>) -> @stride(32) array<vec2<f32>, 2u> {
return @stride(32) array<vec2<f32>, 2u>(mat[0u], mat[1u]);
fn mat2x2_stride_32_to_arr(m : mat2x2<f32>) -> @stride(32) array<vec2<f32>, 2u> {
return @stride(32) array<vec2<f32>, 2u>(m[0u], m[1u]);
}
@stage(compute) @workgroup_size(1)
@ -531,8 +531,8 @@ fn arr_to_mat2x2_stride_32(arr : @stride(32) array<vec2<f32>, 2u>) -> mat2x2<f32
return mat2x2<f32>(arr[0u], arr[1u]);
}
fn mat2x2_stride_32_to_arr(mat : mat2x2<f32>) -> @stride(32) array<vec2<f32>, 2u> {
return @stride(32) array<vec2<f32>, 2u>(mat[0u], mat[1u]);
fn mat2x2_stride_32_to_arr(m : mat2x2<f32>) -> @stride(32) array<vec2<f32>, 2u> {
return @stride(32) array<vec2<f32>, 2u>(m[0u], m[1u]);
}
@stage(compute) @workgroup_size(1)

View File

@ -15,9 +15,9 @@ mat2 arr_to_mat2x2_stride_16(strided_arr arr[2]) {
return mat2(arr[0u].el, arr[1u].el);
}
strided_arr[2] mat2x2_stride_16_to_arr(mat2 mat) {
strided_arr tint_symbol = strided_arr(mat[0u]);
strided_arr tint_symbol_1 = strided_arr(mat[1u]);
strided_arr[2] mat2x2_stride_16_to_arr(mat2 m) {
strided_arr tint_symbol = strided_arr(m[0u]);
strided_arr tint_symbol_1 = strided_arr(m[1u]);
strided_arr tint_symbol_2[2] = strided_arr[2](tint_symbol, tint_symbol_1);
return tint_symbol_2;
}

View File

@ -9,9 +9,9 @@ float2x2 arr_to_mat2x2_stride_16(strided_arr arr[2]) {
}
typedef strided_arr mat2x2_stride_16_to_arr_ret[2];
mat2x2_stride_16_to_arr_ret mat2x2_stride_16_to_arr(float2x2 mat) {
const strided_arr tint_symbol_6 = {mat[0u]};
const strided_arr tint_symbol_7 = {mat[1u]};
mat2x2_stride_16_to_arr_ret mat2x2_stride_16_to_arr(float2x2 m) {
const strided_arr tint_symbol_6 = {m[0u]};
const strided_arr tint_symbol_7 = {m[1u]};
const strided_arr tint_symbol_8[2] = {tint_symbol_6, tint_symbol_7};
return tint_symbol_8;
}

View File

@ -18,9 +18,9 @@ float2x2 arr_to_mat2x2_stride_16(tint_array_wrapper arr) {
return float2x2(arr.arr[0u].el, arr.arr[1u].el);
}
tint_array_wrapper mat2x2_stride_16_to_arr(float2x2 mat) {
strided_arr const tint_symbol = {.el=mat[0u]};
strided_arr const tint_symbol_1 = {.el=mat[1u]};
tint_array_wrapper mat2x2_stride_16_to_arr(float2x2 m) {
strided_arr const tint_symbol = {.el=m[0u]};
strided_arr const tint_symbol_1 = {.el=m[1u]};
tint_array_wrapper const tint_symbol_2 = {.arr={tint_symbol, tint_symbol_1}};
return tint_symbol_2;
}

View File

@ -15,7 +15,7 @@
OpName %arr_to_mat2x2_stride_16 "arr_to_mat2x2_stride_16"
OpName %arr "arr"
OpName %mat2x2_stride_16_to_arr "mat2x2_stride_16_to_arr"
OpName %mat "mat"
OpName %m "m"
OpName %f_1 "f_1"
OpName %f "f"
OpDecorate %SSBO Block
@ -52,11 +52,11 @@
OpReturnValue %21
OpFunctionEnd
%mat2x2_stride_16_to_arr = OpFunction %_arr_strided_arr_uint_2 None %22
%mat = OpFunctionParameter %mat2v2float
%m = OpFunctionParameter %mat2v2float
%25 = OpLabel
%26 = OpCompositeExtract %v2float %mat 0
%26 = OpCompositeExtract %v2float %m 0
%27 = OpCompositeConstruct %strided_arr %26
%28 = OpCompositeExtract %v2float %mat 1
%28 = OpCompositeExtract %v2float %m 1
%29 = OpCompositeConstruct %strided_arr %28
%30 = OpCompositeConstruct %_arr_strided_arr_uint_2 %27 %29
OpReturnValue %30

View File

@ -13,8 +13,8 @@ fn arr_to_mat2x2_stride_16(arr : array<strided_arr, 2u>) -> mat2x2<f32> {
return mat2x2<f32>(arr[0u].el, arr[1u].el);
}
fn mat2x2_stride_16_to_arr(mat : mat2x2<f32>) -> array<strided_arr, 2u> {
return array<strided_arr, 2u>(strided_arr(mat[0u]), strided_arr(mat[1u]));
fn mat2x2_stride_16_to_arr(m : mat2x2<f32>) -> array<strided_arr, 2u> {
return array<strided_arr, 2u>(strided_arr(m[0u]), strided_arr(m[1u]));
}
fn f_1() {