From 555c256344e0b5918444d7702877e62535704910 Mon Sep 17 00:00:00 2001 From: James Price Date: Thu, 31 Mar 2022 22:30:10 +0000 Subject: [PATCH] wgsl: Add support for compound assignment Implemented in both the reader and writer with E2E tests. Other backends detect compound assignment and ICE for now. Bug: tint:1325 Change-Id: Ie3f51e03627a38b12bd1513c4bcf1bebb3282863 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/74363 Reviewed-by: Ben Clayton Kokoro: Kokoro --- src/tint/reader/wgsl/lexer.cc | 32 +++++++ src/tint/reader/wgsl/lexer_test.cc | 10 ++- src/tint/reader/wgsl/parser_impl.cc | 55 +++++++++++- src/tint/reader/wgsl/parser_impl.h | 6 +- .../wgsl/parser_impl_assignment_stmt_test.cc | 88 ++++++++++++++----- src/tint/reader/wgsl/token.cc | 16 ++++ src/tint/reader/wgsl/token.h | 16 ++++ src/tint/writer/wgsl/generator_impl.cc | 48 ++++++++-- src/tint/writer/wgsl/generator_impl.h | 10 +++ .../compound_assign/complex_lhs.wgsl | 20 +++++ .../complex_lhs.wgsl.expected.glsl | 26 ++++++ .../complex_lhs.wgsl.expected.hlsl | 26 ++++++ .../complex_lhs.wgsl.expected.msl | 26 ++++++ .../complex_lhs.wgsl.expected.spvasm | 26 ++++++ .../complex_lhs.wgsl.expected.wgsl | 21 +++++ .../compound_assign/divide_by_zero.wgsl | 14 +++ .../divide_by_zero.wgsl.expected.glsl | 19 ++++ .../divide_by_zero.wgsl.expected.hlsl | 19 ++++ .../divide_by_zero.wgsl.expected.msl | 19 ++++ .../divide_by_zero.wgsl.expected.spvasm | 19 ++++ .../divide_by_zero.wgsl.expected.wgsl | 14 +++ .../statements/compound_assign/for_loop.wgsl | 31 +++++++ .../for_loop.wgsl.expected.glsl | 35 ++++++++ .../for_loop.wgsl.expected.hlsl | 35 ++++++++ .../for_loop.wgsl.expected.msl | 35 ++++++++ .../for_loop.wgsl.expected.spvasm | 35 ++++++++ .../for_loop.wgsl.expected.wgsl | 30 +++++++ .../statements/compound_assign/function.wgsl | 9 ++ .../function.wgsl.expected.glsl | 13 +++ .../function.wgsl.expected.hlsl | 13 +++ .../function.wgsl.expected.msl | 13 +++ .../function.wgsl.expected.spvasm | 13 +++ .../function.wgsl.expected.wgsl | 8 ++ .../compound_assign/matrix/minus.wgsl | 9 ++ .../matrix/minus.wgsl.expected.glsl | 14 +++ .../matrix/minus.wgsl.expected.hlsl | 14 +++ .../matrix/minus.wgsl.expected.msl | 14 +++ .../matrix/minus.wgsl.expected.spvasm | 14 +++ .../matrix/minus.wgsl.expected.wgsl | 9 ++ .../compound_assign/matrix/plus.wgsl | 9 ++ .../matrix/plus.wgsl.expected.glsl | 14 +++ .../matrix/plus.wgsl.expected.hlsl | 14 +++ .../matrix/plus.wgsl.expected.msl | 14 +++ .../matrix/plus.wgsl.expected.spvasm | 14 +++ .../matrix/plus.wgsl.expected.wgsl | 9 ++ .../compound_assign/matrix/times-scalar.wgsl | 9 ++ .../matrix/times-scalar.wgsl.expected.glsl | 14 +++ .../matrix/times-scalar.wgsl.expected.hlsl | 14 +++ .../matrix/times-scalar.wgsl.expected.msl | 14 +++ .../matrix/times-scalar.wgsl.expected.spvasm | 14 +++ .../matrix/times-scalar.wgsl.expected.wgsl | 9 ++ .../compound_assign/matrix/times.wgsl | 9 ++ .../matrix/times.wgsl.expected.glsl | 14 +++ .../matrix/times.wgsl.expected.hlsl | 14 +++ .../matrix/times.wgsl.expected.msl | 14 +++ .../matrix/times.wgsl.expected.spvasm | 14 +++ .../matrix/times.wgsl.expected.wgsl | 9 ++ .../statements/compound_assign/private.wgsl | 9 ++ .../private.wgsl.expected.glsl | 16 ++++ .../private.wgsl.expected.hlsl | 16 ++++ .../compound_assign/private.wgsl.expected.msl | 16 ++++ .../private.wgsl.expected.spvasm | 16 ++++ .../private.wgsl.expected.wgsl | 11 +++ .../compound_assign/scalar/and.wgsl | 9 ++ .../scalar/and.wgsl.expected.glsl | 14 +++ .../scalar/and.wgsl.expected.hlsl | 14 +++ .../scalar/and.wgsl.expected.msl | 14 +++ .../scalar/and.wgsl.expected.spvasm | 14 +++ .../scalar/and.wgsl.expected.wgsl | 9 ++ .../compound_assign/scalar/divide.wgsl | 9 ++ .../scalar/divide.wgsl.expected.glsl | 14 +++ .../scalar/divide.wgsl.expected.hlsl | 14 +++ .../scalar/divide.wgsl.expected.msl | 14 +++ .../scalar/divide.wgsl.expected.spvasm | 14 +++ .../scalar/divide.wgsl.expected.wgsl | 9 ++ .../compound_assign/scalar/minus.wgsl | 9 ++ .../scalar/minus.wgsl.expected.glsl | 14 +++ .../scalar/minus.wgsl.expected.hlsl | 14 +++ .../scalar/minus.wgsl.expected.msl | 14 +++ .../scalar/minus.wgsl.expected.spvasm | 14 +++ .../scalar/minus.wgsl.expected.wgsl | 9 ++ .../compound_assign/scalar/modulo.wgsl | 9 ++ .../scalar/modulo.wgsl.expected.glsl | 14 +++ .../scalar/modulo.wgsl.expected.hlsl | 14 +++ .../scalar/modulo.wgsl.expected.msl | 14 +++ .../scalar/modulo.wgsl.expected.spvasm | 14 +++ .../scalar/modulo.wgsl.expected.wgsl | 9 ++ .../statements/compound_assign/scalar/or.wgsl | 9 ++ .../scalar/or.wgsl.expected.glsl | 14 +++ .../scalar/or.wgsl.expected.hlsl | 14 +++ .../scalar/or.wgsl.expected.msl | 14 +++ .../scalar/or.wgsl.expected.spvasm | 14 +++ .../scalar/or.wgsl.expected.wgsl | 9 ++ .../compound_assign/scalar/plus.wgsl | 9 ++ .../scalar/plus.wgsl.expected.glsl | 14 +++ .../scalar/plus.wgsl.expected.hlsl | 14 +++ .../scalar/plus.wgsl.expected.msl | 14 +++ .../scalar/plus.wgsl.expected.spvasm | 14 +++ .../scalar/plus.wgsl.expected.wgsl | 9 ++ .../compound_assign/scalar/times.wgsl | 9 ++ .../scalar/times.wgsl.expected.glsl | 14 +++ .../scalar/times.wgsl.expected.hlsl | 14 +++ .../scalar/times.wgsl.expected.msl | 14 +++ .../scalar/times.wgsl.expected.spvasm | 14 +++ .../scalar/times.wgsl.expected.wgsl | 9 ++ .../compound_assign/scalar/xor.wgsl | 9 ++ .../scalar/xor.wgsl.expected.glsl | 14 +++ .../scalar/xor.wgsl.expected.hlsl | 14 +++ .../scalar/xor.wgsl.expected.msl | 14 +++ .../scalar/xor.wgsl.expected.spvasm | 14 +++ .../scalar/xor.wgsl.expected.wgsl | 9 ++ .../compound_assign/vector/and.wgsl | 9 ++ .../vector/and.wgsl.expected.glsl | 14 +++ .../vector/and.wgsl.expected.hlsl | 14 +++ .../vector/and.wgsl.expected.msl | 14 +++ .../vector/and.wgsl.expected.spvasm | 14 +++ .../vector/and.wgsl.expected.wgsl | 9 ++ .../compound_assign/vector/divide-scalar.wgsl | 9 ++ .../vector/divide-scalar.wgsl.expected.glsl | 14 +++ .../vector/divide-scalar.wgsl.expected.hlsl | 14 +++ .../vector/divide-scalar.wgsl.expected.msl | 14 +++ .../vector/divide-scalar.wgsl.expected.spvasm | 14 +++ .../vector/divide-scalar.wgsl.expected.wgsl | 9 ++ .../compound_assign/vector/divide.wgsl | 9 ++ .../vector/divide.wgsl.expected.glsl | 14 +++ .../vector/divide.wgsl.expected.hlsl | 14 +++ .../vector/divide.wgsl.expected.msl | 14 +++ .../vector/divide.wgsl.expected.spvasm | 14 +++ .../vector/divide.wgsl.expected.wgsl | 9 ++ .../compound_assign/vector/minus-scalar.wgsl | 9 ++ .../vector/minus-scalar.wgsl.expected.glsl | 14 +++ .../vector/minus-scalar.wgsl.expected.hlsl | 14 +++ .../vector/minus-scalar.wgsl.expected.msl | 14 +++ .../vector/minus-scalar.wgsl.expected.spvasm | 14 +++ .../vector/minus-scalar.wgsl.expected.wgsl | 9 ++ .../compound_assign/vector/minus.wgsl | 9 ++ .../vector/minus.wgsl.expected.glsl | 14 +++ .../vector/minus.wgsl.expected.hlsl | 14 +++ .../vector/minus.wgsl.expected.msl | 14 +++ .../vector/minus.wgsl.expected.spvasm | 14 +++ .../vector/minus.wgsl.expected.wgsl | 9 ++ .../compound_assign/vector/modulo-scalar.wgsl | 9 ++ .../vector/modulo-scalar.wgsl.expected.glsl | 14 +++ .../vector/modulo-scalar.wgsl.expected.hlsl | 14 +++ .../vector/modulo-scalar.wgsl.expected.msl | 14 +++ .../vector/modulo-scalar.wgsl.expected.spvasm | 14 +++ .../vector/modulo-scalar.wgsl.expected.wgsl | 9 ++ .../compound_assign/vector/modulo.wgsl | 9 ++ .../vector/modulo.wgsl.expected.glsl | 14 +++ .../vector/modulo.wgsl.expected.hlsl | 14 +++ .../vector/modulo.wgsl.expected.msl | 14 +++ .../vector/modulo.wgsl.expected.spvasm | 14 +++ .../vector/modulo.wgsl.expected.wgsl | 9 ++ .../statements/compound_assign/vector/or.wgsl | 9 ++ .../vector/or.wgsl.expected.glsl | 14 +++ .../vector/or.wgsl.expected.hlsl | 14 +++ .../vector/or.wgsl.expected.msl | 14 +++ .../vector/or.wgsl.expected.spvasm | 14 +++ .../vector/or.wgsl.expected.wgsl | 9 ++ .../compound_assign/vector/plus-scalar.wgsl | 9 ++ .../vector/plus-scalar.wgsl.expected.glsl | 14 +++ .../vector/plus-scalar.wgsl.expected.hlsl | 14 +++ .../vector/plus-scalar.wgsl.expected.msl | 14 +++ .../vector/plus-scalar.wgsl.expected.spvasm | 14 +++ .../vector/plus-scalar.wgsl.expected.wgsl | 9 ++ .../compound_assign/vector/plus.wgsl | 9 ++ .../vector/plus.wgsl.expected.glsl | 14 +++ .../vector/plus.wgsl.expected.hlsl | 14 +++ .../vector/plus.wgsl.expected.msl | 14 +++ .../vector/plus.wgsl.expected.spvasm | 14 +++ .../vector/plus.wgsl.expected.wgsl | 9 ++ .../compound_assign/vector/times-matrix.wgsl | 9 ++ .../vector/times-matrix.wgsl.expected.glsl | 14 +++ .../vector/times-matrix.wgsl.expected.hlsl | 14 +++ .../vector/times-matrix.wgsl.expected.msl | 14 +++ .../vector/times-matrix.wgsl.expected.spvasm | 14 +++ .../vector/times-matrix.wgsl.expected.wgsl | 9 ++ .../compound_assign/vector/times-scalar.wgsl | 9 ++ .../vector/times-scalar.wgsl.expected.glsl | 14 +++ .../vector/times-scalar.wgsl.expected.hlsl | 14 +++ .../vector/times-scalar.wgsl.expected.msl | 14 +++ .../vector/times-scalar.wgsl.expected.spvasm | 14 +++ .../vector/times-scalar.wgsl.expected.wgsl | 9 ++ .../compound_assign/vector/times.wgsl | 9 ++ .../vector/times.wgsl.expected.glsl | 14 +++ .../vector/times.wgsl.expected.hlsl | 14 +++ .../vector/times.wgsl.expected.msl | 14 +++ .../vector/times.wgsl.expected.spvasm | 14 +++ .../vector/times.wgsl.expected.wgsl | 9 ++ .../compound_assign/vector/xor.wgsl | 9 ++ .../vector/xor.wgsl.expected.glsl | 14 +++ .../vector/xor.wgsl.expected.hlsl | 14 +++ .../vector/xor.wgsl.expected.msl | 14 +++ .../vector/xor.wgsl.expected.spvasm | 14 +++ .../vector/xor.wgsl.expected.wgsl | 9 ++ .../statements/compound_assign/workgroup.wgsl | 9 ++ .../workgroup.wgsl.expected.glsl | 16 ++++ .../workgroup.wgsl.expected.hlsl | 16 ++++ .../workgroup.wgsl.expected.msl | 16 ++++ .../workgroup.wgsl.expected.spvasm | 16 ++++ .../workgroup.wgsl.expected.wgsl | 11 +++ 201 files changed, 2854 insertions(+), 38 deletions(-) create mode 100644 test/tint/statements/compound_assign/complex_lhs.wgsl create mode 100644 test/tint/statements/compound_assign/complex_lhs.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/complex_lhs.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/complex_lhs.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/complex_lhs.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/complex_lhs.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/divide_by_zero.wgsl create mode 100644 test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/for_loop.wgsl create mode 100644 test/tint/statements/compound_assign/for_loop.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/for_loop.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/for_loop.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/for_loop.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/for_loop.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/function.wgsl create mode 100644 test/tint/statements/compound_assign/function.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/function.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/function.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/function.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/function.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/matrix/minus.wgsl create mode 100644 test/tint/statements/compound_assign/matrix/minus.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/matrix/minus.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/matrix/minus.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/matrix/minus.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/matrix/minus.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/matrix/plus.wgsl create mode 100644 test/tint/statements/compound_assign/matrix/plus.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/matrix/plus.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/matrix/plus.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/matrix/plus.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/matrix/plus.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/matrix/times-scalar.wgsl create mode 100644 test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/matrix/times.wgsl create mode 100644 test/tint/statements/compound_assign/matrix/times.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/matrix/times.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/matrix/times.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/matrix/times.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/matrix/times.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/private.wgsl create mode 100644 test/tint/statements/compound_assign/private.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/private.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/private.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/private.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/private.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/and.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/and.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/scalar/and.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/scalar/and.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/scalar/and.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/scalar/and.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/divide.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/scalar/divide.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/scalar/divide.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/scalar/divide.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/scalar/divide.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/minus.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/minus.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/scalar/minus.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/scalar/minus.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/scalar/minus.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/scalar/minus.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/modulo.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/or.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/or.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/scalar/or.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/scalar/or.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/scalar/or.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/scalar/or.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/plus.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/plus.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/scalar/plus.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/scalar/plus.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/scalar/plus.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/scalar/plus.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/times.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/times.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/scalar/times.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/scalar/times.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/scalar/times.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/scalar/times.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/xor.wgsl create mode 100644 test/tint/statements/compound_assign/scalar/xor.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/scalar/xor.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/scalar/xor.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/scalar/xor.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/scalar/xor.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/vector/and.wgsl create mode 100644 test/tint/statements/compound_assign/vector/and.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/vector/and.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/vector/and.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/vector/and.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/vector/and.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/vector/divide-scalar.wgsl create mode 100644 test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/vector/divide.wgsl create mode 100644 test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/vector/divide.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/vector/divide.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/vector/divide.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/vector/divide.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/vector/minus-scalar.wgsl create mode 100644 test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/vector/minus.wgsl create mode 100644 test/tint/statements/compound_assign/vector/minus.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/vector/minus.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/vector/minus.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/vector/minus.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/vector/minus.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/vector/modulo-scalar.wgsl create mode 100644 test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/vector/modulo.wgsl create mode 100644 test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/vector/modulo.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/vector/modulo.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/vector/modulo.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/vector/modulo.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/vector/or.wgsl create mode 100644 test/tint/statements/compound_assign/vector/or.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/vector/or.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/vector/or.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/vector/or.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/vector/or.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/vector/plus-scalar.wgsl create mode 100644 test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/vector/plus.wgsl create mode 100644 test/tint/statements/compound_assign/vector/plus.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/vector/plus.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/vector/plus.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/vector/plus.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/vector/plus.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/vector/times-matrix.wgsl create mode 100644 test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/vector/times-scalar.wgsl create mode 100644 test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/vector/times.wgsl create mode 100644 test/tint/statements/compound_assign/vector/times.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/vector/times.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/vector/times.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/vector/times.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/vector/times.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/vector/xor.wgsl create mode 100644 test/tint/statements/compound_assign/vector/xor.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/vector/xor.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/vector/xor.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/vector/xor.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/vector/xor.wgsl.expected.wgsl create mode 100644 test/tint/statements/compound_assign/workgroup.wgsl create mode 100644 test/tint/statements/compound_assign/workgroup.wgsl.expected.glsl create mode 100644 test/tint/statements/compound_assign/workgroup.wgsl.expected.hlsl create mode 100644 test/tint/statements/compound_assign/workgroup.wgsl.expected.msl create mode 100644 test/tint/statements/compound_assign/workgroup.wgsl.expected.spvasm create mode 100644 test/tint/statements/compound_assign/workgroup.wgsl.expected.wgsl diff --git a/src/tint/reader/wgsl/lexer.cc b/src/tint/reader/wgsl/lexer.cc index e6a01daa83..fdbd2dfc4b 100644 --- a/src/tint/reader/wgsl/lexer.cc +++ b/src/tint/reader/wgsl/lexer.cc @@ -829,10 +829,18 @@ Token Lexer::try_punctuation() { type = Token::Type::kAndAnd; pos_ += 2; location_.column += 2; + } else if (matches(pos_, "&=")) { + type = Token::Type::kAndEqual; + pos_ += 2; + location_.column += 2; } else if (matches(pos_, "&")) { type = Token::Type::kAnd; pos_ += 1; location_.column += 1; + } else if (matches(pos_, "/=")) { + type = Token::Type::kDivisionEqual; + pos_ += 2; + location_.column += 2; } else if (matches(pos_, "/")) { type = Token::Type::kForwardSlash; pos_ += 1; @@ -885,6 +893,10 @@ Token Lexer::try_punctuation() { type = Token::Type::kLessThan; pos_ += 1; location_.column += 1; + } else if (matches(pos_, "%=")) { + type = Token::Type::kModuloEqual; + pos_ += 2; + location_.column += 2; } else if (matches(pos_, "%")) { type = Token::Type::kMod; pos_ += 1; @@ -897,6 +909,10 @@ Token Lexer::try_punctuation() { type = Token::Type::kMinusMinus; pos_ += 2; location_.column += 2; + } else if (matches(pos_, "-=")) { + type = Token::Type::kMinusEqual; + pos_ += 2; + location_.column += 2; } else if (matches(pos_, "-")) { type = Token::Type::kMinus; pos_ += 1; @@ -909,6 +925,10 @@ Token Lexer::try_punctuation() { type = Token::Type::kPlusPlus; pos_ += 2; location_.column += 2; + } else if (matches(pos_, "+=")) { + type = Token::Type::kPlusEqual; + pos_ += 2; + location_.column += 2; } else if (matches(pos_, "+")) { type = Token::Type::kPlus; pos_ += 1; @@ -917,6 +937,10 @@ Token Lexer::try_punctuation() { type = Token::Type::kOrOr; pos_ += 2; location_.column += 2; + } else if (matches(pos_, "|=")) { + type = Token::Type::kOrEqual; + pos_ += 2; + location_.column += 2; } else if (matches(pos_, "|")) { type = Token::Type::kOr; pos_ += 1; @@ -925,6 +949,10 @@ Token Lexer::try_punctuation() { type = Token::Type::kSemicolon; pos_ += 1; location_.column += 1; + } else if (matches(pos_, "*=")) { + type = Token::Type::kTimesEqual; + pos_ += 2; + location_.column += 2; } else if (matches(pos_, "*")) { type = Token::Type::kStar; pos_ += 1; @@ -937,6 +965,10 @@ Token Lexer::try_punctuation() { type = Token::Type::kUnderscore; pos_ += 1; location_.column += 1; + } else if (matches(pos_, "^=")) { + type = Token::Type::kXorEqual; + pos_ += 2; + location_.column += 2; } else if (matches(pos_, "^")) { type = Token::Type::kXor; pos_ += 1; diff --git a/src/tint/reader/wgsl/lexer_test.cc b/src/tint/reader/wgsl/lexer_test.cc index 08336914eb..76aa3c4513 100644 --- a/src/tint/reader/wgsl/lexer_test.cc +++ b/src/tint/reader/wgsl/lexer_test.cc @@ -832,7 +832,15 @@ INSTANTIATE_TEST_SUITE_P( TokenData{"*", Token::Type::kStar}, TokenData{"~", Token::Type::kTilde}, TokenData{"_", Token::Type::kUnderscore}, - TokenData{"^", Token::Type::kXor})); + TokenData{"^", Token::Type::kXor}, + TokenData{"+=", Token::Type::kPlusEqual}, + TokenData{"-=", Token::Type::kMinusEqual}, + TokenData{"*=", Token::Type::kTimesEqual}, + TokenData{"/=", Token::Type::kDivisionEqual}, + TokenData{"%=", Token::Type::kModuloEqual}, + TokenData{"&=", Token::Type::kAndEqual}, + TokenData{"|=", Token::Type::kOrEqual}, + TokenData{"^=", Token::Type::kXorEqual})); using KeywordTest = testing::TestWithParam; TEST_P(KeywordTest, Parses) { diff --git a/src/tint/reader/wgsl/parser_impl.cc b/src/tint/reader/wgsl/parser_impl.cc index af02aaa363..03d6ca3227 100644 --- a/src/tint/reader/wgsl/parser_impl.cc +++ b/src/tint/reader/wgsl/parser_impl.cc @@ -2652,9 +2652,45 @@ Maybe ParserImpl::logical_or_expression() { return expect_logical_or_expr(lhs.value); } +// compound_assignment_operator: +// | plus_equal +// | minus_equal +// | times_equal +// | division_equal +// | modulo_equal +// | and_equal +// | or_equal +// | xor_equal +Maybe ParserImpl::compound_assignment_operator() { + ast::BinaryOp compound_op = ast::BinaryOp::kNone; + if (peek_is(Token::Type::kPlusEqual)) { + compound_op = ast::BinaryOp::kAdd; + } else if (peek_is(Token::Type::kMinusEqual)) { + compound_op = ast::BinaryOp::kSubtract; + } else if (peek_is(Token::Type::kTimesEqual)) { + compound_op = ast::BinaryOp::kMultiply; + } else if (peek_is(Token::Type::kDivisionEqual)) { + compound_op = ast::BinaryOp::kDivide; + } else if (peek_is(Token::Type::kModuloEqual)) { + compound_op = ast::BinaryOp::kModulo; + } else if (peek_is(Token::Type::kAndEqual)) { + compound_op = ast::BinaryOp::kAnd; + } else if (peek_is(Token::Type::kOrEqual)) { + compound_op = ast::BinaryOp::kOr; + } else if (peek_is(Token::Type::kXorEqual)) { + compound_op = ast::BinaryOp::kXor; + } + if (compound_op != ast::BinaryOp::kNone) { + next(); + return compound_op; + } + return Failure::kNoMatch; +} + // assignment_stmt -// : (unary_expression | underscore) EQUAL logical_or_expression -Maybe ParserImpl::assignment_stmt() { +// | lhs_expression ( equal | compound_assignment_operator ) expression +// | underscore equal expression +Maybe ParserImpl::assignment_stmt() { auto t = peek(); auto source = t.source(); @@ -2677,9 +2713,15 @@ Maybe ParserImpl::assignment_stmt() { lhs = create(source); } - if (!expect("assignment", Token::Type::kEqual)) { + auto compound_op = compound_assignment_operator(); + if (compound_op.errored) { return Failure::kErrored; } + if (!compound_op.matched) { + if (!expect("assignment", Token::Type::kEqual)) { + return Failure::kErrored; + } + } auto rhs = logical_or_expression(); if (rhs.errored) { @@ -2689,7 +2731,12 @@ Maybe ParserImpl::assignment_stmt() { return add_error(peek(), "unable to parse right side of assignment"); } - return create(source, lhs.value, rhs.value); + if (compound_op.value != ast::BinaryOp::kNone) { + return create( + source, lhs.value, rhs.value, compound_op.value); + } else { + return create(source, lhs.value, rhs.value); + } } // const_literal diff --git a/src/tint/reader/wgsl/parser_impl.h b/src/tint/reader/wgsl/parser_impl.h index d358b1119f..0c072de802 100644 --- a/src/tint/reader/wgsl/parser_impl.h +++ b/src/tint/reader/wgsl/parser_impl.h @@ -31,7 +31,6 @@ namespace tint { namespace ast { -class AssignmentStatement; class BreakStatement; class CallStatement; class ContinueStatement; @@ -657,9 +656,12 @@ class ParserImpl { /// Parses a `logical_or_expression` grammar element /// @returns the parsed expression or nullptr Maybe logical_or_expression(); + /// Parses a `compound_assignment_operator` grammar element + /// @returns the parsed compound assignment operator + Maybe compound_assignment_operator(); /// Parses a `assignment_stmt` grammar element /// @returns the parsed assignment or nullptr - Maybe assignment_stmt(); + Maybe assignment_stmt(); /// Parses one or more attribute lists. /// @return the parsed attribute list, or an empty list on error. Maybe attribute_list(); diff --git a/src/tint/reader/wgsl/parser_impl_assignment_stmt_test.cc b/src/tint/reader/wgsl/parser_impl_assignment_stmt_test.cc index f2e950dca4..340a577aac 100644 --- a/src/tint/reader/wgsl/parser_impl_assignment_stmt_test.cc +++ b/src/tint/reader/wgsl/parser_impl_assignment_stmt_test.cc @@ -27,17 +27,17 @@ TEST_F(ParserImplTest, AssignmentStmt_Parses_ToVariable) { EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); - ASSERT_TRUE(e->Is()); - ASSERT_NE(e->lhs, nullptr); - ASSERT_NE(e->rhs, nullptr); + auto* a = e->As(); + ASSERT_NE(a, nullptr); + ASSERT_NE(a->lhs, nullptr); + ASSERT_NE(a->rhs, nullptr); - ASSERT_TRUE(e->lhs->Is()); - auto* ident = e->lhs->As(); + ASSERT_TRUE(a->lhs->Is()); + auto* ident = a->lhs->As(); EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); - ASSERT_NE(e->rhs, nullptr); - ASSERT_TRUE(e->rhs->Is()); - EXPECT_EQ(e->rhs->As()->value, 123); + ASSERT_TRUE(a->rhs->Is()); + EXPECT_EQ(a->rhs->As()->value, 123); } TEST_F(ParserImplTest, AssignmentStmt_Parses_ToMember) { @@ -48,16 +48,16 @@ TEST_F(ParserImplTest, AssignmentStmt_Parses_ToMember) { EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); - ASSERT_TRUE(e->Is()); - ASSERT_NE(e->lhs, nullptr); - ASSERT_NE(e->rhs, nullptr); + auto* a = e->As(); + ASSERT_NE(a, nullptr); + ASSERT_NE(a->lhs, nullptr); + ASSERT_NE(a->rhs, nullptr); - ASSERT_NE(e->rhs, nullptr); - ASSERT_TRUE(e->rhs->Is()); - EXPECT_EQ(e->rhs->As()->value, 123); + ASSERT_TRUE(a->rhs->Is()); + EXPECT_EQ(a->rhs->As()->value, 123); - ASSERT_TRUE(e->lhs->Is()); - auto* mem = e->lhs->As(); + ASSERT_TRUE(a->lhs->Is()); + auto* mem = a->lhs->As(); ASSERT_TRUE(mem->member->Is()); auto* ident = mem->member->As(); @@ -96,15 +96,37 @@ TEST_F(ParserImplTest, AssignmentStmt_Parses_ToPhony) { EXPECT_FALSE(p->has_error()) << p->error(); ASSERT_NE(e.value, nullptr); - ASSERT_TRUE(e->Is()); - ASSERT_NE(e->lhs, nullptr); - ASSERT_NE(e->rhs, nullptr); + auto* a = e->As(); + ASSERT_NE(a, nullptr); + ASSERT_NE(a->lhs, nullptr); + ASSERT_NE(a->rhs, nullptr); - ASSERT_NE(e->rhs, nullptr); - ASSERT_TRUE(e->rhs->Is()); - EXPECT_EQ(e->rhs->As()->value, 123); + ASSERT_TRUE(a->rhs->Is()); + EXPECT_EQ(a->rhs->As()->value, 123); - ASSERT_TRUE(e->lhs->Is()); + ASSERT_TRUE(a->lhs->Is()); +} + +TEST_F(ParserImplTest, AssignmentStmt_Parses_CompoundOp) { + auto p = parser("a += 123"); + auto e = p->assignment_stmt(); + EXPECT_TRUE(e.matched); + EXPECT_FALSE(e.errored); + EXPECT_FALSE(p->has_error()) << p->error(); + ASSERT_NE(e.value, nullptr); + + auto* a = e->As(); + ASSERT_NE(a, nullptr); + ASSERT_NE(a->lhs, nullptr); + ASSERT_NE(a->rhs, nullptr); + EXPECT_EQ(a->op, ast::BinaryOp::kAdd); + + ASSERT_TRUE(a->lhs->Is()); + auto* ident = a->lhs->As(); + EXPECT_EQ(ident->symbol, p->builder().Symbols().Get("a")); + + ASSERT_TRUE(a->rhs->Is()); + EXPECT_EQ(a->rhs->As()->value, 123); } TEST_F(ParserImplTest, AssignmentStmt_MissingEqual) { @@ -117,6 +139,16 @@ TEST_F(ParserImplTest, AssignmentStmt_MissingEqual) { EXPECT_EQ(p->error(), "1:12: expected '=' for assignment"); } +TEST_F(ParserImplTest, AssignmentStmt_Compound_MissingEqual) { + auto p = parser("a + 123"); + auto e = p->assignment_stmt(); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(e.value, nullptr); + EXPECT_EQ(p->error(), "1:3: expected '=' for assignment"); +} + TEST_F(ParserImplTest, AssignmentStmt_InvalidLHS) { auto p = parser("if (true) {} = 123"); auto e = p->assignment_stmt(); @@ -136,6 +168,16 @@ TEST_F(ParserImplTest, AssignmentStmt_InvalidRHS) { EXPECT_EQ(p->error(), "1:14: unable to parse right side of assignment"); } +TEST_F(ParserImplTest, AssignmentStmt_InvalidCompoundOp) { + auto p = parser("a &&= true"); + auto e = p->assignment_stmt(); + EXPECT_FALSE(e.matched); + EXPECT_TRUE(e.errored); + EXPECT_EQ(e.value, nullptr); + EXPECT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:3: expected '=' for assignment"); +} + } // namespace } // namespace wgsl } // namespace reader diff --git a/src/tint/reader/wgsl/token.cc b/src/tint/reader/wgsl/token.cc index c873e179b6..b36d301ac6 100644 --- a/src/tint/reader/wgsl/token.cc +++ b/src/tint/reader/wgsl/token.cc @@ -108,6 +108,22 @@ std::string_view Token::TypeToName(Type type) { return "_"; case Token::Type::kXor: return "^"; + case Token::Type::kPlusEqual: + return "+="; + case Token::Type::kMinusEqual: + return "-="; + case Token::Type::kTimesEqual: + return "*="; + case Token::Type::kDivisionEqual: + return "/="; + case Token::Type::kModuloEqual: + return "%="; + case Token::Type::kAndEqual: + return "&="; + case Token::Type::kOrEqual: + return "|="; + case Token::Type::kXorEqual: + return "^="; case Token::Type::kArray: return "array"; diff --git a/src/tint/reader/wgsl/token.h b/src/tint/reader/wgsl/token.h index b25fb60622..fed8fc90aa 100644 --- a/src/tint/reader/wgsl/token.h +++ b/src/tint/reader/wgsl/token.h @@ -118,6 +118,22 @@ class Token { kUnderscore, /// A '^' kXor, + /// A '+=' + kPlusEqual, + /// A '-=' + kMinusEqual, + /// A '*=' + kTimesEqual, + /// A '/=' + kDivisionEqual, + /// A '%=' + kModuloEqual, + /// A '&=' + kAndEqual, + /// A '|=' + kOrEqual, + /// A '^=' + kXorEqual, /// A 'array' kArray, diff --git a/src/tint/writer/wgsl/generator_impl.cc b/src/tint/writer/wgsl/generator_impl.cc index 1bc68bce8d..5433c459ce 100644 --- a/src/tint/writer/wgsl/generator_impl.cc +++ b/src/tint/writer/wgsl/generator_impl.cc @@ -786,8 +786,21 @@ bool GeneratorImpl::EmitBinary(std::ostream& out, return false; } out << " "; + if (!EmitBinaryOp(out, expr->op)) { + return false; + } + out << " "; - switch (expr->op) { + if (!EmitExpression(out, expr->rhs)) { + return false; + } + + out << ")"; + return true; +} + +bool GeneratorImpl::EmitBinaryOp(std::ostream& out, const ast::BinaryOp op) { + switch (op) { case ast::BinaryOp::kAnd: out << "&"; break; @@ -847,13 +860,6 @@ bool GeneratorImpl::EmitBinary(std::ostream& out, "missing binary operation type"); return false; } - out << " "; - - if (!EmitExpression(out, expr->rhs)) { - return false; - } - - out << ")"; return true; } @@ -911,6 +917,9 @@ bool GeneratorImpl::EmitStatement(const ast::Statement* stmt) { out << ";"; return true; }, + [&](const ast::CompoundAssignmentStatement* c) { + return EmitCompoundAssign(c); + }, [&](const ast::ContinueStatement* c) { return EmitContinue(c); }, [&](const ast::DiscardStatement* d) { return EmitDiscard(d); }, [&](const ast::FallthroughStatement* f) { return EmitFallthrough(f); }, @@ -996,6 +1005,29 @@ bool GeneratorImpl::EmitCase(const ast::CaseStatement* stmt) { return true; } +bool GeneratorImpl::EmitCompoundAssign( + const ast::CompoundAssignmentStatement* stmt) { + auto out = line(); + + if (!EmitExpression(out, stmt->lhs)) { + return false; + } + + out << " "; + if (!EmitBinaryOp(out, stmt->op)) { + return false; + } + out << "= "; + + if (!EmitExpression(out, stmt->rhs)) { + return false; + } + + out << ";"; + + return true; +} + bool GeneratorImpl::EmitContinue(const ast::ContinueStatement*) { line() << "continue;"; return true; diff --git a/src/tint/writer/wgsl/generator_impl.h b/src/tint/writer/wgsl/generator_impl.h index c5b4a87938..86faf884d8 100644 --- a/src/tint/writer/wgsl/generator_impl.h +++ b/src/tint/writer/wgsl/generator_impl.h @@ -21,6 +21,7 @@ #include "src/tint/ast/binary_expression.h" #include "src/tint/ast/bitcast_expression.h" #include "src/tint/ast/break_statement.h" +#include "src/tint/ast/compound_assignment_statement.h" #include "src/tint/ast/continue_statement.h" #include "src/tint/ast/discard_statement.h" #include "src/tint/ast/fallthrough_statement.h" @@ -72,6 +73,11 @@ class GeneratorImpl : public TextGenerator { /// @param expr the binary expression /// @returns true if the expression was emitted, false otherwise bool EmitBinary(std::ostream& out, const ast::BinaryExpression* expr); + /// Handles generating a binary operator + /// @param out the output of the expression stream + /// @param op the binary operator + /// @returns true if the operator was emitted, false otherwise + bool EmitBinaryOp(std::ostream& out, const ast::BinaryOp op); /// Handles generating a bitcast expression /// @param out the output of the expression stream /// @param expr the bitcast expression @@ -94,6 +100,10 @@ class GeneratorImpl : public TextGenerator { /// @param stmt the statement /// @returns true if the statment was emitted successfully bool EmitCase(const ast::CaseStatement* stmt); + /// Handles a compound assignment statement + /// @param stmt the statement to emit + /// @returns true if the statement was emitted successfully + bool EmitCompoundAssign(const ast::CompoundAssignmentStatement* stmt); /// Handles generating a literal expression /// @param out the output of the expression stream /// @param expr the literal expression expression diff --git a/test/tint/statements/compound_assign/complex_lhs.wgsl b/test/tint/statements/compound_assign/complex_lhs.wgsl new file mode 100644 index 0000000000..9141b86108 --- /dev/null +++ b/test/tint/statements/compound_assign/complex_lhs.wgsl @@ -0,0 +1,20 @@ +struct S { + a : array, 4>, +} + +var counter : i32; +fn foo() -> i32 { + counter += 1; + return counter; +} +fn bar() -> i32 { + counter += 2; + return counter; +} + +fn main() { + var x = S(); + let p = &x; + // foo() and bar() should only be called once each. + (*p).a[foo()][bar()] += 5; +} diff --git a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.glsl b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.glsl new file mode 100644 index 0000000000..7ba50af8a5 --- /dev/null +++ b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.glsl @@ -0,0 +1,26 @@ +SKIP: FAILED + + +struct S { + a : array, 4>, +} + +var counter : i32; + +fn foo() -> i32 { + counter += 1; + return counter; +} + +fn bar() -> i32 { + counter += 2; + return counter; +} + +fn main() { + var x = S(); + let p = &(x); + (*(p)).a[foo()][bar()] += 5; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.hlsl b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.hlsl new file mode 100644 index 0000000000..7ba50af8a5 --- /dev/null +++ b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.hlsl @@ -0,0 +1,26 @@ +SKIP: FAILED + + +struct S { + a : array, 4>, +} + +var counter : i32; + +fn foo() -> i32 { + counter += 1; + return counter; +} + +fn bar() -> i32 { + counter += 2; + return counter; +} + +fn main() { + var x = S(); + let p = &(x); + (*(p)).a[foo()][bar()] += 5; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.msl b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.msl new file mode 100644 index 0000000000..c7986ec1b4 --- /dev/null +++ b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.msl @@ -0,0 +1,26 @@ +SKIP: FAILED + + +struct S { + a : array, 4>, +} + +var counter : i32; + +fn foo() -> i32 { + counter += 1; + return counter; +} + +fn bar() -> i32 { + counter += 2; + return counter; +} + +fn tint_symbol() { + var x = S(); + let p = &(x); + (*(p)).a[foo()][bar()] += 5; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.spvasm b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.spvasm new file mode 100644 index 0000000000..32462a3f72 --- /dev/null +++ b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.spvasm @@ -0,0 +1,26 @@ +SKIP: FAILED + + +struct S { + a : array, 4>, +} + +var counter : i32; + +fn foo() -> i32 { + counter += 1; + return counter; +} + +fn bar() -> i32 { + counter += 2; + return counter; +} + +fn main() { + var x = S(); + let p = &(x); + (*(p)).a[foo()][bar()] += 5; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.wgsl b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.wgsl new file mode 100644 index 0000000000..4d16e27053 --- /dev/null +++ b/test/tint/statements/compound_assign/complex_lhs.wgsl.expected.wgsl @@ -0,0 +1,21 @@ +struct S { + a : array, 4>, +} + +var counter : i32; + +fn foo() -> i32 { + counter += 1; + return counter; +} + +fn bar() -> i32 { + counter += 2; + return counter; +} + +fn main() { + var x = S(); + let p = &(x); + (*(p)).a[foo()][bar()] += 5; +} diff --git a/test/tint/statements/compound_assign/divide_by_zero.wgsl b/test/tint/statements/compound_assign/divide_by_zero.wgsl new file mode 100644 index 0000000000..7ff3454342 --- /dev/null +++ b/test/tint/statements/compound_assign/divide_by_zero.wgsl @@ -0,0 +1,14 @@ +var a : i32; +var b : f32; + +fn foo(maybe_zero : i32) { + a /= 0; + a %= 0; + a /= maybe_zero; + a %= maybe_zero; + + b /= 0.0; + b %= 0.0; + b /= f32(maybe_zero); + b %= f32(maybe_zero); +} diff --git a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.glsl b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.glsl new file mode 100644 index 0000000000..eeec903df7 --- /dev/null +++ b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.glsl @@ -0,0 +1,19 @@ +SKIP: FAILED + + +var a : i32; + +var b : f32; + +fn foo(maybe_zero : i32) { + a /= 0; + a %= 0; + a /= maybe_zero; + a %= maybe_zero; + b /= 0.0; + b %= 0.0; + b /= f32(maybe_zero); + b %= f32(maybe_zero); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.hlsl b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.hlsl new file mode 100644 index 0000000000..eeec903df7 --- /dev/null +++ b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.hlsl @@ -0,0 +1,19 @@ +SKIP: FAILED + + +var a : i32; + +var b : f32; + +fn foo(maybe_zero : i32) { + a /= 0; + a %= 0; + a /= maybe_zero; + a %= maybe_zero; + b /= 0.0; + b %= 0.0; + b /= f32(maybe_zero); + b %= f32(maybe_zero); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.msl b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.msl new file mode 100644 index 0000000000..eeec903df7 --- /dev/null +++ b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.msl @@ -0,0 +1,19 @@ +SKIP: FAILED + + +var a : i32; + +var b : f32; + +fn foo(maybe_zero : i32) { + a /= 0; + a %= 0; + a /= maybe_zero; + a %= maybe_zero; + b /= 0.0; + b %= 0.0; + b /= f32(maybe_zero); + b %= f32(maybe_zero); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.spvasm b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.spvasm new file mode 100644 index 0000000000..13980b3e4a --- /dev/null +++ b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.spvasm @@ -0,0 +1,19 @@ +SKIP: FAILED + + +var a : i32; + +var b : f32; + +fn foo(maybe_zero : i32) { + a /= 0; + a %= 0; + a /= maybe_zero; + a %= maybe_zero; + b /= 0.0; + b %= 0.0; + b /= f32(maybe_zero); + b %= f32(maybe_zero); +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.wgsl b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.wgsl new file mode 100644 index 0000000000..6a6bc58cda --- /dev/null +++ b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.wgsl @@ -0,0 +1,14 @@ +var a : i32; + +var b : f32; + +fn foo(maybe_zero : i32) { + a /= 0; + a %= 0; + a /= maybe_zero; + a %= maybe_zero; + b /= 0.0; + b %= 0.0; + b /= f32(maybe_zero); + b %= f32(maybe_zero); +} diff --git a/test/tint/statements/compound_assign/for_loop.wgsl b/test/tint/statements/compound_assign/for_loop.wgsl new file mode 100644 index 0000000000..6f9d76110c --- /dev/null +++ b/test/tint/statements/compound_assign/for_loop.wgsl @@ -0,0 +1,31 @@ +struct S { + a : i32, + b : vec4, + c : mat2x2, +} +@group(0) @binding(0) +var v : S; + +var i : u32; + +fn idx1() -> i32 { + i += 1u; + return 1; +} + +fn idx2() -> i32 { + i += 2u; + return 1; +} + +fn idx3() -> i32 { + i += 3u; + return 1; +} + +fn foo() { + var a = array(); + // Make sure that the functions are only evaluated once each. + for (a[idx1()] *= 2.0; a[idx2()] < 10.0; a[idx3()] += 1.0) { + } +} diff --git a/test/tint/statements/compound_assign/for_loop.wgsl.expected.glsl b/test/tint/statements/compound_assign/for_loop.wgsl.expected.glsl new file mode 100644 index 0000000000..2903ab7e52 --- /dev/null +++ b/test/tint/statements/compound_assign/for_loop.wgsl.expected.glsl @@ -0,0 +1,35 @@ +SKIP: FAILED + + +struct S { + a : i32, + b : vec4, + c : mat2x2, +} + +@group(0) @binding(0) var v : S; + +var i : u32; + +fn idx1() -> i32 { + i += 1u; + return 1; +} + +fn idx2() -> i32 { + i += 2u; + return 1; +} + +fn idx3() -> i32 { + i += 3u; + return 1; +} + +fn foo() { + var a = array(); + for(a[idx1()] *= 2.0; (a[idx2()] < 10.0); a[idx3()] += 1.0) { + } +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/for_loop.wgsl.expected.hlsl b/test/tint/statements/compound_assign/for_loop.wgsl.expected.hlsl new file mode 100644 index 0000000000..2903ab7e52 --- /dev/null +++ b/test/tint/statements/compound_assign/for_loop.wgsl.expected.hlsl @@ -0,0 +1,35 @@ +SKIP: FAILED + + +struct S { + a : i32, + b : vec4, + c : mat2x2, +} + +@group(0) @binding(0) var v : S; + +var i : u32; + +fn idx1() -> i32 { + i += 1u; + return 1; +} + +fn idx2() -> i32 { + i += 2u; + return 1; +} + +fn idx3() -> i32 { + i += 3u; + return 1; +} + +fn foo() { + var a = array(); + for(a[idx1()] *= 2.0; (a[idx2()] < 10.0); a[idx3()] += 1.0) { + } +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/for_loop.wgsl.expected.msl b/test/tint/statements/compound_assign/for_loop.wgsl.expected.msl new file mode 100644 index 0000000000..2903ab7e52 --- /dev/null +++ b/test/tint/statements/compound_assign/for_loop.wgsl.expected.msl @@ -0,0 +1,35 @@ +SKIP: FAILED + + +struct S { + a : i32, + b : vec4, + c : mat2x2, +} + +@group(0) @binding(0) var v : S; + +var i : u32; + +fn idx1() -> i32 { + i += 1u; + return 1; +} + +fn idx2() -> i32 { + i += 2u; + return 1; +} + +fn idx3() -> i32 { + i += 3u; + return 1; +} + +fn foo() { + var a = array(); + for(a[idx1()] *= 2.0; (a[idx2()] < 10.0); a[idx3()] += 1.0) { + } +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/for_loop.wgsl.expected.spvasm b/test/tint/statements/compound_assign/for_loop.wgsl.expected.spvasm new file mode 100644 index 0000000000..7c8a0de36a --- /dev/null +++ b/test/tint/statements/compound_assign/for_loop.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +SKIP: FAILED + + +struct S { + a : i32, + b : vec4, + c : mat2x2, +} + +@group(0) @binding(0) var v : S; + +var i : u32; + +fn idx1() -> i32 { + i += 1u; + return 1; +} + +fn idx2() -> i32 { + i += 2u; + return 1; +} + +fn idx3() -> i32 { + i += 3u; + return 1; +} + +fn foo() { + var a = array(); + for(a[idx1()] *= 2.0; (a[idx2()] < 10.0); a[idx3()] += 1.0) { + } +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/for_loop.wgsl.expected.wgsl b/test/tint/statements/compound_assign/for_loop.wgsl.expected.wgsl new file mode 100644 index 0000000000..64ce28ae48 --- /dev/null +++ b/test/tint/statements/compound_assign/for_loop.wgsl.expected.wgsl @@ -0,0 +1,30 @@ +struct S { + a : i32, + b : vec4, + c : mat2x2, +} + +@group(0) @binding(0) var v : S; + +var i : u32; + +fn idx1() -> i32 { + i += 1u; + return 1; +} + +fn idx2() -> i32 { + i += 2u; + return 1; +} + +fn idx3() -> i32 { + i += 3u; + return 1; +} + +fn foo() { + var a = array(); + for(a[idx1()] *= 2.0; (a[idx2()] < 10.0); a[idx3()] += 1.0) { + } +} diff --git a/test/tint/statements/compound_assign/function.wgsl b/test/tint/statements/compound_assign/function.wgsl new file mode 100644 index 0000000000..158821ea14 --- /dev/null +++ b/test/tint/statements/compound_assign/function.wgsl @@ -0,0 +1,9 @@ + +fn foo() { + var a : i32; + var b : vec4; + var c : mat2x2; + a /= 2; + b *= mat4x4(); + c *= 2.0; +} diff --git a/test/tint/statements/compound_assign/function.wgsl.expected.glsl b/test/tint/statements/compound_assign/function.wgsl.expected.glsl new file mode 100644 index 0000000000..1d0e27ad68 --- /dev/null +++ b/test/tint/statements/compound_assign/function.wgsl.expected.glsl @@ -0,0 +1,13 @@ +SKIP: FAILED + + +fn foo() { + var a : i32; + var b : vec4; + var c : mat2x2; + a /= 2; + b *= mat4x4(); + c *= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/function.wgsl.expected.hlsl b/test/tint/statements/compound_assign/function.wgsl.expected.hlsl new file mode 100644 index 0000000000..1d0e27ad68 --- /dev/null +++ b/test/tint/statements/compound_assign/function.wgsl.expected.hlsl @@ -0,0 +1,13 @@ +SKIP: FAILED + + +fn foo() { + var a : i32; + var b : vec4; + var c : mat2x2; + a /= 2; + b *= mat4x4(); + c *= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/function.wgsl.expected.msl b/test/tint/statements/compound_assign/function.wgsl.expected.msl new file mode 100644 index 0000000000..1d0e27ad68 --- /dev/null +++ b/test/tint/statements/compound_assign/function.wgsl.expected.msl @@ -0,0 +1,13 @@ +SKIP: FAILED + + +fn foo() { + var a : i32; + var b : vec4; + var c : mat2x2; + a /= 2; + b *= mat4x4(); + c *= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/function.wgsl.expected.spvasm b/test/tint/statements/compound_assign/function.wgsl.expected.spvasm new file mode 100644 index 0000000000..231a8b39fe --- /dev/null +++ b/test/tint/statements/compound_assign/function.wgsl.expected.spvasm @@ -0,0 +1,13 @@ +SKIP: FAILED + + +fn foo() { + var a : i32; + var b : vec4; + var c : mat2x2; + a /= 2; + b *= mat4x4(); + c *= 2.0; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/function.wgsl.expected.wgsl b/test/tint/statements/compound_assign/function.wgsl.expected.wgsl new file mode 100644 index 0000000000..5722de35a8 --- /dev/null +++ b/test/tint/statements/compound_assign/function.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +fn foo() { + var a : i32; + var b : vec4; + var c : mat2x2; + a /= 2; + b *= mat4x4(); + c *= 2.0; +} diff --git a/test/tint/statements/compound_assign/matrix/minus.wgsl b/test/tint/statements/compound_assign/matrix/minus.wgsl new file mode 100644 index 0000000000..a793cada79 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/minus.wgsl @@ -0,0 +1,9 @@ +struct S { + a : mat4x4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a -= mat4x4(); +} diff --git a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.glsl b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.glsl new file mode 100644 index 0000000000..cbd50f80c2 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= mat4x4(); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.hlsl b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.hlsl new file mode 100644 index 0000000000..12462f08f4 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= mat4x4(); +} + +Failed to generate: error: cannot assign to value of type 'mat4x4' diff --git a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.msl b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.msl new file mode 100644 index 0000000000..cbd50f80c2 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= mat4x4(); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.spvasm b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.spvasm new file mode 100644 index 0000000000..6f439ad1b0 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= mat4x4(); +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.wgsl b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.wgsl new file mode 100644 index 0000000000..f0aff222fe --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/minus.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= mat4x4(); +} diff --git a/test/tint/statements/compound_assign/matrix/plus.wgsl b/test/tint/statements/compound_assign/matrix/plus.wgsl new file mode 100644 index 0000000000..9a4501c005 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/plus.wgsl @@ -0,0 +1,9 @@ +struct S { + a : mat4x4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a += mat4x4(); +} diff --git a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.glsl b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.glsl new file mode 100644 index 0000000000..8b7df003dd --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += mat4x4(); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.hlsl b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.hlsl new file mode 100644 index 0000000000..f227f3c83f --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += mat4x4(); +} + +Failed to generate: error: cannot assign to value of type 'mat4x4' diff --git a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.msl b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.msl new file mode 100644 index 0000000000..8b7df003dd --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += mat4x4(); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.spvasm b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.spvasm new file mode 100644 index 0000000000..046e3b9a89 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += mat4x4(); +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.wgsl b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.wgsl new file mode 100644 index 0000000000..29e991a33f --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/plus.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += mat4x4(); +} diff --git a/test/tint/statements/compound_assign/matrix/times-scalar.wgsl b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl new file mode 100644 index 0000000000..742cd8d97f --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl @@ -0,0 +1,9 @@ +struct S { + a : mat4x4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a *= 2.0; +} diff --git a/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.glsl b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.glsl new file mode 100644 index 0000000000..ba8ec90aa3 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.hlsl b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.hlsl new file mode 100644 index 0000000000..ed559f76c8 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= 2.0; +} + +Failed to generate: error: cannot assign to value of type 'mat4x4' diff --git a/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.msl b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.msl new file mode 100644 index 0000000000..ba8ec90aa3 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.spvasm b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.spvasm new file mode 100644 index 0000000000..79a3b00047 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= 2.0; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.wgsl b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.wgsl new file mode 100644 index 0000000000..9102d6ccfb --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/times-scalar.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= 2.0; +} diff --git a/test/tint/statements/compound_assign/matrix/times.wgsl b/test/tint/statements/compound_assign/matrix/times.wgsl new file mode 100644 index 0000000000..a9502ceb43 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/times.wgsl @@ -0,0 +1,9 @@ +struct S { + a : mat4x4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a *= mat4x4(); +} diff --git a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.glsl b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.glsl new file mode 100644 index 0000000000..ce02b882ac --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= mat4x4(); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.hlsl b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.hlsl new file mode 100644 index 0000000000..6132eae7bb --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= mat4x4(); +} + +Failed to generate: error: cannot assign to value of type 'mat4x4' diff --git a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.msl b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.msl new file mode 100644 index 0000000000..ce02b882ac --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= mat4x4(); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.spvasm b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7f54479c9 --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= mat4x4(); +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/matrix/times.wgsl.expected.wgsl b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.wgsl new file mode 100644 index 0000000000..2c604e9d4a --- /dev/null +++ b/test/tint/statements/compound_assign/matrix/times.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : mat4x4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= mat4x4(); +} diff --git a/test/tint/statements/compound_assign/private.wgsl b/test/tint/statements/compound_assign/private.wgsl new file mode 100644 index 0000000000..b64c92da8e --- /dev/null +++ b/test/tint/statements/compound_assign/private.wgsl @@ -0,0 +1,9 @@ +var a : i32; +var b : vec4; +var c : mat2x2; + +fn foo() { + a /= 2; + b *= mat4x4(); + c *= 2.0; +} diff --git a/test/tint/statements/compound_assign/private.wgsl.expected.glsl b/test/tint/statements/compound_assign/private.wgsl.expected.glsl new file mode 100644 index 0000000000..c655dcf954 --- /dev/null +++ b/test/tint/statements/compound_assign/private.wgsl.expected.glsl @@ -0,0 +1,16 @@ +SKIP: FAILED + + +var a : i32; + +var b : vec4; + +var c : mat2x2; + +fn foo() { + a /= 2; + b *= mat4x4(); + c *= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/private.wgsl.expected.hlsl b/test/tint/statements/compound_assign/private.wgsl.expected.hlsl new file mode 100644 index 0000000000..c655dcf954 --- /dev/null +++ b/test/tint/statements/compound_assign/private.wgsl.expected.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + + +var a : i32; + +var b : vec4; + +var c : mat2x2; + +fn foo() { + a /= 2; + b *= mat4x4(); + c *= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/private.wgsl.expected.msl b/test/tint/statements/compound_assign/private.wgsl.expected.msl new file mode 100644 index 0000000000..c655dcf954 --- /dev/null +++ b/test/tint/statements/compound_assign/private.wgsl.expected.msl @@ -0,0 +1,16 @@ +SKIP: FAILED + + +var a : i32; + +var b : vec4; + +var c : mat2x2; + +fn foo() { + a /= 2; + b *= mat4x4(); + c *= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/private.wgsl.expected.spvasm b/test/tint/statements/compound_assign/private.wgsl.expected.spvasm new file mode 100644 index 0000000000..8166138b65 --- /dev/null +++ b/test/tint/statements/compound_assign/private.wgsl.expected.spvasm @@ -0,0 +1,16 @@ +SKIP: FAILED + + +var a : i32; + +var b : vec4; + +var c : mat2x2; + +fn foo() { + a /= 2; + b *= mat4x4(); + c *= 2.0; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/private.wgsl.expected.wgsl b/test/tint/statements/compound_assign/private.wgsl.expected.wgsl new file mode 100644 index 0000000000..3aaa852924 --- /dev/null +++ b/test/tint/statements/compound_assign/private.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var a : i32; + +var b : vec4; + +var c : mat2x2; + +fn foo() { + a /= 2; + b *= mat4x4(); + c *= 2.0; +} diff --git a/test/tint/statements/compound_assign/scalar/and.wgsl b/test/tint/statements/compound_assign/scalar/and.wgsl new file mode 100644 index 0000000000..41c467d3f2 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/and.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a &= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/and.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.glsl new file mode 100644 index 0000000000..91e8f530a9 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a &= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/and.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.hlsl new file mode 100644 index 0000000000..f0ed522b07 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a &= 2; +} + +Failed to generate: error: cannot assign to value of type 'i32' diff --git a/test/tint/statements/compound_assign/scalar/and.wgsl.expected.msl b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.msl new file mode 100644 index 0000000000..91e8f530a9 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a &= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/and.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.spvasm new file mode 100644 index 0000000000..b5bbca9e9f --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a &= 2; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/and.wgsl.expected.wgsl b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.wgsl new file mode 100644 index 0000000000..82e9631cb6 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/and.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a &= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl b/test/tint/statements/compound_assign/scalar/divide.wgsl new file mode 100644 index 0000000000..9a26e28f9f --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/divide.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a /= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl new file mode 100644 index 0000000000..d60ac98868 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a /= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.hlsl new file mode 100644 index 0000000000..6ceb4c326c --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a /= 2; +} + +Failed to generate: error: cannot assign to value of type 'i32' diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.msl b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.msl new file mode 100644 index 0000000000..d60ac98868 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a /= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.spvasm new file mode 100644 index 0000000000..d1cbd51114 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a /= 2; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.wgsl b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.wgsl new file mode 100644 index 0000000000..1b6df05707 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a /= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/minus.wgsl b/test/tint/statements/compound_assign/scalar/minus.wgsl new file mode 100644 index 0000000000..5799ba7270 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/minus.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a -= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.glsl new file mode 100644 index 0000000000..e091f6cd33 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.hlsl new file mode 100644 index 0000000000..f878485319 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= 2; +} + +Failed to generate: error: cannot assign to value of type 'i32' diff --git a/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.msl b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.msl new file mode 100644 index 0000000000..e091f6cd33 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.spvasm new file mode 100644 index 0000000000..9cafcb93c7 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= 2; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.wgsl b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.wgsl new file mode 100644 index 0000000000..dfd4402313 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/minus.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl b/test/tint/statements/compound_assign/scalar/modulo.wgsl new file mode 100644 index 0000000000..11e5cab8c7 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a %= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl new file mode 100644 index 0000000000..4d04799d26 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a %= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.hlsl new file mode 100644 index 0000000000..24d87bda10 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a %= 2; +} + +Failed to generate: error: cannot assign to value of type 'i32' diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.msl b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.msl new file mode 100644 index 0000000000..4d04799d26 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a %= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.spvasm new file mode 100644 index 0000000000..40d64ce25d --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a %= 2; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.wgsl b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.wgsl new file mode 100644 index 0000000000..57e5fad2c7 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a %= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/or.wgsl b/test/tint/statements/compound_assign/scalar/or.wgsl new file mode 100644 index 0000000000..f6e3a19bb9 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/or.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a |= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/or.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.glsl new file mode 100644 index 0000000000..eab9b3b56e --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a |= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/or.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.hlsl new file mode 100644 index 0000000000..15ce0f2fda --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a |= 2; +} + +Failed to generate: error: cannot assign to value of type 'i32' diff --git a/test/tint/statements/compound_assign/scalar/or.wgsl.expected.msl b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.msl new file mode 100644 index 0000000000..eab9b3b56e --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a |= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/or.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.spvasm new file mode 100644 index 0000000000..573dbf1803 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a |= 2; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/or.wgsl.expected.wgsl b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.wgsl new file mode 100644 index 0000000000..e6cbd2c9c4 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/or.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a |= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/plus.wgsl b/test/tint/statements/compound_assign/scalar/plus.wgsl new file mode 100644 index 0000000000..fa04f62cd4 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/plus.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a += 2; +} diff --git a/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.glsl new file mode 100644 index 0000000000..614eba8ae2 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.hlsl new file mode 100644 index 0000000000..c8629d3fe2 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += 2; +} + +Failed to generate: error: cannot assign to value of type 'i32' diff --git a/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.msl b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.msl new file mode 100644 index 0000000000..614eba8ae2 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.spvasm new file mode 100644 index 0000000000..5ff170056f --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += 2; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.wgsl b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.wgsl new file mode 100644 index 0000000000..e2620d36b2 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/plus.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += 2; +} diff --git a/test/tint/statements/compound_assign/scalar/times.wgsl b/test/tint/statements/compound_assign/scalar/times.wgsl new file mode 100644 index 0000000000..c296b7d633 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/times.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a *= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/times.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.glsl new file mode 100644 index 0000000000..fb265ff19f --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/times.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.hlsl new file mode 100644 index 0000000000..136c564775 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= 2; +} + +Failed to generate: error: cannot assign to value of type 'i32' diff --git a/test/tint/statements/compound_assign/scalar/times.wgsl.expected.msl b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.msl new file mode 100644 index 0000000000..fb265ff19f --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/times.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.spvasm new file mode 100644 index 0000000000..c4bf38af9d --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= 2; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/times.wgsl.expected.wgsl b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.wgsl new file mode 100644 index 0000000000..2889144963 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/times.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/xor.wgsl b/test/tint/statements/compound_assign/scalar/xor.wgsl new file mode 100644 index 0000000000..2d672066e1 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/xor.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a ^= 2; +} diff --git a/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.glsl new file mode 100644 index 0000000000..41134280eb --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a ^= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.hlsl b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.hlsl new file mode 100644 index 0000000000..7a8bb45515 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a ^= 2; +} + +Failed to generate: error: cannot assign to value of type 'i32' diff --git a/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.msl b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.msl new file mode 100644 index 0000000000..41134280eb --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a ^= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.spvasm new file mode 100644 index 0000000000..43c47127f4 --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a ^= 2; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.wgsl b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.wgsl new file mode 100644 index 0000000000..455b40e46e --- /dev/null +++ b/test/tint/statements/compound_assign/scalar/xor.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : i32, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a ^= 2; +} diff --git a/test/tint/statements/compound_assign/vector/and.wgsl b/test/tint/statements/compound_assign/vector/and.wgsl new file mode 100644 index 0000000000..3dd51ca1f1 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/and.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a &= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/and.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/and.wgsl.expected.glsl new file mode 100644 index 0000000000..61074a2605 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/and.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a &= vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/and.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/and.wgsl.expected.hlsl new file mode 100644 index 0000000000..fb13cb3205 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/and.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a &= vec4(2); +} + +Failed to generate: error: cannot assign to value of type 'vec4' diff --git a/test/tint/statements/compound_assign/vector/and.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/and.wgsl.expected.msl new file mode 100644 index 0000000000..61074a2605 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/and.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a &= vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/and.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/and.wgsl.expected.spvasm new file mode 100644 index 0000000000..302714331c --- /dev/null +++ b/test/tint/statements/compound_assign/vector/and.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a &= vec4(2); +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/and.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/and.wgsl.expected.wgsl new file mode 100644 index 0000000000..3ab8d96518 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/and.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a &= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/divide-scalar.wgsl b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl new file mode 100644 index 0000000000..6795928048 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a /= 2.0; +} diff --git a/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.glsl new file mode 100644 index 0000000000..1d24582d57 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a /= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.hlsl new file mode 100644 index 0000000000..082db5570e --- /dev/null +++ b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a /= 2.0; +} + +Failed to generate: error: cannot assign to value of type 'vec4' diff --git a/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.msl new file mode 100644 index 0000000000..1d24582d57 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a /= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.spvasm new file mode 100644 index 0000000000..3a337b8a06 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a /= 2.0; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.wgsl new file mode 100644 index 0000000000..1fc9cced35 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/divide-scalar.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a /= 2.0; +} diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl b/test/tint/statements/compound_assign/vector/divide.wgsl new file mode 100644 index 0000000000..8126309286 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/divide.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a /= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl new file mode 100644 index 0000000000..817a93cabf --- /dev/null +++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a /= vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.hlsl new file mode 100644 index 0000000000..309e2f9ca9 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a /= vec4(2); +} + +Failed to generate: error: cannot assign to value of type 'vec4' diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.msl new file mode 100644 index 0000000000..817a93cabf --- /dev/null +++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a /= vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.spvasm new file mode 100644 index 0000000000..3843576d4e --- /dev/null +++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a /= vec4(2); +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.wgsl new file mode 100644 index 0000000000..b164cdad7a --- /dev/null +++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a /= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/minus-scalar.wgsl b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl new file mode 100644 index 0000000000..ed8526d45d --- /dev/null +++ b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a -= 2.0; +} diff --git a/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.glsl new file mode 100644 index 0000000000..d8d8f2c68d --- /dev/null +++ b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.hlsl new file mode 100644 index 0000000000..5cd4dbc1cf --- /dev/null +++ b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= 2.0; +} + +Failed to generate: error: cannot assign to value of type 'vec4' diff --git a/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.msl new file mode 100644 index 0000000000..d8d8f2c68d --- /dev/null +++ b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.spvasm new file mode 100644 index 0000000000..6fe6c15f52 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= 2.0; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.wgsl new file mode 100644 index 0000000000..979de2e109 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/minus-scalar.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= 2.0; +} diff --git a/test/tint/statements/compound_assign/vector/minus.wgsl b/test/tint/statements/compound_assign/vector/minus.wgsl new file mode 100644 index 0000000000..c0fe1ee114 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/minus.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a -= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/minus.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.glsl new file mode 100644 index 0000000000..ae94d7f98d --- /dev/null +++ b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/minus.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.hlsl new file mode 100644 index 0000000000..6eab7f8584 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= vec4(2); +} + +Failed to generate: error: cannot assign to value of type 'vec4' diff --git a/test/tint/statements/compound_assign/vector/minus.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.msl new file mode 100644 index 0000000000..ae94d7f98d --- /dev/null +++ b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/minus.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.spvasm new file mode 100644 index 0000000000..fa2bc43198 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= vec4(2); +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/minus.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.wgsl new file mode 100644 index 0000000000..3e0fec946d --- /dev/null +++ b/test/tint/statements/compound_assign/vector/minus.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a -= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl new file mode 100644 index 0000000000..0291d9d437 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a %= 2; +} diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl new file mode 100644 index 0000000000..c4ca6050d3 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a %= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.hlsl new file mode 100644 index 0000000000..4b030d514d --- /dev/null +++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a %= 2; +} + +Failed to generate: error: cannot assign to value of type 'vec4' diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.msl new file mode 100644 index 0000000000..c4ca6050d3 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a %= 2; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.spvasm new file mode 100644 index 0000000000..ea9d76d2b7 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a %= 2; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.wgsl new file mode 100644 index 0000000000..8c5e4aaa61 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a %= 2; +} diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl b/test/tint/statements/compound_assign/vector/modulo.wgsl new file mode 100644 index 0000000000..494919b253 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/modulo.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a %= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl new file mode 100644 index 0000000000..1574ee9505 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a %= vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.hlsl new file mode 100644 index 0000000000..076b36f2b8 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a %= vec4(2); +} + +Failed to generate: error: cannot assign to value of type 'vec4' diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.msl new file mode 100644 index 0000000000..1574ee9505 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a %= vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.spvasm new file mode 100644 index 0000000000..5286c69bc0 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a %= vec4(2); +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.wgsl new file mode 100644 index 0000000000..285ed31662 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a %= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/or.wgsl b/test/tint/statements/compound_assign/vector/or.wgsl new file mode 100644 index 0000000000..6e691eb6ae --- /dev/null +++ b/test/tint/statements/compound_assign/vector/or.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a |= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/or.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/or.wgsl.expected.glsl new file mode 100644 index 0000000000..95ac3ab93c --- /dev/null +++ b/test/tint/statements/compound_assign/vector/or.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a |= vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/or.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/or.wgsl.expected.hlsl new file mode 100644 index 0000000000..1b844da394 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/or.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a |= vec4(2); +} + +Failed to generate: error: cannot assign to value of type 'vec4' diff --git a/test/tint/statements/compound_assign/vector/or.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/or.wgsl.expected.msl new file mode 100644 index 0000000000..95ac3ab93c --- /dev/null +++ b/test/tint/statements/compound_assign/vector/or.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a |= vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/or.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/or.wgsl.expected.spvasm new file mode 100644 index 0000000000..62bc8a65a0 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/or.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a |= vec4(2); +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/or.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/or.wgsl.expected.wgsl new file mode 100644 index 0000000000..e81a11f7fc --- /dev/null +++ b/test/tint/statements/compound_assign/vector/or.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a |= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/plus-scalar.wgsl b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl new file mode 100644 index 0000000000..bc9894a95b --- /dev/null +++ b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a += 2.0; +} diff --git a/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.glsl new file mode 100644 index 0000000000..1d292d8e32 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.hlsl new file mode 100644 index 0000000000..a3cacaa8a2 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += 2.0; +} + +Failed to generate: error: cannot assign to value of type 'vec4' diff --git a/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.msl new file mode 100644 index 0000000000..1d292d8e32 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.spvasm new file mode 100644 index 0000000000..dba101e852 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += 2.0; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.wgsl new file mode 100644 index 0000000000..c3a2a5d840 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/plus-scalar.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += 2.0; +} diff --git a/test/tint/statements/compound_assign/vector/plus.wgsl b/test/tint/statements/compound_assign/vector/plus.wgsl new file mode 100644 index 0000000000..cc219d47f3 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/plus.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a += vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/plus.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.glsl new file mode 100644 index 0000000000..db5b5832e1 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/plus.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.hlsl new file mode 100644 index 0000000000..7405e1d1c8 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += vec4(2); +} + +Failed to generate: error: cannot assign to value of type 'vec4' diff --git a/test/tint/statements/compound_assign/vector/plus.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.msl new file mode 100644 index 0000000000..db5b5832e1 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/plus.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.spvasm new file mode 100644 index 0000000000..03bdb8c18c --- /dev/null +++ b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += vec4(2); +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/plus.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.wgsl new file mode 100644 index 0000000000..6688efecb4 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/plus.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a += vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/times-matrix.wgsl b/test/tint/statements/compound_assign/vector/times-matrix.wgsl new file mode 100644 index 0000000000..2048cdc1d6 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times-matrix.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a *= mat4x4(); +} diff --git a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.glsl new file mode 100644 index 0000000000..f9b30dd257 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= mat4x4(); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.hlsl new file mode 100644 index 0000000000..92704de3bc --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= mat4x4(); +} + +Failed to generate: error: cannot assign to value of type 'vec4' diff --git a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.msl new file mode 100644 index 0000000000..f9b30dd257 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= mat4x4(); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.spvasm new file mode 100644 index 0000000000..6a230617fa --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= mat4x4(); +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.wgsl new file mode 100644 index 0000000000..391148f144 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times-matrix.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= mat4x4(); +} diff --git a/test/tint/statements/compound_assign/vector/times-scalar.wgsl b/test/tint/statements/compound_assign/vector/times-scalar.wgsl new file mode 100644 index 0000000000..c6411e7678 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times-scalar.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a *= 2.0; +} diff --git a/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.glsl new file mode 100644 index 0000000000..eac3281b1a --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.hlsl new file mode 100644 index 0000000000..1e026cd4bb --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= 2.0; +} + +Failed to generate: error: cannot assign to value of type 'vec4' diff --git a/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.msl new file mode 100644 index 0000000000..eac3281b1a --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.spvasm new file mode 100644 index 0000000000..095e2b063e --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= 2.0; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.wgsl new file mode 100644 index 0000000000..b90b01caf4 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times-scalar.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= 2.0; +} diff --git a/test/tint/statements/compound_assign/vector/times.wgsl b/test/tint/statements/compound_assign/vector/times.wgsl new file mode 100644 index 0000000000..17dfb38dd4 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a *= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/times.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/times.wgsl.expected.glsl new file mode 100644 index 0000000000..a486a563ef --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/times.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/times.wgsl.expected.hlsl new file mode 100644 index 0000000000..31340f935f --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= vec4(2); +} + +Failed to generate: error: cannot assign to value of type 'vec4' diff --git a/test/tint/statements/compound_assign/vector/times.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/times.wgsl.expected.msl new file mode 100644 index 0000000000..a486a563ef --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/times.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/times.wgsl.expected.spvasm new file mode 100644 index 0000000000..a658717ecd --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= vec4(2); +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/times.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/times.wgsl.expected.wgsl new file mode 100644 index 0000000000..b100eaae52 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/times.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a *= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/xor.wgsl b/test/tint/statements/compound_assign/vector/xor.wgsl new file mode 100644 index 0000000000..ac60c7731e --- /dev/null +++ b/test/tint/statements/compound_assign/vector/xor.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} +@group(0) @binding(0) +var v : S; + +fn foo() { + v.a ^= vec4(2); +} diff --git a/test/tint/statements/compound_assign/vector/xor.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.glsl new file mode 100644 index 0000000000..2ce32772c0 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.glsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a ^= vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/xor.wgsl.expected.hlsl b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.hlsl new file mode 100644 index 0000000000..b325284076 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.hlsl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a ^= vec4(2); +} + +Failed to generate: error: cannot assign to value of type 'vec4' diff --git a/test/tint/statements/compound_assign/vector/xor.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.msl new file mode 100644 index 0000000000..2ce32772c0 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.msl @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a ^= vec4(2); +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/xor.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.spvasm new file mode 100644 index 0000000000..c2f83b7f15 --- /dev/null +++ b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.spvasm @@ -0,0 +1,14 @@ +SKIP: FAILED + + +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a ^= vec4(2); +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/vector/xor.wgsl.expected.wgsl b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.wgsl new file mode 100644 index 0000000000..d7e30f801e --- /dev/null +++ b/test/tint/statements/compound_assign/vector/xor.wgsl.expected.wgsl @@ -0,0 +1,9 @@ +struct S { + a : vec4, +} + +@group(0) @binding(0) var v : S; + +fn foo() { + v.a ^= vec4(2); +} diff --git a/test/tint/statements/compound_assign/workgroup.wgsl b/test/tint/statements/compound_assign/workgroup.wgsl new file mode 100644 index 0000000000..9df7c43c91 --- /dev/null +++ b/test/tint/statements/compound_assign/workgroup.wgsl @@ -0,0 +1,9 @@ +var a : i32; +var b : vec4; +var c : mat2x2; + +fn foo() { + a /= 2; + b *= mat4x4(); + c *= 2.0; +} diff --git a/test/tint/statements/compound_assign/workgroup.wgsl.expected.glsl b/test/tint/statements/compound_assign/workgroup.wgsl.expected.glsl new file mode 100644 index 0000000000..5cdf29f1d7 --- /dev/null +++ b/test/tint/statements/compound_assign/workgroup.wgsl.expected.glsl @@ -0,0 +1,16 @@ +SKIP: FAILED + + +var a : i32; + +var b : vec4; + +var c : mat2x2; + +fn foo() { + a /= 2; + b *= mat4x4(); + c *= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/workgroup.wgsl.expected.hlsl b/test/tint/statements/compound_assign/workgroup.wgsl.expected.hlsl new file mode 100644 index 0000000000..5cdf29f1d7 --- /dev/null +++ b/test/tint/statements/compound_assign/workgroup.wgsl.expected.hlsl @@ -0,0 +1,16 @@ +SKIP: FAILED + + +var a : i32; + +var b : vec4; + +var c : mat2x2; + +fn foo() { + a /= 2; + b *= mat4x4(); + c *= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/workgroup.wgsl.expected.msl b/test/tint/statements/compound_assign/workgroup.wgsl.expected.msl new file mode 100644 index 0000000000..5cdf29f1d7 --- /dev/null +++ b/test/tint/statements/compound_assign/workgroup.wgsl.expected.msl @@ -0,0 +1,16 @@ +SKIP: FAILED + + +var a : i32; + +var b : vec4; + +var c : mat2x2; + +fn foo() { + a /= 2; + b *= mat4x4(); + c *= 2.0; +} + +Failed to generate: error: unknown statement type: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/workgroup.wgsl.expected.spvasm b/test/tint/statements/compound_assign/workgroup.wgsl.expected.spvasm new file mode 100644 index 0000000000..f670d77e32 --- /dev/null +++ b/test/tint/statements/compound_assign/workgroup.wgsl.expected.spvasm @@ -0,0 +1,16 @@ +SKIP: FAILED + + +var a : i32; + +var b : vec4; + +var c : mat2x2; + +fn foo() { + a /= 2; + b *= mat4x4(); + c *= 2.0; +} + +Failed to generate: Unknown statement: tint::ast::CompoundAssignmentStatement diff --git a/test/tint/statements/compound_assign/workgroup.wgsl.expected.wgsl b/test/tint/statements/compound_assign/workgroup.wgsl.expected.wgsl new file mode 100644 index 0000000000..c6423d1f4b --- /dev/null +++ b/test/tint/statements/compound_assign/workgroup.wgsl.expected.wgsl @@ -0,0 +1,11 @@ +var a : i32; + +var b : vec4; + +var c : mat2x2; + +fn foo() { + a /= 2; + b *= mat4x4(); + c *= 2.0; +}