diff --git a/src/tint/BUILD.gn b/src/tint/BUILD.gn index dbe934c9b1..61bdea6977 100644 --- a/src/tint/BUILD.gn +++ b/src/tint/BUILD.gn @@ -547,6 +547,8 @@ libtint_source_set("libtint_core_all_src") { "transform/utils/hoist_to_decl_before.h", "transform/var_for_dynamic_index.cc", "transform/var_for_dynamic_index.h", + "transform/vectorize_matrix_conversions.cc", + "transform/vectorize_matrix_conversions.h", "transform/vectorize_scalar_matrix_constructors.cc", "transform/vectorize_scalar_matrix_constructors.h", "transform/vertex_pulling.cc", @@ -1219,6 +1221,7 @@ if (tint_build_unittests) { "transform/utils/get_insertion_point_test.cc", "transform/utils/hoist_to_decl_before_test.cc", "transform/var_for_dynamic_index_test.cc", + "transform/vectorize_matrix_conversions_test.cc", "transform/vectorize_scalar_matrix_constructors_test.cc", "transform/vertex_pulling_test.cc", "transform/while_to_loop_test.cc", diff --git a/src/tint/CMakeLists.txt b/src/tint/CMakeLists.txt index 87d6eb000f..62809ab6fc 100644 --- a/src/tint/CMakeLists.txt +++ b/src/tint/CMakeLists.txt @@ -459,6 +459,8 @@ set(TINT_LIB_SRCS transform/utils/hoist_to_decl_before.h transform/var_for_dynamic_index.cc transform/var_for_dynamic_index.h + transform/vectorize_matrix_conversions.cc + transform/vectorize_matrix_conversions.h transform/vectorize_scalar_matrix_constructors.cc transform/vectorize_scalar_matrix_constructors.h transform/vertex_pulling.cc @@ -1131,6 +1133,7 @@ if(TINT_BUILD_TESTS) transform/unshadow_test.cc transform/unwind_discard_functions_test.cc transform/var_for_dynamic_index_test.cc + transform/vectorize_matrix_conversions_test.cc transform/vectorize_scalar_matrix_constructors_test.cc transform/vertex_pulling_test.cc transform/while_to_loop_test.cc diff --git a/src/tint/transform/vectorize_matrix_conversions.cc b/src/tint/transform/vectorize_matrix_conversions.cc new file mode 100644 index 0000000000..576b8857df --- /dev/null +++ b/src/tint/transform/vectorize_matrix_conversions.cc @@ -0,0 +1,136 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/transform/vectorize_matrix_conversions.h" + +#include +#include +#include + +#include "src/tint/program_builder.h" +#include "src/tint/sem/abstract_numeric.h" +#include "src/tint/sem/call.h" +#include "src/tint/sem/expression.h" +#include "src/tint/sem/type_conversion.h" +#include "src/tint/utils/hash.h" +#include "src/tint/utils/map.h" + +TINT_INSTANTIATE_TYPEINFO(tint::transform::VectorizeMatrixConversions); + +namespace tint::transform { + +VectorizeMatrixConversions::VectorizeMatrixConversions() = default; + +VectorizeMatrixConversions::~VectorizeMatrixConversions() = default; + +bool VectorizeMatrixConversions::ShouldRun(const Program* program, const DataMap&) const { + for (auto* node : program->ASTNodes().Objects()) { + if (auto* sem = program->Sem().Get(node)) { + if (auto* call = sem->UnwrapMaterialize()->As()) { + if (call->Target()->Is() && call->Type()->Is()) { + auto& args = call->Arguments(); + if (args.Length() == 1 && args[0]->Type()->UnwrapRef()->is_float_matrix()) { + return true; + } + } + } + } + } + return false; +} + +void VectorizeMatrixConversions::Run(CloneContext& ctx, const DataMap&, DataMap&) const { + using HelperFunctionKey = + utils::UnorderedKeyWrapper>; + + std::unordered_map matrix_convs; + + ctx.ReplaceAll([&](const ast::CallExpression* expr) -> const ast::CallExpression* { + auto* call = ctx.src->Sem().Get(expr)->UnwrapMaterialize()->As(); + auto* ty_conv = call->Target()->As(); + if (!ty_conv) { + return nullptr; + } + auto* dst_type = call->Type()->As(); + if (!dst_type) { + return nullptr; + } + + auto& args = call->Arguments(); + if (args.Length() != 1) { + return nullptr; + } + + auto& src = args[0]; + + auto* src_type = args[0]->Type()->UnwrapRef()->As(); + if (!src_type) { + return nullptr; + } + + // The source and destination type of a matrix conversion must have a same shape. + if (!(src_type->rows() == dst_type->rows() && src_type->columns() == dst_type->columns())) { + TINT_ICE(Transform, ctx.dst->Diagnostics()) + << "source and destination matrix has different shape in matrix conversion"; + return nullptr; + } + + auto build_vectorized_conversion_expression = [&](auto&& src_expression_builder) { + utils::Vector columns; + for (uint32_t c = 0; c < dst_type->columns(); c++) { + auto* src_matrix_expr = src_expression_builder(); + auto* src_column_expr = + ctx.dst->IndexAccessor(src_matrix_expr, ctx.dst->Expr(tint::AInt(c))); + columns.Push(ctx.dst->Construct(CreateASTTypeFor(ctx, dst_type->ColumnType()), + src_column_expr)); + } + return ctx.dst->Construct(CreateASTTypeFor(ctx, dst_type), columns); + }; + + // Replace the matrix conversion to column vector conversions and a matrix construction. + if (!src->HasSideEffects()) { + // Simply use the argument's declaration if it has no side effects. + return build_vectorized_conversion_expression([&]() { // + return ctx.Clone(src->Declaration()); + }); + } else { + // If has side effects, use a helper function. + auto fn = + utils::GetOrCreate(matrix_convs, HelperFunctionKey{{src_type, dst_type}}, [&] { + auto name = + ctx.dst->Symbols().New("convert_mat" + std::to_string(src_type->columns()) + + "x" + std::to_string(src_type->rows()) + "_" + + ctx.dst->FriendlyName(src_type->type()) + "_" + + ctx.dst->FriendlyName(dst_type->type())); + ctx.dst->Func( + name, + utils::Vector{ + ctx.dst->Param("value", CreateASTTypeFor(ctx, src_type)), + }, + CreateASTTypeFor(ctx, dst_type), + utils::Vector{ + ctx.dst->Return(build_vectorized_conversion_expression([&]() { // + return ctx.dst->Expr("value"); + })), + }); + return name; + }); + return ctx.dst->Call(fn, ctx.Clone(args[0]->Declaration())); + } + }); + + ctx.Clone(); +} + +} // namespace tint::transform diff --git a/src/tint/transform/vectorize_matrix_conversions.h b/src/tint/transform/vectorize_matrix_conversions.h new file mode 100644 index 0000000000..f16467c3dc --- /dev/null +++ b/src/tint/transform/vectorize_matrix_conversions.h @@ -0,0 +1,48 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_TINT_TRANSFORM_VECTORIZE_MATRIX_CONVERSIONS_H_ +#define SRC_TINT_TRANSFORM_VECTORIZE_MATRIX_CONVERSIONS_H_ + +#include "src/tint/transform/transform.h" + +namespace tint::transform { + +/// A transform that converts matrix conversions (between f32 and f16 matrices) to the vector form. +class VectorizeMatrixConversions final : public Castable { + public: + /// Constructor + VectorizeMatrixConversions(); + + /// Destructor + ~VectorizeMatrixConversions() override; + + /// @param program the program to inspect + /// @param data optional extra transform-specific input data + /// @returns true if this transform should be run for the given program + bool ShouldRun(const Program* program, const DataMap& data = {}) const override; + + protected: + /// Runs the transform using the CloneContext built for transforming a + /// program. Run() is responsible for calling Clone() on the CloneContext. + /// @param ctx the CloneContext primed with the input program and + /// ProgramBuilder + /// @param inputs optional extra transform-specific input data + /// @param outputs optional extra transform-specific output data + void Run(CloneContext& ctx, const DataMap& inputs, DataMap& outputs) const override; +}; + +} // namespace tint::transform + +#endif // SRC_TINT_TRANSFORM_VECTORIZE_MATRIX_CONVERSIONS_H_ diff --git a/src/tint/transform/vectorize_matrix_conversions_test.cc b/src/tint/transform/vectorize_matrix_conversions_test.cc new file mode 100644 index 0000000000..8142b58b86 --- /dev/null +++ b/src/tint/transform/vectorize_matrix_conversions_test.cc @@ -0,0 +1,411 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "src/tint/transform/vectorize_matrix_conversions.h" + +#include +#include + +#include "src/tint/transform/test_helper.h" +#include "src/tint/utils/string.h" + +namespace tint::transform { +namespace { + +using VectorizeMatrixConversionsTest = TransformTestWithParam>; + +TEST_F(VectorizeMatrixConversionsTest, ShouldRunEmptyModule) { + auto* src = R"()"; + + EXPECT_FALSE(ShouldRun(src)); +} + +// Test that VectorizeMatrixConversions transforms the matRxC to matRxC conversion as +// expected. +// +// Example input: +// +// enable f16; +// +// @fragment +// fn main() { +// let m = mat3x2(vec2(0.0, 1.0), vec2(2.0, 3.0), vec2(4.0, 5.0)); +// let n : mat3x2 = mat3x2(m); +// } +// +// Example output: +// +// enable f16; +// +// @fragment +// fn main() { +// let m = mat3x2(vec2(0.0, 1.0), vec2(2.0, 3.0), vec2(4.0, 5.0)); +// let n : mat3x2 = mat3x2(vec2(m[0]), vec2(m[1]), vec2(m[2])); +// } +TEST_P(VectorizeMatrixConversionsTest, Conversion_F32ToF16) { + uint32_t cols = GetParam().first; + uint32_t rows = GetParam().second; + std::string src_mat_type = "mat" + std::to_string(cols) + "x" + std::to_string(rows) + ""; + std::string src_vec_type = "vec" + std::to_string(rows) + ""; + std::string dst_mat_type = "mat" + std::to_string(cols) + "x" + std::to_string(rows) + ""; + std::string dst_vec_type = "vec" + std::to_string(rows) + ""; + std::string vector_values; + for (uint32_t c = 0; c < cols; c++) { + if (c > 0) { + vector_values += ", "; + } + vector_values += src_vec_type + "("; + for (uint32_t r = 0; r < rows; r++) { + if (r > 0) { + vector_values += ", "; + } + auto value = std::to_string(c * rows + r) + ".0"; + vector_values += value; + } + vector_values += ")"; + } + + std::string vectorized_args = ""; + for (uint32_t c = 0; c < cols; c++) { + if (c > 0) { + vectorized_args += ", "; + } + vectorized_args += dst_vec_type + "(m[" + std::to_string(c) + "])"; + } + + std::string tmpl = R"( +enable f16; + +@fragment +fn main() { + let m = ${src_mat_type}(${values}); + let n : ${dst_mat_type} = ${dst_mat_type}(${args}); +} +)"; + tmpl = utils::ReplaceAll(tmpl, "${src_mat_type}", src_mat_type); + tmpl = utils::ReplaceAll(tmpl, "${dst_mat_type}", dst_mat_type); + tmpl = utils::ReplaceAll(tmpl, "${values}", vector_values); + auto src = utils::ReplaceAll(tmpl, "${args}", "m"); + auto expect = utils::ReplaceAll(tmpl, "${args}", vectorized_args); + + EXPECT_TRUE(ShouldRun(src)); + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +// Test that VectorizeMatrixConversions transforms the matRxC to matRxC conversion as +// expected. +// +// Example input: +// +// enable f16; +// +// @fragment +// fn main() { +// let m = mat3x2(vec2(0.0, 1.0), vec2(2.0, 3.0), vec2(4.0, 5.0)); +// let n : mat3x2 = mat3x2(m); +// } +// +// Example output: +// +// enable f16; +// +// @fragment +// fn main() { +// let m = mat3x2(vec2(0.0, 1.0), vec2(2.0, 3.0), vec2(4.0, 5.0)); +// let n : mat3x2 = mat3x2(vec2(m[0]), vec2(m[1]), vec2(m[2])); +// } +TEST_P(VectorizeMatrixConversionsTest, Conversion_F16ToF32) { + uint32_t cols = GetParam().first; + uint32_t rows = GetParam().second; + std::string src_mat_type = "mat" + std::to_string(cols) + "x" + std::to_string(rows) + ""; + std::string src_vec_type = "vec" + std::to_string(rows) + ""; + std::string dst_mat_type = "mat" + std::to_string(cols) + "x" + std::to_string(rows) + ""; + std::string dst_vec_type = "vec" + std::to_string(rows) + ""; + std::string vector_values; + for (uint32_t c = 0; c < cols; c++) { + if (c > 0) { + vector_values += ", "; + } + vector_values += src_vec_type + "("; + for (uint32_t r = 0; r < rows; r++) { + if (r > 0) { + vector_values += ", "; + } + auto value = std::to_string(c * rows + r) + ".0"; + vector_values += value; + } + vector_values += ")"; + } + + std::string vectorized_args = ""; + for (uint32_t c = 0; c < cols; c++) { + if (c > 0) { + vectorized_args += ", "; + } + vectorized_args += dst_vec_type + "(m[" + std::to_string(c) + "])"; + } + + std::string tmpl = R"( +enable f16; + +@fragment +fn main() { + let m = ${src_mat_type}(${values}); + let n : ${dst_mat_type} = ${dst_mat_type}(${args}); +} +)"; + tmpl = utils::ReplaceAll(tmpl, "${src_mat_type}", src_mat_type); + tmpl = utils::ReplaceAll(tmpl, "${dst_mat_type}", dst_mat_type); + tmpl = utils::ReplaceAll(tmpl, "${values}", vector_values); + auto src = utils::ReplaceAll(tmpl, "${args}", "m"); + auto expect = utils::ReplaceAll(tmpl, "${args}", vectorized_args); + + EXPECT_TRUE(ShouldRun(src)); + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +// Test that VectorizeMatrixConversions transform generates help functions for conversions of which +// input expression has side effect. +// +// Example input: +// +// enable f16; +// +// var i : i32 = 0; +// +// fn mat_f32() -> mat2x2 { +// i = (i + 1); +// return mat2x2(vec2(f32(i), f32(i)), vec2(f32(i), f32(i))); +// } +// +// fn mat_f16() -> mat2x2 { +// i = (i + 1); +// return mat2x2(vec2(f16(i), f16(i)), vec2(f16(i), f16(i))); +// } +// +// @fragment +// fn main() { +// let m32 : mat2x2 = mat2x2(mat_f16()); +// let m16 : mat2x2 = mat2x2(mat_f32()); +// } +// +// Example output: +// +// enable f16; +// +// var i : i32 = 0; +// +// fn mat_f32() -> mat2x2 { +// i = (i + 1); +// return mat2x2(vec2(f32(i), f32(i)), vec2(f32(i), f32(i))); +// } +// +// fn mat_f16() -> mat2x2 { +// i = (i + 1); +// return mat2x2(vec2(f16(i), f16(i)), vec2(f16(i), f16(i))); +// } +// +// fn convert_mat2x2_f16_f32(value : mat2x2) -> mat2x2 { +// return mat2x2(vec2(value[0]), vec2(value[1])); +// } +// +// fn convert_mat2x2_f32_f16(value : mat2x2) -> mat2x2 { +// return mat2x2(vec2(value[0]), vec2(value[1])); +// } +// +// @fragment +// fn main() { +// let m32 : mat2x2 = convert_mat2x2_f16_f32(mat_f16()); +// let m16 : mat2x2 = convert_mat2x2_f32_f16(mat_f32()); +// } +TEST_P(VectorizeMatrixConversionsTest, Conversion_WithSideEffect) { + uint32_t cols = GetParam().first; + uint32_t rows = GetParam().second; + std::string mat_shape = "mat" + std::to_string(cols) + "x" + std::to_string(rows); + std::string f32_mat_type = mat_shape + ""; + std::string f32_vec_type = "vec" + std::to_string(rows) + ""; + std::string f16_mat_type = mat_shape + ""; + std::string f16_vec_type = "vec" + std::to_string(rows) + ""; + std::string f32_vector_values; + std::string f16_vector_values; + for (uint32_t c = 0; c < cols; c++) { + if (c > 0) { + f32_vector_values += ", "; + f16_vector_values += ", "; + } + f32_vector_values += f32_vec_type + "("; + f16_vector_values += f16_vec_type + "("; + for (uint32_t r = 0; r < rows; r++) { + if (r > 0) { + f32_vector_values += ", "; + f16_vector_values += ", "; + } + f32_vector_values += "f32(i)"; + f16_vector_values += "f16(i)"; + } + f32_vector_values += ")"; + f16_vector_values += ")"; + } + + std::string f32_vectorized_args = ""; + std::string f16_vectorized_args = ""; + for (uint32_t c = 0; c < cols; c++) { + if (c > 0) { + f32_vectorized_args += ", "; + f16_vectorized_args += ", "; + } + f32_vectorized_args += f32_vec_type + "(value[" + std::to_string(c) + "])"; + f16_vectorized_args += f16_vec_type + "(value[" + std::to_string(c) + "])"; + } + + std::string tmpl = R"( +enable f16; + +var i : i32 = 0; + +fn mat_f32() -> ${f32_mat_type} { + i = (i + 1); + return ${f32_mat_type}(${f32_values}); +} + +fn mat_f16() -> ${f16_mat_type} { + i = (i + 1); + return ${f16_mat_type}(${f16_values}); +} +${helper_function} +@fragment +fn main() { + let m32 : ${f32_mat_type} = ${f32_matrix_conversion}; + let m16 : ${f16_mat_type} = ${f16_matrix_conversion}; +} +)"; + tmpl = utils::ReplaceAll(tmpl, "${f32_values}", f32_vector_values); + tmpl = utils::ReplaceAll(tmpl, "${f16_values}", f16_vector_values); + auto src = utils::ReplaceAll(tmpl, "${f32_matrix_conversion}", "${f32_mat_type}(mat_f16())"); + src = utils::ReplaceAll(src, "${f16_matrix_conversion}", "${f16_mat_type}(mat_f32())"); + src = utils::ReplaceAll(src, "${helper_function}", ""); + src = utils::ReplaceAll(src, "${f32_mat_type}", f32_mat_type); + src = utils::ReplaceAll(src, "${f16_mat_type}", f16_mat_type); + + auto helper_function = std::string(R"( +fn convert_${mat_shape}_f16_f32(value : ${f16_mat_type}) -> ${f32_mat_type} { + return ${f32_mat_type}(${f32_vectorized_args}); +} + +fn convert_${mat_shape}_f32_f16(value : ${f32_mat_type}) -> ${f16_mat_type} { + return ${f16_mat_type}(${f16_vectorized_args}); +} +)"); + auto expect = utils::ReplaceAll(tmpl, "${helper_function}", helper_function); + expect = utils::ReplaceAll(expect, "${f32_mat_type}", f32_mat_type); + expect = utils::ReplaceAll(expect, "${f16_mat_type}", f16_mat_type); + expect = utils::ReplaceAll(expect, "${f32_matrix_conversion}", + "convert_${mat_shape}_f16_f32(mat_f16())"); + expect = utils::ReplaceAll(expect, "${f16_matrix_conversion}", + "convert_${mat_shape}_f32_f16(mat_f32())"); + expect = utils::ReplaceAll(expect, "${mat_shape}", mat_shape); + expect = utils::ReplaceAll(expect, "${f32_vectorized_args}", f32_vectorized_args); + expect = utils::ReplaceAll(expect, "${f16_vectorized_args}", f16_vectorized_args); + + EXPECT_TRUE(ShouldRun(src)); + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +// Test that VectorizeMatrixConversions transform will not run for matrix constructor. +TEST_P(VectorizeMatrixConversionsTest, NonConversion_ConstructorFromVectors) { + uint32_t cols = GetParam().first; + uint32_t rows = GetParam().second; + std::string mat_type = "mat" + std::to_string(cols) + "x" + std::to_string(rows) + ""; + std::string vec_type = "vec" + std::to_string(rows) + ""; + std::string columns; + for (uint32_t c = 0; c < cols; c++) { + if (c > 0) { + columns += ", "; + } + columns += vec_type + "()"; + } + + std::string tmpl = R"( +@fragment +fn main() { + let m = ${matrix}(${columns}); +} +)"; + tmpl = utils::ReplaceAll(tmpl, "${matrix}", mat_type); + auto src = utils::ReplaceAll(tmpl, "${columns}", columns); + auto expect = src; + + EXPECT_FALSE(ShouldRun(src)); + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +// Test that VectorizeMatrixConversions transform will not run for identity matrix constructor, +// which also take a single matrix as input. +TEST_P(VectorizeMatrixConversionsTest, NonConversion_IdentityConstructor) { + uint32_t cols = GetParam().first; + uint32_t rows = GetParam().second; + std::string mat_type = "mat" + std::to_string(cols) + "x" + std::to_string(rows) + ""; + std::string vec_type = "vec" + std::to_string(rows) + ""; + std::string columns; + for (uint32_t c = 0; c < cols; c++) { + if (c > 0) { + columns += ", "; + } + columns += vec_type + "()"; + } + + std::string tmpl = R"( +@fragment +fn main() { + let m = ${matrix}(${columns}); + let n : ${matrix} = ${matrix}(m); +} +)"; + tmpl = utils::ReplaceAll(tmpl, "${matrix}", mat_type); + auto src = utils::ReplaceAll(tmpl, "${columns}", columns); + auto expect = src; + + EXPECT_FALSE(ShouldRun(src)); + + auto got = Run(src); + + EXPECT_EQ(expect, str(got)); +} + +INSTANTIATE_TEST_SUITE_P(VectorizeMatrixConversionsTest, + VectorizeMatrixConversionsTest, + testing::Values(std::make_pair(2, 2), + std::make_pair(2, 3), + std::make_pair(2, 4), + std::make_pair(3, 2), + std::make_pair(3, 3), + std::make_pair(3, 4), + std::make_pair(4, 2), + std::make_pair(4, 3), + std::make_pair(4, 4))); + +} // namespace +} // namespace tint::transform diff --git a/src/tint/writer/spirv/builder.cc b/src/tint/writer/spirv/builder.cc index 55b8bc7dd8..c2056a4d77 100644 --- a/src/tint/writer/spirv/builder.cc +++ b/src/tint/writer/spirv/builder.cc @@ -1390,8 +1390,7 @@ uint32_t Builder::GenerateTypeConstructorOrConversion(const sem::Call* call, auto* value_type = args[0]->Type()->UnwrapRef(); if (auto* val_mat = value_type->As()) { // Generate passthrough for matrices of the same type - can_cast_or_copy = - (res_mat->columns() == val_mat->columns()) && (res_mat->rows() == val_mat->rows()); + can_cast_or_copy = res_mat == val_mat; } } @@ -1578,13 +1577,19 @@ uint32_t Builder::GenerateCastOrCopyOrPassthrough(const sem::Type* to_type, } else if ((from_type->is_float_scalar() && to_type->Is()) || (from_type->is_float_vector() && to_type->is_unsigned_integer_vector())) { op = spv::Op::OpConvertFToU; - } else if ((from_type->Is() && to_type->Is()) || - (from_type->Is() && to_type->Is()) || - (from_type->Is() && to_type->Is()) || - (from_type->Is() && to_type->Is()) || - (from_type->Is() && to_type->Is()) || - (from_type->Is() && (from_type == to_type))) { + } else if (from_type + ->IsAnyOf() && + from_type == to_type) { + // Identity constructor for scalar and vector types return val_id; + } else if ((from_type->is_float_scalar() && to_type->is_float_scalar()) || + (from_type->is_float_vector() && to_type->is_float_vector() && + from_type->As()->Width() == to_type->As()->Width())) { + // Convert between f32 and f16 types. + // OpFConvert requires the scalar component types to be different, and the case of from_type + // and to_type being the same floating point scalar or vector type, i.e. identity + // constructor, is already handled in the previous else-if clause. + op = spv::Op::OpFConvert; } else if ((from_type->Is() && to_type->Is()) || (from_type->Is() && to_type->Is()) || (from_type->is_signed_integer_vector() && to_type->is_unsigned_integer_vector()) || @@ -1644,8 +1649,18 @@ uint32_t Builder::GenerateCastOrCopyOrPassthrough(const sem::Type* to_type, } return result_id; - } else if (from_type->Is()) { - return val_id; + } else if (from_type->Is() && to_type->Is()) { + // SPIRV does not support matrix conversion, the only valid case is matrix identity + // constructor. Matrix conversion between f32 and f16 should be transformed into vector + // conversions for each column vectors by VectorizeMatrixConversions. + auto* from_mat = from_type->As(); + auto* to_mat = to_type->As(); + if (from_mat == to_mat) { + return val_id; + } + TINT_ICE(Writer, builder_.Diagnostics()) + << "matrix conversion is not supported and should have been handled by " + "VectorizeMatrixConversions"; } else { TINT_ICE(Writer, builder_.Diagnostics()) << "Invalid from_type"; } diff --git a/src/tint/writer/spirv/builder_constructor_expression_test.cc b/src/tint/writer/spirv/builder_constructor_expression_test.cc index 9c9bd74da4..cb8dd4fe14 100644 --- a/src/tint/writer/spirv/builder_constructor_expression_test.cc +++ b/src/tint/writer/spirv/builder_constructor_expression_test.cc @@ -3927,30 +3927,6 @@ TEST_F(SpvBuilderConstructorTest, Type_Convert_U32_To_I32) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_Convert_I32_To_U32) { - auto* var = Decl(Var("x", ty.i32(), Expr(2_i))); - auto* cast = Construct("x"); - WrapInFunction(var, cast); - - spirv::Builder& b = Build(); - - b.push_function(Function{}); - EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); - EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 1 -%2 = OpConstant %1 2 -%4 = OpTypePointer Function %1 -%5 = OpConstantNull %1 -%7 = OpTypeInt 32 0 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(OpStore %3 %2 -%8 = OpLoad %1 %3 -%6 = OpBitcast %7 %8 -)"); -} - TEST_F(SpvBuilderConstructorTest, Type_Convert_F32_To_I32) { auto* var = Decl(Var("x", ty.f32(), Expr(2.4_f))); auto* cast = Construct("x"); @@ -4001,6 +3977,30 @@ TEST_F(SpvBuilderConstructorTest, Type_Convert_F16_To_I32) { )"); } +TEST_F(SpvBuilderConstructorTest, Type_Convert_I32_To_U32) { + auto* var = Decl(Var("x", ty.i32(), Expr(2_i))); + auto* cast = Construct("x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 1 +%2 = OpConstant %1 2 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%7 = OpTypeInt 32 0 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%8 = OpLoad %1 %3 +%6 = OpBitcast %7 %8 +)"); +} + TEST_F(SpvBuilderConstructorTest, Type_Convert_F32_To_U32) { auto* var = Decl(Var("x", ty.f32(), Expr(2.4_f))); auto* cast = Construct("x"); @@ -4075,6 +4075,56 @@ TEST_F(SpvBuilderConstructorTest, Type_Convert_I32_To_F32) { )"); } +TEST_F(SpvBuilderConstructorTest, Type_Convert_U32_To_F32) { + auto* var = Decl(Var("x", ty.u32(), Expr(2_u))); + auto* cast = Construct("x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 0 +%2 = OpConstant %1 2 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%7 = OpTypeFloat 32 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%8 = OpLoad %1 %3 +%6 = OpConvertUToF %7 %8 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Convert_F16_To_F32) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); + auto* cast = Construct("x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 16 +%2 = OpConstant %1 0x1p+1 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%7 = OpTypeFloat 32 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%8 = OpLoad %1 %3 +%6 = OpFConvert %7 %8 +)"); +} + TEST_F(SpvBuilderConstructorTest, Type_Convert_I32_To_F16) { Enable(ast::Extension::kF16); @@ -4101,30 +4151,6 @@ TEST_F(SpvBuilderConstructorTest, Type_Convert_I32_To_F16) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_Convert_U32_To_F32) { - auto* var = Decl(Var("x", ty.u32(), Expr(2_u))); - auto* cast = Construct("x"); - WrapInFunction(var, cast); - - spirv::Builder& b = Build(); - - b.push_function(Function{}); - EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); - EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeInt 32 0 -%2 = OpConstant %1 2 -%4 = OpTypePointer Function %1 -%5 = OpConstantNull %1 -%7 = OpTypeFloat 32 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(OpStore %3 %2 -%8 = OpLoad %1 %3 -%6 = OpConvertUToF %7 %8 -)"); -} - TEST_F(SpvBuilderConstructorTest, Type_Convert_U32_To_F16) { Enable(ast::Extension::kF16); @@ -4151,6 +4177,32 @@ TEST_F(SpvBuilderConstructorTest, Type_Convert_U32_To_F16) { )"); } +TEST_F(SpvBuilderConstructorTest, Type_Convert_F32_To_F16) { + Enable(ast::Extension::kF16); + + auto* var = Decl(Var("x", ty.f32(), Expr(2_f))); + auto* cast = Construct("x"); + WrapInFunction(var, cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + EXPECT_TRUE(b.GenerateStatement(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%1 = OpTypeFloat 32 +%2 = OpConstant %1 2 +%4 = OpTypePointer Function %1 +%5 = OpConstantNull %1 +%7 = OpTypeFloat 16 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(OpStore %3 %2 +%8 = OpLoad %1 %3 +%6 = OpFConvert %7 %8 +)"); +} + TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_U32_to_I32) { auto* var = GlobalVar("i", ty.vec3(), ast::StorageClass::kPrivate); @@ -4337,6 +4389,60 @@ TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_I32_to_F32) { )"); } +TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_U32_to_F32) { + auto* var = GlobalVar("i", ty.vec3(), ast::StorageClass::kPrivate); + + auto* cast = vec3("i"); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 0 +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%8 = OpTypeFloat 32 +%7 = OpTypeVector %8 3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%9 = OpLoad %3 %1 +%6 = OpConvertUToF %7 %9 +)"); +} + +TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_F16_to_F32) { + Enable(ast::Extension::kF16); + + auto* var = GlobalVar("i", ty.vec3(), ast::StorageClass::kPrivate); + + auto* cast = vec3("i"); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 16 +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%8 = OpTypeFloat 32 +%7 = OpTypeVector %8 3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%9 = OpLoad %3 %1 +%6 = OpFConvert %7 %9 +)"); +} + TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_I32_to_F16) { Enable(ast::Extension::kF16); @@ -4365,32 +4471,6 @@ TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_I32_to_F16) { )"); } -TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_U32_to_F32) { - auto* var = GlobalVar("i", ty.vec3(), ast::StorageClass::kPrivate); - - auto* cast = vec3("i"); - WrapInFunction(cast); - - spirv::Builder& b = Build(); - - b.push_function(Function{}); - ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); - EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); - - EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeInt 32 0 -%3 = OpTypeVector %4 3 -%2 = OpTypePointer Private %3 -%5 = OpConstantNull %3 -%1 = OpVariable %2 Private %5 -%8 = OpTypeFloat 32 -%7 = OpTypeVector %8 3 -)"); - EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), - R"(%9 = OpLoad %3 %1 -%6 = OpConvertUToF %7 %9 -)"); -} - TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_U32_to_F16) { Enable(ast::Extension::kF16); @@ -4419,6 +4499,34 @@ TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_U32_to_F16) { )"); } +TEST_F(SpvBuilderConstructorTest, Type_Convert_Vectors_F32_to_F16) { + Enable(ast::Extension::kF16); + + auto* var = GlobalVar("i", ty.vec3(), ast::StorageClass::kPrivate); + + auto* cast = vec3("i"); + WrapInFunction(cast); + + spirv::Builder& b = Build(); + + b.push_function(Function{}); + ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.error(); + EXPECT_EQ(b.GenerateExpression(cast), 6u) << b.error(); + + EXPECT_EQ(DumpInstructions(b.types()), R"(%4 = OpTypeFloat 32 +%3 = OpTypeVector %4 3 +%2 = OpTypePointer Private %3 +%5 = OpConstantNull %3 +%1 = OpVariable %2 Private %5 +%8 = OpTypeFloat 16 +%7 = OpTypeVector %8 3 +)"); + EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()), + R"(%9 = OpLoad %3 %1 +%6 = OpFConvert %7 %9 +)"); +} + TEST_F(SpvBuilderConstructorTest, IsConstructorConst_GlobalVectorWithAllConstConstructors) { // vec3(1.0, 2.0, 3.0) -> true auto* t = vec3(1_f, 2_f, 3_f); diff --git a/src/tint/writer/spirv/generator_impl.cc b/src/tint/writer/spirv/generator_impl.cc index 8586562741..ace52092f7 100644 --- a/src/tint/writer/spirv/generator_impl.cc +++ b/src/tint/writer/spirv/generator_impl.cc @@ -32,6 +32,7 @@ #include "src/tint/transform/unshadow.h" #include "src/tint/transform/unwind_discard_functions.h" #include "src/tint/transform/var_for_dynamic_index.h" +#include "src/tint/transform/vectorize_matrix_conversions.h" #include "src/tint/transform/vectorize_scalar_matrix_constructors.h" #include "src/tint/transform/while_to_loop.h" #include "src/tint/transform/zero_init_workgroup_memory.h" @@ -78,6 +79,7 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { manager.Add(); // Required for arrayLength() manager.Add(); manager.Add(); + manager.Add(); manager.Add(); // Must come after manager.Add(); // ZeroInitWorkgroupMemory manager.Add(); diff --git a/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl b/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl new file mode 100644 index 0000000000..9009ac9346 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl @@ -0,0 +1,10 @@ +enable f16; +var t : f16; +fn m() -> mat2x2 { + t = t + 1.0h; + return mat2x2(1.0h, 2.0h, + 3.0h, 4.0h); +} +fn f() { + var v : mat2x2 = mat2x2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c0aba27d1c --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float2x2 v = float2x2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..29aa0dc18f --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float2x2 v = float2x2(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000026A2F8678E0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..fa899a05b7 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16mat2 m() { + t = (t + 1.0hf); + return f16mat2(f16vec2(1.0hf, 2.0hf), f16vec2(3.0hf, 4.0hf)); +} + +void f() { + f16mat2 tint_symbol = m(); + mat2 v = mat2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..90a846e4b7 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half2x2 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = (tint_symbol_1 + 1.0h); + return half2x2(half2(1.0h, 2.0h), half2(3.0h, 4.0h)); +} + +void f() { + half2x2 const tint_symbol = m(); + float2x2 v = float2x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..df186883ce --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %9 = OpTypeFunction %mat2v2half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %18 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %21 = OpConstantComposite %v2half %half_0x1_8p_1 %half_0x1p_2 + %22 = OpConstantComposite %mat2v2half %18 %21 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %int = OpTypeInt 32 1 + %31 = OpConstantNull %int + %int_1 = OpConstant %int 1 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %39 = OpConstantNull %mat2v2float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat2v2half None %9 + %13 = OpLabel + %14 = OpLoad %half %t + %16 = OpFAdd %half %14 %half_0x1p_0 + OpStore %t %16 + OpReturnValue %22 + OpFunctionEnd + %f = OpFunction %void None %5 + %24 = OpLabel + %v = OpVariable %_ptr_Function_mat2v2float Function %39 + %25 = OpFunctionCall %mat2v2half %m + %32 = OpCompositeExtract %v2half %25 0 + %29 = OpFConvert %v2float %32 + %35 = OpCompositeExtract %v2half %25 1 + %33 = OpFConvert %v2float %35 + %36 = OpCompositeConstruct %mat2v2float %29 %33 + OpStore %v %36 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..65ee8f332d --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> mat2x2 { + t = (t + 1.0h); + return mat2x2(1.0h, 2.0h, 3.0h, 4.0h); +} + +fn f() { + var v : mat2x2 = mat2x2(m()); +} diff --git a/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl b/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl new file mode 100644 index 0000000000..4bf82de5ea --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl @@ -0,0 +1,10 @@ +enable f16; +var t : f32; +fn m() -> mat2x2 { + t = t + 1.0f; + return mat2x2(1.0f, 2.0f, + 3.0f, 4.0f); +} +fn f() { + var v : mat2x2 = mat2x2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2e3822fa69 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float2x2 m() { + t = (t + 1.0f); + return float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); +} + +void f() { + const float2x2 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..49af747870 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float2x2 m() { + t = (t + 1.0f); + return float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); +} + +void f() { + const float2x2 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002331C288CF0(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..46a6a1b5ef --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +mat2 m() { + t = (t + 1.0f); + return mat2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f)); +} + +void f() { + mat2 tint_symbol = m(); + f16mat2 v = f16mat2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..f9159fbe0d --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float2x2 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = (tint_symbol_1 + 1.0f); + return float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); +} + +void f() { + float2x2 const tint_symbol = m(); + half2x2 v = half2x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..13b9baa966 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %9 = OpTypeFunction %mat2v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %18 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %21 = OpConstantComposite %v2float %float_3 %float_4 + %22 = OpConstantComposite %mat2v2float %18 %21 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %int = OpTypeInt 32 1 + %31 = OpConstantNull %int + %int_1 = OpConstant %int 1 +%_ptr_Function_mat2v2half = OpTypePointer Function %mat2v2half + %39 = OpConstantNull %mat2v2half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat2v2float None %9 + %13 = OpLabel + %14 = OpLoad %float %t + %16 = OpFAdd %float %14 %float_1 + OpStore %t %16 + OpReturnValue %22 + OpFunctionEnd + %f = OpFunction %void None %5 + %24 = OpLabel + %v = OpVariable %_ptr_Function_mat2v2half Function %39 + %25 = OpFunctionCall %mat2v2float %m + %32 = OpCompositeExtract %v2float %25 0 + %29 = OpFConvert %v2half %32 + %35 = OpCompositeExtract %v2float %25 1 + %33 = OpFConvert %v2half %35 + %36 = OpCompositeConstruct %mat2v2half %29 %33 + OpStore %v %36 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..d753de4fe5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f32; + +fn m() -> mat2x2 { + t = (t + 1.0f); + return mat2x2(1.0f, 2.0f, 3.0f, 4.0f); +} + +fn f() { + var v : mat2x2 = mat2x2(m()); +} diff --git a/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl b/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl new file mode 100644 index 0000000000..d9fad3f144 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl @@ -0,0 +1,3 @@ +enable f16; +var u : mat2x2 = mat2x2(mat2x2(1.0h, 2.0h, + 3.0h, 4.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cef5e618a3 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 u = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); diff --git a/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cef5e618a3 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 u = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); diff --git a/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..325024f767 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2 u = mat2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f)); diff --git a/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..e9e4f98b48 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %6 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %9 = OpConstantComposite %v2float %float_3 %float_4 + %10 = OpConstantComposite %mat2v2float %6 %9 +%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float + %u = OpVariable %_ptr_Private_mat2v2float Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..4571594597 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/literal/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat2x2 = mat2x2(mat2x2(1.0h, 2.0h, 3.0h, 4.0h)); diff --git a/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl b/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl new file mode 100644 index 0000000000..64a224c61e --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl @@ -0,0 +1,3 @@ +enable f16; +var u : mat2x2 = mat2x2(mat2x2(1.0f, 2.0f, + 3.0f, 4.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..212965f498 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h))); diff --git a/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..599a78dd09 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000017A260403B0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..c528fb05d1 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2 u = f16mat2(f16vec2(1.0hf, 2.0hf), f16vec2(3.0hf, 4.0hf)); diff --git a/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..8008a43bd3 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %6 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %9 = OpConstantComposite %v2half %half_0x1_8p_1 %half_0x1p_2 + %10 = OpConstantComposite %mat2v2half %6 %9 +%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half + %u = OpVariable %_ptr_Private_mat2v2half Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..ac9b1ffc60 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/literal/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat2x2 = mat2x2(mat2x2(1.0f, 2.0f, 3.0f, 4.0f)); diff --git a/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl b/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl new file mode 100644 index 0000000000..37fb4dbb4c --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl @@ -0,0 +1,6 @@ +enable f16; +var u = mat2x2(1.0h, 2.0h, + 3.0h, 4.0h); +fn f() { + var v : mat2x2 = mat2x2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..97dbc4c3c4 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h))); + +void f() { + float2x2 v = float2x2(u); +} diff --git a/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9fafc593c2 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h))); + +void f() { + float2x2 v = float2x2(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000023103DB6760(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..b4df532071 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2 u = f16mat2(f16vec2(1.0hf, 2.0hf), f16vec2(3.0hf, 4.0hf)); +void f() { + mat2 v = mat2(u); +} + diff --git a/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..d27e57fbaf --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half2x2 tint_symbol = half2x2(half2(1.0h, 2.0h), half2(3.0h, 4.0h)); + float2x2 v = float2x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..9359eae111 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %6 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %9 = OpConstantComposite %v2half %half_0x1_8p_1 %half_0x1p_2 + %10 = OpConstantComposite %mat2v2half %6 %9 +%_ptr_Private_mat2v2half = OpTypePointer Private %mat2v2half + %u = OpVariable %_ptr_Private_mat2v2half Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %int = OpTypeInt 32 1 + %24 = OpConstantNull %int +%_ptr_Private_v2half = OpTypePointer Private %v2half + %int_1 = OpConstant %int 1 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %35 = OpConstantNull %mat2v2float +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %13 + %18 = OpLabel + %v = OpVariable %_ptr_Function_mat2v2float Function %35 + %26 = OpAccessChain %_ptr_Private_v2half %u %24 + %27 = OpLoad %v2half %26 + %22 = OpFConvert %v2float %27 + %30 = OpAccessChain %_ptr_Private_v2half %u %int_1 + %31 = OpLoad %v2half %30 + %28 = OpFConvert %v2float %31 + %32 = OpCompositeConstruct %mat2v2float %22 %28 + OpStore %v %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..f2c4406ad1 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat2x2(1.0h, 2.0h, 3.0h, 4.0h); + +fn f() { + var v : mat2x2 = mat2x2(u); +} diff --git a/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl b/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl new file mode 100644 index 0000000000..8be7874033 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl @@ -0,0 +1,6 @@ +enable f16; +var u = mat2x2(1.0f, 2.0f, + 3.0f, 4.0f); +fn f() { + var v : mat2x2 = mat2x2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f6e8634442 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 u = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + +void f() { + matrix v = matrix(u); +} diff --git a/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a90fee36d8 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x2 u = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + +void f() { + matrix v = matrix(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000022E5A1842F0(9,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..9eae74ceb9 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2 u = mat2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f)); +void f() { + f16mat2 v = f16mat2(u); +} + diff --git a/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..c7519dcad1 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float2x2 tint_symbol = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + half2x2 v = half2x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..0f9e29d8e6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %6 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %9 = OpConstantComposite %v2float %float_3 %float_4 + %10 = OpConstantComposite %mat2v2float %6 %9 +%_ptr_Private_mat2v2float = OpTypePointer Private %mat2v2float + %u = OpVariable %_ptr_Private_mat2v2float Private %10 + %void = OpTypeVoid + %13 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat2v2half = OpTypeMatrix %v2half 2 + %int = OpTypeInt 32 1 + %24 = OpConstantNull %int +%_ptr_Private_v2float = OpTypePointer Private %v2float + %int_1 = OpConstant %int 1 +%_ptr_Function_mat2v2half = OpTypePointer Function %mat2v2half + %35 = OpConstantNull %mat2v2half +%unused_entry_point = OpFunction %void None %13 + %16 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %13 + %18 = OpLabel + %v = OpVariable %_ptr_Function_mat2v2half Function %35 + %26 = OpAccessChain %_ptr_Private_v2float %u %24 + %27 = OpLoad %v2float %26 + %22 = OpFConvert %v2half %27 + %30 = OpAccessChain %_ptr_Private_v2float %u %int_1 + %31 = OpLoad %v2float %30 + %28 = OpFConvert %v2half %31 + %32 = OpCompositeConstruct %mat2v2half %22 %28 + OpStore %v %32 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..0d41ae0bd0 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat2x2(1.0f, 2.0f, 3.0f, 4.0f); + +fn f() { + var v : mat2x2 = mat2x2(u); +} diff --git a/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl b/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl new file mode 100644 index 0000000000..4bc657a006 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl @@ -0,0 +1,10 @@ +enable f16; +var t : f16; +fn m() -> mat2x3 { + t = t + 1.0h; + return mat2x3(1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h); +} +fn f() { + var v : mat2x3 = mat2x3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..452d825be8 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float2x3 v = float2x3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9a57aa5e67 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float2x3 v = float2x3(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000175F40071F0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..62999630a9 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16mat2x3 m() { + t = (t + 1.0hf); + return f16mat2x3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf)); +} + +void f() { + f16mat2x3 tint_symbol = m(); + mat2x3 v = mat2x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..25500b4d84 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half2x3 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = (tint_symbol_1 + 1.0h); + return half2x3(half3(1.0h, 2.0h, 3.0h), half3(4.0h, 5.0h, 6.0h)); +} + +void f() { + half2x3 const tint_symbol = m(); + float2x3 v = float2x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..873cdb92b5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %9 = OpTypeFunction %mat2v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %19 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %23 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 + %24 = OpConstantComposite %mat2v3half %19 %23 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %int = OpTypeInt 32 1 + %33 = OpConstantNull %int + %int_1 = OpConstant %int 1 +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float + %41 = OpConstantNull %mat2v3float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat2v3half None %9 + %13 = OpLabel + %14 = OpLoad %half %t + %16 = OpFAdd %half %14 %half_0x1p_0 + OpStore %t %16 + OpReturnValue %24 + OpFunctionEnd + %f = OpFunction %void None %5 + %26 = OpLabel + %v = OpVariable %_ptr_Function_mat2v3float Function %41 + %27 = OpFunctionCall %mat2v3half %m + %34 = OpCompositeExtract %v3half %27 0 + %31 = OpFConvert %v3float %34 + %37 = OpCompositeExtract %v3half %27 1 + %35 = OpFConvert %v3float %37 + %38 = OpCompositeConstruct %mat2v3float %31 %35 + OpStore %v %38 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..8ea13ccddf --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> mat2x3 { + t = (t + 1.0h); + return mat2x3(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h); +} + +fn f() { + var v : mat2x3 = mat2x3(m()); +} diff --git a/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl b/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl new file mode 100644 index 0000000000..dcf972a4f3 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl @@ -0,0 +1,10 @@ +enable f16; +var t : f32; +fn m() -> mat2x3 { + t = t + 1.0f; + return mat2x3(1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f); +} +fn f() { + var v : mat2x3 = mat2x3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2bfbb8d407 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float2x3 m() { + t = (t + 1.0f); + return float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); +} + +void f() { + const float2x3 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..81c99312ff --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float2x3 m() { + t = (t + 1.0f); + return float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); +} + +void f() { + const float2x3 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000029F80D27980(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..6b817e9af5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +mat2x3 m() { + t = (t + 1.0f); + return mat2x3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f)); +} + +void f() { + mat2x3 tint_symbol = m(); + f16mat2x3 v = f16mat2x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..ffb559c865 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float2x3 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = (tint_symbol_1 + 1.0f); + return float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); +} + +void f() { + float2x3 const tint_symbol = m(); + half2x3 v = half2x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..2622b2b656 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %9 = OpTypeFunction %mat2v3float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %19 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %23 = OpConstantComposite %v3float %float_4 %float_5 %float_6 + %24 = OpConstantComposite %mat2v3float %19 %23 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %int = OpTypeInt 32 1 + %33 = OpConstantNull %int + %int_1 = OpConstant %int 1 +%_ptr_Function_mat2v3half = OpTypePointer Function %mat2v3half + %41 = OpConstantNull %mat2v3half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat2v3float None %9 + %13 = OpLabel + %14 = OpLoad %float %t + %16 = OpFAdd %float %14 %float_1 + OpStore %t %16 + OpReturnValue %24 + OpFunctionEnd + %f = OpFunction %void None %5 + %26 = OpLabel + %v = OpVariable %_ptr_Function_mat2v3half Function %41 + %27 = OpFunctionCall %mat2v3float %m + %34 = OpCompositeExtract %v3float %27 0 + %31 = OpFConvert %v3half %34 + %37 = OpCompositeExtract %v3float %27 1 + %35 = OpFConvert %v3half %37 + %38 = OpCompositeConstruct %mat2v3half %31 %35 + OpStore %v %38 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..c97dcd83fa --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f32; + +fn m() -> mat2x3 { + t = (t + 1.0f); + return mat2x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f); +} + +fn f() { + var v : mat2x3 = mat2x3(m()); +} diff --git a/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl b/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl new file mode 100644 index 0000000000..0b252efe02 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl @@ -0,0 +1,3 @@ +enable f16; +var u : mat2x3 = mat2x3(mat2x3(1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..42c816fd05 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 u = float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); diff --git a/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..42c816fd05 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 u = float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); diff --git a/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..d0eeb55d43 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2x3 u = mat2x3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f)); diff --git a/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..b321ef0f03 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %7 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %11 = OpConstantComposite %v3float %float_4 %float_5 %float_6 + %12 = OpConstantComposite %mat2v3float %7 %11 +%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float + %u = OpVariable %_ptr_Private_mat2v3float Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..460f730e35 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/literal/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat2x3 = mat2x3(mat2x3(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h)); diff --git a/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl b/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl new file mode 100644 index 0000000000..504e1c211a --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl @@ -0,0 +1,3 @@ +enable f16; +var u : mat2x3 = mat2x3(mat2x3(1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d3ace69f3e --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h))); diff --git a/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e7c062b31c --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001558B1D0610(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..c4095f7596 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x3 u = f16mat2x3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf)); diff --git a/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..63ff1b8e4a --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %7 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %11 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 + %12 = OpConstantComposite %mat2v3half %7 %11 +%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half + %u = OpVariable %_ptr_Private_mat2v3half Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..0790c8b255 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/literal/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat2x3 = mat2x3(mat2x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f)); diff --git a/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl b/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl new file mode 100644 index 0000000000..7faa479f6c --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl @@ -0,0 +1,6 @@ +enable f16; +var u = mat2x3(1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h); +fn f() { + var v : mat2x3 = mat2x3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..616b60591f --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h))); + +void f() { + float2x3 v = float2x3(u); +} diff --git a/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cfa50df0f2 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h))); + +void f() { + float2x3 v = float2x3(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000022FCB692870(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..8207f34d0a --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x3 u = f16mat2x3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf)); +void f() { + mat2x3 v = mat2x3(u); +} + diff --git a/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..a263c8d109 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half2x3 tint_symbol = half2x3(half3(1.0h, 2.0h, 3.0h), half3(4.0h, 5.0h, 6.0h)); + float2x3 v = float2x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..243d601504 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %7 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %11 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 + %12 = OpConstantComposite %mat2v3half %7 %11 +%_ptr_Private_mat2v3half = OpTypePointer Private %mat2v3half + %u = OpVariable %_ptr_Private_mat2v3half Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %int = OpTypeInt 32 1 + %26 = OpConstantNull %int +%_ptr_Private_v3half = OpTypePointer Private %v3half + %int_1 = OpConstant %int 1 +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float + %37 = OpConstantNull %mat2v3float +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %15 + %20 = OpLabel + %v = OpVariable %_ptr_Function_mat2v3float Function %37 + %28 = OpAccessChain %_ptr_Private_v3half %u %26 + %29 = OpLoad %v3half %28 + %24 = OpFConvert %v3float %29 + %32 = OpAccessChain %_ptr_Private_v3half %u %int_1 + %33 = OpLoad %v3half %32 + %30 = OpFConvert %v3float %33 + %34 = OpCompositeConstruct %mat2v3float %24 %30 + OpStore %v %34 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..ba821190df --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat2x3(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h); + +fn f() { + var v : mat2x3 = mat2x3(u); +} diff --git a/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl b/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl new file mode 100644 index 0000000000..d4619090fb --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl @@ -0,0 +1,6 @@ +enable f16; +var u = mat2x3(1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f); +fn f() { + var v : mat2x3 = mat2x3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..acdc03e0e5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 u = float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); + +void f() { + matrix v = matrix(u); +} diff --git a/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c9401825a4 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x3 u = float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); + +void f() { + matrix v = matrix(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000220E99769D0(9,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..3f8c664411 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2x3 u = mat2x3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f)); +void f() { + f16mat2x3 v = f16mat2x3(u); +} + diff --git a/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..10585b894b --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float2x3 tint_symbol = float2x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); + half2x3 v = half2x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..0191bdbb03 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 38 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %7 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %11 = OpConstantComposite %v3float %float_4 %float_5 %float_6 + %12 = OpConstantComposite %mat2v3float %7 %11 +%_ptr_Private_mat2v3float = OpTypePointer Private %mat2v3float + %u = OpVariable %_ptr_Private_mat2v3float Private %12 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat2v3half = OpTypeMatrix %v3half 2 + %int = OpTypeInt 32 1 + %26 = OpConstantNull %int +%_ptr_Private_v3float = OpTypePointer Private %v3float + %int_1 = OpConstant %int 1 +%_ptr_Function_mat2v3half = OpTypePointer Function %mat2v3half + %37 = OpConstantNull %mat2v3half +%unused_entry_point = OpFunction %void None %15 + %18 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %15 + %20 = OpLabel + %v = OpVariable %_ptr_Function_mat2v3half Function %37 + %28 = OpAccessChain %_ptr_Private_v3float %u %26 + %29 = OpLoad %v3float %28 + %24 = OpFConvert %v3half %29 + %32 = OpAccessChain %_ptr_Private_v3float %u %int_1 + %33 = OpLoad %v3float %32 + %30 = OpFConvert %v3half %33 + %34 = OpCompositeConstruct %mat2v3half %24 %30 + OpStore %v %34 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..8e0ce27ad0 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat2x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f); + +fn f() { + var v : mat2x3 = mat2x3(u); +} diff --git a/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl b/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl new file mode 100644 index 0000000000..ed69b7404f --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl @@ -0,0 +1,10 @@ +enable f16; +var t : f16; +fn m() -> mat2x4 { + t = t + 1.0h; + return mat2x4(1.0h, 2.0h, 3.0h, 4.0h, + 5.0h, 6.0h, 7.0h, 8.0h); +} +fn f() { + var v : mat2x4 = mat2x4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9daf5a1c0c --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float2x4 v = float2x4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a0b30162a3 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float2x4 v = float2x4(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000197CB8872F0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..1089e8c8fb --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16mat2x4 m() { + t = (t + 1.0hf); + return f16mat2x4(f16vec4(1.0hf, 2.0hf, 3.0hf, 4.0hf), f16vec4(5.0hf, 6.0hf, 7.0hf, 8.0hf)); +} + +void f() { + f16mat2x4 tint_symbol = m(); + mat2x4 v = mat2x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..f3c5d0fdf1 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half2x4 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = (tint_symbol_1 + 1.0h); + return half2x4(half4(1.0h, 2.0h, 3.0h, 4.0h), half4(5.0h, 6.0h, 7.0h, 8.0h)); +} + +void f() { + half2x4 const tint_symbol = m(); + float2x4 v = float2x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d9cc0d354 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %9 = OpTypeFunction %mat2v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %20 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %25 = OpConstantComposite %v4half %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 + %26 = OpConstantComposite %mat2v4half %20 %25 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat2v4float = OpTypeMatrix %v4float 2 + %int = OpTypeInt 32 1 + %35 = OpConstantNull %int + %int_1 = OpConstant %int 1 +%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float + %43 = OpConstantNull %mat2v4float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat2v4half None %9 + %13 = OpLabel + %14 = OpLoad %half %t + %16 = OpFAdd %half %14 %half_0x1p_0 + OpStore %t %16 + OpReturnValue %26 + OpFunctionEnd + %f = OpFunction %void None %5 + %28 = OpLabel + %v = OpVariable %_ptr_Function_mat2v4float Function %43 + %29 = OpFunctionCall %mat2v4half %m + %36 = OpCompositeExtract %v4half %29 0 + %33 = OpFConvert %v4float %36 + %39 = OpCompositeExtract %v4half %29 1 + %37 = OpFConvert %v4float %39 + %40 = OpCompositeConstruct %mat2v4float %33 %37 + OpStore %v %40 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..49fb4aa07b --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> mat2x4 { + t = (t + 1.0h); + return mat2x4(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h); +} + +fn f() { + var v : mat2x4 = mat2x4(m()); +} diff --git a/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl b/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl new file mode 100644 index 0000000000..bbae4a7ec0 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl @@ -0,0 +1,10 @@ +enable f16; +var t : f32; +fn m() -> mat2x4 { + t = t + 1.0f; + return mat2x4(1.0f, 2.0f, 3.0f, 4.0f, + 5.0f, 6.0f, 7.0f, 8.0f); +} +fn f() { + var v : mat2x4 = mat2x4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e5d0dd3005 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float2x4 m() { + t = (t + 1.0f); + return float2x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f)); +} + +void f() { + const float2x4 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..464420c66c --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float2x4 m() { + t = (t + 1.0f); + return float2x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f)); +} + +void f() { + const float2x4 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000278DD4C1620(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..34fe2da050 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +mat2x4 m() { + t = (t + 1.0f); + return mat2x4(vec4(1.0f, 2.0f, 3.0f, 4.0f), vec4(5.0f, 6.0f, 7.0f, 8.0f)); +} + +void f() { + mat2x4 tint_symbol = m(); + f16mat2x4 v = f16mat2x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..1dd1032e1b --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float2x4 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = (tint_symbol_1 + 1.0f); + return float2x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f)); +} + +void f() { + float2x4 const tint_symbol = m(); + half2x4 v = half2x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..05e66959dc --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 +%mat2v4float = OpTypeMatrix %v4float 2 + %9 = OpTypeFunction %mat2v4float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %20 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %25 = OpConstantComposite %v4float %float_5 %float_6 %float_7 %float_8 + %26 = OpConstantComposite %mat2v4float %20 %25 + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %int = OpTypeInt 32 1 + %35 = OpConstantNull %int + %int_1 = OpConstant %int 1 +%_ptr_Function_mat2v4half = OpTypePointer Function %mat2v4half + %43 = OpConstantNull %mat2v4half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat2v4float None %9 + %13 = OpLabel + %14 = OpLoad %float %t + %16 = OpFAdd %float %14 %float_1 + OpStore %t %16 + OpReturnValue %26 + OpFunctionEnd + %f = OpFunction %void None %5 + %28 = OpLabel + %v = OpVariable %_ptr_Function_mat2v4half Function %43 + %29 = OpFunctionCall %mat2v4float %m + %36 = OpCompositeExtract %v4float %29 0 + %33 = OpFConvert %v4half %36 + %39 = OpCompositeExtract %v4float %29 1 + %37 = OpFConvert %v4half %39 + %40 = OpCompositeConstruct %mat2v4half %33 %37 + OpStore %v %40 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..8f32b64bba --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f32; + +fn m() -> mat2x4 { + t = (t + 1.0f); + return mat2x4(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f); +} + +fn f() { + var v : mat2x4 = mat2x4(m()); +} diff --git a/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl b/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl new file mode 100644 index 0000000000..b76ad3c4a8 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl @@ -0,0 +1,3 @@ +enable f16; +var u : mat2x4 = mat2x4(mat2x4(1.0h, 2.0h, 3.0h, 4.0h, + 5.0h, 6.0h, 7.0h, 8.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d6ec6d8aa1 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 u = float2x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d6ec6d8aa1 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 u = float2x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..71461d0012 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2x4 u = mat2x4(vec4(1.0f, 2.0f, 3.0f, 4.0f), vec4(5.0f, 6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..07286f71cb --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat2v4float = OpTypeMatrix %v4float 2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %8 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %13 = OpConstantComposite %v4float %float_5 %float_6 %float_7 %float_8 + %14 = OpConstantComposite %mat2v4float %8 %13 +%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float + %u = OpVariable %_ptr_Private_mat2v4float Private %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..9f85fd1965 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/literal/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat2x4 = mat2x4(mat2x4(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h)); diff --git a/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl b/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl new file mode 100644 index 0000000000..f569867ede --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl @@ -0,0 +1,3 @@ +enable f16; +var u : mat2x4 = mat2x4(mat2x4(1.0f, 2.0f, 3.0f, 4.0f, + 5.0f, 6.0f, 7.0f, 8.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..779c1e730b --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); diff --git a/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f3243ae172 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001DA11702BC0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..c80b9ddec9 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x4 u = f16mat2x4(f16vec4(1.0hf, 2.0hf, 3.0hf, 4.0hf), f16vec4(5.0hf, 6.0hf, 7.0hf, 8.0hf)); diff --git a/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..22a00c6db4 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %8 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %13 = OpConstantComposite %v4half %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 + %14 = OpConstantComposite %mat2v4half %8 %13 +%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half + %u = OpVariable %_ptr_Private_mat2v4half Private %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..44eb17fd07 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/literal/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat2x4 = mat2x4(mat2x4(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl b/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl new file mode 100644 index 0000000000..f62aae7848 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl @@ -0,0 +1,6 @@ +enable f16; +var u = mat2x4(1.0h, 2.0h, 3.0h, 4.0h, + 5.0h, 6.0h, 7.0h, 8.0h); +fn f() { + var v : mat2x4 = mat2x4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..060def00bc --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); + +void f() { + float2x4 v = float2x4(u); +} diff --git a/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4697fe97a5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h))); + +void f() { + float2x4 v = float2x4(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001865A835AF0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..d682f91778 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat2x4 u = f16mat2x4(f16vec4(1.0hf, 2.0hf, 3.0hf, 4.0hf), f16vec4(5.0hf, 6.0hf, 7.0hf, 8.0hf)); +void f() { + mat2x4 v = mat2x4(u); +} + diff --git a/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..c1249579a1 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half2x4 tint_symbol = half2x4(half4(1.0h, 2.0h, 3.0h, 4.0h), half4(5.0h, 6.0h, 7.0h, 8.0h)); + float2x4 v = float2x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..6ada4282e5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,61 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %8 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %13 = OpConstantComposite %v4half %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 + %14 = OpConstantComposite %mat2v4half %8 %13 +%_ptr_Private_mat2v4half = OpTypePointer Private %mat2v4half + %u = OpVariable %_ptr_Private_mat2v4half Private %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat2v4float = OpTypeMatrix %v4float 2 + %int = OpTypeInt 32 1 + %28 = OpConstantNull %int +%_ptr_Private_v4half = OpTypePointer Private %v4half + %int_1 = OpConstant %int 1 +%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float + %39 = OpConstantNull %mat2v4float +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %17 + %22 = OpLabel + %v = OpVariable %_ptr_Function_mat2v4float Function %39 + %30 = OpAccessChain %_ptr_Private_v4half %u %28 + %31 = OpLoad %v4half %30 + %26 = OpFConvert %v4float %31 + %34 = OpAccessChain %_ptr_Private_v4half %u %int_1 + %35 = OpLoad %v4half %34 + %32 = OpFConvert %v4float %35 + %36 = OpCompositeConstruct %mat2v4float %26 %32 + OpStore %v %36 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..e57e773ccc --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat2x4(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h); + +fn f() { + var v : mat2x4 = mat2x4(u); +} diff --git a/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl b/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl new file mode 100644 index 0000000000..19ced6cf7b --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl @@ -0,0 +1,6 @@ +enable f16; +var u = mat2x4(1.0f, 2.0f, 3.0f, 4.0f, + 5.0f, 6.0f, 7.0f, 8.0f); +fn f() { + var v : mat2x4 = mat2x4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1d92aaa0ee --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 u = float2x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f)); + +void f() { + matrix v = matrix(u); +} diff --git a/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..326ec5fed3 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2x4 u = float2x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f)); + +void f() { + matrix v = matrix(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000016793C61BF0(9,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..297b343238 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat2x4 u = mat2x4(vec4(1.0f, 2.0f, 3.0f, 4.0f), vec4(5.0f, 6.0f, 7.0f, 8.0f)); +void f() { + f16mat2x4 v = f16mat2x4(u); +} + diff --git a/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..45737667e4 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float2x4 tint_symbol = float2x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f)); + half2x4 v = half2x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..af7d69ece2 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,61 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat2v4float = OpTypeMatrix %v4float 2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %8 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %13 = OpConstantComposite %v4float %float_5 %float_6 %float_7 %float_8 + %14 = OpConstantComposite %mat2v4float %8 %13 +%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float + %u = OpVariable %_ptr_Private_mat2v4float Private %14 + %void = OpTypeVoid + %17 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat2v4half = OpTypeMatrix %v4half 2 + %int = OpTypeInt 32 1 + %28 = OpConstantNull %int +%_ptr_Private_v4float = OpTypePointer Private %v4float + %int_1 = OpConstant %int 1 +%_ptr_Function_mat2v4half = OpTypePointer Function %mat2v4half + %39 = OpConstantNull %mat2v4half +%unused_entry_point = OpFunction %void None %17 + %20 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %17 + %22 = OpLabel + %v = OpVariable %_ptr_Function_mat2v4half Function %39 + %30 = OpAccessChain %_ptr_Private_v4float %u %28 + %31 = OpLoad %v4float %30 + %26 = OpFConvert %v4half %31 + %34 = OpAccessChain %_ptr_Private_v4float %u %int_1 + %35 = OpLoad %v4float %34 + %32 = OpFConvert %v4half %35 + %36 = OpCompositeConstruct %mat2v4half %26 %32 + OpStore %v %36 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..020d69d3d9 --- /dev/null +++ b/test/tint/expressions/type_conv/mat2x4/var/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat2x4(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f); + +fn f() { + var v : mat2x4 = mat2x4(u); +} diff --git a/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl b/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl new file mode 100644 index 0000000000..2f149183d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl @@ -0,0 +1,11 @@ +enable f16; +var t : f16; +fn m() -> mat3x2 { + t = t + 1.0h; + return mat3x2(1.0h, 2.0h, + 3.0h, 4.0h, + 5.0h, 6.0h); +} +fn f() { + var v : mat3x2 = mat3x2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b97ba4864b --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float3x2 v = float3x2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3fb9585129 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float3x2 v = float3x2(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002EC3AF88640(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..2910c01958 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16mat3x2 m() { + t = (t + 1.0hf); + return f16mat3x2(f16vec2(1.0hf, 2.0hf), f16vec2(3.0hf, 4.0hf), f16vec2(5.0hf, 6.0hf)); +} + +void f() { + f16mat3x2 tint_symbol = m(); + mat3x2 v = mat3x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..6a7d753e14 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half3x2 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = (tint_symbol_1 + 1.0h); + return half3x2(half2(1.0h, 2.0h), half2(3.0h, 4.0h), half2(5.0h, 6.0h)); +} + +void f() { + half3x2 const tint_symbol = m(); + float3x2 v = float3x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..23e54874f5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %9 = OpTypeFunction %mat3v2half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %18 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %21 = OpConstantComposite %v2half %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %24 = OpConstantComposite %v2half %half_0x1_4p_2 %half_0x1_8p_2 + %25 = OpConstantComposite %mat3v2half %18 %21 %24 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %int = OpTypeInt 32 1 + %34 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float + %45 = OpConstantNull %mat3v2float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat3v2half None %9 + %13 = OpLabel + %14 = OpLoad %half %t + %16 = OpFAdd %half %14 %half_0x1p_0 + OpStore %t %16 + OpReturnValue %25 + OpFunctionEnd + %f = OpFunction %void None %5 + %27 = OpLabel + %v = OpVariable %_ptr_Function_mat3v2float Function %45 + %28 = OpFunctionCall %mat3v2half %m + %35 = OpCompositeExtract %v2half %28 0 + %32 = OpFConvert %v2float %35 + %38 = OpCompositeExtract %v2half %28 1 + %36 = OpFConvert %v2float %38 + %41 = OpCompositeExtract %v2half %28 2 + %39 = OpFConvert %v2float %41 + %42 = OpCompositeConstruct %mat3v2float %32 %36 %39 + OpStore %v %42 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..8fc8ea0e09 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/function/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> mat3x2 { + t = (t + 1.0h); + return mat3x2(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h); +} + +fn f() { + var v : mat3x2 = mat3x2(m()); +} diff --git a/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl b/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl new file mode 100644 index 0000000000..33d50d02da --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl @@ -0,0 +1,11 @@ +enable f16; +var t : f32; +fn m() -> mat3x2 { + t = t + 1.0f; + return mat3x2(1.0f, 2.0f, + 3.0f, 4.0f, + 5.0f, 6.0f); +} +fn f() { + var v : mat3x2 = mat3x2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..01364f22e2 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float3x2 m() { + t = (t + 1.0f); + return float3x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f)); +} + +void f() { + const float3x2 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e66dee8440 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float3x2 m() { + t = (t + 1.0f); + return float3x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f)); +} + +void f() { + const float3x2 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000269ABB298F0(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..9f046389ab --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +mat3x2 m() { + t = (t + 1.0f); + return mat3x2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f), vec2(5.0f, 6.0f)); +} + +void f() { + mat3x2 tint_symbol = m(); + f16mat3x2 v = f16mat3x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..2ad53ed9a8 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float3x2 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = (tint_symbol_1 + 1.0f); + return float3x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f)); +} + +void f() { + float3x2 const tint_symbol = m(); + half3x2 v = half3x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..0fe0b73a55 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %9 = OpTypeFunction %mat3v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %18 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %21 = OpConstantComposite %v2float %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %24 = OpConstantComposite %v2float %float_5 %float_6 + %25 = OpConstantComposite %mat3v2float %18 %21 %24 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %int = OpTypeInt 32 1 + %34 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Function_mat3v2half = OpTypePointer Function %mat3v2half + %45 = OpConstantNull %mat3v2half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat3v2float None %9 + %13 = OpLabel + %14 = OpLoad %float %t + %16 = OpFAdd %float %14 %float_1 + OpStore %t %16 + OpReturnValue %25 + OpFunctionEnd + %f = OpFunction %void None %5 + %27 = OpLabel + %v = OpVariable %_ptr_Function_mat3v2half Function %45 + %28 = OpFunctionCall %mat3v2float %m + %35 = OpCompositeExtract %v2float %28 0 + %32 = OpFConvert %v2half %35 + %38 = OpCompositeExtract %v2float %28 1 + %36 = OpFConvert %v2half %38 + %41 = OpCompositeExtract %v2float %28 2 + %39 = OpFConvert %v2half %41 + %42 = OpCompositeConstruct %mat3v2half %32 %36 %39 + OpStore %v %42 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..b813e5d8e4 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/function/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f32; + +fn m() -> mat3x2 { + t = (t + 1.0f); + return mat3x2(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f); +} + +fn f() { + var v : mat3x2 = mat3x2(m()); +} diff --git a/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl b/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl new file mode 100644 index 0000000000..2553b3e49f --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl @@ -0,0 +1,4 @@ +enable f16; +var u : mat3x2 = mat3x2(mat3x2(1.0h, 2.0h, + 3.0h, 4.0h, + 5.0h, 6.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b3fcb10bdc --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 u = float3x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f)); diff --git a/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b3fcb10bdc --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 u = float3x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f)); diff --git a/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..24dc8d9cec --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3x2 u = mat3x2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f), vec2(5.0f, 6.0f)); diff --git a/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..1ea84d8813 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %6 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %9 = OpConstantComposite %v2float %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %12 = OpConstantComposite %v2float %float_5 %float_6 + %13 = OpConstantComposite %mat3v2float %6 %9 %12 +%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float + %u = OpVariable %_ptr_Private_mat3v2float Private %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..76614dfc51 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/literal/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat3x2 = mat3x2(mat3x2(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h)); diff --git a/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl b/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl new file mode 100644 index 0000000000..8d72ddbd20 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +var u : mat3x2 = mat3x2(mat3x2(1.0f, 2.0f, + 3.0f, 4.0f, + 5.0f, 6.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a2ffcfcd68 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h))); diff --git a/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0deca3a3ff --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000026E16B10460(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..710006385c --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x2 u = f16mat3x2(f16vec2(1.0hf, 2.0hf), f16vec2(3.0hf, 4.0hf), f16vec2(5.0hf, 6.0hf)); diff --git a/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7b93731a0 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %6 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %9 = OpConstantComposite %v2half %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %12 = OpConstantComposite %v2half %half_0x1_4p_2 %half_0x1_8p_2 + %13 = OpConstantComposite %mat3v2half %6 %9 %12 +%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half + %u = OpVariable %_ptr_Private_mat3v2half Private %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..0b643f7e8b --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/literal/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat3x2 = mat3x2(mat3x2(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f)); diff --git a/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl b/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl new file mode 100644 index 0000000000..daa162d27b --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl @@ -0,0 +1,7 @@ +enable f16; +var u = mat3x2(1.0h, 2.0h, + 3.0h, 4.0h, + 5.0h, 6.0h); +fn f() { + var v : mat3x2 = mat3x2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4ce211c8d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h))); + +void f() { + float3x2 v = float3x2(u); +} diff --git a/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..adac0f48da --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h))); + +void f() { + float3x2 v = float3x2(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002B0F3EB5B60(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..8f6b2d0efe --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x2 u = f16mat3x2(f16vec2(1.0hf, 2.0hf), f16vec2(3.0hf, 4.0hf), f16vec2(5.0hf, 6.0hf)); +void f() { + mat3x2 v = mat3x2(u); +} + diff --git a/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..16aa3f7426 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half3x2 tint_symbol = half3x2(half2(1.0h, 2.0h), half2(3.0h, 4.0h), half2(5.0h, 6.0h)); + float3x2 v = float3x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..fde68840d9 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %6 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %9 = OpConstantComposite %v2half %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %12 = OpConstantComposite %v2half %half_0x1_4p_2 %half_0x1_8p_2 + %13 = OpConstantComposite %mat3v2half %6 %9 %12 +%_ptr_Private_mat3v2half = OpTypePointer Private %mat3v2half + %u = OpVariable %_ptr_Private_mat3v2half Private %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %int = OpTypeInt 32 1 + %27 = OpConstantNull %int +%_ptr_Private_v2half = OpTypePointer Private %v2half + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float + %42 = OpConstantNull %mat3v2float +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %16 + %21 = OpLabel + %v = OpVariable %_ptr_Function_mat3v2float Function %42 + %29 = OpAccessChain %_ptr_Private_v2half %u %27 + %30 = OpLoad %v2half %29 + %25 = OpFConvert %v2float %30 + %33 = OpAccessChain %_ptr_Private_v2half %u %int_1 + %34 = OpLoad %v2half %33 + %31 = OpFConvert %v2float %34 + %37 = OpAccessChain %_ptr_Private_v2half %u %int_2 + %38 = OpLoad %v2half %37 + %35 = OpFConvert %v2float %38 + %39 = OpCompositeConstruct %mat3v2float %25 %31 %35 + OpStore %v %39 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..d064b8fcb0 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/var/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat3x2(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h); + +fn f() { + var v : mat3x2 = mat3x2(u); +} diff --git a/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl b/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl new file mode 100644 index 0000000000..141d6e7dcf --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +var u = mat3x2(1.0f, 2.0f, + 3.0f, 4.0f, + 5.0f, 6.0f); +fn f() { + var v : mat3x2 = mat3x2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4bbc2a1393 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 u = float3x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f)); + +void f() { + matrix v = matrix(u); +} diff --git a/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c87aeea447 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x2 u = float3x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f)); + +void f() { + matrix v = matrix(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000029207815AE0(9,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..2faacdc44d --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3x2 u = mat3x2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f), vec2(5.0f, 6.0f)); +void f() { + f16mat3x2 v = f16mat3x2(u); +} + diff --git a/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..1376800760 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float3x2 tint_symbol = float3x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f)); + half3x2 v = half3x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..2c801204fa --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %6 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %9 = OpConstantComposite %v2float %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %12 = OpConstantComposite %v2float %float_5 %float_6 + %13 = OpConstantComposite %mat3v2float %6 %9 %12 +%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float + %u = OpVariable %_ptr_Private_mat3v2float Private %13 + %void = OpTypeVoid + %16 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat3v2half = OpTypeMatrix %v2half 3 + %int = OpTypeInt 32 1 + %27 = OpConstantNull %int +%_ptr_Private_v2float = OpTypePointer Private %v2float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Function_mat3v2half = OpTypePointer Function %mat3v2half + %42 = OpConstantNull %mat3v2half +%unused_entry_point = OpFunction %void None %16 + %19 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %16 + %21 = OpLabel + %v = OpVariable %_ptr_Function_mat3v2half Function %42 + %29 = OpAccessChain %_ptr_Private_v2float %u %27 + %30 = OpLoad %v2float %29 + %25 = OpFConvert %v2half %30 + %33 = OpAccessChain %_ptr_Private_v2float %u %int_1 + %34 = OpLoad %v2float %33 + %31 = OpFConvert %v2half %34 + %37 = OpAccessChain %_ptr_Private_v2float %u %int_2 + %38 = OpLoad %v2float %37 + %35 = OpFConvert %v2half %38 + %39 = OpCompositeConstruct %mat3v2half %25 %31 %35 + OpStore %v %39 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..eba0057669 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x2/var/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat3x2(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f); + +fn f() { + var v : mat3x2 = mat3x2(u); +} diff --git a/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl b/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl new file mode 100644 index 0000000000..3801a5d1ac --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl @@ -0,0 +1,11 @@ +enable f16; +var t : f16; +fn m() -> mat3x3 { + t = t + 1.0h; + return mat3x3(1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, + 7.0h, 8.0h, 9.0h); +} +fn f() { + var v : mat3x3 = mat3x3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5b10048a34 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float3x3 v = float3x3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4bff935f92 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float3x3 v = float3x3(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000224D29B9280(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..efeb651fdc --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16mat3 m() { + t = (t + 1.0hf); + return f16mat3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf), f16vec3(7.0hf, 8.0hf, 9.0hf)); +} + +void f() { + f16mat3 tint_symbol = m(); + mat3 v = mat3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..8428cb4d95 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half3x3 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = (tint_symbol_1 + 1.0h); + return half3x3(half3(1.0h, 2.0h, 3.0h), half3(4.0h, 5.0h, 6.0h), half3(7.0h, 8.0h, 9.0h)); +} + +void f() { + half3x3 const tint_symbol = m(); + float3x3 v = float3x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..dc6d126502 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %9 = OpTypeFunction %mat3v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %19 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %23 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 + %27 = OpConstantComposite %v3half %half_0x1_cp_2 %half_0x1p_3 %half_0x1_2p_3 + %28 = OpConstantComposite %mat3v3half %19 %23 %27 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %int = OpTypeInt 32 1 + %37 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %48 = OpConstantNull %mat3v3float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat3v3half None %9 + %13 = OpLabel + %14 = OpLoad %half %t + %16 = OpFAdd %half %14 %half_0x1p_0 + OpStore %t %16 + OpReturnValue %28 + OpFunctionEnd + %f = OpFunction %void None %5 + %30 = OpLabel + %v = OpVariable %_ptr_Function_mat3v3float Function %48 + %31 = OpFunctionCall %mat3v3half %m + %38 = OpCompositeExtract %v3half %31 0 + %35 = OpFConvert %v3float %38 + %41 = OpCompositeExtract %v3half %31 1 + %39 = OpFConvert %v3float %41 + %44 = OpCompositeExtract %v3half %31 2 + %42 = OpFConvert %v3float %44 + %45 = OpCompositeConstruct %mat3v3float %35 %39 %42 + OpStore %v %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..c6cdcc5b11 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/function/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> mat3x3 { + t = (t + 1.0h); + return mat3x3(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h); +} + +fn f() { + var v : mat3x3 = mat3x3(m()); +} diff --git a/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl b/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl new file mode 100644 index 0000000000..b0a0a1dd75 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl @@ -0,0 +1,11 @@ +enable f16; +var t : f32; +fn m() -> mat3x3 { + t = t + 1.0f; + return mat3x3(1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, + 7.0f, 8.0f, 9.0f); +} +fn f() { + var v : mat3x3 = mat3x3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d76a0ab828 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float3x3 m() { + t = (t + 1.0f); + return float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); +} + +void f() { + const float3x3 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7f386dd863 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float3x3 m() { + t = (t + 1.0f); + return float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); +} + +void f() { + const float3x3 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000267AF1B7880(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..3d2a369d00 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +mat3 m() { + t = (t + 1.0f); + return mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f)); +} + +void f() { + mat3 tint_symbol = m(); + f16mat3 v = f16mat3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..e0a6c0c312 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float3x3 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = (tint_symbol_1 + 1.0f); + return float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); +} + +void f() { + float3x3 const tint_symbol = m(); + half3x3 v = half3x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..1554c2a292 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %9 = OpTypeFunction %mat3v3float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %19 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %23 = OpConstantComposite %v3float %float_4 %float_5 %float_6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %27 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %28 = OpConstantComposite %mat3v3float %19 %23 %27 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %int = OpTypeInt 32 1 + %37 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Function_mat3v3half = OpTypePointer Function %mat3v3half + %48 = OpConstantNull %mat3v3half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat3v3float None %9 + %13 = OpLabel + %14 = OpLoad %float %t + %16 = OpFAdd %float %14 %float_1 + OpStore %t %16 + OpReturnValue %28 + OpFunctionEnd + %f = OpFunction %void None %5 + %30 = OpLabel + %v = OpVariable %_ptr_Function_mat3v3half Function %48 + %31 = OpFunctionCall %mat3v3float %m + %38 = OpCompositeExtract %v3float %31 0 + %35 = OpFConvert %v3half %38 + %41 = OpCompositeExtract %v3float %31 1 + %39 = OpFConvert %v3half %41 + %44 = OpCompositeExtract %v3float %31 2 + %42 = OpFConvert %v3half %44 + %45 = OpCompositeConstruct %mat3v3half %35 %39 %42 + OpStore %v %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..83d840f67f --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/function/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f32; + +fn m() -> mat3x3 { + t = (t + 1.0f); + return mat3x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); +} + +fn f() { + var v : mat3x3 = mat3x3(m()); +} diff --git a/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl b/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl new file mode 100644 index 0000000000..06878620e6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl @@ -0,0 +1,4 @@ +enable f16; +var u : mat3x3 = mat3x3(mat3x3(1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, + 7.0h, 8.0h, 9.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b3f9ed87f8 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 u = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); diff --git a/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b3f9ed87f8 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 u = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); diff --git a/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..685ba98182 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3 u = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f)); diff --git a/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..b9828bddec --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %7 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %11 = OpConstantComposite %v3float %float_4 %float_5 %float_6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %15 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %16 = OpConstantComposite %mat3v3float %7 %11 %15 +%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float + %u = OpVariable %_ptr_Private_mat3v3float Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..1df16a9b91 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/literal/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat3x3 = mat3x3(mat3x3(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h)); diff --git a/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl b/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl new file mode 100644 index 0000000000..1c45c94742 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +var u : mat3x3 = mat3x3(mat3x3(1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, + 7.0f, 8.0f, 9.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c028f60358 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h))); diff --git a/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4bd5ba27b7 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000252573B05F0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8a2eebc2e0 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3 u = f16mat3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf), f16vec3(7.0hf, 8.0hf, 9.0hf)); diff --git a/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..f5f8649ea3 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %7 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %11 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 + %15 = OpConstantComposite %v3half %half_0x1_cp_2 %half_0x1p_3 %half_0x1_2p_3 + %16 = OpConstantComposite %mat3v3half %7 %11 %15 +%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half + %u = OpVariable %_ptr_Private_mat3v3half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..ca7ac70f64 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/literal/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat3x3 = mat3x3(mat3x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f)); diff --git a/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl b/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl new file mode 100644 index 0000000000..8dd80d75f2 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl @@ -0,0 +1,7 @@ +enable f16; +var u = mat3x3(1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, + 7.0h, 8.0h, 9.0h); +fn f() { + var v : mat3x3 = mat3x3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..064ab39924 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h))); + +void f() { + float3x3 v = float3x3(u); +} diff --git a/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..80c9bc750d --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h))); + +void f() { + float3x3 v = float3x3(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001D779876470(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..9b8f2bfbfe --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3 u = f16mat3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf), f16vec3(7.0hf, 8.0hf, 9.0hf)); +void f() { + mat3 v = mat3(u); +} + diff --git a/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..dce7f33cfd --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half3x3 tint_symbol = half3x3(half3(1.0h, 2.0h, 3.0h), half3(4.0h, 5.0h, 6.0h), half3(7.0h, 8.0h, 9.0h)); + float3x3 v = float3x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..02b5e29492 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %7 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %11 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 + %15 = OpConstantComposite %v3half %half_0x1_cp_2 %half_0x1p_3 %half_0x1_2p_3 + %16 = OpConstantComposite %mat3v3half %7 %11 %15 +%_ptr_Private_mat3v3half = OpTypePointer Private %mat3v3half + %u = OpVariable %_ptr_Private_mat3v3half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %int = OpTypeInt 32 1 + %30 = OpConstantNull %int +%_ptr_Private_v3half = OpTypePointer Private %v3half + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %45 = OpConstantNull %mat3v3float +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %19 + %24 = OpLabel + %v = OpVariable %_ptr_Function_mat3v3float Function %45 + %32 = OpAccessChain %_ptr_Private_v3half %u %30 + %33 = OpLoad %v3half %32 + %28 = OpFConvert %v3float %33 + %36 = OpAccessChain %_ptr_Private_v3half %u %int_1 + %37 = OpLoad %v3half %36 + %34 = OpFConvert %v3float %37 + %40 = OpAccessChain %_ptr_Private_v3half %u %int_2 + %41 = OpLoad %v3half %40 + %38 = OpFConvert %v3float %41 + %42 = OpCompositeConstruct %mat3v3float %28 %34 %38 + OpStore %v %42 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..98fe147c3a --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/var/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat3x3(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h); + +fn f() { + var v : mat3x3 = mat3x3(u); +} diff --git a/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl b/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl new file mode 100644 index 0000000000..45ba8c0009 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +var u = mat3x3(1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, + 7.0f, 8.0f, 9.0f); +fn f() { + var v : mat3x3 = mat3x3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..afe1005e44 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 u = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + +void f() { + matrix v = matrix(u); +} diff --git a/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..73914b85a0 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x3 u = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + +void f() { + matrix v = matrix(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000020807F65650(9,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..a01224ead6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3 u = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f)); +void f() { + f16mat3 v = f16mat3(u); +} + diff --git a/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..1b4315bea6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float3x3 tint_symbol = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)); + half3x3 v = half3x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..fc81de7390 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %7 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %11 = OpConstantComposite %v3float %float_4 %float_5 %float_6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %15 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %16 = OpConstantComposite %mat3v3float %7 %11 %15 +%_ptr_Private_mat3v3float = OpTypePointer Private %mat3v3float + %u = OpVariable %_ptr_Private_mat3v3float Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat3v3half = OpTypeMatrix %v3half 3 + %int = OpTypeInt 32 1 + %30 = OpConstantNull %int +%_ptr_Private_v3float = OpTypePointer Private %v3float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Function_mat3v3half = OpTypePointer Function %mat3v3half + %45 = OpConstantNull %mat3v3half +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %19 + %24 = OpLabel + %v = OpVariable %_ptr_Function_mat3v3half Function %45 + %32 = OpAccessChain %_ptr_Private_v3float %u %30 + %33 = OpLoad %v3float %32 + %28 = OpFConvert %v3half %33 + %36 = OpAccessChain %_ptr_Private_v3float %u %int_1 + %37 = OpLoad %v3float %36 + %34 = OpFConvert %v3half %37 + %40 = OpAccessChain %_ptr_Private_v3float %u %int_2 + %41 = OpLoad %v3float %40 + %38 = OpFConvert %v3half %41 + %42 = OpCompositeConstruct %mat3v3half %28 %34 %38 + OpStore %v %42 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..a320c9e221 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x3/var/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat3x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); + +fn f() { + var v : mat3x3 = mat3x3(u); +} diff --git a/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl b/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl new file mode 100644 index 0000000000..708402f679 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl @@ -0,0 +1,11 @@ +enable f16; +var t : f16; +fn m() -> mat3x4 { + t = t + 1.0h; + return mat3x4(1.0h, 2.0h, 3.0h, 4.0h, + 5.0h, 6.0h, 7.0h, 8.0h, + 9.0h, 10.0h, 11.0h, 12.0h); +} +fn f() { + var v : mat3x4 = mat3x4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..16a948f3aa --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h), float16_t(12.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float3x4 v = float3x4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4e718e48e3 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h), float16_t(12.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float3x4 v = float3x4(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000216C7AE7340(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..3f5cf0b9b9 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16mat3x4 m() { + t = (t + 1.0hf); + return f16mat3x4(f16vec4(1.0hf, 2.0hf, 3.0hf, 4.0hf), f16vec4(5.0hf, 6.0hf, 7.0hf, 8.0hf), f16vec4(9.0hf, 10.0hf, 11.0hf, 12.0hf)); +} + +void f() { + f16mat3x4 tint_symbol = m(); + mat3x4 v = mat3x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..9112e8bd92 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half3x4 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = (tint_symbol_1 + 1.0h); + return half3x4(half4(1.0h, 2.0h, 3.0h, 4.0h), half4(5.0h, 6.0h, 7.0h, 8.0h), half4(9.0h, 10.0h, 11.0h, 12.0h)); +} + +void f() { + half3x4 const tint_symbol = m(); + float3x4 v = float3x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..4ec86a34e1 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %9 = OpTypeFunction %mat3v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %20 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %25 = OpConstantComposite %v4half %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 +%half_0x1_8p_3 = OpConstant %half 0x1.8p+3 + %30 = OpConstantComposite %v4half %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 %half_0x1_8p_3 + %31 = OpConstantComposite %mat3v4half %20 %25 %30 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat3v4float = OpTypeMatrix %v4float 3 + %int = OpTypeInt 32 1 + %40 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %51 = OpConstantNull %mat3v4float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat3v4half None %9 + %13 = OpLabel + %14 = OpLoad %half %t + %16 = OpFAdd %half %14 %half_0x1p_0 + OpStore %t %16 + OpReturnValue %31 + OpFunctionEnd + %f = OpFunction %void None %5 + %33 = OpLabel + %v = OpVariable %_ptr_Function_mat3v4float Function %51 + %34 = OpFunctionCall %mat3v4half %m + %41 = OpCompositeExtract %v4half %34 0 + %38 = OpFConvert %v4float %41 + %44 = OpCompositeExtract %v4half %34 1 + %42 = OpFConvert %v4float %44 + %47 = OpCompositeExtract %v4half %34 2 + %45 = OpFConvert %v4float %47 + %48 = OpCompositeConstruct %mat3v4float %38 %42 %45 + OpStore %v %48 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..1edddf289e --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/function/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> mat3x4 { + t = (t + 1.0h); + return mat3x4(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h); +} + +fn f() { + var v : mat3x4 = mat3x4(m()); +} diff --git a/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl b/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl new file mode 100644 index 0000000000..892e6980e3 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl @@ -0,0 +1,11 @@ +enable f16; +var t : f32; +fn m() -> mat3x4 { + t = t + 1.0f; + return mat3x4(1.0f, 2.0f, 3.0f, 4.0f, + 5.0f, 6.0f, 7.0f, 8.0f, + 9.0f, 10.0f, 11.0f, 12.0f); +} +fn f() { + var v : mat3x4 = mat3x4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..88b81832a6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float3x4 m() { + t = (t + 1.0f); + return float3x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f)); +} + +void f() { + const float3x4 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..878092a1c8 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float3x4 m() { + t = (t + 1.0f); + return float3x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f)); +} + +void f() { + const float3x4 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001C84A702630(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..9bea84d690 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +mat3x4 m() { + t = (t + 1.0f); + return mat3x4(vec4(1.0f, 2.0f, 3.0f, 4.0f), vec4(5.0f, 6.0f, 7.0f, 8.0f), vec4(9.0f, 10.0f, 11.0f, 12.0f)); +} + +void f() { + mat3x4 tint_symbol = m(); + f16mat3x4 v = f16mat3x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..fb93df0d88 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float3x4 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = (tint_symbol_1 + 1.0f); + return float3x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f)); +} + +void f() { + float3x4 const tint_symbol = m(); + half3x4 v = half3x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..cf83de70d4 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 +%mat3v4float = OpTypeMatrix %v4float 3 + %9 = OpTypeFunction %mat3v4float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %20 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %25 = OpConstantComposite %v4float %float_5 %float_6 %float_7 %float_8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %float_12 = OpConstant %float 12 + %30 = OpConstantComposite %v4float %float_9 %float_10 %float_11 %float_12 + %31 = OpConstantComposite %mat3v4float %20 %25 %30 + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %int = OpTypeInt 32 1 + %40 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Function_mat3v4half = OpTypePointer Function %mat3v4half + %51 = OpConstantNull %mat3v4half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat3v4float None %9 + %13 = OpLabel + %14 = OpLoad %float %t + %16 = OpFAdd %float %14 %float_1 + OpStore %t %16 + OpReturnValue %31 + OpFunctionEnd + %f = OpFunction %void None %5 + %33 = OpLabel + %v = OpVariable %_ptr_Function_mat3v4half Function %51 + %34 = OpFunctionCall %mat3v4float %m + %41 = OpCompositeExtract %v4float %34 0 + %38 = OpFConvert %v4half %41 + %44 = OpCompositeExtract %v4float %34 1 + %42 = OpFConvert %v4half %44 + %47 = OpCompositeExtract %v4float %34 2 + %45 = OpFConvert %v4half %47 + %48 = OpCompositeConstruct %mat3v4half %38 %42 %45 + OpStore %v %48 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..7f2d22543b --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/function/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f32; + +fn m() -> mat3x4 { + t = (t + 1.0f); + return mat3x4(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f); +} + +fn f() { + var v : mat3x4 = mat3x4(m()); +} diff --git a/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl b/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl new file mode 100644 index 0000000000..e57ae6ca44 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl @@ -0,0 +1,4 @@ +enable f16; +var u : mat3x4 = mat3x4(mat3x4(1.0h, 2.0h, 3.0h, 4.0h, + 5.0h, 6.0h, 7.0h, 8.0h, + 9.0h, 10.0h, 11.0h, 12.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..af40379c24 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 u = float3x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f)); diff --git a/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..af40379c24 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 u = float3x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f)); diff --git a/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..8c9c104560 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3x4 u = mat3x4(vec4(1.0f, 2.0f, 3.0f, 4.0f), vec4(5.0f, 6.0f, 7.0f, 8.0f), vec4(9.0f, 10.0f, 11.0f, 12.0f)); diff --git a/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..fcdcdc72c1 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat3v4float = OpTypeMatrix %v4float 3 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %8 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %13 = OpConstantComposite %v4float %float_5 %float_6 %float_7 %float_8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %float_12 = OpConstant %float 12 + %18 = OpConstantComposite %v4float %float_9 %float_10 %float_11 %float_12 + %19 = OpConstantComposite %mat3v4float %8 %13 %18 +%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float + %u = OpVariable %_ptr_Private_mat3v4float Private %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..79bc54b88f --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/literal/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat3x4 = mat3x4(mat3x4(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h)); diff --git a/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl b/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl new file mode 100644 index 0000000000..3f4bab57c7 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl @@ -0,0 +1,4 @@ +enable f16; +var u : mat3x4 = mat3x4(mat3x4(1.0f, 2.0f, 3.0f, 4.0f, + 5.0f, 6.0f, 7.0f, 8.0f, + 9.0f, 10.0f, 11.0f, 12.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6e10b34c2b --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h), float16_t(12.0h))); diff --git a/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b101790119 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h), float16_t(12.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001A6F7BC28A0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..97cc56c1bc --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x4 u = f16mat3x4(f16vec4(1.0hf, 2.0hf, 3.0hf, 4.0hf), f16vec4(5.0hf, 6.0hf, 7.0hf, 8.0hf), f16vec4(9.0hf, 10.0hf, 11.0hf, 12.0hf)); diff --git a/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..bed7b0a4de --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %8 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %13 = OpConstantComposite %v4half %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 +%half_0x1_8p_3 = OpConstant %half 0x1.8p+3 + %18 = OpConstantComposite %v4half %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 %half_0x1_8p_3 + %19 = OpConstantComposite %mat3v4half %8 %13 %18 +%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half + %u = OpVariable %_ptr_Private_mat3v4half Private %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..dac88fe611 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/literal/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat3x4 = mat3x4(mat3x4(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f)); diff --git a/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl b/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl new file mode 100644 index 0000000000..d00be8399f --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl @@ -0,0 +1,7 @@ +enable f16; +var u = mat3x4(1.0h, 2.0h, 3.0h, 4.0h, + 5.0h, 6.0h, 7.0h, 8.0h, + 9.0h, 10.0h, 11.0h, 12.0h); +fn f() { + var v : mat3x4 = mat3x4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c3c2338cf0 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h), float16_t(12.0h))); + +void f() { + float3x4 v = float3x4(u); +} diff --git a/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..afdca8030b --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h), float16_t(12.0h))); + +void f() { + float3x4 v = float3x4(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000020E077F91B0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..6f04320ee9 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat3x4 u = f16mat3x4(f16vec4(1.0hf, 2.0hf, 3.0hf, 4.0hf), f16vec4(5.0hf, 6.0hf, 7.0hf, 8.0hf), f16vec4(9.0hf, 10.0hf, 11.0hf, 12.0hf)); +void f() { + mat3x4 v = mat3x4(u); +} + diff --git a/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..633908be34 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half3x4 tint_symbol = half3x4(half4(1.0h, 2.0h, 3.0h, 4.0h), half4(5.0h, 6.0h, 7.0h, 8.0h), half4(9.0h, 10.0h, 11.0h, 12.0h)); + float3x4 v = float3x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..b116d81078 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %8 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %13 = OpConstantComposite %v4half %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 +%half_0x1_8p_3 = OpConstant %half 0x1.8p+3 + %18 = OpConstantComposite %v4half %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 %half_0x1_8p_3 + %19 = OpConstantComposite %mat3v4half %8 %13 %18 +%_ptr_Private_mat3v4half = OpTypePointer Private %mat3v4half + %u = OpVariable %_ptr_Private_mat3v4half Private %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat3v4float = OpTypeMatrix %v4float 3 + %int = OpTypeInt 32 1 + %33 = OpConstantNull %int +%_ptr_Private_v4half = OpTypePointer Private %v4half + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float + %48 = OpConstantNull %mat3v4float +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %22 + %27 = OpLabel + %v = OpVariable %_ptr_Function_mat3v4float Function %48 + %35 = OpAccessChain %_ptr_Private_v4half %u %33 + %36 = OpLoad %v4half %35 + %31 = OpFConvert %v4float %36 + %39 = OpAccessChain %_ptr_Private_v4half %u %int_1 + %40 = OpLoad %v4half %39 + %37 = OpFConvert %v4float %40 + %43 = OpAccessChain %_ptr_Private_v4half %u %int_2 + %44 = OpLoad %v4half %43 + %41 = OpFConvert %v4float %44 + %45 = OpCompositeConstruct %mat3v4float %31 %37 %41 + OpStore %v %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..f7e04da345 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/var/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat3x4(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h); + +fn f() { + var v : mat3x4 = mat3x4(u); +} diff --git a/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl b/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl new file mode 100644 index 0000000000..b6394e4ec5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl @@ -0,0 +1,7 @@ +enable f16; +var u = mat3x4(1.0f, 2.0f, 3.0f, 4.0f, + 5.0f, 6.0f, 7.0f, 8.0f, + 9.0f, 10.0f, 11.0f, 12.0f); +fn f() { + var v : mat3x4 = mat3x4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cf0176de16 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 u = float3x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f)); + +void f() { + matrix v = matrix(u); +} diff --git a/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..988494a17a --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3x4 u = float3x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f)); + +void f() { + matrix v = matrix(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000014A025857D0(9,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..86f849f520 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat3x4 u = mat3x4(vec4(1.0f, 2.0f, 3.0f, 4.0f), vec4(5.0f, 6.0f, 7.0f, 8.0f), vec4(9.0f, 10.0f, 11.0f, 12.0f)); +void f() { + f16mat3x4 v = f16mat3x4(u); +} + diff --git a/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..be9dd55b4a --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float3x4 tint_symbol = float3x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f)); + half3x4 v = half3x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..f1b7067f7e --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 49 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat3v4float = OpTypeMatrix %v4float 3 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %8 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %13 = OpConstantComposite %v4float %float_5 %float_6 %float_7 %float_8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %float_12 = OpConstant %float 12 + %18 = OpConstantComposite %v4float %float_9 %float_10 %float_11 %float_12 + %19 = OpConstantComposite %mat3v4float %8 %13 %18 +%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float + %u = OpVariable %_ptr_Private_mat3v4float Private %19 + %void = OpTypeVoid + %22 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat3v4half = OpTypeMatrix %v4half 3 + %int = OpTypeInt 32 1 + %33 = OpConstantNull %int +%_ptr_Private_v4float = OpTypePointer Private %v4float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Function_mat3v4half = OpTypePointer Function %mat3v4half + %48 = OpConstantNull %mat3v4half +%unused_entry_point = OpFunction %void None %22 + %25 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %22 + %27 = OpLabel + %v = OpVariable %_ptr_Function_mat3v4half Function %48 + %35 = OpAccessChain %_ptr_Private_v4float %u %33 + %36 = OpLoad %v4float %35 + %31 = OpFConvert %v4half %36 + %39 = OpAccessChain %_ptr_Private_v4float %u %int_1 + %40 = OpLoad %v4float %39 + %37 = OpFConvert %v4half %40 + %43 = OpAccessChain %_ptr_Private_v4float %u %int_2 + %44 = OpLoad %v4float %43 + %41 = OpFConvert %v4half %44 + %45 = OpCompositeConstruct %mat3v4half %31 %37 %41 + OpStore %v %45 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..c53c6de252 --- /dev/null +++ b/test/tint/expressions/type_conv/mat3x4/var/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat3x4(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f); + +fn f() { + var v : mat3x4 = mat3x4(u); +} diff --git a/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl b/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl new file mode 100644 index 0000000000..d7c7ddae03 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl @@ -0,0 +1,12 @@ +enable f16; +var t : f16; +fn m() -> mat4x2 { + t = t + 1.0h; + return mat4x2(1.0h, 2.0h, + 3.0h, 4.0h, + 5.0h, 6.0h, + 7.0h, 8.0h); +} +fn f() { + var v : mat4x2 = mat4x2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3e38c5df59 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float4x2 v = float4x2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dfbad105fe --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float4x2 v = float4x2(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000228EFA57270(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..196429b1cd --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16mat4x2 m() { + t = (t + 1.0hf); + return f16mat4x2(f16vec2(1.0hf, 2.0hf), f16vec2(3.0hf, 4.0hf), f16vec2(5.0hf, 6.0hf), f16vec2(7.0hf, 8.0hf)); +} + +void f() { + f16mat4x2 tint_symbol = m(); + mat4x2 v = mat4x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..099f286011 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half4x2 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = (tint_symbol_1 + 1.0h); + return half4x2(half2(1.0h, 2.0h), half2(3.0h, 4.0h), half2(5.0h, 6.0h), half2(7.0h, 8.0h)); +} + +void f() { + half4x2 const tint_symbol = m(); + float4x2 v = float4x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..b10e29501b --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %9 = OpTypeFunction %mat4v2half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %18 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %21 = OpConstantComposite %v2half %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %24 = OpConstantComposite %v2half %half_0x1_4p_2 %half_0x1_8p_2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %27 = OpConstantComposite %v2half %half_0x1_cp_2 %half_0x1p_3 + %28 = OpConstantComposite %mat4v2half %18 %21 %24 %27 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 + %int = OpTypeInt 32 1 + %37 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float + %51 = OpConstantNull %mat4v2float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat4v2half None %9 + %13 = OpLabel + %14 = OpLoad %half %t + %16 = OpFAdd %half %14 %half_0x1p_0 + OpStore %t %16 + OpReturnValue %28 + OpFunctionEnd + %f = OpFunction %void None %5 + %30 = OpLabel + %v = OpVariable %_ptr_Function_mat4v2float Function %51 + %31 = OpFunctionCall %mat4v2half %m + %38 = OpCompositeExtract %v2half %31 0 + %35 = OpFConvert %v2float %38 + %41 = OpCompositeExtract %v2half %31 1 + %39 = OpFConvert %v2float %41 + %44 = OpCompositeExtract %v2half %31 2 + %42 = OpFConvert %v2float %44 + %47 = OpCompositeExtract %v2half %31 3 + %45 = OpFConvert %v2float %47 + %48 = OpCompositeConstruct %mat4v2float %35 %39 %42 %45 + OpStore %v %48 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..3479b7c017 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/function/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> mat4x2 { + t = (t + 1.0h); + return mat4x2(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h); +} + +fn f() { + var v : mat4x2 = mat4x2(m()); +} diff --git a/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl b/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl new file mode 100644 index 0000000000..638adf4399 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl @@ -0,0 +1,12 @@ +enable f16; +var t : f32; +fn m() -> mat4x2 { + t = t + 1.0f; + return mat4x2(1.0f, 2.0f, + 3.0f, 4.0f, + 5.0f, 6.0f, + 7.0f, 8.0f); +} +fn f() { + var v : mat4x2 = mat4x2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..445f7295bf --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float4x2 m() { + t = (t + 1.0f); + return float4x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f), float2(7.0f, 8.0f)); +} + +void f() { + const float4x2 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..882ab935d4 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float4x2 m() { + t = (t + 1.0f); + return float4x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f), float2(7.0f, 8.0f)); +} + +void f() { + const float4x2 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000026668627530(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..85e12c62d9 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +mat4x2 m() { + t = (t + 1.0f); + return mat4x2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f), vec2(5.0f, 6.0f), vec2(7.0f, 8.0f)); +} + +void f() { + mat4x2 tint_symbol = m(); + f16mat4x2 v = f16mat4x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..742a2716f5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float4x2 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = (tint_symbol_1 + 1.0f); + return float4x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f), float2(7.0f, 8.0f)); +} + +void f() { + float4x2 const tint_symbol = m(); + half4x2 v = half4x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..405e81f3b4 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 + %9 = OpTypeFunction %mat4v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %18 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %21 = OpConstantComposite %v2float %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %24 = OpConstantComposite %v2float %float_5 %float_6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %27 = OpConstantComposite %v2float %float_7 %float_8 + %28 = OpConstantComposite %mat4v2float %18 %21 %24 %27 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %int = OpTypeInt 32 1 + %37 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_mat4v2half = OpTypePointer Function %mat4v2half + %51 = OpConstantNull %mat4v2half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat4v2float None %9 + %13 = OpLabel + %14 = OpLoad %float %t + %16 = OpFAdd %float %14 %float_1 + OpStore %t %16 + OpReturnValue %28 + OpFunctionEnd + %f = OpFunction %void None %5 + %30 = OpLabel + %v = OpVariable %_ptr_Function_mat4v2half Function %51 + %31 = OpFunctionCall %mat4v2float %m + %38 = OpCompositeExtract %v2float %31 0 + %35 = OpFConvert %v2half %38 + %41 = OpCompositeExtract %v2float %31 1 + %39 = OpFConvert %v2half %41 + %44 = OpCompositeExtract %v2float %31 2 + %42 = OpFConvert %v2half %44 + %47 = OpCompositeExtract %v2float %31 3 + %45 = OpFConvert %v2half %47 + %48 = OpCompositeConstruct %mat4v2half %35 %39 %42 %45 + OpStore %v %48 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..f3c23f7a2e --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/function/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f32; + +fn m() -> mat4x2 { + t = (t + 1.0f); + return mat4x2(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f); +} + +fn f() { + var v : mat4x2 = mat4x2(m()); +} diff --git a/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl b/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl new file mode 100644 index 0000000000..cfa16416ba --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u : mat4x2 = mat4x2(mat4x2(1.0h, 2.0h, + 3.0h, 4.0h, + 5.0h, 6.0h, + 7.0h, 8.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..113c8102bd --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 u = float4x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f), float2(7.0f, 8.0f)); diff --git a/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..113c8102bd --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 u = float4x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f), float2(7.0f, 8.0f)); diff --git a/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..70e4d7b7dd --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4x2 u = mat4x2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f), vec2(5.0f, 6.0f), vec2(7.0f, 8.0f)); diff --git a/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..c35e4faf55 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %6 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %9 = OpConstantComposite %v2float %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %12 = OpConstantComposite %v2float %float_5 %float_6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %15 = OpConstantComposite %v2float %float_7 %float_8 + %16 = OpConstantComposite %mat4v2float %6 %9 %12 %15 +%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float + %u = OpVariable %_ptr_Private_mat4v2float Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..f076eab016 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/literal/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat4x2 = mat4x2(mat4x2(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h)); diff --git a/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl b/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl new file mode 100644 index 0000000000..f0213c5002 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u : mat4x2 = mat4x2(mat4x2(1.0f, 2.0f, + 3.0f, 4.0f, + 5.0f, 6.0f, + 7.0f, 8.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6e1ba5ae70 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h))); diff --git a/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1c471eac50 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000014FAA172AF0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..7075172dff --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x2 u = f16mat4x2(f16vec2(1.0hf, 2.0hf), f16vec2(3.0hf, 4.0hf), f16vec2(5.0hf, 6.0hf), f16vec2(7.0hf, 8.0hf)); diff --git a/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..95aa241fc4 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %6 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %9 = OpConstantComposite %v2half %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %12 = OpConstantComposite %v2half %half_0x1_4p_2 %half_0x1_8p_2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %15 = OpConstantComposite %v2half %half_0x1_cp_2 %half_0x1p_3 + %16 = OpConstantComposite %mat4v2half %6 %9 %12 %15 +%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half + %u = OpVariable %_ptr_Private_mat4v2half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..b86c48625b --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/literal/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat4x2 = mat4x2(mat4x2(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f)); diff --git a/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl b/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl new file mode 100644 index 0000000000..9253c6edcb --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl @@ -0,0 +1,8 @@ +enable f16; +var u = mat4x2(1.0h, 2.0h, + 3.0h, 4.0h, + 5.0h, 6.0h, + 7.0h, 8.0h); +fn f() { + var v : mat4x2 = mat4x2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bfab205c97 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h))); + +void f() { + float4x2 v = float4x2(u); +} diff --git a/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..414a76cb9e --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h)), vector(float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h))); + +void f() { + float4x2 v = float4x2(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001628F3F6160(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..d8b245867d --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x2 u = f16mat4x2(f16vec2(1.0hf, 2.0hf), f16vec2(3.0hf, 4.0hf), f16vec2(5.0hf, 6.0hf), f16vec2(7.0hf, 8.0hf)); +void f() { + mat4x2 v = mat4x2(u); +} + diff --git a/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..ff77b1c435 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half4x2 tint_symbol = half4x2(half2(1.0h, 2.0h), half2(3.0h, 4.0h), half2(5.0h, 6.0h), half2(7.0h, 8.0h)); + float4x2 v = float4x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..5082000231 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 + %6 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %9 = OpConstantComposite %v2half %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %12 = OpConstantComposite %v2half %half_0x1_4p_2 %half_0x1_8p_2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %15 = OpConstantComposite %v2half %half_0x1_cp_2 %half_0x1p_3 + %16 = OpConstantComposite %mat4v2half %6 %9 %12 %15 +%_ptr_Private_mat4v2half = OpTypePointer Private %mat4v2half + %u = OpVariable %_ptr_Private_mat4v2half Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 + %int = OpTypeInt 32 1 + %30 = OpConstantNull %int +%_ptr_Private_v2half = OpTypePointer Private %v2half + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float + %49 = OpConstantNull %mat4v2float +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %19 + %24 = OpLabel + %v = OpVariable %_ptr_Function_mat4v2float Function %49 + %32 = OpAccessChain %_ptr_Private_v2half %u %30 + %33 = OpLoad %v2half %32 + %28 = OpFConvert %v2float %33 + %36 = OpAccessChain %_ptr_Private_v2half %u %int_1 + %37 = OpLoad %v2half %36 + %34 = OpFConvert %v2float %37 + %40 = OpAccessChain %_ptr_Private_v2half %u %int_2 + %41 = OpLoad %v2half %40 + %38 = OpFConvert %v2float %41 + %44 = OpAccessChain %_ptr_Private_v2half %u %int_3 + %45 = OpLoad %v2half %44 + %42 = OpFConvert %v2float %45 + %46 = OpCompositeConstruct %mat4v2float %28 %34 %38 %42 + OpStore %v %46 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..d2c8150753 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/var/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat4x2(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h); + +fn f() { + var v : mat4x2 = mat4x2(u); +} diff --git a/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl b/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl new file mode 100644 index 0000000000..271c9f7247 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl @@ -0,0 +1,8 @@ +enable f16; +var u = mat4x2(1.0f, 2.0f, + 3.0f, 4.0f, + 5.0f, 6.0f, + 7.0f, 8.0f); +fn f() { + var v : mat4x2 = mat4x2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cf80f1de60 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 u = float4x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f), float2(7.0f, 8.0f)); + +void f() { + matrix v = matrix(u); +} diff --git a/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..90cf1dc4d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x2 u = float4x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f), float2(7.0f, 8.0f)); + +void f() { + matrix v = matrix(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002880E1B53D0(9,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..76e529d0f4 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4x2 u = mat4x2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f), vec2(5.0f, 6.0f), vec2(7.0f, 8.0f)); +void f() { + f16mat4x2 v = f16mat4x2(u); +} + diff --git a/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..556cab7bcd --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float4x2 tint_symbol = float4x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f), float2(7.0f, 8.0f)); + half4x2 v = half4x2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..005612f78b --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 50 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat4v2float = OpTypeMatrix %v2float 4 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %6 = OpConstantComposite %v2float %float_1 %float_2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %9 = OpConstantComposite %v2float %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %12 = OpConstantComposite %v2float %float_5 %float_6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %15 = OpConstantComposite %v2float %float_7 %float_8 + %16 = OpConstantComposite %mat4v2float %6 %9 %12 %15 +%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float + %u = OpVariable %_ptr_Private_mat4v2float Private %16 + %void = OpTypeVoid + %19 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %mat4v2half = OpTypeMatrix %v2half 4 + %int = OpTypeInt 32 1 + %30 = OpConstantNull %int +%_ptr_Private_v2float = OpTypePointer Private %v2float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_mat4v2half = OpTypePointer Function %mat4v2half + %49 = OpConstantNull %mat4v2half +%unused_entry_point = OpFunction %void None %19 + %22 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %19 + %24 = OpLabel + %v = OpVariable %_ptr_Function_mat4v2half Function %49 + %32 = OpAccessChain %_ptr_Private_v2float %u %30 + %33 = OpLoad %v2float %32 + %28 = OpFConvert %v2half %33 + %36 = OpAccessChain %_ptr_Private_v2float %u %int_1 + %37 = OpLoad %v2float %36 + %34 = OpFConvert %v2half %37 + %40 = OpAccessChain %_ptr_Private_v2float %u %int_2 + %41 = OpLoad %v2float %40 + %38 = OpFConvert %v2half %41 + %44 = OpAccessChain %_ptr_Private_v2float %u %int_3 + %45 = OpLoad %v2float %44 + %42 = OpFConvert %v2half %45 + %46 = OpCompositeConstruct %mat4v2half %28 %34 %38 %42 + OpStore %v %46 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..310ffb1c50 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x2/var/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat4x2(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f); + +fn f() { + var v : mat4x2 = mat4x2(u); +} diff --git a/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl b/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl new file mode 100644 index 0000000000..f536bd83e5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl @@ -0,0 +1,12 @@ +enable f16; +var t : f16; +fn m() -> mat4x3 { + t = t + 1.0h; + return mat4x3(1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, + 7.0h, 8.0h, 9.0h, + 10.0h, 11.0h, 12.0h); +} +fn f() { + var v : mat4x3 = mat4x3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5017f37238 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h)), vector(float16_t(10.0h), float16_t(11.0h), float16_t(12.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float4x3 v = float4x3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a17223b1b5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h)), vector(float16_t(10.0h), float16_t(11.0h), float16_t(12.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float4x3 v = float4x3(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002B481E37820(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..4bcf830af1 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16mat4x3 m() { + t = (t + 1.0hf); + return f16mat4x3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf), f16vec3(7.0hf, 8.0hf, 9.0hf), f16vec3(10.0hf, 11.0hf, 12.0hf)); +} + +void f() { + f16mat4x3 tint_symbol = m(); + mat4x3 v = mat4x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..4af3c85e50 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half4x3 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = (tint_symbol_1 + 1.0h); + return half4x3(half3(1.0h, 2.0h, 3.0h), half3(4.0h, 5.0h, 6.0h), half3(7.0h, 8.0h, 9.0h), half3(10.0h, 11.0h, 12.0h)); +} + +void f() { + half4x3 const tint_symbol = m(); + float4x3 v = float4x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..95d360ecf2 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %9 = OpTypeFunction %mat4v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %19 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %23 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 + %27 = OpConstantComposite %v3half %half_0x1_cp_2 %half_0x1p_3 %half_0x1_2p_3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 +%half_0x1_8p_3 = OpConstant %half 0x1.8p+3 + %31 = OpConstantComposite %v3half %half_0x1_4p_3 %half_0x1_6p_3 %half_0x1_8p_3 + %32 = OpConstantComposite %mat4v3half %19 %23 %27 %31 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %int = OpTypeInt 32 1 + %41 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %55 = OpConstantNull %mat4v3float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat4v3half None %9 + %13 = OpLabel + %14 = OpLoad %half %t + %16 = OpFAdd %half %14 %half_0x1p_0 + OpStore %t %16 + OpReturnValue %32 + OpFunctionEnd + %f = OpFunction %void None %5 + %34 = OpLabel + %v = OpVariable %_ptr_Function_mat4v3float Function %55 + %35 = OpFunctionCall %mat4v3half %m + %42 = OpCompositeExtract %v3half %35 0 + %39 = OpFConvert %v3float %42 + %45 = OpCompositeExtract %v3half %35 1 + %43 = OpFConvert %v3float %45 + %48 = OpCompositeExtract %v3half %35 2 + %46 = OpFConvert %v3float %48 + %51 = OpCompositeExtract %v3half %35 3 + %49 = OpFConvert %v3float %51 + %52 = OpCompositeConstruct %mat4v3float %39 %43 %46 %49 + OpStore %v %52 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..de5778bb4a --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/function/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> mat4x3 { + t = (t + 1.0h); + return mat4x3(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h); +} + +fn f() { + var v : mat4x3 = mat4x3(m()); +} diff --git a/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl b/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl new file mode 100644 index 0000000000..2e979e2917 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl @@ -0,0 +1,12 @@ +enable f16; +var t : f32; +fn m() -> mat4x3 { + t = t + 1.0f; + return mat4x3(1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, + 7.0f, 8.0f, 9.0f, + 10.0f, 11.0f, 12.0f); +} +fn f() { + var v : mat4x3 = mat4x3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d481deb499 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float4x3 m() { + t = (t + 1.0f); + return float4x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f), float3(10.0f, 11.0f, 12.0f)); +} + +void f() { + const float4x3 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..13133ba159 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float4x3 m() { + t = (t + 1.0f); + return float4x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f), float3(10.0f, 11.0f, 12.0f)); +} + +void f() { + const float4x3 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001AAB4DC5CD0(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..0e3afa74cb --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +mat4x3 m() { + t = (t + 1.0f); + return mat4x3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f), vec3(10.0f, 11.0f, 12.0f)); +} + +void f() { + mat4x3 tint_symbol = m(); + f16mat4x3 v = f16mat4x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..3d3dc95dd6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float4x3 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = (tint_symbol_1 + 1.0f); + return float4x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f), float3(10.0f, 11.0f, 12.0f)); +} + +void f() { + float4x3 const tint_symbol = m(); + half4x3 v = half4x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..151a5040fc --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %9 = OpTypeFunction %mat4v3float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %19 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %23 = OpConstantComposite %v3float %float_4 %float_5 %float_6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %27 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %float_12 = OpConstant %float 12 + %31 = OpConstantComposite %v3float %float_10 %float_11 %float_12 + %32 = OpConstantComposite %mat4v3float %19 %23 %27 %31 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %int = OpTypeInt 32 1 + %41 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_mat4v3half = OpTypePointer Function %mat4v3half + %55 = OpConstantNull %mat4v3half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat4v3float None %9 + %13 = OpLabel + %14 = OpLoad %float %t + %16 = OpFAdd %float %14 %float_1 + OpStore %t %16 + OpReturnValue %32 + OpFunctionEnd + %f = OpFunction %void None %5 + %34 = OpLabel + %v = OpVariable %_ptr_Function_mat4v3half Function %55 + %35 = OpFunctionCall %mat4v3float %m + %42 = OpCompositeExtract %v3float %35 0 + %39 = OpFConvert %v3half %42 + %45 = OpCompositeExtract %v3float %35 1 + %43 = OpFConvert %v3half %45 + %48 = OpCompositeExtract %v3float %35 2 + %46 = OpFConvert %v3half %48 + %51 = OpCompositeExtract %v3float %35 3 + %49 = OpFConvert %v3half %51 + %52 = OpCompositeConstruct %mat4v3half %39 %43 %46 %49 + OpStore %v %52 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..c5e39a17b3 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/function/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f32; + +fn m() -> mat4x3 { + t = (t + 1.0f); + return mat4x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f); +} + +fn f() { + var v : mat4x3 = mat4x3(m()); +} diff --git a/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl b/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl new file mode 100644 index 0000000000..e479132a72 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u : mat4x3 = mat4x3(mat4x3(1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, + 7.0h, 8.0h, 9.0h, + 10.0h, 11.0h, 12.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f964db9e9a --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 u = float4x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f), float3(10.0f, 11.0f, 12.0f)); diff --git a/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f964db9e9a --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 u = float4x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f), float3(10.0f, 11.0f, 12.0f)); diff --git a/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..08c3dd2c41 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4x3 u = mat4x3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f), vec3(10.0f, 11.0f, 12.0f)); diff --git a/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..9e5869a159 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %7 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %11 = OpConstantComposite %v3float %float_4 %float_5 %float_6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %15 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %float_12 = OpConstant %float 12 + %19 = OpConstantComposite %v3float %float_10 %float_11 %float_12 + %20 = OpConstantComposite %mat4v3float %7 %11 %15 %19 +%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float + %u = OpVariable %_ptr_Private_mat4v3float Private %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..d17063739c --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/literal/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat4x3 = mat4x3(mat4x3(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h)); diff --git a/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl b/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl new file mode 100644 index 0000000000..7f70656f11 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u : mat4x3 = mat4x3(mat4x3(1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, + 7.0f, 8.0f, 9.0f, + 10.0f, 11.0f, 12.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8863c456e5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h)), vector(float16_t(10.0h), float16_t(11.0h), float16_t(12.0h))); diff --git a/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5f4774f2ac --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h)), vector(float16_t(10.0h), float16_t(11.0h), float16_t(12.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001EACB1D01F0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..a5e172e7f1 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x3 u = f16mat4x3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf), f16vec3(7.0hf, 8.0hf, 9.0hf), f16vec3(10.0hf, 11.0hf, 12.0hf)); diff --git a/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..cc572a9ead --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %7 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %11 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 + %15 = OpConstantComposite %v3half %half_0x1_cp_2 %half_0x1p_3 %half_0x1_2p_3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 +%half_0x1_8p_3 = OpConstant %half 0x1.8p+3 + %19 = OpConstantComposite %v3half %half_0x1_4p_3 %half_0x1_6p_3 %half_0x1_8p_3 + %20 = OpConstantComposite %mat4v3half %7 %11 %15 %19 +%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half + %u = OpVariable %_ptr_Private_mat4v3half Private %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..913780101f --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/literal/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat4x3 = mat4x3(mat4x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f)); diff --git a/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl b/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl new file mode 100644 index 0000000000..be12251ae0 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl @@ -0,0 +1,8 @@ +enable f16; +var u = mat4x3(1.0h, 2.0h, 3.0h, + 4.0h, 5.0h, 6.0h, + 7.0h, 8.0h, 9.0h, + 10.0h, 11.0h, 12.0h); +fn f() { + var v : mat4x3 = mat4x3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..98245d2a8e --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h)), vector(float16_t(10.0h), float16_t(11.0h), float16_t(12.0h))); + +void f() { + float4x3 v = float4x3(u); +} diff --git a/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cdc83c7150 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h)), vector(float16_t(4.0h), float16_t(5.0h), float16_t(6.0h)), vector(float16_t(7.0h), float16_t(8.0h), float16_t(9.0h)), vector(float16_t(10.0h), float16_t(11.0h), float16_t(12.0h))); + +void f() { + float4x3 v = float4x3(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000015A33866E20(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..2698571be5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4x3 u = f16mat4x3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf), f16vec3(7.0hf, 8.0hf, 9.0hf), f16vec3(10.0hf, 11.0hf, 12.0hf)); +void f() { + mat4x3 v = mat4x3(u); +} + diff --git a/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..75503fb9f7 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half4x3 tint_symbol = half4x3(half3(1.0h, 2.0h, 3.0h), half3(4.0h, 5.0h, 6.0h), half3(7.0h, 8.0h, 9.0h), half3(10.0h, 11.0h, 12.0h)); + float4x3 v = float4x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..a584ac37ea --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 + %7 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 +%half_0x1p_2 = OpConstant %half 0x1p+2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 + %11 = OpConstantComposite %v3half %half_0x1p_2 %half_0x1_4p_2 %half_0x1_8p_2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 + %15 = OpConstantComposite %v3half %half_0x1_cp_2 %half_0x1p_3 %half_0x1_2p_3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 +%half_0x1_8p_3 = OpConstant %half 0x1.8p+3 + %19 = OpConstantComposite %v3half %half_0x1_4p_3 %half_0x1_6p_3 %half_0x1_8p_3 + %20 = OpConstantComposite %mat4v3half %7 %11 %15 %19 +%_ptr_Private_mat4v3half = OpTypePointer Private %mat4v3half + %u = OpVariable %_ptr_Private_mat4v3half Private %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %int = OpTypeInt 32 1 + %34 = OpConstantNull %int +%_ptr_Private_v3half = OpTypePointer Private %v3half + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float + %53 = OpConstantNull %mat4v3float +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %23 + %28 = OpLabel + %v = OpVariable %_ptr_Function_mat4v3float Function %53 + %36 = OpAccessChain %_ptr_Private_v3half %u %34 + %37 = OpLoad %v3half %36 + %32 = OpFConvert %v3float %37 + %40 = OpAccessChain %_ptr_Private_v3half %u %int_1 + %41 = OpLoad %v3half %40 + %38 = OpFConvert %v3float %41 + %44 = OpAccessChain %_ptr_Private_v3half %u %int_2 + %45 = OpLoad %v3half %44 + %42 = OpFConvert %v3float %45 + %48 = OpAccessChain %_ptr_Private_v3half %u %int_3 + %49 = OpLoad %v3half %48 + %46 = OpFConvert %v3float %49 + %50 = OpCompositeConstruct %mat4v3float %32 %38 %42 %46 + OpStore %v %50 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..fa7fdb2b3b --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/var/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat4x3(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h); + +fn f() { + var v : mat4x3 = mat4x3(u); +} diff --git a/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl b/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl new file mode 100644 index 0000000000..a22cb0f98e --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl @@ -0,0 +1,8 @@ +enable f16; +var u = mat4x3(1.0f, 2.0f, 3.0f, + 4.0f, 5.0f, 6.0f, + 7.0f, 8.0f, 9.0f, + 10.0f, 11.0f, 12.0f); +fn f() { + var v : mat4x3 = mat4x3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..414435a17b --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 u = float4x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f), float3(10.0f, 11.0f, 12.0f)); + +void f() { + matrix v = matrix(u); +} diff --git a/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..129b04de4a --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x3 u = float4x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f), float3(10.0f, 11.0f, 12.0f)); + +void f() { + matrix v = matrix(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000012140D82540(9,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..fea6fc4801 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4x3 u = mat4x3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f), vec3(10.0f, 11.0f, 12.0f)); +void f() { + f16mat4x3 v = f16mat4x3(u); +} + diff --git a/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..1ba9e77ef5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float4x3 tint_symbol = float4x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f), float3(10.0f, 11.0f, 12.0f)); + half4x3 v = half4x3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..0c04c31022 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat4v3float = OpTypeMatrix %v3float 4 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %7 = OpConstantComposite %v3float %float_1 %float_2 %float_3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %11 = OpConstantComposite %v3float %float_4 %float_5 %float_6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %float_9 = OpConstant %float 9 + %15 = OpConstantComposite %v3float %float_7 %float_8 %float_9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %float_12 = OpConstant %float 12 + %19 = OpConstantComposite %v3float %float_10 %float_11 %float_12 + %20 = OpConstantComposite %mat4v3float %7 %11 %15 %19 +%_ptr_Private_mat4v3float = OpTypePointer Private %mat4v3float + %u = OpVariable %_ptr_Private_mat4v3float Private %20 + %void = OpTypeVoid + %23 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 + %mat4v3half = OpTypeMatrix %v3half 4 + %int = OpTypeInt 32 1 + %34 = OpConstantNull %int +%_ptr_Private_v3float = OpTypePointer Private %v3float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_mat4v3half = OpTypePointer Function %mat4v3half + %53 = OpConstantNull %mat4v3half +%unused_entry_point = OpFunction %void None %23 + %26 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %23 + %28 = OpLabel + %v = OpVariable %_ptr_Function_mat4v3half Function %53 + %36 = OpAccessChain %_ptr_Private_v3float %u %34 + %37 = OpLoad %v3float %36 + %32 = OpFConvert %v3half %37 + %40 = OpAccessChain %_ptr_Private_v3float %u %int_1 + %41 = OpLoad %v3float %40 + %38 = OpFConvert %v3half %41 + %44 = OpAccessChain %_ptr_Private_v3float %u %int_2 + %45 = OpLoad %v3float %44 + %42 = OpFConvert %v3half %45 + %48 = OpAccessChain %_ptr_Private_v3float %u %int_3 + %49 = OpLoad %v3float %48 + %46 = OpFConvert %v3half %49 + %50 = OpCompositeConstruct %mat4v3half %32 %38 %42 %46 + OpStore %v %50 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..f3b84af202 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x3/var/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat4x3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f); + +fn f() { + var v : mat4x3 = mat4x3(u); +} diff --git a/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl b/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl new file mode 100644 index 0000000000..fd519a60b5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl @@ -0,0 +1,12 @@ +enable f16; +var t : f16; +fn m() -> mat4x4 { + t = t + 1.0h; + return mat4x4(1.0h, 2.0h, 3.0h, 4.0h, + 5.0h, 6.0h, 7.0h, 8.0h, + 9.0h, 10.0h, 11.0h, 12.0h, + 13.0h, 14.0h, 15.0h, 16.0h); +} +fn f() { + var v : mat4x4 = mat4x4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..af73a5adc3 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h), float16_t(12.0h)), vector(float16_t(13.0h), float16_t(14.0h), float16_t(15.0h), float16_t(16.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float4x4 v = float4x4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f146840c8a --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +matrix m() { + t = (t + float16_t(1.0h)); + return matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h), float16_t(12.0h)), vector(float16_t(13.0h), float16_t(14.0h), float16_t(15.0h), float16_t(16.0h))); +} + +void f() { + const matrix tint_symbol = m(); + float4x4 v = float4x4(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001A405986C50(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..14a39f14e3 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16mat4 m() { + t = (t + 1.0hf); + return f16mat4(f16vec4(1.0hf, 2.0hf, 3.0hf, 4.0hf), f16vec4(5.0hf, 6.0hf, 7.0hf, 8.0hf), f16vec4(9.0hf, 10.0hf, 11.0hf, 12.0hf), f16vec4(13.0hf, 14.0hf, 15.0hf, 16.0hf)); +} + +void f() { + f16mat4 tint_symbol = m(); + mat4 v = mat4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..49e73113a1 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half4x4 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = (tint_symbol_1 + 1.0h); + return half4x4(half4(1.0h, 2.0h, 3.0h, 4.0h), half4(5.0h, 6.0h, 7.0h, 8.0h), half4(9.0h, 10.0h, 11.0h, 12.0h), half4(13.0h, 14.0h, 15.0h, 16.0h)); +} + +void f() { + half4x4 const tint_symbol = m(); + float4x4 v = float4x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..e8aa21490b --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %9 = OpTypeFunction %mat4v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %20 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %25 = OpConstantComposite %v4half %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 +%half_0x1_8p_3 = OpConstant %half 0x1.8p+3 + %30 = OpConstantComposite %v4half %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 %half_0x1_8p_3 +%half_0x1_ap_3 = OpConstant %half 0x1.ap+3 +%half_0x1_cp_3 = OpConstant %half 0x1.cp+3 +%half_0x1_ep_3 = OpConstant %half 0x1.ep+3 +%half_0x1p_4 = OpConstant %half 0x1p+4 + %35 = OpConstantComposite %v4half %half_0x1_ap_3 %half_0x1_cp_3 %half_0x1_ep_3 %half_0x1p_4 + %36 = OpConstantComposite %mat4v4half %20 %25 %30 %35 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %int = OpTypeInt 32 1 + %45 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %59 = OpConstantNull %mat4v4float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat4v4half None %9 + %13 = OpLabel + %14 = OpLoad %half %t + %16 = OpFAdd %half %14 %half_0x1p_0 + OpStore %t %16 + OpReturnValue %36 + OpFunctionEnd + %f = OpFunction %void None %5 + %38 = OpLabel + %v = OpVariable %_ptr_Function_mat4v4float Function %59 + %39 = OpFunctionCall %mat4v4half %m + %46 = OpCompositeExtract %v4half %39 0 + %43 = OpFConvert %v4float %46 + %49 = OpCompositeExtract %v4half %39 1 + %47 = OpFConvert %v4float %49 + %52 = OpCompositeExtract %v4half %39 2 + %50 = OpFConvert %v4float %52 + %55 = OpCompositeExtract %v4half %39 3 + %53 = OpFConvert %v4float %55 + %56 = OpCompositeConstruct %mat4v4float %43 %47 %50 %53 + OpStore %v %56 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..c66678b9f2 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/function/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> mat4x4 { + t = (t + 1.0h); + return mat4x4(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h, 13.0h, 14.0h, 15.0h, 16.0h); +} + +fn f() { + var v : mat4x4 = mat4x4(m()); +} diff --git a/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl b/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl new file mode 100644 index 0000000000..ffa9c7eacb --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl @@ -0,0 +1,12 @@ +enable f16; +var t : f32; +fn m() -> mat4x4 { + t = t + 1.0f; + return mat4x4(1.0f, 2.0f, 3.0f, 4.0f, + 5.0f, 6.0f, 7.0f, 8.0f, + 9.0f, 10.0f, 11.0f, 12.0f, + 13.0f, 14.0f, 15.0f, 16.0f); +} +fn f() { + var v : mat4x4 = mat4x4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2fc0d6a101 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float4x4 m() { + t = (t + 1.0f); + return float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f)); +} + +void f() { + const float4x4 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..29c0fed0b5 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float4x4 m() { + t = (t + 1.0f); + return float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f)); +} + +void f() { + const float4x4 tint_symbol = m(); + matrix v = matrix(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000020C0B747410(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..5fc0a7ab60 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +mat4 m() { + t = (t + 1.0f); + return mat4(vec4(1.0f, 2.0f, 3.0f, 4.0f), vec4(5.0f, 6.0f, 7.0f, 8.0f), vec4(9.0f, 10.0f, 11.0f, 12.0f), vec4(13.0f, 14.0f, 15.0f, 16.0f)); +} + +void f() { + mat4 tint_symbol = m(); + f16mat4 v = f16mat4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..7a32b55579 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float4x4 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = (tint_symbol_1 + 1.0f); + return float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f)); +} + +void f() { + float4x4 const tint_symbol = m(); + half4x4 v = half4x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..58de604a85 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 60 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %9 = OpTypeFunction %mat4v4float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %20 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %25 = OpConstantComposite %v4float %float_5 %float_6 %float_7 %float_8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %float_12 = OpConstant %float 12 + %30 = OpConstantComposite %v4float %float_9 %float_10 %float_11 %float_12 + %float_13 = OpConstant %float 13 + %float_14 = OpConstant %float 14 + %float_15 = OpConstant %float 15 + %float_16 = OpConstant %float 16 + %35 = OpConstantComposite %v4float %float_13 %float_14 %float_15 %float_16 + %36 = OpConstantComposite %mat4v4float %20 %25 %30 %35 + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %int = OpTypeInt 32 1 + %45 = OpConstantNull %int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_mat4v4half = OpTypePointer Function %mat4v4half + %59 = OpConstantNull %mat4v4half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %mat4v4float None %9 + %13 = OpLabel + %14 = OpLoad %float %t + %16 = OpFAdd %float %14 %float_1 + OpStore %t %16 + OpReturnValue %36 + OpFunctionEnd + %f = OpFunction %void None %5 + %38 = OpLabel + %v = OpVariable %_ptr_Function_mat4v4half Function %59 + %39 = OpFunctionCall %mat4v4float %m + %46 = OpCompositeExtract %v4float %39 0 + %43 = OpFConvert %v4half %46 + %49 = OpCompositeExtract %v4float %39 1 + %47 = OpFConvert %v4half %49 + %52 = OpCompositeExtract %v4float %39 2 + %50 = OpFConvert %v4half %52 + %55 = OpCompositeExtract %v4float %39 3 + %53 = OpFConvert %v4half %55 + %56 = OpCompositeConstruct %mat4v4half %43 %47 %50 %53 + OpStore %v %56 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..3c6852a1ef --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/function/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f32; + +fn m() -> mat4x4 { + t = (t + 1.0f); + return mat4x4(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f); +} + +fn f() { + var v : mat4x4 = mat4x4(m()); +} diff --git a/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl b/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl new file mode 100644 index 0000000000..7a3e319752 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u : mat4x4 = mat4x4(mat4x4(1.0h, 2.0h, 3.0h, 4.0h, + 5.0h, 6.0h, 7.0h, 8.0h, + 9.0h, 10.0h, 11.0h, 12.0h, + 13.0h, 14.0h, 15.0h, 16.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..31b2306e9c --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 u = float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f)); diff --git a/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..31b2306e9c --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 u = float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f)); diff --git a/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..8c3fe10f91 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4 u = mat4(vec4(1.0f, 2.0f, 3.0f, 4.0f), vec4(5.0f, 6.0f, 7.0f, 8.0f), vec4(9.0f, 10.0f, 11.0f, 12.0f), vec4(13.0f, 14.0f, 15.0f, 16.0f)); diff --git a/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..dffe30ac26 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %8 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %13 = OpConstantComposite %v4float %float_5 %float_6 %float_7 %float_8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %float_12 = OpConstant %float 12 + %18 = OpConstantComposite %v4float %float_9 %float_10 %float_11 %float_12 + %float_13 = OpConstant %float 13 + %float_14 = OpConstant %float 14 + %float_15 = OpConstant %float 15 + %float_16 = OpConstant %float 16 + %23 = OpConstantComposite %v4float %float_13 %float_14 %float_15 %float_16 + %24 = OpConstantComposite %mat4v4float %8 %13 %18 %23 +%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float + %u = OpVariable %_ptr_Private_mat4v4float Private %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..ca4d0b861d --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/literal/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat4x4 = mat4x4(mat4x4(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h, 13.0h, 14.0h, 15.0h, 16.0h)); diff --git a/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl b/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl new file mode 100644 index 0000000000..c1e907cb8a --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u : mat4x4 = mat4x4(mat4x4(1.0f, 2.0f, 3.0f, 4.0f, + 5.0f, 6.0f, 7.0f, 8.0f, + 9.0f, 10.0f, 11.0f, 12.0f, + 13.0f, 14.0f, 15.0f, 16.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..46076c36fb --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h), float16_t(12.0h)), vector(float16_t(13.0h), float16_t(14.0h), float16_t(15.0h), float16_t(16.0h))); diff --git a/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..441b67567a --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h), float16_t(12.0h)), vector(float16_t(13.0h), float16_t(14.0h), float16_t(15.0h), float16_t(16.0h))); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000026BBBC557B0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..094e52a3fc --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4 u = f16mat4(f16vec4(1.0hf, 2.0hf, 3.0hf, 4.0hf), f16vec4(5.0hf, 6.0hf, 7.0hf, 8.0hf), f16vec4(9.0hf, 10.0hf, 11.0hf, 12.0hf), f16vec4(13.0hf, 14.0hf, 15.0hf, 16.0hf)); diff --git a/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..abaa1e5495 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %8 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %13 = OpConstantComposite %v4half %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 +%half_0x1_8p_3 = OpConstant %half 0x1.8p+3 + %18 = OpConstantComposite %v4half %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 %half_0x1_8p_3 +%half_0x1_ap_3 = OpConstant %half 0x1.ap+3 +%half_0x1_cp_3 = OpConstant %half 0x1.cp+3 +%half_0x1_ep_3 = OpConstant %half 0x1.ep+3 +%half_0x1p_4 = OpConstant %half 0x1p+4 + %23 = OpConstantComposite %v4half %half_0x1_ap_3 %half_0x1_cp_3 %half_0x1_ep_3 %half_0x1p_4 + %24 = OpConstantComposite %mat4v4half %8 %13 %18 %23 +%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half + %u = OpVariable %_ptr_Private_mat4v4half Private %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe83a96191 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/literal/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : mat4x4 = mat4x4(mat4x4(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f)); diff --git a/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl b/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl new file mode 100644 index 0000000000..85a5313ed0 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl @@ -0,0 +1,8 @@ +enable f16; +var u = mat4x4(1.0h, 2.0h, 3.0h, 4.0h, + 5.0h, 6.0h, 7.0h, 8.0h, + 9.0h, 10.0h, 11.0h, 12.0h, + 13.0h, 14.0h, 15.0h, 16.0h); +fn f() { + var v : mat4x4 = mat4x4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..64606b8b33 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h), float16_t(12.0h)), vector(float16_t(13.0h), float16_t(14.0h), float16_t(15.0h), float16_t(16.0h))); + +void f() { + float4x4 v = float4x4(u); +} diff --git a/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a2a682f2cf --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static matrix u = matrix(vector(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h), float16_t(4.0h)), vector(float16_t(5.0h), float16_t(6.0h), float16_t(7.0h), float16_t(8.0h)), vector(float16_t(9.0h), float16_t(10.0h), float16_t(11.0h), float16_t(12.0h)), vector(float16_t(13.0h), float16_t(14.0h), float16_t(15.0h), float16_t(16.0h))); + +void f() { + float4x4 v = float4x4(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000024F4DC87730(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..dfbcf46889 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16mat4 u = f16mat4(f16vec4(1.0hf, 2.0hf, 3.0hf, 4.0hf), f16vec4(5.0hf, 6.0hf, 7.0hf, 8.0hf), f16vec4(9.0hf, 10.0hf, 11.0hf, 12.0hf), f16vec4(13.0hf, 14.0hf, 15.0hf, 16.0hf)); +void f() { + mat4 v = mat4(u); +} + diff --git a/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..49daf0342e --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half4x4 tint_symbol = half4x4(half4(1.0h, 2.0h, 3.0h, 4.0h), half4(5.0h, 6.0h, 7.0h, 8.0h), half4(9.0h, 10.0h, 11.0h, 12.0h), half4(13.0h, 14.0h, 15.0h, 16.0h)); + float4x4 v = float4x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..70c71a9367 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x1p_1 = OpConstant %half 0x1p+1 +%half_0x1_8p_1 = OpConstant %half 0x1.8p+1 +%half_0x1p_2 = OpConstant %half 0x1p+2 + %8 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_1 %half_0x1_8p_1 %half_0x1p_2 +%half_0x1_4p_2 = OpConstant %half 0x1.4p+2 +%half_0x1_8p_2 = OpConstant %half 0x1.8p+2 +%half_0x1_cp_2 = OpConstant %half 0x1.cp+2 +%half_0x1p_3 = OpConstant %half 0x1p+3 + %13 = OpConstantComposite %v4half %half_0x1_4p_2 %half_0x1_8p_2 %half_0x1_cp_2 %half_0x1p_3 +%half_0x1_2p_3 = OpConstant %half 0x1.2p+3 +%half_0x1_4p_3 = OpConstant %half 0x1.4p+3 +%half_0x1_6p_3 = OpConstant %half 0x1.6p+3 +%half_0x1_8p_3 = OpConstant %half 0x1.8p+3 + %18 = OpConstantComposite %v4half %half_0x1_2p_3 %half_0x1_4p_3 %half_0x1_6p_3 %half_0x1_8p_3 +%half_0x1_ap_3 = OpConstant %half 0x1.ap+3 +%half_0x1_cp_3 = OpConstant %half 0x1.cp+3 +%half_0x1_ep_3 = OpConstant %half 0x1.ep+3 +%half_0x1p_4 = OpConstant %half 0x1p+4 + %23 = OpConstantComposite %v4half %half_0x1_ap_3 %half_0x1_cp_3 %half_0x1_ep_3 %half_0x1p_4 + %24 = OpConstantComposite %mat4v4half %8 %13 %18 %23 +%_ptr_Private_mat4v4half = OpTypePointer Private %mat4v4half + %u = OpVariable %_ptr_Private_mat4v4half Private %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %int = OpTypeInt 32 1 + %38 = OpConstantNull %int +%_ptr_Private_v4half = OpTypePointer Private %v4half + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %57 = OpConstantNull %mat4v4float +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %27 + %32 = OpLabel + %v = OpVariable %_ptr_Function_mat4v4float Function %57 + %40 = OpAccessChain %_ptr_Private_v4half %u %38 + %41 = OpLoad %v4half %40 + %36 = OpFConvert %v4float %41 + %44 = OpAccessChain %_ptr_Private_v4half %u %int_1 + %45 = OpLoad %v4half %44 + %42 = OpFConvert %v4float %45 + %48 = OpAccessChain %_ptr_Private_v4half %u %int_2 + %49 = OpLoad %v4half %48 + %46 = OpFConvert %v4float %49 + %52 = OpAccessChain %_ptr_Private_v4half %u %int_3 + %53 = OpLoad %v4half %52 + %50 = OpFConvert %v4float %53 + %54 = OpCompositeConstruct %mat4v4float %36 %42 %46 %50 + OpStore %v %54 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..6ccfb806d6 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/var/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat4x4(1.0h, 2.0h, 3.0h, 4.0h, 5.0h, 6.0h, 7.0h, 8.0h, 9.0h, 10.0h, 11.0h, 12.0h, 13.0h, 14.0h, 15.0h, 16.0h); + +fn f() { + var v : mat4x4 = mat4x4(u); +} diff --git a/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl b/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl new file mode 100644 index 0000000000..b5e0bc292d --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl @@ -0,0 +1,8 @@ +enable f16; +var u = mat4x4(1.0f, 2.0f, 3.0f, 4.0f, + 5.0f, 6.0f, 7.0f, 8.0f, + 9.0f, 10.0f, 11.0f, 12.0f, + 13.0f, 14.0f, 15.0f, 16.0f); +fn f() { + var v : mat4x4 = mat4x4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2ff3e53b78 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 u = float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f)); + +void f() { + matrix v = matrix(u); +} diff --git a/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d42d91f579 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4x4 u = float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f)); + +void f() { + matrix v = matrix(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000014F5CB159F0(9,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..3e0324dbb9 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +mat4 u = mat4(vec4(1.0f, 2.0f, 3.0f, 4.0f), vec4(5.0f, 6.0f, 7.0f, 8.0f), vec4(9.0f, 10.0f, 11.0f, 12.0f), vec4(13.0f, 14.0f, 15.0f, 16.0f)); +void f() { + f16mat4 v = f16mat4(u); +} + diff --git a/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..f9fcc8635f --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float4x4 tint_symbol = float4x4(float4(1.0f, 2.0f, 3.0f, 4.0f), float4(5.0f, 6.0f, 7.0f, 8.0f), float4(9.0f, 10.0f, 11.0f, 12.0f), float4(13.0f, 14.0f, 15.0f, 16.0f)); + half4x4 v = half4x4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..677bcafc82 --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %8 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %13 = OpConstantComposite %v4float %float_5 %float_6 %float_7 %float_8 + %float_9 = OpConstant %float 9 + %float_10 = OpConstant %float 10 + %float_11 = OpConstant %float 11 + %float_12 = OpConstant %float 12 + %18 = OpConstantComposite %v4float %float_9 %float_10 %float_11 %float_12 + %float_13 = OpConstant %float 13 + %float_14 = OpConstant %float 14 + %float_15 = OpConstant %float 15 + %float_16 = OpConstant %float 16 + %23 = OpConstantComposite %v4float %float_13 %float_14 %float_15 %float_16 + %24 = OpConstantComposite %mat4v4float %8 %13 %18 %23 +%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float + %u = OpVariable %_ptr_Private_mat4v4float Private %24 + %void = OpTypeVoid + %27 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 + %mat4v4half = OpTypeMatrix %v4half 4 + %int = OpTypeInt 32 1 + %38 = OpConstantNull %int +%_ptr_Private_v4float = OpTypePointer Private %v4float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Function_mat4v4half = OpTypePointer Function %mat4v4half + %57 = OpConstantNull %mat4v4half +%unused_entry_point = OpFunction %void None %27 + %30 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %27 + %32 = OpLabel + %v = OpVariable %_ptr_Function_mat4v4half Function %57 + %40 = OpAccessChain %_ptr_Private_v4float %u %38 + %41 = OpLoad %v4float %40 + %36 = OpFConvert %v4half %41 + %44 = OpAccessChain %_ptr_Private_v4float %u %int_1 + %45 = OpLoad %v4float %44 + %42 = OpFConvert %v4half %45 + %48 = OpAccessChain %_ptr_Private_v4float %u %int_2 + %49 = OpLoad %v4float %48 + %46 = OpFConvert %v4half %49 + %52 = OpAccessChain %_ptr_Private_v4float %u %int_3 + %53 = OpLoad %v4float %52 + %50 = OpFConvert %v4half %53 + %54 = OpCompositeConstruct %mat4v4half %36 %42 %46 %50 + OpStore %v %54 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..7b339139dc --- /dev/null +++ b/test/tint/expressions/type_conv/mat4x4/var/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = mat4x4(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f); + +fn f() { + var v : mat4x4 = mat4x4(u); +} diff --git a/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl b/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl new file mode 100644 index 0000000000..44315eda44 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : bool; +fn m() -> bool { + t = true; + return bool(t); +} +fn f() { + var v : f16 = f16(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..442fe6254a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool m() { + t = true; + return bool(t); +} + +void f() { + const bool tint_symbol = m(); + float16_t v = float16_t(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7c3af7e350 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,22 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool m() { + t = true; + return bool(t); +} + +void f() { + const bool tint_symbol = m(); + float16_t v = float16_t(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001E8286B1350(15,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001E8286B1350(15,13): error X3000: unrecognized identifier 'v' + diff --git a/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..9a556e7f59 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bool m() { + t = true; + return bool(t); +} + +void f() { + bool tint_symbol = m(); + float16_t v = float16_t(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.msl new file mode 100644 index 0000000000..13e2076156 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool(tint_symbol_1); +} + +void f() { + bool const tint_symbol = m(); + half v = half(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..cd0b8d8d15 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.spvasm @@ -0,0 +1,49 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %bool + %true = OpConstantTrue %bool + %half = OpTypeFloat 16 +%half_0x0p_0 = OpConstant %half 0x0p+0 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%_ptr_Function_half = OpTypePointer Function %half + %24 = OpConstantNull %half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %bool None %9 + %11 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_half Function %24 + %17 = OpFunctionCall %bool %m + %18 = OpSelect %half %17 %half_0x1p_0 %half_0x0p_0 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..3f3c39ae46 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : bool; + +fn m() -> bool { + t = true; + return bool(t); +} + +fn f() { + var v : f16 = f16(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl b/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl new file mode 100644 index 0000000000..bbeac79965 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl @@ -0,0 +1,8 @@ +var t : bool; +fn m() -> bool { + t = true; + return bool(t); +} +fn f() { + var v : f32 = f32(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e0eacd5c8e --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool m() { + t = true; + return bool(t); +} + +void f() { + const bool tint_symbol = m(); + float v = float(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e0eacd5c8e --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool m() { + t = true; + return bool(t); +} + +void f() { + const bool tint_symbol = m(); + float v = float(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..75fa5aa094 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bool m() { + t = true; + return bool(t); +} + +void f() { + bool tint_symbol = m(); + float v = float(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.msl new file mode 100644 index 0000000000..c6b5797093 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool(tint_symbol_1); +} + +void f() { + bool const tint_symbol = m(); + float v = float(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..706919417d --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.spvasm @@ -0,0 +1,45 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %bool + %true = OpConstantTrue %bool + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 +%_ptr_Function_float = OpTypePointer Function %float + %24 = OpConstantNull %float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %bool None %9 + %11 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_float Function %24 + %17 = OpFunctionCall %bool %m + %18 = OpSelect %float %17 %float_1 %float_0 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..14dbcd69d1 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-f32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : bool; + +fn m() -> bool { + t = true; + return bool(t); +} + +fn f() { + var v : f32 = f32(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl b/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl new file mode 100644 index 0000000000..d8968bb150 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl @@ -0,0 +1,8 @@ +var t : bool; +fn m() -> bool { + t = true; + return bool(t); +} +fn f() { + var v : i32 = i32(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..50298c71d1 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool m() { + t = true; + return bool(t); +} + +void f() { + const bool tint_symbol = m(); + int v = int(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..50298c71d1 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool m() { + t = true; + return bool(t); +} + +void f() { + const bool tint_symbol = m(); + int v = int(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..fee846b397 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bool m() { + t = true; + return bool(t); +} + +void f() { + bool tint_symbol = m(); + int v = int(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.msl new file mode 100644 index 0000000000..7c99561db4 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool(tint_symbol_1); +} + +void f() { + bool const tint_symbol = m(); + int v = int(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..79abcde77e --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.spvasm @@ -0,0 +1,45 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %bool + %true = OpConstantTrue %bool + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_int = OpTypePointer Function %int + %24 = OpConstantNull %int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %bool None %9 + %11 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_int Function %24 + %17 = OpFunctionCall %bool %m + %18 = OpSelect %int %17 %int_1 %int_0 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..126e0900d4 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-i32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : bool; + +fn m() -> bool { + t = true; + return bool(t); +} + +fn f() { + var v : i32 = i32(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl b/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl new file mode 100644 index 0000000000..ebaa1bb6d1 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl @@ -0,0 +1,8 @@ +var t : bool; +fn m() -> bool { + t = true; + return bool(t); +} +fn f() { + var v : u32 = u32(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0379cac3f3 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool m() { + t = true; + return bool(t); +} + +void f() { + const bool tint_symbol = m(); + uint v = uint(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0379cac3f3 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool m() { + t = true; + return bool(t); +} + +void f() { + const bool tint_symbol = m(); + uint v = uint(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..c79176d367 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bool m() { + t = true; + return bool(t); +} + +void f() { + bool tint_symbol = m(); + uint v = uint(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.msl new file mode 100644 index 0000000000..4a602ec391 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool(tint_symbol_1); +} + +void f() { + bool const tint_symbol = m(); + uint v = uint(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..a6fac1bf43 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.spvasm @@ -0,0 +1,45 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %bool + %true = OpConstantTrue %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint + %24 = OpConstantNull %uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %bool None %9 + %11 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_uint Function %24 + %17 = OpFunctionCall %bool %m + %18 = OpSelect %uint %17 %uint_1 %uint_0 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..dd3cdcdfdc --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/bool-u32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : bool; + +fn m() -> bool { + t = true; + return bool(t); +} + +fn f() { + var v : u32 = u32(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl b/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl new file mode 100644 index 0000000000..daaf953d1c --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> f16 { + t = 1.0h; + return f16(t); +} +fn f() { + var v : bool = bool(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..318920fa37 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +float16_t m() { + t = float16_t(1.0h); + return float16_t(t); +} + +void f() { + const float16_t tint_symbol = m(); + bool v = bool(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..da6c51e45a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +float16_t m() { + t = float16_t(1.0h); + return float16_t(t); +} + +void f() { + const float16_t tint_symbol = m(); + bool v = bool(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000020415C557F0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..d67520d324 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +float16_t m() { + t = 1.0hf; + return float16_t(t); +} + +void f() { + float16_t tint_symbol = m(); + bool v = bool(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.msl new file mode 100644 index 0000000000..4d003562bd --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half(tint_symbol_1); +} + +void f() { + half const tint_symbol = m(); + bool v = bool(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..75682fa662 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %half None %9 + %11 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_bool Function %22 + %17 = OpFunctionCall %half %m + %18 = OpFUnordNotEqual %bool %17 %4 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..58208cddfb --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-bool.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> f16 { + t = 1.0h; + return f16(t); +} + +fn f() { + var v : bool = bool(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl b/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl new file mode 100644 index 0000000000..001868bee1 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> f16 { + t = 1.0h; + return f16(t); +} +fn f() { + var v : f32 = f32(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d3c968774a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +float16_t m() { + t = float16_t(1.0h); + return float16_t(t); +} + +void f() { + const float16_t tint_symbol = m(); + float v = float(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b7f6eb08fa --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +float16_t m() { + t = float16_t(1.0h); + return float16_t(t); +} + +void f() { + const float16_t tint_symbol = m(); + float v = float(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001CFE5701350(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..9378f6442a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +float16_t m() { + t = 1.0hf; + return float16_t(t); +} + +void f() { + float16_t tint_symbol = m(); + float v = float(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..18a11d6cef --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half(tint_symbol_1); +} + +void f() { + half const tint_symbol = m(); + float v = float(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..39fa87186c --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpConstantNull %float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %half None %9 + %11 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_float Function %22 + %17 = OpFunctionCall %half %m + %18 = OpFConvert %float %17 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..f8b24d18a0 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> f16 { + t = 1.0h; + return f16(t); +} + +fn f() { + var v : f32 = f32(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl new file mode 100644 index 0000000000..532dac6b6a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> f16 { + t = 1.0h; + return f16(t); +} +fn f() { + var v : i32 = i32(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c4a82c7228 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +float16_t m() { + t = float16_t(1.0h); + return float16_t(t); +} + +void f() { + const float16_t tint_symbol = m(); + int v = int(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..97ff042c71 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +float16_t m() { + t = float16_t(1.0h); + return float16_t(t); +} + +void f() { + const float16_t tint_symbol = m(); + int v = int(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001E819715600(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..c22be1bb79 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +float16_t m() { + t = 1.0hf; + return float16_t(t); +} + +void f() { + float16_t tint_symbol = m(); + int v = int(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.msl new file mode 100644 index 0000000000..44bc84b0c2 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half(tint_symbol_1); +} + +void f() { + half const tint_symbol = m(); + int v = int(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..cc4e8d1bab --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %half None %9 + %11 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_int Function %22 + %17 = OpFunctionCall %half %m + %18 = OpConvertFToS %int %17 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..e9aa6ba50e --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-i32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> f16 { + t = 1.0h; + return f16(t); +} + +fn f() { + var v : i32 = i32(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl new file mode 100644 index 0000000000..4918b25ea9 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> f16 { + t = 1.0h; + return f16(t); +} +fn f() { + var v : u32 = u32(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..79afb41969 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +float16_t m() { + t = float16_t(1.0h); + return float16_t(t); +} + +void f() { + const float16_t tint_symbol = m(); + uint v = uint(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..08fc672e7d --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +float16_t m() { + t = float16_t(1.0h); + return float16_t(t); +} + +void f() { + const float16_t tint_symbol = m(); + uint v = uint(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001DAF6968AE0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..214d18264d --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +float16_t m() { + t = 1.0hf; + return float16_t(t); +} + +void f() { + float16_t tint_symbol = m(); + uint v = uint(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.msl new file mode 100644 index 0000000000..5d8e34bc47 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half(tint_symbol_1); +} + +void f() { + half const tint_symbol = m(); + uint v = uint(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..7fec91f684 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %22 = OpConstantNull %uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %half None %9 + %11 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_uint Function %22 + %17 = OpFunctionCall %half %m + %18 = OpConvertFToU %uint %17 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..994fc13ec1 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f16-u32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> f16 { + t = 1.0h; + return f16(t); +} + +fn f() { + var v : u32 = u32(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl b/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl new file mode 100644 index 0000000000..523cfbe843 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl @@ -0,0 +1,8 @@ +var t : f32; +fn m() -> f32 { + t = 1.0f; + return f32(t); +} +fn f() { + var v : bool = bool(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a714e0ddfa --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float m() { + t = 1.0f; + return float(t); +} + +void f() { + const float tint_symbol = m(); + bool v = bool(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a714e0ddfa --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float m() { + t = 1.0f; + return float(t); +} + +void f() { + const float tint_symbol = m(); + bool v = bool(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..e4acfc622c --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +float m() { + t = 1.0f; + return float(t); +} + +void f() { + float tint_symbol = m(); + bool v = bool(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..3a2a4b51ff --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float(tint_symbol_1); +} + +void f() { + float const tint_symbol = m(); + bool v = bool(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..89c2f6b72e --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %float None %9 + %11 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_bool Function %22 + %17 = OpFunctionCall %float %m + %18 = OpFUnordNotEqual %bool %17 %4 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..09afcde63c --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-bool.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : f32; + +fn m() -> f32 { + t = 1.0f; + return f32(t); +} + +fn f() { + var v : bool = bool(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl b/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl new file mode 100644 index 0000000000..524f1d9d96 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f32; +fn m() -> f32 { + t = 1.0f; + return f32(t); +} +fn f() { + var v : f16 = f16(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0b6428dd79 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float m() { + t = 1.0f; + return float(t); +} + +void f() { + const float tint_symbol = m(); + float16_t v = float16_t(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..acaff84a23 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,22 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float m() { + t = 1.0f; + return float(t); +} + +void f() { + const float tint_symbol = m(); + float16_t v = float16_t(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002636E171350(15,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002636E171350(15,13): error X3000: unrecognized identifier 'v' + diff --git a/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..12b7a0d2dd --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +float m() { + t = 1.0f; + return float(t); +} + +void f() { + float tint_symbol = m(); + float16_t v = float16_t(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..a65e58651c --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float(tint_symbol_1); +} + +void f() { + float const tint_symbol = m(); + half v = half(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..a9ab8dea21 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %float + %float_1 = OpConstant %float 1 + %half = OpTypeFloat 16 +%_ptr_Function_half = OpTypePointer Function %half + %22 = OpConstantNull %half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %float None %9 + %11 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_half Function %22 + %17 = OpFunctionCall %float %m + %18 = OpFConvert %half %17 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..18e3f13862 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f32; + +fn m() -> f32 { + t = 1.0f; + return f32(t); +} + +fn f() { + var v : f16 = f16(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl new file mode 100644 index 0000000000..20ba445549 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl @@ -0,0 +1,8 @@ +var t : f32; +fn m() -> f32 { + t = 1.0f; + return f32(t); +} +fn f() { + var v : i32 = i32(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4fc15597e6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float m() { + t = 1.0f; + return float(t); +} + +void f() { + const float tint_symbol = m(); + int v = int(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4fc15597e6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float m() { + t = 1.0f; + return float(t); +} + +void f() { + const float tint_symbol = m(); + int v = int(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..ce31d14055 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +float m() { + t = 1.0f; + return float(t); +} + +void f() { + float tint_symbol = m(); + int v = int(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..2b22db516f --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float(tint_symbol_1); +} + +void f() { + float const tint_symbol = m(); + int v = int(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..60009a1151 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %float None %9 + %11 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_int Function %22 + %17 = OpFunctionCall %float %m + %18 = OpConvertFToS %int %17 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..51e40e43fe --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-i32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : f32; + +fn m() -> f32 { + t = 1.0f; + return f32(t); +} + +fn f() { + var v : i32 = i32(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl new file mode 100644 index 0000000000..68354f0706 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl @@ -0,0 +1,8 @@ +var t : f32; +fn m() -> f32 { + t = 1.0f; + return f32(t); +} +fn f() { + var v : u32 = u32(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7272ba58be --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float m() { + t = 1.0f; + return float(t); +} + +void f() { + const float tint_symbol = m(); + uint v = uint(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7272ba58be --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float m() { + t = 1.0f; + return float(t); +} + +void f() { + const float tint_symbol = m(); + uint v = uint(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..c91caf0817 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +float m() { + t = 1.0f; + return float(t); +} + +void f() { + float tint_symbol = m(); + uint v = uint(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..d4324eee58 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float(tint_symbol_1); +} + +void f() { + float const tint_symbol = m(); + uint v = uint(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..1a72c47987 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %float + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %22 = OpConstantNull %uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %float None %9 + %11 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_uint Function %22 + %17 = OpFunctionCall %float %m + %18 = OpConvertFToU %uint %17 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..21680946d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/f32-u32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : f32; + +fn m() -> f32 { + t = 1.0f; + return f32(t); +} + +fn f() { + var v : u32 = u32(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl b/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl new file mode 100644 index 0000000000..e184404df4 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl @@ -0,0 +1,8 @@ +var t : i32; +fn m() -> i32 { + t = 1i; + return i32(t); +} +fn f() { + var v : bool = bool(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..425981a082 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int m() { + t = 1; + return int(t); +} + +void f() { + const int tint_symbol = m(); + bool v = bool(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..425981a082 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int m() { + t = 1; + return int(t); +} + +void f() { + const int tint_symbol = m(); + bool v = bool(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..ab58ee7a00 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +int m() { + t = 1; + return int(t); +} + +void f() { + int tint_symbol = m(); + bool v = bool(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..cf8299431d --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int(tint_symbol_1); +} + +void f() { + int const tint_symbol = m(); + bool v = bool(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..e7d2a6725e --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %int None %9 + %11 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_bool Function %22 + %17 = OpFunctionCall %int %m + %18 = OpINotEqual %bool %17 %4 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..c65ee31c9b --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-bool.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : i32; + +fn m() -> i32 { + t = 1i; + return i32(t); +} + +fn f() { + var v : bool = bool(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl b/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl new file mode 100644 index 0000000000..1c6f3201f8 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : i32; +fn m() -> i32 { + t = 1i; + return i32(t); +} +fn f() { + var v : f16 = f16(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..12e6786efb --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int m() { + t = 1; + return int(t); +} + +void f() { + const int tint_symbol = m(); + float16_t v = float16_t(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5409726efc --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,22 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int m() { + t = 1; + return int(t); +} + +void f() { + const int tint_symbol = m(); + float16_t v = float16_t(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000029BAA431590(15,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000029BAA431590(15,13): error X3000: unrecognized identifier 'v' + diff --git a/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..aa70eaf9ba --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +int m() { + t = 1; + return int(t); +} + +void f() { + int tint_symbol = m(); + float16_t v = float16_t(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..cfccce05af --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int(tint_symbol_1); +} + +void f() { + int const tint_symbol = m(); + half v = half(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..e0d973a3e7 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %int + %int_1 = OpConstant %int 1 + %half = OpTypeFloat 16 +%_ptr_Function_half = OpTypePointer Function %half + %22 = OpConstantNull %half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %int None %9 + %11 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_half Function %22 + %17 = OpFunctionCall %int %m + %18 = OpConvertSToF %half %17 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..c88c363df0 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : i32; + +fn m() -> i32 { + t = 1i; + return i32(t); +} + +fn f() { + var v : f16 = f16(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl b/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl new file mode 100644 index 0000000000..19f8e5bd55 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl @@ -0,0 +1,8 @@ +var t : i32; +fn m() -> i32 { + t = 1i; + return i32(t); +} +fn f() { + var v : f32 = f32(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bc986804b5 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int m() { + t = 1; + return int(t); +} + +void f() { + const int tint_symbol = m(); + float v = float(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bc986804b5 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int m() { + t = 1; + return int(t); +} + +void f() { + const int tint_symbol = m(); + float v = float(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..78ac06a4c8 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +int m() { + t = 1; + return int(t); +} + +void f() { + int tint_symbol = m(); + float v = float(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..a2b48e04ff --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int(tint_symbol_1); +} + +void f() { + int const tint_symbol = m(); + float v = float(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..e9321ed921 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %int + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpConstantNull %float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %int None %9 + %11 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_float Function %22 + %17 = OpFunctionCall %int %m + %18 = OpConvertSToF %float %17 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..7dfd41b588 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-f32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : i32; + +fn m() -> i32 { + t = 1i; + return i32(t); +} + +fn f() { + var v : f32 = f32(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl b/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl new file mode 100644 index 0000000000..7e37889db9 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl @@ -0,0 +1,8 @@ +var t : i32; +fn m() -> i32 { + t = 1i; + return i32(t); +} +fn f() { + var v : u32 = u32(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ed9dc2cc61 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int m() { + t = 1; + return int(t); +} + +void f() { + const int tint_symbol = m(); + uint v = uint(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ed9dc2cc61 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int m() { + t = 1; + return int(t); +} + +void f() { + const int tint_symbol = m(); + uint v = uint(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..aebf5d04fc --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +int m() { + t = 1; + return int(t); +} + +void f() { + int tint_symbol = m(); + uint v = uint(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..f295700973 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int(tint_symbol_1); +} + +void f() { + int const tint_symbol = m(); + uint v = uint(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..2044877cce --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %22 = OpConstantNull %uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %int None %9 + %11 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_uint Function %22 + %17 = OpFunctionCall %int %m + %18 = OpBitcast %uint %17 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..2073153d86 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/i32-u32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : i32; + +fn m() -> i32 { + t = 1i; + return i32(t); +} + +fn f() { + var v : u32 = u32(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl b/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl new file mode 100644 index 0000000000..3a01c45128 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl @@ -0,0 +1,8 @@ +var t : u32; +fn m() -> u32 { + t = 1u; + return u32(t); +} +fn f() { + var v : bool = bool(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cc307df873 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint m() { + t = 1u; + return uint(t); +} + +void f() { + const uint tint_symbol = m(); + bool v = bool(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cc307df873 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint m() { + t = 1u; + return uint(t); +} + +void f() { + const uint tint_symbol = m(); + bool v = bool(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..4a04f86b53 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uint m() { + t = 1u; + return uint(t); +} + +void f() { + uint tint_symbol = m(); + bool v = bool(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..46cd474072 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint(tint_symbol_1); +} + +void f() { + uint const tint_symbol = m(); + bool v = bool(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..87b0133ec8 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %22 = OpConstantNull %bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %uint None %9 + %11 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_bool Function %22 + %17 = OpFunctionCall %uint %m + %18 = OpINotEqual %bool %17 %4 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..5bd0e629f1 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-bool.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : u32; + +fn m() -> u32 { + t = 1u; + return u32(t); +} + +fn f() { + var v : bool = bool(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl b/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl new file mode 100644 index 0000000000..e27ba7432b --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : u32; +fn m() -> u32 { + t = 1u; + return u32(t); +} +fn f() { + var v : f16 = f16(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..629132edd9 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint m() { + t = 1u; + return uint(t); +} + +void f() { + const uint tint_symbol = m(); + float16_t v = float16_t(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9ce1f010f0 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,22 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint m() { + t = 1u; + return uint(t); +} + +void f() { + const uint tint_symbol = m(); + float16_t v = float16_t(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000027A60011350(15,3-11): error X3000: unrecognized identifier 'float16_t' +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000027A60011350(15,13): error X3000: unrecognized identifier 'v' + diff --git a/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..28856ada19 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uint m() { + t = 1u; + return uint(t); +} + +void f() { + uint tint_symbol = m(); + float16_t v = float16_t(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..d609ec8172 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint(tint_symbol_1); +} + +void f() { + uint const tint_symbol = m(); + half v = half(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..0676da42a5 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %uint + %uint_1 = OpConstant %uint 1 + %half = OpTypeFloat 16 +%_ptr_Function_half = OpTypePointer Function %half + %22 = OpConstantNull %half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %uint None %9 + %11 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_half Function %22 + %17 = OpFunctionCall %uint %m + %18 = OpConvertUToF %half %17 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..b97e57c99c --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : u32; + +fn m() -> u32 { + t = 1u; + return u32(t); +} + +fn f() { + var v : f16 = f16(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl b/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl new file mode 100644 index 0000000000..2ed51ecf8b --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl @@ -0,0 +1,8 @@ +var t : u32; +fn m() -> u32 { + t = 1u; + return u32(t); +} +fn f() { + var v : f32 = f32(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b826ab8379 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint m() { + t = 1u; + return uint(t); +} + +void f() { + const uint tint_symbol = m(); + float v = float(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b826ab8379 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint m() { + t = 1u; + return uint(t); +} + +void f() { + const uint tint_symbol = m(); + float v = float(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..1b9173806d --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uint m() { + t = 1u; + return uint(t); +} + +void f() { + uint tint_symbol = m(); + float v = float(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..90b2f09f37 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint(tint_symbol_1); +} + +void f() { + uint const tint_symbol = m(); + float v = float(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..4c396caee7 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %uint + %uint_1 = OpConstant %uint 1 + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %22 = OpConstantNull %float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %uint None %9 + %11 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_float Function %22 + %17 = OpFunctionCall %uint %m + %18 = OpConvertUToF %float %17 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..46780eebad --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-f32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : u32; + +fn m() -> u32 { + t = 1u; + return u32(t); +} + +fn f() { + var v : f32 = f32(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl b/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl new file mode 100644 index 0000000000..dd6f7883da --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl @@ -0,0 +1,8 @@ +var t : u32; +fn m() -> u32 { + t = 1u; + return u32(t); +} +fn f() { + var v : i32 = i32(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..83b68d8037 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint m() { + t = 1u; + return uint(t); +} + +void f() { + const uint tint_symbol = m(); + int v = int(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..83b68d8037 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint m() { + t = 1u; + return uint(t); +} + +void f() { + const uint tint_symbol = m(); + int v = int(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..87cb6067ba --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uint m() { + t = 1u; + return uint(t); +} + +void f() { + uint tint_symbol = m(); + int v = int(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..48e8bcd5d2 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint(tint_symbol_1); +} + +void f() { + uint const tint_symbol = m(); + int v = int(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..7198e7a7a5 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.spvasm @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %9 = OpTypeFunction %uint + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %22 = OpConstantNull %int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %uint None %9 + %11 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + OpReturnValue %14 + OpFunctionEnd + %f = OpFunction %void None %5 + %16 = OpLabel + %v = OpVariable %_ptr_Function_int Function %22 + %17 = OpFunctionCall %uint %m + %18 = OpBitcast %int %17 + OpStore %v %18 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..d95289bf6c --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/function/u32-i32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : u32; + +fn m() -> u32 { + t = 1u; + return u32(t); +} + +fn f() { + var v : i32 = i32(m()); +} diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl b/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl new file mode 100644 index 0000000000..1a0533b580 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : f16 = f16(bool(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a02e35fd0a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..12226e25d3 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001F86D5128C0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8086693aec --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t u = 1.0hf; diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba65b6c8d1 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.spvasm @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%_ptr_Private_half = OpTypePointer Private %half + %u = OpVariable %_ptr_Private_half Private %half_0x1p_0 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..3bde2f0a44 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : f16 = f16(bool(true)); diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl b/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl new file mode 100644 index 0000000000..d3b414b0f4 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl @@ -0,0 +1 @@ +var u : f32 = f32(bool(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b287159390 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b287159390 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..fa9c99c916 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float u = 1.0f; diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..4a79de0618 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Private_float = OpTypePointer Private %float + %u = OpVariable %_ptr_Private_float Private %float_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..2431d42c4f --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : f32 = f32(bool(true)); diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl b/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl new file mode 100644 index 0000000000..ee7b4dfe60 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl @@ -0,0 +1 @@ +var u : i32 = i32(bool(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..32749c4b8a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..32749c4b8a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..586ab74a60 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int u = 1; diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..ed2b05ba52 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Private_int = OpTypePointer Private %int + %u = OpVariable %_ptr_Private_int Private %int_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..323307f9e8 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-i32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : i32 = i32(bool(true)); diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl b/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl new file mode 100644 index 0000000000..8e355a4c53 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl @@ -0,0 +1 @@ +var u : u32 = u32(bool(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7e6b2d6c21 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7e6b2d6c21 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..f5ccf4a2bc --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint u = 1u; diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..e928251ee7 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_uint = OpTypePointer Private %uint + %u = OpVariable %_ptr_Private_uint Private %uint_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..a8833baad5 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/bool-u32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : u32 = u32(bool(true)); diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl b/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl new file mode 100644 index 0000000000..141f7574ab --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : bool = bool(f16(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..327c4d2d2b --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..327c4d2d2b --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..6f62c92356 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool u = true; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..921b1a6604 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.spvasm @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Private_bool = OpTypePointer Private %bool + %u = OpVariable %_ptr_Private_bool Private %true + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..24b09041c6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-bool.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : bool = bool(f16(1.0h)); diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl b/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl new file mode 100644 index 0000000000..512647f9a0 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : f32 = f32(f16(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b287159390 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b287159390 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..a72fdcdbc1 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float u = 1.0f; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..4eaed2735a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Private_float = OpTypePointer Private %float + %u = OpVariable %_ptr_Private_float Private %float_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..552f0af159 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : f32 = f32(f16(1.0h)); diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl b/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl new file mode 100644 index 0000000000..f497be739d --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : i32 = i32(f16(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..32749c4b8a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..32749c4b8a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..37207effee --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int u = 1; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..2d4246d1af --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.spvasm @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Private_int = OpTypePointer Private %int + %u = OpVariable %_ptr_Private_int Private %int_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..6399f203a2 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-i32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : i32 = i32(f16(1.0h)); diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl b/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl new file mode 100644 index 0000000000..653ef0b968 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : u32 = u32(f16(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7e6b2d6c21 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7e6b2d6c21 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..1210b101af --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint u = 1u; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..202e054c51 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.spvasm @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_uint = OpTypePointer Private %uint + %u = OpVariable %_ptr_Private_uint Private %uint_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..9b05580426 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f16-u32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : u32 = u32(f16(1.0h)); diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl b/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl new file mode 100644 index 0000000000..5449839e35 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl @@ -0,0 +1 @@ +var u : bool = bool(f32(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..327c4d2d2b --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..327c4d2d2b --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..454d878c11 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool u = true; diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..e3ac0379cd --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Private_bool = OpTypePointer Private %bool + %u = OpVariable %_ptr_Private_bool Private %true + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c731d4d77 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-bool.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : bool = bool(f32(1.0f)); diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl b/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl new file mode 100644 index 0000000000..c77233a031 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : f16 = f16(f32(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a02e35fd0a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f4351d7350 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001E657EE6CC0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8086693aec --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t u = 1.0hf; diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba65b6c8d1 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%_ptr_Private_half = OpTypePointer Private %half + %u = OpVariable %_ptr_Private_half Private %half_0x1p_0 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..758a1020b8 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : f16 = f16(f32(1.0f)); diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl b/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl new file mode 100644 index 0000000000..6dc69531ef --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl @@ -0,0 +1 @@ +var u : i32 = i32(f32(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..32749c4b8a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..32749c4b8a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..586ab74a60 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int u = 1; diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..ed2b05ba52 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Private_int = OpTypePointer Private %int + %u = OpVariable %_ptr_Private_int Private %int_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..c6e43f7981 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-i32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : i32 = i32(f32(1.0f)); diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl b/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl new file mode 100644 index 0000000000..e99f9fae92 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl @@ -0,0 +1 @@ +var u : u32 = u32(f32(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7e6b2d6c21 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7e6b2d6c21 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..f5ccf4a2bc --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint u = 1u; diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..e928251ee7 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_uint = OpTypePointer Private %uint + %u = OpVariable %_ptr_Private_uint Private %uint_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..bdeebe71e1 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/f32-u32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : u32 = u32(f32(1.0f)); diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl b/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl new file mode 100644 index 0000000000..3b5cb95291 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl @@ -0,0 +1 @@ +var u : bool = bool(i32(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..327c4d2d2b --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..327c4d2d2b --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..454d878c11 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool u = true; diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..e3ac0379cd --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Private_bool = OpTypePointer Private %bool + %u = OpVariable %_ptr_Private_bool Private %true + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..94be66ba37 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-bool.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : bool = bool(i32(1i)); diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl b/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl new file mode 100644 index 0000000000..dca2e05632 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : f16 = f16(i32(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a02e35fd0a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b4d0214057 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000142B88027F0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8086693aec --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t u = 1.0hf; diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba65b6c8d1 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.spvasm @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%_ptr_Private_half = OpTypePointer Private %half + %u = OpVariable %_ptr_Private_half Private %half_0x1p_0 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..0b32d74353 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : f16 = f16(i32(1i)); diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl b/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl new file mode 100644 index 0000000000..a0a0ae6259 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl @@ -0,0 +1 @@ +var u : f32 = f32(i32(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b287159390 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b287159390 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..fa9c99c916 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float u = 1.0f; diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..4a79de0618 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Private_float = OpTypePointer Private %float + %u = OpVariable %_ptr_Private_float Private %float_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..67c9548c07 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : f32 = f32(i32(1i)); diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl b/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl new file mode 100644 index 0000000000..f0d6674cbb --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl @@ -0,0 +1 @@ +var u : u32 = u32(i32(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7e6b2d6c21 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7e6b2d6c21 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..f5ccf4a2bc --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint u = 1u; diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..e928251ee7 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_uint = OpTypePointer Private %uint + %u = OpVariable %_ptr_Private_uint Private %uint_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..af0f9b7dc7 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/i32-u32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : u32 = u32(i32(1i)); diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl b/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl new file mode 100644 index 0000000000..ecdeb2aa0e --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl @@ -0,0 +1 @@ +var u : bool = bool(u32(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..327c4d2d2b --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..327c4d2d2b --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..454d878c11 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool u = true; diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..e3ac0379cd --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Private_bool = OpTypePointer Private %bool + %u = OpVariable %_ptr_Private_bool Private %true + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..bdd53930c0 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-bool.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : bool = bool(u32(1u)); diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl b/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl new file mode 100644 index 0000000000..fdd14faacd --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : f16 = f16(u32(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a02e35fd0a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5b64979f9a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002034FAF6CC0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8086693aec --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t u = 1.0hf; diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..ba65b6c8d1 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.spvasm @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%_ptr_Private_half = OpTypePointer Private %half + %u = OpVariable %_ptr_Private_half Private %half_0x1p_0 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..f0d45d7e15 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : f16 = f16(u32(1u)); diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl b/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl new file mode 100644 index 0000000000..45ed98f18a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl @@ -0,0 +1 @@ +var u : f32 = f32(u32(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b287159390 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b287159390 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..fa9c99c916 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float u = 1.0f; diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..4a79de0618 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Private_float = OpTypePointer Private %float + %u = OpVariable %_ptr_Private_float Private %float_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..6c73ec691e --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : f32 = f32(u32(1u)); diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl b/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl new file mode 100644 index 0000000000..9bc418bbf0 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl @@ -0,0 +1 @@ +var u : i32 = i32(u32(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..32749c4b8a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..32749c4b8a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..586ab74a60 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int u = 1; diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..ed2b05ba52 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.spvasm @@ -0,0 +1,21 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 9 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Private_int = OpTypePointer Private %int + %u = OpVariable %_ptr_Private_int Private %int_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..97e29d6c6a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/literal/u32-i32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : i32 = i32(u32(1u)); diff --git a/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl b/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl new file mode 100644 index 0000000000..2f8019f0ed --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = bool(true); +fn f() { + let v : f16 = f16(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2577913c3e --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; + +void f() { + const float16_t v = float16_t(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..77d09d577b --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; + +void f() { + const float16_t v = float16_t(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001A077FD2610(9,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..2e1a28b8fc --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool u = true; +void f() { + float16_t v = float16_t(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.msl new file mode 100644 index 0000000000..6eee947223 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool tint_symbol = true; + half const v = half(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..60d19105ca --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.spvasm @@ -0,0 +1,35 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Private_bool = OpTypePointer Private %bool + %u = OpVariable %_ptr_Private_bool Private %true + %void = OpTypeVoid + %5 = OpTypeFunction %void + %half = OpTypeFloat 16 +%half_0x0p_0 = OpConstant %half 0x0p+0 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %bool %u + %11 = OpSelect %half %13 %half_0x1p_0 %half_0x0p_0 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..76d3f8f0bc --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = bool(true); + +fn f() { + let v : f16 = f16(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl b/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl new file mode 100644 index 0000000000..a8e5d3c4e5 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl @@ -0,0 +1,4 @@ +var u = bool(true); +fn f() { + let v : f32 = f32(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..623c925ab7 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; + +void f() { + const float v = float(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..623c925ab7 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; + +void f() { + const float v = float(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..b37be9dc4d --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool u = true; +void f() { + float v = float(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.msl new file mode 100644 index 0000000000..ce17ffcf8d --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool tint_symbol = true; + float const v = float(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..ca93547f93 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.spvasm @@ -0,0 +1,31 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Private_bool = OpTypePointer Private %bool + %u = OpVariable %_ptr_Private_bool Private %true + %void = OpTypeVoid + %5 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %bool %u + %11 = OpSelect %float %13 %float_1 %float_0 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..80c943cad2 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = bool(true); + +fn f() { + let v : f32 = f32(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl b/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl new file mode 100644 index 0000000000..16d077515f --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl @@ -0,0 +1,4 @@ +var u = bool(true); +fn f() { + let v : i32 = i32(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9b8110ff32 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; + +void f() { + const int v = int(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9b8110ff32 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; + +void f() { + const int v = int(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..e9e894bbc0 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool u = true; +void f() { + int v = int(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.msl new file mode 100644 index 0000000000..fd9140436d --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool tint_symbol = true; + int const v = int(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..f2715166ee --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.spvasm @@ -0,0 +1,31 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Private_bool = OpTypePointer Private %bool + %u = OpVariable %_ptr_Private_bool Private %true + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %bool %u + %11 = OpSelect %int %13 %int_1 %int_0 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..12d29b476d --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = bool(true); + +fn f() { + let v : i32 = i32(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl b/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl new file mode 100644 index 0000000000..05eec83aff --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl @@ -0,0 +1,4 @@ +var u = bool(true); +fn f() { + let v : u32 = u32(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8c38227c41 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; + +void f() { + const uint v = uint(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8c38227c41 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool u = true; + +void f() { + const uint v = uint(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..73d01158e5 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool u = true; +void f() { + uint v = uint(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.msl new file mode 100644 index 0000000000..684812085b --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool tint_symbol = true; + uint const v = uint(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..c9bef53e08 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.spvasm @@ -0,0 +1,31 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 16 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Private_bool = OpTypePointer Private %bool + %u = OpVariable %_ptr_Private_bool Private %true + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %bool %u + %11 = OpSelect %uint %13 %uint_1 %uint_0 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..627875d6c0 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/bool-u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = bool(true); + +fn f() { + let v : u32 = u32(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl b/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl new file mode 100644 index 0000000000..7ef59463c7 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = f16(1.0h); +fn f() { + let v : bool = bool(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5bd2ae2770 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); + +void f() { + const bool v = bool(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b9399130da --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); + +void f() { + const bool v = bool(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000162B2F85E70(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..89562e3ee5 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t u = 1.0hf; +void f() { + bool v = bool(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.msl new file mode 100644 index 0000000000..880b1c6a59 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half tint_symbol = 1.0h; + bool const v = bool(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..5deb109271 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.spvasm @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%_ptr_Private_half = OpTypePointer Private %half + %u = OpVariable %_ptr_Private_half Private %half_0x1p_0 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %bool = OpTypeBool + %14 = OpConstantNull %half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %half %u + %11 = OpFUnordNotEqual %bool %13 %14 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..2526e5078e --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-bool.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = f16(1.0h); + +fn f() { + let v : bool = bool(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl b/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl new file mode 100644 index 0000000000..2767b3c864 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = f16(1.0h); +fn f() { + let v : f32 = f32(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e33b771862 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); + +void f() { + const float v = float(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..223056075c --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); + +void f() { + const float v = float(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001D158112A20(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..c04ad95694 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t u = 1.0hf; +void f() { + float v = float(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..1b283ad2b9 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half tint_symbol = 1.0h; + float const v = float(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..691d2d49b0 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%_ptr_Private_half = OpTypePointer Private %half + %u = OpVariable %_ptr_Private_half Private %half_0x1p_0 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %float = OpTypeFloat 32 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %half %u + %11 = OpFConvert %float %13 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..25a0dea4a6 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = f16(1.0h); + +fn f() { + let v : f32 = f32(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl new file mode 100644 index 0000000000..96f46b6133 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = f16(1.0h); +fn f() { + let v : i32 = i32(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..532f097b06 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); + +void f() { + const int v = int(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e2cf919860 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); + +void f() { + const int v = int(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001CFDDC92A20(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..04c6a2bf73 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t u = 1.0hf; +void f() { + int v = int(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.msl new file mode 100644 index 0000000000..52d4f2dd58 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half tint_symbol = 1.0h; + int const v = int(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..8f7259da40 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%_ptr_Private_half = OpTypePointer Private %half + %u = OpVariable %_ptr_Private_half Private %half_0x1p_0 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %half %u + %11 = OpConvertFToS %int %13 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..ba52be30da --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-i32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = f16(1.0h); + +fn f() { + let v : i32 = i32(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl new file mode 100644 index 0000000000..2dc669e837 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = f16(1.0h); +fn f() { + let v : u32 = u32(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dc49b5e4ae --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); + +void f() { + const uint v = uint(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..25c01bef4f --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t u = float16_t(1.0h); + +void f() { + const uint v = uint(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001FB41A62990(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..dcfd186a9e --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t u = 1.0hf; +void f() { + uint v = uint(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.msl new file mode 100644 index 0000000000..c8d08279ec --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half tint_symbol = 1.0h; + uint const v = uint(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..1e95323061 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%_ptr_Private_half = OpTypePointer Private %half + %u = OpVariable %_ptr_Private_half Private %half_0x1p_0 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %half %u + %11 = OpConvertFToU %uint %13 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..3db457fb99 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f16-u32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = f16(1.0h); + +fn f() { + let v : u32 = u32(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl b/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl new file mode 100644 index 0000000000..6f2c14b1b2 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl @@ -0,0 +1,4 @@ +var u = f32(1.0f); +fn f() { + let v : bool = bool(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..abfcd3990c --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; + +void f() { + const bool v = bool(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..abfcd3990c --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; + +void f() { + const bool v = bool(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..a3f758b0a2 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float u = 1.0f; +void f() { + bool v = bool(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..9c7f704839 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float tint_symbol = 1.0f; + bool const v = bool(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..f457bea895 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Private_float = OpTypePointer Private %float + %u = OpVariable %_ptr_Private_float Private %float_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %bool = OpTypeBool + %14 = OpConstantNull %float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %float %u + %11 = OpFUnordNotEqual %bool %13 %14 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..41d4cc9621 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-bool.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = f32(1.0f); + +fn f() { + let v : bool = bool(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl b/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl new file mode 100644 index 0000000000..9eb10f65fa --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = f32(1.0f); +fn f() { + let v : f16 = f16(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..15672f24e4 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; + +void f() { + const float16_t v = float16_t(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..de1dc4829a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; + +void f() { + const float16_t v = float16_t(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001955C252970(9,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..a838e6fa74 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float u = 1.0f; +void f() { + float16_t v = float16_t(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..0889335b67 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float tint_symbol = 1.0f; + half const v = half(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..beb63bbeec --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Private_float = OpTypePointer Private %float + %u = OpVariable %_ptr_Private_float Private %float_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %half = OpTypeFloat 16 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %float %u + %11 = OpFConvert %half %13 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..a6057b1ba5 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = f32(1.0f); + +fn f() { + let v : f16 = f16(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl new file mode 100644 index 0000000000..a66dc01b01 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl @@ -0,0 +1,4 @@ +var u = f32(1.0f); +fn f() { + let v : i32 = i32(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3c58ea2a53 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; + +void f() { + const int v = int(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c58ea2a53 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; + +void f() { + const int v = int(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..2b93b043f8 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float u = 1.0f; +void f() { + int v = int(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..5e9ae0904d --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float tint_symbol = 1.0f; + int const v = int(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..fa4ccee9ab --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.spvasm @@ -0,0 +1,29 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Private_float = OpTypePointer Private %float + %u = OpVariable %_ptr_Private_float Private %float_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %float %u + %11 = OpConvertFToS %int %13 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..c4f2cc12e5 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = f32(1.0f); + +fn f() { + let v : i32 = i32(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl new file mode 100644 index 0000000000..de994c3903 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl @@ -0,0 +1,4 @@ +var u = f32(1.0f); +fn f() { + let v : u32 = u32(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ae1a041360 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; + +void f() { + const uint v = uint(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ae1a041360 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float u = 1.0f; + +void f() { + const uint v = uint(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..4e8edd9b4d --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float u = 1.0f; +void f() { + uint v = uint(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..c797446ff1 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float tint_symbol = 1.0f; + uint const v = uint(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..f82b285d66 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.spvasm @@ -0,0 +1,29 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 +%_ptr_Private_float = OpTypePointer Private %float + %u = OpVariable %_ptr_Private_float Private %float_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %float %u + %11 = OpConvertFToU %uint %13 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..f8772187c4 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/f32-u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = f32(1.0f); + +fn f() { + let v : u32 = u32(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl b/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl new file mode 100644 index 0000000000..6ba93608fe --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl @@ -0,0 +1,4 @@ +var u = i32(1i); +fn f() { + let v : bool = bool(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..88fdc2bf41 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; + +void f() { + const bool v = bool(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..88fdc2bf41 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; + +void f() { + const bool v = bool(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..60498f052a --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int u = 1; +void f() { + bool v = bool(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..49b25d1d44 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int tint_symbol = 1; + bool const v = bool(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..e990bfdae4 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Private_int = OpTypePointer Private %int + %u = OpVariable %_ptr_Private_int Private %int_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %bool = OpTypeBool + %14 = OpConstantNull %int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %int %u + %11 = OpINotEqual %bool %13 %14 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..b7e670f24f --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-bool.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = i32(1i); + +fn f() { + let v : bool = bool(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl b/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl new file mode 100644 index 0000000000..50752bb25f --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = i32(1i); +fn f() { + let v : f16 = f16(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..377f00edbf --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; + +void f() { + const float16_t v = float16_t(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c5cb25611 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; + +void f() { + const float16_t v = float16_t(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000026C24F72E80(9,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..6bf62b26f8 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int u = 1; +void f() { + float16_t v = float16_t(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..edce6bd8ef --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int tint_symbol = 1; + half const v = half(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..71c348f6a9 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Private_int = OpTypePointer Private %int + %u = OpVariable %_ptr_Private_int Private %int_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %half = OpTypeFloat 16 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %int %u + %11 = OpConvertSToF %half %13 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..37a3a10501 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = i32(1i); + +fn f() { + let v : f16 = f16(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl b/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl new file mode 100644 index 0000000000..9e948115ff --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl @@ -0,0 +1,4 @@ +var u = i32(1i); +fn f() { + let v : f32 = f32(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6a351bd358 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; + +void f() { + const float v = float(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6a351bd358 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; + +void f() { + const float v = float(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..2d6d29abd3 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int u = 1; +void f() { + float v = float(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..b2a40969d5 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int tint_symbol = 1; + float const v = float(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..8dd32f0a00 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.spvasm @@ -0,0 +1,29 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Private_int = OpTypePointer Private %int + %u = OpVariable %_ptr_Private_int Private %int_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %float = OpTypeFloat 32 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %int %u + %11 = OpConvertSToF %float %13 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..2d3bc2b47d --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = i32(1i); + +fn f() { + let v : f32 = f32(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl b/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl new file mode 100644 index 0000000000..6f213d68c2 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl @@ -0,0 +1,4 @@ +var u = i32(1i); +fn f() { + let v : u32 = u32(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e0324f5a0c --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; + +void f() { + const uint v = uint(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e0324f5a0c --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int u = 1; + +void f() { + const uint v = uint(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..c252680913 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int u = 1; +void f() { + uint v = uint(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..1a40f995da --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int tint_symbol = 1; + uint const v = uint(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..1319e1e8ac --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.spvasm @@ -0,0 +1,29 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Private_int = OpTypePointer Private %int + %u = OpVariable %_ptr_Private_int Private %int_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %int %u + %11 = OpBitcast %uint %13 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..b1b334c4e5 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/i32-u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = i32(1i); + +fn f() { + let v : u32 = u32(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl b/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl new file mode 100644 index 0000000000..a914b1f781 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl @@ -0,0 +1,4 @@ +var u = u32(1u); +fn f() { + let v : bool = bool(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d6bbf8ac9f --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; + +void f() { + const bool v = bool(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d6bbf8ac9f --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; + +void f() { + const bool v = bool(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..c52d9271ef --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint u = 1u; +void f() { + bool v = bool(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..55679d432d --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint tint_symbol = 1u; + bool const v = bool(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..f1b714ba67 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.spvasm @@ -0,0 +1,30 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 15 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_uint = OpTypePointer Private %uint + %u = OpVariable %_ptr_Private_uint Private %uint_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %bool = OpTypeBool + %14 = OpConstantNull %uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %uint %u + %11 = OpINotEqual %bool %13 %14 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..36a86c514b --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-bool.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = u32(1u); + +fn f() { + let v : bool = bool(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl b/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl new file mode 100644 index 0000000000..4ce94d62f5 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = u32(1u); +fn f() { + let v : f16 = f16(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..43c52a66d5 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; + +void f() { + const float16_t v = float16_t(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a9669f6966 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; + +void f() { + const float16_t v = float16_t(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002C39A2D2A10(9,9-17): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..9c01479442 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint u = 1u; +void f() { + float16_t v = float16_t(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..5c3ef66e51 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint tint_symbol = 1u; + half const v = half(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..e3c92825cb --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_uint = OpTypePointer Private %uint + %u = OpVariable %_ptr_Private_uint Private %uint_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %half = OpTypeFloat 16 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %uint %u + %11 = OpConvertUToF %half %13 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..769efd20da --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = u32(1u); + +fn f() { + let v : f16 = f16(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl b/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl new file mode 100644 index 0000000000..59083e63ed --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl @@ -0,0 +1,4 @@ +var u = u32(1u); +fn f() { + let v : f32 = f32(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..62b6ad17d8 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; + +void f() { + const float v = float(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..62b6ad17d8 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; + +void f() { + const float v = float(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..727b2bbc0f --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint u = 1u; +void f() { + float v = float(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..4b942e233f --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint tint_symbol = 1u; + float const v = float(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..80140cb6fb --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.spvasm @@ -0,0 +1,29 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_uint = OpTypePointer Private %uint + %u = OpVariable %_ptr_Private_uint Private %uint_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %float = OpTypeFloat 32 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %uint %u + %11 = OpConvertUToF %float %13 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..c0c9c2941c --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = u32(1u); + +fn f() { + let v : f32 = f32(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl b/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl new file mode 100644 index 0000000000..7ad464a3ec --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl @@ -0,0 +1,4 @@ +var u = u32(1u); +fn f() { + let v : i32 = i32(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4ab40a2ffb --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; + +void f() { + const int v = int(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4ab40a2ffb --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint u = 1u; + +void f() { + const int v = int(u); +} diff --git a/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..f2614061f4 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint u = 1u; +void f() { + int v = int(u); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..27c9c437dd --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint tint_symbol = 1u; + int const v = int(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..6ad72e65d7 --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.spvasm @@ -0,0 +1,29 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Private_uint = OpTypePointer Private %uint + %u = OpVariable %_ptr_Private_uint Private %uint_1 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %5 + %10 = OpLabel + %13 = OpLoad %uint %u + %11 = OpBitcast %int %13 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..303f9c837d --- /dev/null +++ b/test/tint/expressions/type_conv/scalar/var/u32-i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = u32(1u); + +fn f() { + let v : i32 = i32(u); +} diff --git a/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl b/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl new file mode 100644 index 0000000000..9c0c733461 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : bool; +fn m() -> vec2 { + t = true; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..5b9f27da0f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool2 m() { + t = true; + return bool2((t).xx); +} + +void f() { + const bool2 tint_symbol = m(); + vector v = vector(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1c37f1be62 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool2 m() { + t = true; + return bool2((t).xx); +} + +void f() { + const bool2 tint_symbol = m(); + vector v = vector(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000226F33C8410(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..522f4f280e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bvec2 m() { + t = true; + return bvec2(t); +} + +void f() { + bvec2 tint_symbol = m(); + f16vec2 v = f16vec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.msl new file mode 100644 index 0000000000..6c423478fa --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool2 m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool2(tint_symbol_1); +} + +void f() { + bool2 const tint_symbol = m(); + half2 v = half2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..bd449ae776 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2bool = OpTypeVector %bool 2 + %9 = OpTypeFunction %v2bool + %true = OpConstantTrue %bool + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%half_0x0p_0 = OpConstant %half 0x0p+0 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %24 = OpConstantComposite %v2half %half_0x0p_0 %half_0x0p_0 + %25 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 +%_ptr_Function_v2half = OpTypePointer Function %v2half + %28 = OpConstantNull %v2half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2bool None %9 + %12 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + %15 = OpCompositeConstruct %v2bool %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2half Function %28 + %18 = OpFunctionCall %v2bool %m + %19 = OpSelect %v2half %18 %25 %24 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..3b01ebf7c7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : bool; + +fn m() -> vec2 { + t = true; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl b/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl new file mode 100644 index 0000000000..0297268eb4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl @@ -0,0 +1,8 @@ +var t : bool; +fn m() -> vec2 { + t = true; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..87dc4f2a9a --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool2 m() { + t = true; + return bool2((t).xx); +} + +void f() { + const bool2 tint_symbol = m(); + float2 v = float2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..87dc4f2a9a --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool2 m() { + t = true; + return bool2((t).xx); +} + +void f() { + const bool2 tint_symbol = m(); + float2 v = float2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..bcbfc63df2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bvec2 m() { + t = true; + return bvec2(t); +} + +void f() { + bvec2 tint_symbol = m(); + vec2 v = vec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.msl new file mode 100644 index 0000000000..eeb0bdb4c2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool2 m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool2(tint_symbol_1); +} + +void f() { + bool2 const tint_symbol = m(); + float2 v = float2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..adce86103d --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2bool = OpTypeVector %bool 2 + %9 = OpTypeFunction %v2bool + %true = OpConstantTrue %bool + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %24 = OpConstantComposite %v2float %float_0 %float_0 + %25 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %28 = OpConstantNull %v2float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2bool None %9 + %12 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + %15 = OpCompositeConstruct %v2bool %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %28 + %18 = OpFunctionCall %v2bool %m + %19 = OpSelect %v2float %18 %25 %24 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..b47833d6d7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-f32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : bool; + +fn m() -> vec2 { + t = true; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl b/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl new file mode 100644 index 0000000000..c6239c1a31 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl @@ -0,0 +1,8 @@ +var t : bool; +fn m() -> vec2 { + t = true; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e8660a20b4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool2 m() { + t = true; + return bool2((t).xx); +} + +void f() { + const bool2 tint_symbol = m(); + int2 v = int2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e8660a20b4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool2 m() { + t = true; + return bool2((t).xx); +} + +void f() { + const bool2 tint_symbol = m(); + int2 v = int2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..129a41b0c5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bvec2 m() { + t = true; + return bvec2(t); +} + +void f() { + bvec2 tint_symbol = m(); + ivec2 v = ivec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.msl new file mode 100644 index 0000000000..0b09693096 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool2 m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool2(tint_symbol_1); +} + +void f() { + bool2 const tint_symbol = m(); + int2 v = int2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..fd51e44163 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2bool = OpTypeVector %bool 2 + %9 = OpTypeFunction %v2bool + %true = OpConstantTrue %bool + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %24 = OpConstantComposite %v2int %int_0 %int_0 + %25 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %28 = OpConstantNull %v2int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2bool None %9 + %12 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + %15 = OpCompositeConstruct %v2bool %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2int Function %28 + %18 = OpFunctionCall %v2bool %m + %19 = OpSelect %v2int %18 %25 %24 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..c34ab7abbf --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-i32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : bool; + +fn m() -> vec2 { + t = true; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl b/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl new file mode 100644 index 0000000000..2addc5d8c2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl @@ -0,0 +1,8 @@ +var t : bool; +fn m() -> vec2 { + t = true; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b46086a5e0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool2 m() { + t = true; + return bool2((t).xx); +} + +void f() { + const bool2 tint_symbol = m(); + uint2 v = uint2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b46086a5e0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool2 m() { + t = true; + return bool2((t).xx); +} + +void f() { + const bool2 tint_symbol = m(); + uint2 v = uint2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..cfe5d1d89d --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bvec2 m() { + t = true; + return bvec2(t); +} + +void f() { + bvec2 tint_symbol = m(); + uvec2 v = uvec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.msl new file mode 100644 index 0000000000..3e1872addd --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool2 m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool2(tint_symbol_1); +} + +void f() { + bool2 const tint_symbol = m(); + uint2 v = uint2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..9844237a2c --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2bool = OpTypeVector %bool 2 + %9 = OpTypeFunction %v2bool + %true = OpConstantTrue %bool + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %24 = OpConstantComposite %v2uint %uint_0 %uint_0 + %25 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %28 = OpConstantNull %v2uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2bool None %9 + %12 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + %15 = OpCompositeConstruct %v2bool %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2uint Function %28 + %18 = OpFunctionCall %v2bool %m + %19 = OpSelect %v2uint %18 %25 %24 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..8285f3c867 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/bool-u32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : bool; + +fn m() -> vec2 { + t = true; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl b/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl new file mode 100644 index 0000000000..43b406a856 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> vec2 { + t = 1.0h; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..daebce904a --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xx); +} + +void f() { + const vector tint_symbol = m(); + bool2 v = bool2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6edde3a57b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xx); +} + +void f() { + const vector tint_symbol = m(); + bool2 v = bool2(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000183B34171B0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..6a3fb3fab5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16vec2 m() { + t = 1.0hf; + return f16vec2(t); +} + +void f() { + f16vec2 tint_symbol = m(); + bvec2 v = bvec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.msl new file mode 100644 index 0000000000..2004729d73 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half2 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half2(tint_symbol_1); +} + +void f() { + half2 const tint_symbol = m(); + bool2 v = bool2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..c8e48146c0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2half = OpTypeVector %half 2 + %9 = OpTypeFunction %v2half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %22 = OpConstantNull %v2half +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %25 = OpConstantNull %v2bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2half None %9 + %12 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + %15 = OpCompositeConstruct %v2half %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2bool Function %25 + %18 = OpFunctionCall %v2half %m + %19 = OpFUnordNotEqual %v2bool %18 %22 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..02dd30a834 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-bool.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> vec2 { + t = 1.0h; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl b/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl new file mode 100644 index 0000000000..9d08e7f6d3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> vec2 { + t = 1.0h; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..336ff1b74e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xx); +} + +void f() { + const vector tint_symbol = m(); + float2 v = float2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e797e272a7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xx); +} + +void f() { + const vector tint_symbol = m(); + float2 v = float2(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000028C31298CE0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..884902bd88 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16vec2 m() { + t = 1.0hf; + return f16vec2(t); +} + +void f() { + f16vec2 tint_symbol = m(); + vec2 v = vec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..e055110a9c --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half2 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half2(tint_symbol_1); +} + +void f() { + half2 const tint_symbol = m(); + float2 v = float2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..2887595b85 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2half = OpTypeVector %half 2 + %9 = OpTypeFunction %v2half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %24 = OpConstantNull %v2float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2half None %9 + %12 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + %15 = OpCompositeConstruct %v2half %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %24 + %18 = OpFunctionCall %v2half %m + %19 = OpFConvert %v2float %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..60a40082e5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> vec2 { + t = 1.0h; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl new file mode 100644 index 0000000000..9c7985f4e0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> vec2 { + t = 1.0h; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..81e425f778 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xx); +} + +void f() { + const vector tint_symbol = m(); + int2 v = int2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9e56d92678 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xx); +} + +void f() { + const vector tint_symbol = m(); + int2 v = int2(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000255D68477C0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..36840f57ea --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16vec2 m() { + t = 1.0hf; + return f16vec2(t); +} + +void f() { + f16vec2 tint_symbol = m(); + ivec2 v = ivec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.msl new file mode 100644 index 0000000000..33275d5464 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half2 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half2(tint_symbol_1); +} + +void f() { + half2 const tint_symbol = m(); + int2 v = int2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..54328c513c --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2half = OpTypeVector %half 2 + %9 = OpTypeFunction %v2half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2half None %9 + %12 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + %15 = OpCompositeConstruct %v2half %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2int Function %24 + %18 = OpFunctionCall %v2half %m + %19 = OpConvertFToS %v2int %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..3be738e630 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-i32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> vec2 { + t = 1.0h; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl new file mode 100644 index 0000000000..b8f662715e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> vec2 { + t = 1.0h; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4f5cc65245 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xx); +} + +void f() { + const vector tint_symbol = m(); + uint2 v = uint2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4d4778eeb3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xx); +} + +void f() { + const vector tint_symbol = m(); + uint2 v = uint2(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001C78EFF77C0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..df38a3cd6d --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16vec2 m() { + t = 1.0hf; + return f16vec2(t); +} + +void f() { + f16vec2 tint_symbol = m(); + uvec2 v = uvec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.msl new file mode 100644 index 0000000000..513e6c3f29 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half2 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half2(tint_symbol_1); +} + +void f() { + half2 const tint_symbol = m(); + uint2 v = uint2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..66018f279a --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2half = OpTypeVector %half 2 + %9 = OpTypeFunction %v2half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %24 = OpConstantNull %v2uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2half None %9 + %12 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + %15 = OpCompositeConstruct %v2half %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2uint Function %24 + %18 = OpFunctionCall %v2half %m + %19 = OpConvertFToU %v2uint %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..0baea217d3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f16-u32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> vec2 { + t = 1.0h; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl b/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl new file mode 100644 index 0000000000..4548914597 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl @@ -0,0 +1,8 @@ +var t : f32; +fn m() -> vec2 { + t = 1.0f; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..908c985770 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float2 m() { + t = 1.0f; + return float2((t).xx); +} + +void f() { + const float2 tint_symbol = m(); + bool2 v = bool2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..908c985770 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float2 m() { + t = 1.0f; + return float2((t).xx); +} + +void f() { + const float2 tint_symbol = m(); + bool2 v = bool2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..df5a338535 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +vec2 m() { + t = 1.0f; + return vec2(t); +} + +void f() { + vec2 tint_symbol = m(); + bvec2 v = bvec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..d4ec1a91bd --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float2 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float2(tint_symbol_1); +} + +void f() { + float2 const tint_symbol = m(); + bool2 v = bool2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..28b9822182 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %9 = OpTypeFunction %v2float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %22 = OpConstantNull %v2float +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %25 = OpConstantNull %v2bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2float None %9 + %12 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + %15 = OpCompositeConstruct %v2float %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2bool Function %25 + %18 = OpFunctionCall %v2float %m + %19 = OpFUnordNotEqual %v2bool %18 %22 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..e1569c0e4f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-bool.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : f32; + +fn m() -> vec2 { + t = 1.0f; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl b/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl new file mode 100644 index 0000000000..4f98328488 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f32; +fn m() -> vec2 { + t = 1.0f; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9b12cfe1ac --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float2 m() { + t = 1.0f; + return float2((t).xx); +} + +void f() { + const float2 tint_symbol = m(); + vector v = vector(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..01e68b1f1b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float2 m() { + t = 1.0f; + return float2((t).xx); +} + +void f() { + const float2 tint_symbol = m(); + vector v = vector(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000018B591277C0(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..73fec6ce7b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +vec2 m() { + t = 1.0f; + return vec2(t); +} + +void f() { + vec2 tint_symbol = m(); + f16vec2 v = f16vec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..73cfab06cf --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float2 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float2(tint_symbol_1); +} + +void f() { + float2 const tint_symbol = m(); + half2 v = half2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..7c3f007c7f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %9 = OpTypeFunction %v2float + %float_1 = OpConstant %float 1 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpConstantNull %v2half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2float None %9 + %12 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + %15 = OpCompositeConstruct %v2float %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2half Function %24 + %18 = OpFunctionCall %v2float %m + %19 = OpFConvert %v2half %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..6b4ed965cc --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f32; + +fn m() -> vec2 { + t = 1.0f; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl new file mode 100644 index 0000000000..4707f3a552 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl @@ -0,0 +1,8 @@ +var t : f32; +fn m() -> vec2 { + t = 1.0f; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b8c126f2ac --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float2 m() { + t = 1.0f; + return float2((t).xx); +} + +void f() { + const float2 tint_symbol = m(); + int2 v = int2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b8c126f2ac --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float2 m() { + t = 1.0f; + return float2((t).xx); +} + +void f() { + const float2 tint_symbol = m(); + int2 v = int2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..d231846545 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +vec2 m() { + t = 1.0f; + return vec2(t); +} + +void f() { + vec2 tint_symbol = m(); + ivec2 v = ivec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..7e6c6787af --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float2 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float2(tint_symbol_1); +} + +void f() { + float2 const tint_symbol = m(); + int2 v = int2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..9000a75d1c --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %9 = OpTypeFunction %v2float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2float None %9 + %12 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + %15 = OpCompositeConstruct %v2float %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2int Function %24 + %18 = OpFunctionCall %v2float %m + %19 = OpConvertFToS %v2int %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..2eb111162e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-i32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : f32; + +fn m() -> vec2 { + t = 1.0f; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl new file mode 100644 index 0000000000..93ccc953d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl @@ -0,0 +1,8 @@ +var t : f32; +fn m() -> vec2 { + t = 1.0f; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a21b6d2731 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float2 m() { + t = 1.0f; + return float2((t).xx); +} + +void f() { + const float2 tint_symbol = m(); + uint2 v = uint2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a21b6d2731 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float2 m() { + t = 1.0f; + return float2((t).xx); +} + +void f() { + const float2 tint_symbol = m(); + uint2 v = uint2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..775f771e8c --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +vec2 m() { + t = 1.0f; + return vec2(t); +} + +void f() { + vec2 tint_symbol = m(); + uvec2 v = uvec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..38d1a0e0d0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float2 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float2(tint_symbol_1); +} + +void f() { + float2 const tint_symbol = m(); + uint2 v = uint2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..23d54f8960 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 + %9 = OpTypeFunction %v2float + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %24 = OpConstantNull %v2uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2float None %9 + %12 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + %15 = OpCompositeConstruct %v2float %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2uint Function %24 + %18 = OpFunctionCall %v2float %m + %19 = OpConvertFToU %v2uint %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..1c7402ccd4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/f32-u32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : f32; + +fn m() -> vec2 { + t = 1.0f; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl b/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl new file mode 100644 index 0000000000..c22e51ee8f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl @@ -0,0 +1,8 @@ +var t : i32; +fn m() -> vec2 { + t = 1i; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a22315816d --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int2 m() { + t = 1; + return int2((t).xx); +} + +void f() { + const int2 tint_symbol = m(); + bool2 v = bool2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a22315816d --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int2 m() { + t = 1; + return int2((t).xx); +} + +void f() { + const int2 tint_symbol = m(); + bool2 v = bool2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..be2349f4af --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +ivec2 m() { + t = 1; + return ivec2(t); +} + +void f() { + ivec2 tint_symbol = m(); + bvec2 v = bvec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..1c14c715c3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int2 m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int2(tint_symbol_1); +} + +void f() { + int2 const tint_symbol = m(); + bool2 v = bool2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..76c77d38a8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %22 = OpConstantNull %v2int +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %25 = OpConstantNull %v2bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2int None %9 + %12 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + %15 = OpCompositeConstruct %v2int %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2bool Function %25 + %18 = OpFunctionCall %v2int %m + %19 = OpINotEqual %v2bool %18 %22 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..0041212a5f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-bool.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : i32; + +fn m() -> vec2 { + t = 1i; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl b/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl new file mode 100644 index 0000000000..58b14c0dc0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : i32; +fn m() -> vec2 { + t = 1i; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..409790e458 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int2 m() { + t = 1; + return int2((t).xx); +} + +void f() { + const int2 tint_symbol = m(); + vector v = vector(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3db01bcd5f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int2 m() { + t = 1; + return int2((t).xx); +} + +void f() { + const int2 tint_symbol = m(); + vector v = vector(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001E8494E77C0(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..181f8b4d49 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +ivec2 m() { + t = 1; + return ivec2(t); +} + +void f() { + ivec2 tint_symbol = m(); + f16vec2 v = f16vec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..7b4fe5dd7a --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int2 m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int2(tint_symbol_1); +} + +void f() { + int2 const tint_symbol = m(); + half2 v = half2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..515c99607d --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int + %int_1 = OpConstant %int 1 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpConstantNull %v2half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2int None %9 + %12 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + %15 = OpCompositeConstruct %v2int %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2half Function %24 + %18 = OpFunctionCall %v2int %m + %19 = OpConvertSToF %v2half %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..6653d1a5fe --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : i32; + +fn m() -> vec2 { + t = 1i; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl b/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl new file mode 100644 index 0000000000..e87bf9c4ea --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl @@ -0,0 +1,8 @@ +var t : i32; +fn m() -> vec2 { + t = 1i; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..326e902fc6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int2 m() { + t = 1; + return int2((t).xx); +} + +void f() { + const int2 tint_symbol = m(); + float2 v = float2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..326e902fc6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int2 m() { + t = 1; + return int2((t).xx); +} + +void f() { + const int2 tint_symbol = m(); + float2 v = float2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..d5202573ec --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +ivec2 m() { + t = 1; + return ivec2(t); +} + +void f() { + ivec2 tint_symbol = m(); + vec2 v = vec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..da1158dda1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int2 m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int2(tint_symbol_1); +} + +void f() { + int2 const tint_symbol = m(); + float2 v = float2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..8e1f9d2029 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %24 = OpConstantNull %v2float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2int None %9 + %12 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + %15 = OpCompositeConstruct %v2int %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %24 + %18 = OpFunctionCall %v2int %m + %19 = OpConvertSToF %v2float %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..7c772d0783 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-f32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : i32; + +fn m() -> vec2 { + t = 1i; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl b/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl new file mode 100644 index 0000000000..e8ad78f4bb --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl @@ -0,0 +1,8 @@ +var t : i32; +fn m() -> vec2 { + t = 1i; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..665eda01f5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int2 m() { + t = 1; + return int2((t).xx); +} + +void f() { + const int2 tint_symbol = m(); + uint2 v = uint2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..665eda01f5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int2 m() { + t = 1; + return int2((t).xx); +} + +void f() { + const int2 tint_symbol = m(); + uint2 v = uint2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..579dcf0a27 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +ivec2 m() { + t = 1; + return ivec2(t); +} + +void f() { + ivec2 tint_symbol = m(); + uvec2 v = uvec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..8fdd6423fb --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int2 m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int2(tint_symbol_1); +} + +void f() { + int2 const tint_symbol = m(); + uint2 v = uint2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..fc885e5513 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2int = OpTypeVector %int 2 + %9 = OpTypeFunction %v2int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %24 = OpConstantNull %v2uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2int None %9 + %12 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + %15 = OpCompositeConstruct %v2int %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2uint Function %24 + %18 = OpFunctionCall %v2int %m + %19 = OpBitcast %v2uint %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..3d9532adc7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/i32-u32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : i32; + +fn m() -> vec2 { + t = 1i; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl b/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl new file mode 100644 index 0000000000..dcc13c9352 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl @@ -0,0 +1,8 @@ +var t : u32; +fn m() -> vec2 { + t = 1u; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f0b2eedbf3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint2 m() { + t = 1u; + return uint2((t).xx); +} + +void f() { + const uint2 tint_symbol = m(); + bool2 v = bool2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f0b2eedbf3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint2 m() { + t = 1u; + return uint2((t).xx); +} + +void f() { + const uint2 tint_symbol = m(); + bool2 v = bool2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..e78192cde3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uvec2 m() { + t = 1u; + return uvec2(t); +} + +void f() { + uvec2 tint_symbol = m(); + bvec2 v = bvec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..7769587c1b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint2 m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint2(tint_symbol_1); +} + +void f() { + uint2 const tint_symbol = m(); + bool2 v = bool2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..11cd56b2b9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %22 = OpConstantNull %v2uint +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %25 = OpConstantNull %v2bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2uint None %9 + %12 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + %15 = OpCompositeConstruct %v2uint %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2bool Function %25 + %18 = OpFunctionCall %v2uint %m + %19 = OpINotEqual %v2bool %18 %22 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..f236f37321 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-bool.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : u32; + +fn m() -> vec2 { + t = 1u; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl b/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl new file mode 100644 index 0000000000..5dd108f93a --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : u32; +fn m() -> vec2 { + t = 1u; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8fab1d6e56 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint2 m() { + t = 1u; + return uint2((t).xx); +} + +void f() { + const uint2 tint_symbol = m(); + vector v = vector(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..aed9579596 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint2 m() { + t = 1u; + return uint2((t).xx); +} + +void f() { + const uint2 tint_symbol = m(); + vector v = vector(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001545EF51F40(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8a06a1313e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uvec2 m() { + t = 1u; + return uvec2(t); +} + +void f() { + uvec2 tint_symbol = m(); + f16vec2 v = f16vec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..9084e890ba --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint2 m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint2(tint_symbol_1); +} + +void f() { + uint2 const tint_symbol = m(); + half2 v = half2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..2133bc5877 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint + %uint_1 = OpConstant %uint 1 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%_ptr_Function_v2half = OpTypePointer Function %v2half + %24 = OpConstantNull %v2half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2uint None %9 + %12 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + %15 = OpCompositeConstruct %v2uint %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2half Function %24 + %18 = OpFunctionCall %v2uint %m + %19 = OpConvertUToF %v2half %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..e1b5af6f71 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : u32; + +fn m() -> vec2 { + t = 1u; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl b/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl new file mode 100644 index 0000000000..6c0fe6e942 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl @@ -0,0 +1,8 @@ +var t : u32; +fn m() -> vec2 { + t = 1u; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d960aa7b17 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint2 m() { + t = 1u; + return uint2((t).xx); +} + +void f() { + const uint2 tint_symbol = m(); + float2 v = float2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d960aa7b17 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint2 m() { + t = 1u; + return uint2((t).xx); +} + +void f() { + const uint2 tint_symbol = m(); + float2 v = float2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..bea39ffb81 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uvec2 m() { + t = 1u; + return uvec2(t); +} + +void f() { + uvec2 tint_symbol = m(); + vec2 v = vec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..aa82be3328 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint2 m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint2(tint_symbol_1); +} + +void f() { + uint2 const tint_symbol = m(); + float2 v = float2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..48403fd9db --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint + %uint_1 = OpConstant %uint 1 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %24 = OpConstantNull %v2float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2uint None %9 + %12 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + %15 = OpCompositeConstruct %v2uint %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2float Function %24 + %18 = OpFunctionCall %v2uint %m + %19 = OpConvertUToF %v2float %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..096c896143 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-f32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : u32; + +fn m() -> vec2 { + t = 1u; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl b/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl new file mode 100644 index 0000000000..b530e87ef0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl @@ -0,0 +1,8 @@ +var t : u32; +fn m() -> vec2 { + t = 1u; + return vec2(t); +} +fn f() { + var v : vec2 = vec2(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..01c30f9c88 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint2 m() { + t = 1u; + return uint2((t).xx); +} + +void f() { + const uint2 tint_symbol = m(); + int2 v = int2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..01c30f9c88 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint2 m() { + t = 1u; + return uint2((t).xx); +} + +void f() { + const uint2 tint_symbol = m(); + int2 v = int2(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..db6cfc63c7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uvec2 m() { + t = 1u; + return uvec2(t); +} + +void f() { + uvec2 tint_symbol = m(); + ivec2 v = ivec2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..e756c24dcb --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint2 m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint2(tint_symbol_1); +} + +void f() { + uint2 const tint_symbol = m(); + int2 v = int2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..9d6670d5ab --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v2uint = OpTypeVector %uint 2 + %9 = OpTypeFunction %v2uint + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %24 = OpConstantNull %v2int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v2uint None %9 + %12 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + %15 = OpCompositeConstruct %v2uint %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v2int Function %24 + %18 = OpFunctionCall %v2uint %m + %19 = OpBitcast %v2int %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..324ba10b21 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/function/u32-i32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : u32; + +fn m() -> vec2 { + t = 1u; + return vec2(t); +} + +fn f() { + var v : vec2 = vec2(m()); +} diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl b/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl new file mode 100644 index 0000000000..a301552414 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec2 = vec2(vec2(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..165a037fb8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4bb521ccc7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000027D08B330C0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..5afea771f5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec2 u = f16vec2(1.0hf); diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..189fe9deba --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v2half = OpTypePointer Private %v2half + %u = OpVariable %_ptr_Private_v2half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..4fc4fc0e5f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec2 = vec2(vec2(true)); diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl b/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl new file mode 100644 index 0000000000..995fda227f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2fa8ba78d9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2fa8ba78d9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..6863d8f6ad --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec2 u = vec2(1.0f); diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..89cca112d8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Private_v2float = OpTypePointer Private %v2float + %u = OpVariable %_ptr_Private_v2float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..7f0d6d838d --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(true)); diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl b/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl new file mode 100644 index 0000000000..7d8766bfb1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e9bcbac5c9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e9bcbac5c9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..c951534035 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec2 u = ivec2(1); diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..48b1b3a299 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Private_v2int = OpTypePointer Private %v2int + %u = OpVariable %_ptr_Private_v2int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..c0937393d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-i32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(true)); diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl b/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl new file mode 100644 index 0000000000..7a56f42cc8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..087e0c9793 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..087e0c9793 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..dfdecf9da5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec2 u = uvec2(1u); diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..d352657f9b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Private_v2uint = OpTypePointer Private %v2uint + %u = OpVariable %_ptr_Private_v2uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..a9fb8ebc8f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/bool-u32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(true)); diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl b/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl new file mode 100644 index 0000000000..b0d206de49 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec2 = vec2(vec2(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0aeb90a58e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0aeb90a58e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..2e80777478 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec2 u = bvec2(true); diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..a2b8f3d899 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v2bool %true %true +%_ptr_Private_v2bool = OpTypePointer Private %v2bool + %u = OpVariable %_ptr_Private_v2bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..04f2464284 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-bool.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec2 = vec2(vec2(1.0h)); diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl b/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl new file mode 100644 index 0000000000..b8bb4e6c53 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec2 = vec2(vec2(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2fa8ba78d9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2fa8ba78d9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..fb820fe4db --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec2 u = vec2(1.0f); diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..69c6211d25 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Private_v2float = OpTypePointer Private %v2float + %u = OpVariable %_ptr_Private_v2float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..7a01d287e6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec2 = vec2(vec2(1.0h)); diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl b/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl new file mode 100644 index 0000000000..29886acc3c --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec2 = vec2(vec2(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e9bcbac5c9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e9bcbac5c9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..e5a9603d17 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec2 u = ivec2(1); diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..bc73da945f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Private_v2int = OpTypePointer Private %v2int + %u = OpVariable %_ptr_Private_v2int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..bab493cf71 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-i32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec2 = vec2(vec2(1.0h)); diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl b/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl new file mode 100644 index 0000000000..1958dffec3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec2 = vec2(vec2(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..087e0c9793 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..087e0c9793 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..da1429b639 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec2 u = uvec2(1u); diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..5093aa33d4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Private_v2uint = OpTypePointer Private %v2uint + %u = OpVariable %_ptr_Private_v2uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..9c2a2726fb --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f16-u32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec2 = vec2(vec2(1.0h)); diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl b/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl new file mode 100644 index 0000000000..0889a431a8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0aeb90a58e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0aeb90a58e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..21e855a392 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec2 u = bvec2(true); diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..15ae6168b0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v2bool %true %true +%_ptr_Private_v2bool = OpTypePointer Private %v2bool + %u = OpVariable %_ptr_Private_v2bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..6991fa6101 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-bool.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1.0f)); diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl b/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl new file mode 100644 index 0000000000..09dee32997 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec2 = vec2(vec2(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..165a037fb8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fce230c796 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001D0842E29C0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..5afea771f5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec2 u = f16vec2(1.0hf); diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..189fe9deba --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v2half = OpTypePointer Private %v2half + %u = OpVariable %_ptr_Private_v2half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..c99a967a5c --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec2 = vec2(vec2(1.0f)); diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl b/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl new file mode 100644 index 0000000000..7e6976051b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e9bcbac5c9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e9bcbac5c9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..c951534035 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec2 u = ivec2(1); diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..48b1b3a299 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Private_v2int = OpTypePointer Private %v2int + %u = OpVariable %_ptr_Private_v2int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..3351611be6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-i32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1.0f)); diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl b/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl new file mode 100644 index 0000000000..724d1b58bb --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..087e0c9793 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..087e0c9793 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..dfdecf9da5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec2 u = uvec2(1u); diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..d352657f9b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Private_v2uint = OpTypePointer Private %v2uint + %u = OpVariable %_ptr_Private_v2uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..97e31cc145 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/f32-u32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1.0f)); diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl b/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl new file mode 100644 index 0000000000..51f32ab783 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0aeb90a58e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0aeb90a58e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..21e855a392 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec2 u = bvec2(true); diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..15ae6168b0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v2bool %true %true +%_ptr_Private_v2bool = OpTypePointer Private %v2bool + %u = OpVariable %_ptr_Private_v2bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..0fd69e18d8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-bool.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1i)); diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl b/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl new file mode 100644 index 0000000000..cd8466e047 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec2 = vec2(vec2(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..165a037fb8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..5cad1dbc20 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002DED7652730(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..5afea771f5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec2 u = f16vec2(1.0hf); diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..189fe9deba --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v2half = OpTypePointer Private %v2half + %u = OpVariable %_ptr_Private_v2half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..b7d817032d --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec2 = vec2(vec2(1i)); diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl b/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl new file mode 100644 index 0000000000..7c87b7761c --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2fa8ba78d9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2fa8ba78d9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..6863d8f6ad --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec2 u = vec2(1.0f); diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..89cca112d8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Private_v2float = OpTypePointer Private %v2float + %u = OpVariable %_ptr_Private_v2float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..980d35934c --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1i)); diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl b/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl new file mode 100644 index 0000000000..fbd011250b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..087e0c9793 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..087e0c9793 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..dfdecf9da5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec2 u = uvec2(1u); diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..d352657f9b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Private_v2uint = OpTypePointer Private %v2uint + %u = OpVariable %_ptr_Private_v2uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..ed8e2174d3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/i32-u32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1i)); diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl b/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl new file mode 100644 index 0000000000..f8e6764ce4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0aeb90a58e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0aeb90a58e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..21e855a392 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec2 u = bvec2(true); diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..15ae6168b0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v2bool %true %true +%_ptr_Private_v2bool = OpTypePointer Private %v2bool + %u = OpVariable %_ptr_Private_v2bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..1394f641e5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-bool.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1u)); diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl b/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl new file mode 100644 index 0000000000..9d60058b30 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec2 = vec2(vec2(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..165a037fb8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8474a06b87 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000151E70A29D0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..5afea771f5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec2 u = f16vec2(1.0hf); diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..189fe9deba --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v2half = OpTypePointer Private %v2half + %u = OpVariable %_ptr_Private_v2half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..3f5126b342 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec2 = vec2(vec2(1u)); diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl b/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl new file mode 100644 index 0000000000..6474db4a31 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2fa8ba78d9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2fa8ba78d9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..6863d8f6ad --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec2 u = vec2(1.0f); diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..89cca112d8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Private_v2float = OpTypePointer Private %v2float + %u = OpVariable %_ptr_Private_v2float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..2feab4a613 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1u)); diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl b/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl new file mode 100644 index 0000000000..109941c8b0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e9bcbac5c9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e9bcbac5c9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..c951534035 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec2 u = ivec2(1); diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..48b1b3a299 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Private_v2int = OpTypePointer Private %v2int + %u = OpVariable %_ptr_Private_v2int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..4ef193372b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/literal/u32-i32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec2 = vec2(vec2(1u)); diff --git a/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl b/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl new file mode 100644 index 0000000000..1c83276a8c --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec2(true); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..061b88d0d0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; + +void f() { + const vector v = vector(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b03678625e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; + +void f() { + const vector v = vector(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002B8624A4D70(9,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..591347ada4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec2 u = bvec2(true); +void f() { + f16vec2 v = f16vec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.msl new file mode 100644 index 0000000000..50b8a4573d --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool2 tint_symbol = bool2(true); + half2 const v = half2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..6941452997 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v2bool %true %true +%_ptr_Private_v2bool = OpTypePointer Private %v2bool + %u = OpVariable %_ptr_Private_v2bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%half_0x0p_0 = OpConstant %half 0x0p+0 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %19 = OpConstantComposite %v2half %half_0x0p_0 %half_0x0p_0 + %20 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2bool %u + %13 = OpSelect %v2half %16 %20 %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..e3d8df8b62 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec2(true); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl b/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl new file mode 100644 index 0000000000..bd60add7bd --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl @@ -0,0 +1,4 @@ +var u = vec2(true); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..55d1671a20 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; + +void f() { + const float2 v = float2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..55d1671a20 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; + +void f() { + const float2 v = float2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..b67a5284d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec2 u = bvec2(true); +void f() { + vec2 v = vec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.msl new file mode 100644 index 0000000000..5c9d60fe12 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool2 tint_symbol = bool2(true); + float2 const v = float2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..2f319a9cfa --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v2bool %true %true +%_ptr_Private_v2bool = OpTypePointer Private %v2bool + %u = OpVariable %_ptr_Private_v2bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v2float %float_0 %float_0 + %20 = OpConstantComposite %v2float %float_1 %float_1 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2bool %u + %13 = OpSelect %v2float %16 %20 %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..36f68b07a2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec2(true); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl b/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl new file mode 100644 index 0000000000..8d4f4e0e3e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl @@ -0,0 +1,4 @@ +var u = vec2(true); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a8980745e4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; + +void f() { + const int2 v = int2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a8980745e4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; + +void f() { + const int2 v = int2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..5f06c23745 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec2 u = bvec2(true); +void f() { + ivec2 v = ivec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.msl new file mode 100644 index 0000000000..991f2e251b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool2 tint_symbol = bool2(true); + int2 const v = int2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..ed4778e7f6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v2bool %true %true +%_ptr_Private_v2bool = OpTypePointer Private %v2bool + %u = OpVariable %_ptr_Private_v2bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %19 = OpConstantComposite %v2int %int_0 %int_0 + %20 = OpConstantComposite %v2int %int_1 %int_1 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2bool %u + %13 = OpSelect %v2int %16 %20 %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..9213d00769 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec2(true); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl b/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl new file mode 100644 index 0000000000..408718c46f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl @@ -0,0 +1,4 @@ +var u = vec2(true); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4b493ec920 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; + +void f() { + const uint2 v = uint2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4b493ec920 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool2 u = (true).xx; + +void f() { + const uint2 v = uint2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..26162528fa --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec2 u = bvec2(true); +void f() { + uvec2 v = uvec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.msl new file mode 100644 index 0000000000..9f059ba6cd --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool2 tint_symbol = bool2(true); + uint2 const v = uint2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..8c1795164d --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v2bool %true %true +%_ptr_Private_v2bool = OpTypePointer Private %v2bool + %u = OpVariable %_ptr_Private_v2bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %19 = OpConstantComposite %v2uint %uint_0 %uint_0 + %20 = OpConstantComposite %v2uint %uint_1 %uint_1 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2bool %u + %13 = OpSelect %v2uint %16 %20 %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..eaf55f0cf2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/bool-u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec2(true); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl b/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl new file mode 100644 index 0000000000..b364b9e35f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec2(1.0h); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6964814f58 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; + +void f() { + const bool2 v = bool2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c42b84e800 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; + +void f() { + const bool2 v = bool2(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001FF98498800(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..3b874c0bf6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec2 u = f16vec2(1.0hf); +void f() { + bvec2 v = bvec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.msl new file mode 100644 index 0000000000..037cd2a9a7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half2 tint_symbol = half2(1.0h); + bool2 const v = bool2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..343194f3fd --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v2half = OpTypePointer Private %v2half + %u = OpVariable %_ptr_Private_v2half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %17 = OpConstantNull %v2half +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2half %u + %13 = OpFUnordNotEqual %v2bool %16 %17 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..ec7585d5de --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-bool.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec2(1.0h); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl b/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl new file mode 100644 index 0000000000..955e3ab51c --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec2(1.0h); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f47d890bcc --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; + +void f() { + const float2 v = float2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..39816e85cc --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; + +void f() { + const float2 v = float2(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000163B9F34D70(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..3aa4d7e443 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec2 u = f16vec2(1.0hf); +void f() { + vec2 v = vec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..05fbb7bc1a --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half2 tint_symbol = half2(1.0h); + float2 const v = float2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..7e76cb3a69 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v2half = OpTypePointer Private %v2half + %u = OpVariable %_ptr_Private_v2half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2half %u + %13 = OpFConvert %v2float %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..5d52dc6ead --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec2(1.0h); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl new file mode 100644 index 0000000000..d3fd9797a8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec2(1.0h); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..25c1f9f49b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; + +void f() { + const int2 v = int2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..77c2aec954 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; + +void f() { + const int2 v = int2(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000014A047A6A10(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..cc8bd7e057 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec2 u = f16vec2(1.0hf); +void f() { + ivec2 v = ivec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.msl new file mode 100644 index 0000000000..29983d2950 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half2 tint_symbol = half2(1.0h); + int2 const v = int2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..8393a16cef --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v2half = OpTypePointer Private %v2half + %u = OpVariable %_ptr_Private_v2half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2half %u + %13 = OpConvertFToS %v2int %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..bdf4d4faa0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-i32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec2(1.0h); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl new file mode 100644 index 0000000000..15b062fdc8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec2(1.0h); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b9edad47ed --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; + +void f() { + const uint2 v = uint2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ff34c481f5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xx; + +void f() { + const uint2 v = uint2(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001AF42F8A1A0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..809f44347e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec2 u = f16vec2(1.0hf); +void f() { + uvec2 v = uvec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.msl new file mode 100644 index 0000000000..a1fa18bc80 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half2 tint_symbol = half2(1.0h); + uint2 const v = uint2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..68f7f3d77a --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v2half = OpTypePointer Private %v2half + %u = OpVariable %_ptr_Private_v2half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2half %u + %13 = OpConvertFToU %v2uint %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..d809ca79ea --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f16-u32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec2(1.0h); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl b/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl new file mode 100644 index 0000000000..ec468a04d1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl @@ -0,0 +1,4 @@ +var u = vec2(1.0f); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2a2c52316e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; + +void f() { + const bool2 v = bool2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2a2c52316e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; + +void f() { + const bool2 v = bool2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..d5e3273c01 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec2 u = vec2(1.0f); +void f() { + bvec2 v = bvec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..3d5f21b839 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float2 tint_symbol = float2(1.0f); + bool2 const v = bool2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..a520828d71 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Private_v2float = OpTypePointer Private %v2float + %u = OpVariable %_ptr_Private_v2float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %17 = OpConstantNull %v2float +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2float %u + %13 = OpFUnordNotEqual %v2bool %16 %17 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..978663b833 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-bool.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec2(1.0f); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl b/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl new file mode 100644 index 0000000000..da2980e34f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec2(1.0f); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3d864169f6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; + +void f() { + const vector v = vector(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..054aad867e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; + +void f() { + const vector v = vector(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000177C49E23E0(9,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..04373b78f4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec2 u = vec2(1.0f); +void f() { + f16vec2 v = f16vec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..d2b64ffe9a --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float2 tint_symbol = float2(1.0f); + half2 const v = half2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..b092036dd8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Private_v2float = OpTypePointer Private %v2float + %u = OpVariable %_ptr_Private_v2float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2float %u + %13 = OpFConvert %v2half %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..667cbd2dcb --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec2(1.0f); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl new file mode 100644 index 0000000000..6bc74c857f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl @@ -0,0 +1,4 @@ +var u = vec2(1.0f); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7da1555cc5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; + +void f() { + const int2 v = int2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7da1555cc5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; + +void f() { + const int2 v = int2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..76b5fdbced --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec2 u = vec2(1.0f); +void f() { + ivec2 v = ivec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..34cfc3aab1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float2 tint_symbol = float2(1.0f); + int2 const v = int2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..77adb07f44 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Private_v2float = OpTypePointer Private %v2float + %u = OpVariable %_ptr_Private_v2float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2float %u + %13 = OpConvertFToS %v2int %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..cc0ecb06b2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec2(1.0f); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl new file mode 100644 index 0000000000..1423179230 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl @@ -0,0 +1,4 @@ +var u = vec2(1.0f); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cd719e2202 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; + +void f() { + const uint2 v = uint2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cd719e2202 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float2 u = (1.0f).xx; + +void f() { + const uint2 v = uint2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..f02a58b790 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec2 u = vec2(1.0f); +void f() { + uvec2 v = uvec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..a536f2e58b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float2 tint_symbol = float2(1.0f); + uint2 const v = uint2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..2d0a5b6ed6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Private_v2float = OpTypePointer Private %v2float + %u = OpVariable %_ptr_Private_v2float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2float %u + %13 = OpConvertFToU %v2uint %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..90fa92499a --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/f32-u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec2(1.0f); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl b/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl new file mode 100644 index 0000000000..cad7a6948b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl @@ -0,0 +1,4 @@ +var u = vec2(1i); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..92a1740ab2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; + +void f() { + const bool2 v = bool2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..92a1740ab2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; + +void f() { + const bool2 v = bool2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..2f5d0de819 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec2 u = ivec2(1); +void f() { + bvec2 v = bvec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..c5ca4414da --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int2 tint_symbol = int2(1); + bool2 const v = bool2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..3878afdcbf --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Private_v2int = OpTypePointer Private %v2int + %u = OpVariable %_ptr_Private_v2int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %17 = OpConstantNull %v2int +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2int %u + %13 = OpINotEqual %v2bool %16 %17 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..14b119b338 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-bool.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec2(1i); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl b/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl new file mode 100644 index 0000000000..c02011b281 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec2(1i); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6a6df53404 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; + +void f() { + const vector v = vector(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..edc9d2965e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; + +void f() { + const vector v = vector(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001E2861D23E0(9,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..ba422a9acd --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec2 u = ivec2(1); +void f() { + f16vec2 v = f16vec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..04719bca07 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int2 tint_symbol = int2(1); + half2 const v = half2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..96c978cf2d --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Private_v2int = OpTypePointer Private %v2int + %u = OpVariable %_ptr_Private_v2int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2int %u + %13 = OpConvertSToF %v2half %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..6b27fdaf6e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec2(1i); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl b/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl new file mode 100644 index 0000000000..554312ad01 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl @@ -0,0 +1,4 @@ +var u = vec2(1i); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cf1d0c81dc --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; + +void f() { + const float2 v = float2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cf1d0c81dc --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; + +void f() { + const float2 v = float2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..eec025e19c --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec2 u = ivec2(1); +void f() { + vec2 v = vec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..8a2b0e0f6d --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int2 tint_symbol = int2(1); + float2 const v = float2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..e9d34ca180 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Private_v2int = OpTypePointer Private %v2int + %u = OpVariable %_ptr_Private_v2int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2int %u + %13 = OpConvertSToF %v2float %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..e501418a58 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec2(1i); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl b/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl new file mode 100644 index 0000000000..79e7759c0e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl @@ -0,0 +1,4 @@ +var u = vec2(1i); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0fe326f272 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; + +void f() { + const uint2 v = uint2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0fe326f272 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int2 u = (1).xx; + +void f() { + const uint2 v = uint2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..41c0d92559 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec2 u = ivec2(1); +void f() { + uvec2 v = uvec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..5d396c1180 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int2 tint_symbol = int2(1); + uint2 const v = uint2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..5c6fa0aaab --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v2int %int_1 %int_1 +%_ptr_Private_v2int = OpTypePointer Private %v2int + %u = OpVariable %_ptr_Private_v2int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2int %u + %13 = OpBitcast %v2uint %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..f21bd5de7d --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/i32-u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec2(1i); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl b/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl new file mode 100644 index 0000000000..7642208b6d --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl @@ -0,0 +1,4 @@ +var u = vec2(1u); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e49dd4c330 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; + +void f() { + const bool2 v = bool2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e49dd4c330 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; + +void f() { + const bool2 v = bool2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..53da835089 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec2 u = uvec2(1u); +void f() { + bvec2 v = bvec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..50cd6d8eb1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint2 tint_symbol = uint2(1u); + bool2 const v = bool2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..e633662414 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Private_v2uint = OpTypePointer Private %v2uint + %u = OpVariable %_ptr_Private_v2uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %17 = OpConstantNull %v2uint +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2uint %u + %13 = OpINotEqual %v2bool %16 %17 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..70269d2f18 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-bool.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec2(1u); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl b/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl new file mode 100644 index 0000000000..7651a7cc91 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec2(1u); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..33d845f03b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; + +void f() { + const vector v = vector(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c2ff56c1d8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; + +void f() { + const vector v = vector(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000242F4738800(9,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..506f87762e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec2 u = uvec2(1u); +void f() { + f16vec2 v = f16vec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..9caedc81f4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint2 tint_symbol = uint2(1u); + half2 const v = half2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..5d6f19322c --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Private_v2uint = OpTypePointer Private %v2uint + %u = OpVariable %_ptr_Private_v2uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2uint %u + %13 = OpConvertUToF %v2half %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..a76a2f1d0c --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec2(1u); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl b/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl new file mode 100644 index 0000000000..0517675de2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl @@ -0,0 +1,4 @@ +var u = vec2(1u); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1a884f05a8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; + +void f() { + const float2 v = float2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1a884f05a8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; + +void f() { + const float2 v = float2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..2c8e29763c --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec2 u = uvec2(1u); +void f() { + vec2 v = vec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..17e895b0e2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint2 tint_symbol = uint2(1u); + float2 const v = float2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..bde4f3daf2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Private_v2uint = OpTypePointer Private %v2uint + %u = OpVariable %_ptr_Private_v2uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2uint %u + %13 = OpConvertUToF %v2float %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..e50cba7e36 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec2(1u); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl b/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl new file mode 100644 index 0000000000..ba5bcbb4a3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl @@ -0,0 +1,4 @@ +var u = vec2(1u); +fn f() { + let v : vec2 = vec2(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8a636da70f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; + +void f() { + const int2 v = int2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8a636da70f --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint2 u = (1u).xx; + +void f() { + const int2 v = int2(u); +} diff --git a/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..166077857b --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec2 u = uvec2(1u); +void f() { + ivec2 v = ivec2(u); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..f5357b79be --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint2 tint_symbol = uint2(1u); + int2 const v = int2(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..033a7a3e75 --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v2uint %uint_1 %uint_1 +%_ptr_Private_v2uint = OpTypePointer Private %v2uint + %u = OpVariable %_ptr_Private_v2uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v2uint %u + %13 = OpBitcast %v2int %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..6539dd075e --- /dev/null +++ b/test/tint/expressions/type_conv/vec2/var/u32-i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec2(1u); + +fn f() { + let v : vec2 = vec2(u); +} diff --git a/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl b/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl new file mode 100644 index 0000000000..23682a30aa --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : bool; +fn m() -> vec3 { + t = true; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..03fbd21b22 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool3 m() { + t = true; + return bool3((t).xxx); +} + +void f() { + const bool3 tint_symbol = m(); + vector v = vector(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..006557f04c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool3 m() { + t = true; + return bool3((t).xxx); +} + +void f() { + const bool3 tint_symbol = m(); + vector v = vector(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002245D6877C0(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..c82d77a9fe --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bvec3 m() { + t = true; + return bvec3(t); +} + +void f() { + bvec3 tint_symbol = m(); + f16vec3 v = f16vec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.msl new file mode 100644 index 0000000000..395f628e80 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool3 m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool3(tint_symbol_1); +} + +void f() { + bool3 const tint_symbol = m(); + half3 v = half3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..8b1b506cff --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3bool = OpTypeVector %bool 3 + %9 = OpTypeFunction %v3bool + %true = OpConstantTrue %bool + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x0p_0 = OpConstant %half 0x0p+0 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %24 = OpConstantComposite %v3half %half_0x0p_0 %half_0x0p_0 %half_0x0p_0 + %25 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %28 = OpConstantNull %v3half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3bool None %9 + %12 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + %15 = OpCompositeConstruct %v3bool %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3half Function %28 + %18 = OpFunctionCall %v3bool %m + %19 = OpSelect %v3half %18 %25 %24 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..2033cd2089 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : bool; + +fn m() -> vec3 { + t = true; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl b/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl new file mode 100644 index 0000000000..9e62f56908 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl @@ -0,0 +1,8 @@ +var t : bool; +fn m() -> vec3 { + t = true; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..70e33b5404 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool3 m() { + t = true; + return bool3((t).xxx); +} + +void f() { + const bool3 tint_symbol = m(); + float3 v = float3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..70e33b5404 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool3 m() { + t = true; + return bool3((t).xxx); +} + +void f() { + const bool3 tint_symbol = m(); + float3 v = float3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..86616fded4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bvec3 m() { + t = true; + return bvec3(t); +} + +void f() { + bvec3 tint_symbol = m(); + vec3 v = vec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.msl new file mode 100644 index 0000000000..62f5fd8f69 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool3 m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool3(tint_symbol_1); +} + +void f() { + bool3 const tint_symbol = m(); + float3 v = float3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..302df3e1b4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3bool = OpTypeVector %bool 3 + %9 = OpTypeFunction %v3bool + %true = OpConstantTrue %bool + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %24 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %25 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %28 = OpConstantNull %v3float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3bool None %9 + %12 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + %15 = OpCompositeConstruct %v3bool %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3float Function %28 + %18 = OpFunctionCall %v3bool %m + %19 = OpSelect %v3float %18 %25 %24 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..40218be4f5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-f32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : bool; + +fn m() -> vec3 { + t = true; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl b/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl new file mode 100644 index 0000000000..8a78e92691 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl @@ -0,0 +1,8 @@ +var t : bool; +fn m() -> vec3 { + t = true; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dd5d37ca94 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool3 m() { + t = true; + return bool3((t).xxx); +} + +void f() { + const bool3 tint_symbol = m(); + int3 v = int3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dd5d37ca94 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool3 m() { + t = true; + return bool3((t).xxx); +} + +void f() { + const bool3 tint_symbol = m(); + int3 v = int3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..6c6ad82f36 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bvec3 m() { + t = true; + return bvec3(t); +} + +void f() { + bvec3 tint_symbol = m(); + ivec3 v = ivec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.msl new file mode 100644 index 0000000000..09909de75e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool3 m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool3(tint_symbol_1); +} + +void f() { + bool3 const tint_symbol = m(); + int3 v = int3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..d3e753718d --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3bool = OpTypeVector %bool 3 + %9 = OpTypeFunction %v3bool + %true = OpConstantTrue %bool + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %24 = OpConstantComposite %v3int %int_0 %int_0 %int_0 + %25 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %28 = OpConstantNull %v3int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3bool None %9 + %12 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + %15 = OpCompositeConstruct %v3bool %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3int Function %28 + %18 = OpFunctionCall %v3bool %m + %19 = OpSelect %v3int %18 %25 %24 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..974bb8a15b --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-i32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : bool; + +fn m() -> vec3 { + t = true; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl b/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl new file mode 100644 index 0000000000..081bea592b --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl @@ -0,0 +1,8 @@ +var t : bool; +fn m() -> vec3 { + t = true; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3664c15ac3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool3 m() { + t = true; + return bool3((t).xxx); +} + +void f() { + const bool3 tint_symbol = m(); + uint3 v = uint3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3664c15ac3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool3 m() { + t = true; + return bool3((t).xxx); +} + +void f() { + const bool3 tint_symbol = m(); + uint3 v = uint3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..6b0fa09ee9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bvec3 m() { + t = true; + return bvec3(t); +} + +void f() { + bvec3 tint_symbol = m(); + uvec3 v = uvec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.msl new file mode 100644 index 0000000000..5bbce2f624 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool3 m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool3(tint_symbol_1); +} + +void f() { + bool3 const tint_symbol = m(); + uint3 v = uint3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..ed75176185 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3bool = OpTypeVector %bool 3 + %9 = OpTypeFunction %v3bool + %true = OpConstantTrue %bool + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %24 = OpConstantComposite %v3uint %uint_0 %uint_0 %uint_0 + %25 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %28 = OpConstantNull %v3uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3bool None %9 + %12 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + %15 = OpCompositeConstruct %v3bool %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3uint Function %28 + %18 = OpFunctionCall %v3bool %m + %19 = OpSelect %v3uint %18 %25 %24 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..290d479047 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/bool-u32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : bool; + +fn m() -> vec3 { + t = true; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl b/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl new file mode 100644 index 0000000000..df20d76077 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> vec3 { + t = 1.0h; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6326660c3b --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxx); +} + +void f() { + const vector tint_symbol = m(); + bool3 v = bool3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7bf2456f0a --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxx); +} + +void f() { + const vector tint_symbol = m(); + bool3 v = bool3(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001DBFB151F40(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..63d7f09ee8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16vec3 m() { + t = 1.0hf; + return f16vec3(t); +} + +void f() { + f16vec3 tint_symbol = m(); + bvec3 v = bvec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.msl new file mode 100644 index 0000000000..da20e42255 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half3 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half3(tint_symbol_1); +} + +void f() { + half3 const tint_symbol = m(); + bool3 v = bool3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..6adc80761b --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3half = OpTypeVector %half 3 + %9 = OpTypeFunction %v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %22 = OpConstantNull %v3half +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %25 = OpConstantNull %v3bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3half None %9 + %12 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + %15 = OpCompositeConstruct %v3half %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3bool Function %25 + %18 = OpFunctionCall %v3half %m + %19 = OpFUnordNotEqual %v3bool %18 %22 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..aef43523a4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-bool.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> vec3 { + t = 1.0h; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl b/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl new file mode 100644 index 0000000000..0f1a00c675 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> vec3 { + t = 1.0h; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f10ff1c598 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxx); +} + +void f() { + const vector tint_symbol = m(); + float3 v = float3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..85891ebde4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxx); +} + +void f() { + const vector tint_symbol = m(); + float3 v = float3(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000237A4E82460(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..87f04144a9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16vec3 m() { + t = 1.0hf; + return f16vec3(t); +} + +void f() { + f16vec3 tint_symbol = m(); + vec3 v = vec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..5dabf99bc6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half3 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half3(tint_symbol_1); +} + +void f() { + half3 const tint_symbol = m(); + float3 v = float3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..108d5984e9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3half = OpTypeVector %half 3 + %9 = OpTypeFunction %v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %24 = OpConstantNull %v3float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3half None %9 + %12 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + %15 = OpCompositeConstruct %v3half %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3float Function %24 + %18 = OpFunctionCall %v3half %m + %19 = OpFConvert %v3float %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c2bcba389 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> vec3 { + t = 1.0h; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl new file mode 100644 index 0000000000..dc71e818dc --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> vec3 { + t = 1.0h; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..864409a20e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxx); +} + +void f() { + const vector tint_symbol = m(); + int3 v = int3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fe5387d8cb --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxx); +} + +void f() { + const vector tint_symbol = m(); + int3 v = int3(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001F6E8397820(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..13dd9c324c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16vec3 m() { + t = 1.0hf; + return f16vec3(t); +} + +void f() { + f16vec3 tint_symbol = m(); + ivec3 v = ivec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.msl new file mode 100644 index 0000000000..c4314ecd1b --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half3 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half3(tint_symbol_1); +} + +void f() { + half3 const tint_symbol = m(); + int3 v = int3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..8bf9c9b464 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3half = OpTypeVector %half 3 + %9 = OpTypeFunction %v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %24 = OpConstantNull %v3int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3half None %9 + %12 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + %15 = OpCompositeConstruct %v3half %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3int Function %24 + %18 = OpFunctionCall %v3half %m + %19 = OpConvertFToS %v3int %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..dda49c0488 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-i32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> vec3 { + t = 1.0h; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl new file mode 100644 index 0000000000..b86fc2c70f --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> vec3 { + t = 1.0h; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0910aca2a9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxx); +} + +void f() { + const vector tint_symbol = m(); + uint3 v = uint3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c7b3b96cd0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxx); +} + +void f() { + const vector tint_symbol = m(); + uint3 v = uint3(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000160CA8424E0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..e1eb04b219 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16vec3 m() { + t = 1.0hf; + return f16vec3(t); +} + +void f() { + f16vec3 tint_symbol = m(); + uvec3 v = uvec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.msl new file mode 100644 index 0000000000..5922e4ad47 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half3 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half3(tint_symbol_1); +} + +void f() { + half3 const tint_symbol = m(); + uint3 v = uint3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..1c195a1003 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3half = OpTypeVector %half 3 + %9 = OpTypeFunction %v3half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %24 = OpConstantNull %v3uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3half None %9 + %12 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + %15 = OpCompositeConstruct %v3half %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3uint Function %24 + %18 = OpFunctionCall %v3half %m + %19 = OpConvertFToU %v3uint %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..fbd81e7697 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f16-u32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> vec3 { + t = 1.0h; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl b/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl new file mode 100644 index 0000000000..c574803910 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl @@ -0,0 +1,8 @@ +var t : f32; +fn m() -> vec3 { + t = 1.0f; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dd7e1adb86 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float3 m() { + t = 1.0f; + return float3((t).xxx); +} + +void f() { + const float3 tint_symbol = m(); + bool3 v = bool3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..dd7e1adb86 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float3 m() { + t = 1.0f; + return float3((t).xxx); +} + +void f() { + const float3 tint_symbol = m(); + bool3 v = bool3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..9742f6ab9d --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +vec3 m() { + t = 1.0f; + return vec3(t); +} + +void f() { + vec3 tint_symbol = m(); + bvec3 v = bvec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..d12e4999d4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float3 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float3(tint_symbol_1); +} + +void f() { + float3 const tint_symbol = m(); + bool3 v = bool3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..42574783bd --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %9 = OpTypeFunction %v3float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %22 = OpConstantNull %v3float +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %25 = OpConstantNull %v3bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3float None %9 + %12 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + %15 = OpCompositeConstruct %v3float %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3bool Function %25 + %18 = OpFunctionCall %v3float %m + %19 = OpFUnordNotEqual %v3bool %18 %22 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..7124a2c352 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-bool.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : f32; + +fn m() -> vec3 { + t = 1.0f; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl b/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl new file mode 100644 index 0000000000..3a09281aa2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f32; +fn m() -> vec3 { + t = 1.0f; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..157c23f1ea --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float3 m() { + t = 1.0f; + return float3((t).xxx); +} + +void f() { + const float3 tint_symbol = m(); + vector v = vector(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9c5e33d8a7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float3 m() { + t = 1.0f; + return float3((t).xxx); +} + +void f() { + const float3 tint_symbol = m(); + vector v = vector(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000024BEE975800(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..cdb6f165a6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +vec3 m() { + t = 1.0f; + return vec3(t); +} + +void f() { + vec3 tint_symbol = m(); + f16vec3 v = f16vec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..3e39af3a65 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float3 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float3(tint_symbol_1); +} + +void f() { + float3 const tint_symbol = m(); + half3 v = half3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..98319f6cab --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %9 = OpTypeFunction %v3float + %float_1 = OpConstant %float 1 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpConstantNull %v3half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3float None %9 + %12 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + %15 = OpCompositeConstruct %v3float %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3half Function %24 + %18 = OpFunctionCall %v3float %m + %19 = OpFConvert %v3half %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..ec2871d8dd --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f32; + +fn m() -> vec3 { + t = 1.0f; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl new file mode 100644 index 0000000000..50a7150ef6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl @@ -0,0 +1,8 @@ +var t : f32; +fn m() -> vec3 { + t = 1.0f; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..696e21e8cd --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float3 m() { + t = 1.0f; + return float3((t).xxx); +} + +void f() { + const float3 tint_symbol = m(); + int3 v = int3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..696e21e8cd --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float3 m() { + t = 1.0f; + return float3((t).xxx); +} + +void f() { + const float3 tint_symbol = m(); + int3 v = int3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..9b1de1c328 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +vec3 m() { + t = 1.0f; + return vec3(t); +} + +void f() { + vec3 tint_symbol = m(); + ivec3 v = ivec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..9234be0c50 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float3 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float3(tint_symbol_1); +} + +void f() { + float3 const tint_symbol = m(); + int3 v = int3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..7874a366d7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %9 = OpTypeFunction %v3float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %24 = OpConstantNull %v3int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3float None %9 + %12 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + %15 = OpCompositeConstruct %v3float %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3int Function %24 + %18 = OpFunctionCall %v3float %m + %19 = OpConvertFToS %v3int %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..46a0ab8fc6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-i32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : f32; + +fn m() -> vec3 { + t = 1.0f; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl new file mode 100644 index 0000000000..a8e1b43d9a --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl @@ -0,0 +1,8 @@ +var t : f32; +fn m() -> vec3 { + t = 1.0f; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..33e2c8d5eb --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float3 m() { + t = 1.0f; + return float3((t).xxx); +} + +void f() { + const float3 tint_symbol = m(); + uint3 v = uint3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..33e2c8d5eb --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float3 m() { + t = 1.0f; + return float3((t).xxx); +} + +void f() { + const float3 tint_symbol = m(); + uint3 v = uint3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..aeadc11624 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +vec3 m() { + t = 1.0f; + return vec3(t); +} + +void f() { + vec3 tint_symbol = m(); + uvec3 v = uvec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..ab5d33179a --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float3 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float3(tint_symbol_1); +} + +void f() { + float3 const tint_symbol = m(); + uint3 v = uint3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..3f57b52524 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3float = OpTypeVector %float 3 + %9 = OpTypeFunction %v3float + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %24 = OpConstantNull %v3uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3float None %9 + %12 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + %15 = OpCompositeConstruct %v3float %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3uint Function %24 + %18 = OpFunctionCall %v3float %m + %19 = OpConvertFToU %v3uint %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..5294e815bc --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/f32-u32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : f32; + +fn m() -> vec3 { + t = 1.0f; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl b/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl new file mode 100644 index 0000000000..092e6cbcbd --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl @@ -0,0 +1,8 @@ +var t : i32; +fn m() -> vec3 { + t = 1i; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8c965fe693 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int3 m() { + t = 1; + return int3((t).xxx); +} + +void f() { + const int3 tint_symbol = m(); + bool3 v = bool3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8c965fe693 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int3 m() { + t = 1; + return int3((t).xxx); +} + +void f() { + const int3 tint_symbol = m(); + bool3 v = bool3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..0d1d0d0725 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +ivec3 m() { + t = 1; + return ivec3(t); +} + +void f() { + ivec3 tint_symbol = m(); + bvec3 v = bvec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..2f3ed22111 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int3 m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int3(tint_symbol_1); +} + +void f() { + int3 const tint_symbol = m(); + bool3 v = bool3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..264810431f --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %22 = OpConstantNull %v3int +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %25 = OpConstantNull %v3bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3int None %9 + %12 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + %15 = OpCompositeConstruct %v3int %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3bool Function %25 + %18 = OpFunctionCall %v3int %m + %19 = OpINotEqual %v3bool %18 %22 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..0b1c9f81ac --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-bool.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : i32; + +fn m() -> vec3 { + t = 1i; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl b/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl new file mode 100644 index 0000000000..8013b056fa --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : i32; +fn m() -> vec3 { + t = 1i; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7683862930 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int3 m() { + t = 1; + return int3((t).xxx); +} + +void f() { + const int3 tint_symbol = m(); + vector v = vector(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..fd827946d7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int3 m() { + t = 1; + return int3((t).xxx); +} + +void f() { + const int3 tint_symbol = m(); + vector v = vector(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001DBE24284F0(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..e79e063af7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +ivec3 m() { + t = 1; + return ivec3(t); +} + +void f() { + ivec3 tint_symbol = m(); + f16vec3 v = f16vec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..4ae6a3f8de --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int3 m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int3(tint_symbol_1); +} + +void f() { + int3 const tint_symbol = m(); + half3 v = half3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..fab8b85c5b --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int + %int_1 = OpConstant %int 1 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpConstantNull %v3half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3int None %9 + %12 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + %15 = OpCompositeConstruct %v3int %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3half Function %24 + %18 = OpFunctionCall %v3int %m + %19 = OpConvertSToF %v3half %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..07ea64e7f1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : i32; + +fn m() -> vec3 { + t = 1i; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl b/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl new file mode 100644 index 0000000000..37c0cd2843 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl @@ -0,0 +1,8 @@ +var t : i32; +fn m() -> vec3 { + t = 1i; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e8980a0b4d --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int3 m() { + t = 1; + return int3((t).xxx); +} + +void f() { + const int3 tint_symbol = m(); + float3 v = float3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e8980a0b4d --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int3 m() { + t = 1; + return int3((t).xxx); +} + +void f() { + const int3 tint_symbol = m(); + float3 v = float3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..65798dfe70 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +ivec3 m() { + t = 1; + return ivec3(t); +} + +void f() { + ivec3 tint_symbol = m(); + vec3 v = vec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..3c0bdd9eae --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int3 m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int3(tint_symbol_1); +} + +void f() { + int3 const tint_symbol = m(); + float3 v = float3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..b5f2940350 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %24 = OpConstantNull %v3float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3int None %9 + %12 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + %15 = OpCompositeConstruct %v3int %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3float Function %24 + %18 = OpFunctionCall %v3int %m + %19 = OpConvertSToF %v3float %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..a77d868610 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-f32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : i32; + +fn m() -> vec3 { + t = 1i; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl b/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl new file mode 100644 index 0000000000..4d3d9fcdde --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl @@ -0,0 +1,8 @@ +var t : i32; +fn m() -> vec3 { + t = 1i; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3551bfe13c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int3 m() { + t = 1; + return int3((t).xxx); +} + +void f() { + const int3 tint_symbol = m(); + uint3 v = uint3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3551bfe13c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int3 m() { + t = 1; + return int3((t).xxx); +} + +void f() { + const int3 tint_symbol = m(); + uint3 v = uint3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..bcc3e636d2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +ivec3 m() { + t = 1; + return ivec3(t); +} + +void f() { + ivec3 tint_symbol = m(); + uvec3 v = uvec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..cf18af6fd1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int3 m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int3(tint_symbol_1); +} + +void f() { + int3 const tint_symbol = m(); + uint3 v = uint3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..a29bcb899a --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3int = OpTypeVector %int 3 + %9 = OpTypeFunction %v3int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %24 = OpConstantNull %v3uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3int None %9 + %12 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + %15 = OpCompositeConstruct %v3int %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3uint Function %24 + %18 = OpFunctionCall %v3int %m + %19 = OpBitcast %v3uint %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..9a38ef7267 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/i32-u32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : i32; + +fn m() -> vec3 { + t = 1i; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl b/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl new file mode 100644 index 0000000000..922e0f739c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl @@ -0,0 +1,8 @@ +var t : u32; +fn m() -> vec3 { + t = 1u; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a4c4b76cee --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint3 m() { + t = 1u; + return uint3((t).xxx); +} + +void f() { + const uint3 tint_symbol = m(); + bool3 v = bool3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a4c4b76cee --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint3 m() { + t = 1u; + return uint3((t).xxx); +} + +void f() { + const uint3 tint_symbol = m(); + bool3 v = bool3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..74237d425d --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uvec3 m() { + t = 1u; + return uvec3(t); +} + +void f() { + uvec3 tint_symbol = m(); + bvec3 v = bvec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..41a81846e6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint3 m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint3(tint_symbol_1); +} + +void f() { + uint3 const tint_symbol = m(); + bool3 v = bool3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..a7d0a612df --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %22 = OpConstantNull %v3uint +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %25 = OpConstantNull %v3bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3uint None %9 + %12 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + %15 = OpCompositeConstruct %v3uint %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3bool Function %25 + %18 = OpFunctionCall %v3uint %m + %19 = OpINotEqual %v3bool %18 %22 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..fee92675bc --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-bool.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : u32; + +fn m() -> vec3 { + t = 1u; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl b/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl new file mode 100644 index 0000000000..214715237e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : u32; +fn m() -> vec3 { + t = 1u; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..47f99a1875 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint3 m() { + t = 1u; + return uint3((t).xxx); +} + +void f() { + const uint3 tint_symbol = m(); + vector v = vector(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ff21d110b4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint3 m() { + t = 1u; + return uint3((t).xxx); +} + +void f() { + const uint3 tint_symbol = m(); + vector v = vector(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000022F414977C0(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..5ad610c87b --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uvec3 m() { + t = 1u; + return uvec3(t); +} + +void f() { + uvec3 tint_symbol = m(); + f16vec3 v = f16vec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..f48f91e836 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint3 m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint3(tint_symbol_1); +} + +void f() { + uint3 const tint_symbol = m(); + half3 v = half3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..7663668711 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint + %uint_1 = OpConstant %uint 1 + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%_ptr_Function_v3half = OpTypePointer Function %v3half + %24 = OpConstantNull %v3half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3uint None %9 + %12 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + %15 = OpCompositeConstruct %v3uint %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3half Function %24 + %18 = OpFunctionCall %v3uint %m + %19 = OpConvertUToF %v3half %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..1c9e9099b9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : u32; + +fn m() -> vec3 { + t = 1u; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl b/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl new file mode 100644 index 0000000000..12d0315c37 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl @@ -0,0 +1,8 @@ +var t : u32; +fn m() -> vec3 { + t = 1u; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6533c7c87c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint3 m() { + t = 1u; + return uint3((t).xxx); +} + +void f() { + const uint3 tint_symbol = m(); + float3 v = float3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6533c7c87c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint3 m() { + t = 1u; + return uint3((t).xxx); +} + +void f() { + const uint3 tint_symbol = m(); + float3 v = float3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..bde33f591e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uvec3 m() { + t = 1u; + return uvec3(t); +} + +void f() { + uvec3 tint_symbol = m(); + vec3 v = vec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..33b31ab13f --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint3 m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint3(tint_symbol_1); +} + +void f() { + uint3 const tint_symbol = m(); + float3 v = float3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..c43a4f9b41 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint + %uint_1 = OpConstant %uint 1 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %24 = OpConstantNull %v3float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3uint None %9 + %12 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + %15 = OpCompositeConstruct %v3uint %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3float Function %24 + %18 = OpFunctionCall %v3uint %m + %19 = OpConvertUToF %v3float %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..d8040d04f0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-f32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : u32; + +fn m() -> vec3 { + t = 1u; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl b/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl new file mode 100644 index 0000000000..5fffe481f9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl @@ -0,0 +1,8 @@ +var t : u32; +fn m() -> vec3 { + t = 1u; + return vec3(t); +} +fn f() { + var v : vec3 = vec3(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..eeec09bb64 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint3 m() { + t = 1u; + return uint3((t).xxx); +} + +void f() { + const uint3 tint_symbol = m(); + int3 v = int3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..eeec09bb64 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint3 m() { + t = 1u; + return uint3((t).xxx); +} + +void f() { + const uint3 tint_symbol = m(); + int3 v = int3(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..d41c065c56 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uvec3 m() { + t = 1u; + return uvec3(t); +} + +void f() { + uvec3 tint_symbol = m(); + ivec3 v = ivec3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..13a207080e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint3 m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint3(tint_symbol_1); +} + +void f() { + uint3 const tint_symbol = m(); + int3 v = int3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..d2f6ebff72 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 + %9 = OpTypeFunction %v3uint + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %24 = OpConstantNull %v3int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v3uint None %9 + %12 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + %15 = OpCompositeConstruct %v3uint %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v3int Function %24 + %18 = OpFunctionCall %v3uint %m + %19 = OpBitcast %v3int %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd24428045 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/function/u32-i32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : u32; + +fn m() -> vec3 { + t = 1u; + return vec3(t); +} + +fn f() { + var v : vec3 = vec3(m()); +} diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl b/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl new file mode 100644 index 0000000000..420ef6f70a --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec3 = vec3(vec3(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6ec982dd59 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8486139463 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002DECD1C6F70(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..1557049c57 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec3 u = f16vec3(1.0hf); diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..12ca273afc --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v3half = OpTypePointer Private %v3half + %u = OpVariable %_ptr_Private_v3half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..dd7d03503b --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec3 = vec3(vec3(true)); diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl b/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl new file mode 100644 index 0000000000..3bd0fbedff --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3095a5e134 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3095a5e134 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..975c1f7501 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec3 u = vec3(1.0f); diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..351603203f --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %u = OpVariable %_ptr_Private_v3float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..bd9c04bbba --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(true)); diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl b/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl new file mode 100644 index 0000000000..4dfa0efaf2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c4d983a337 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c4d983a337 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..dd4364988d --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec3 u = ivec3(1); diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..593b395f53 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Private_v3int = OpTypePointer Private %v3int + %u = OpVariable %_ptr_Private_v3int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..4b33740bc5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-i32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(true)); diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl b/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl new file mode 100644 index 0000000000..0e3841db23 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..83556a633e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..83556a633e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..ff2eef9b7c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec3 u = uvec3(1u); diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..03d4d110ea --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %u = OpVariable %_ptr_Private_v3uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..47ec6ae787 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/bool-u32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(true)); diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl b/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl new file mode 100644 index 0000000000..51240c9922 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec3 = vec3(vec3(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..66b48b9c09 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..66b48b9c09 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..cff7a572c7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec3 u = bvec3(true); diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..7af62bf1f7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v3bool %true %true %true +%_ptr_Private_v3bool = OpTypePointer Private %v3bool + %u = OpVariable %_ptr_Private_v3bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..3ab204de0d --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-bool.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec3 = vec3(vec3(1.0h)); diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl b/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl new file mode 100644 index 0000000000..cf4f2dc52b --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec3 = vec3(vec3(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3095a5e134 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3095a5e134 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..d83a118ae3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec3 u = vec3(1.0f); diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..098601ed1c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %u = OpVariable %_ptr_Private_v3float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..d86aee37b3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec3 = vec3(vec3(1.0h)); diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl b/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl new file mode 100644 index 0000000000..3642cc3680 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec3 = vec3(vec3(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c4d983a337 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c4d983a337 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..31af18eeae --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec3 u = ivec3(1); diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..de1bb57940 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Private_v3int = OpTypePointer Private %v3int + %u = OpVariable %_ptr_Private_v3int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..9e02920dc4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-i32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec3 = vec3(vec3(1.0h)); diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl b/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl new file mode 100644 index 0000000000..a9a00e216c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec3 = vec3(vec3(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..83556a633e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..83556a633e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..e5461c4472 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec3 u = uvec3(1u); diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..63ed0cad81 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %u = OpVariable %_ptr_Private_v3uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..1999f26fb4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f16-u32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec3 = vec3(vec3(1.0h)); diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl b/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl new file mode 100644 index 0000000000..14d3c9f07f --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..66b48b9c09 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..66b48b9c09 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..6977458cd1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec3 u = bvec3(true); diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..fdb6b6040f --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v3bool %true %true %true +%_ptr_Private_v3bool = OpTypePointer Private %v3bool + %u = OpVariable %_ptr_Private_v3bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..79704197b6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-bool.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1.0f)); diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl b/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl new file mode 100644 index 0000000000..451e4531a5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec3 = vec3(vec3(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6ec982dd59 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f8e54a6743 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000019980C729D0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..1557049c57 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec3 u = f16vec3(1.0hf); diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..12ca273afc --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v3half = OpTypePointer Private %v3half + %u = OpVariable %_ptr_Private_v3half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c84cf200d --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec3 = vec3(vec3(1.0f)); diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl b/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl new file mode 100644 index 0000000000..ed96f4c397 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c4d983a337 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c4d983a337 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..dd4364988d --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec3 u = ivec3(1); diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..593b395f53 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Private_v3int = OpTypePointer Private %v3int + %u = OpVariable %_ptr_Private_v3int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..e7c369259c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-i32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1.0f)); diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl b/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl new file mode 100644 index 0000000000..347b619c33 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..83556a633e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..83556a633e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..ff2eef9b7c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec3 u = uvec3(1u); diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..03d4d110ea --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %u = OpVariable %_ptr_Private_v3uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..13eaaf7482 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/f32-u32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1.0f)); diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl b/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl new file mode 100644 index 0000000000..7330742e5f --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..66b48b9c09 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..66b48b9c09 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..6977458cd1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec3 u = bvec3(true); diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..fdb6b6040f --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v3bool %true %true %true +%_ptr_Private_v3bool = OpTypePointer Private %v3bool + %u = OpVariable %_ptr_Private_v3bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..cc50a72e8e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-bool.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1i)); diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl b/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl new file mode 100644 index 0000000000..282c7d9ba3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec3 = vec3(vec3(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6ec982dd59 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cb285ff3f5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000018BB09C1C10(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..1557049c57 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec3 u = f16vec3(1.0hf); diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..12ca273afc --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v3half = OpTypePointer Private %v3half + %u = OpVariable %_ptr_Private_v3half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..ad20018a35 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec3 = vec3(vec3(1i)); diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl b/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl new file mode 100644 index 0000000000..3a721b8a06 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3095a5e134 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3095a5e134 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..975c1f7501 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec3 u = vec3(1.0f); diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..351603203f --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %u = OpVariable %_ptr_Private_v3float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..e7dcf01ca2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1i)); diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl b/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl new file mode 100644 index 0000000000..77d8bba1f7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..83556a633e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..83556a633e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..ff2eef9b7c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec3 u = uvec3(1u); diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..03d4d110ea --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %u = OpVariable %_ptr_Private_v3uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..a4f8cd7104 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/i32-u32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1i)); diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl b/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl new file mode 100644 index 0000000000..3abe00a68d --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..66b48b9c09 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..66b48b9c09 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..6977458cd1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec3 u = bvec3(true); diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..fdb6b6040f --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v3bool %true %true %true +%_ptr_Private_v3bool = OpTypePointer Private %v3bool + %u = OpVariable %_ptr_Private_v3bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..e597f2b36c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-bool.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1u)); diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl b/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl new file mode 100644 index 0000000000..1d20b91644 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec3 = vec3(vec3(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6ec982dd59 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..461ed7a260 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001986DBC29D0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..1557049c57 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec3 u = f16vec3(1.0hf); diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..12ca273afc --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v3half = OpTypePointer Private %v3half + %u = OpVariable %_ptr_Private_v3half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..76c4873351 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec3 = vec3(vec3(1u)); diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl b/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl new file mode 100644 index 0000000000..8eceb44b2c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3095a5e134 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3095a5e134 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..975c1f7501 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec3 u = vec3(1.0f); diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..351603203f --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %u = OpVariable %_ptr_Private_v3float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..15d3fec768 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1u)); diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl b/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl new file mode 100644 index 0000000000..25f62aa83a --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c4d983a337 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c4d983a337 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..dd4364988d --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec3 u = ivec3(1); diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..593b395f53 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Private_v3int = OpTypePointer Private %v3int + %u = OpVariable %_ptr_Private_v3int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..dbeca9491b --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/literal/u32-i32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec3 = vec3(vec3(1u)); diff --git a/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl b/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl new file mode 100644 index 0000000000..7bc95dd0ef --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec3(true); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..89b9351625 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; + +void f() { + const vector v = vector(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e3d07706b5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; + +void f() { + const vector v = vector(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002AF0BED2160(9,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..47ddae4a30 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec3 u = bvec3(true); +void f() { + f16vec3 v = f16vec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.msl new file mode 100644 index 0000000000..ca02857350 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool3 tint_symbol = bool3(true); + half3 const v = half3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..5aeabfe877 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v3bool %true %true %true +%_ptr_Private_v3bool = OpTypePointer Private %v3bool + %u = OpVariable %_ptr_Private_v3bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x0p_0 = OpConstant %half 0x0p+0 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %19 = OpConstantComposite %v3half %half_0x0p_0 %half_0x0p_0 %half_0x0p_0 + %20 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3bool %u + %13 = OpSelect %v3half %16 %20 %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..cbd7ff35e5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec3(true); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl b/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl new file mode 100644 index 0000000000..72958cf091 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl @@ -0,0 +1,4 @@ +var u = vec3(true); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c1b3d71502 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; + +void f() { + const float3 v = float3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c1b3d71502 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; + +void f() { + const float3 v = float3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..4aa889f6d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec3 u = bvec3(true); +void f() { + vec3 v = vec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.msl new file mode 100644 index 0000000000..c21cd03a34 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool3 tint_symbol = bool3(true); + float3 const v = float3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..44c952301a --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v3bool %true %true %true +%_ptr_Private_v3bool = OpTypePointer Private %v3bool + %u = OpVariable %_ptr_Private_v3bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %20 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3bool %u + %13 = OpSelect %v3float %16 %20 %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..b24b0b7ddf --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec3(true); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl b/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl new file mode 100644 index 0000000000..b0f8c0b3fc --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl @@ -0,0 +1,4 @@ +var u = vec3(true); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c9e5189e3e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; + +void f() { + const int3 v = int3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c9e5189e3e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; + +void f() { + const int3 v = int3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..49d4711b7e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec3 u = bvec3(true); +void f() { + ivec3 v = ivec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.msl new file mode 100644 index 0000000000..145181c9b7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool3 tint_symbol = bool3(true); + int3 const v = int3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..7f86b2f106 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v3bool %true %true %true +%_ptr_Private_v3bool = OpTypePointer Private %v3bool + %u = OpVariable %_ptr_Private_v3bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %19 = OpConstantComposite %v3int %int_0 %int_0 %int_0 + %20 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3bool %u + %13 = OpSelect %v3int %16 %20 %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..450fdc1a21 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec3(true); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl b/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl new file mode 100644 index 0000000000..afbaa1a03c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl @@ -0,0 +1,4 @@ +var u = vec3(true); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..70c7435565 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; + +void f() { + const uint3 v = uint3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..70c7435565 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool3 u = (true).xxx; + +void f() { + const uint3 v = uint3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..32f720d920 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec3 u = bvec3(true); +void f() { + uvec3 v = uvec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.msl new file mode 100644 index 0000000000..c277b5210a --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool3 tint_symbol = bool3(true); + uint3 const v = uint3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..c7ed6f0204 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v3bool %true %true %true +%_ptr_Private_v3bool = OpTypePointer Private %v3bool + %u = OpVariable %_ptr_Private_v3bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %19 = OpConstantComposite %v3uint %uint_0 %uint_0 %uint_0 + %20 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3bool %u + %13 = OpSelect %v3uint %16 %20 %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..2270d26c80 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/bool-u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec3(true); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl b/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl new file mode 100644 index 0000000000..adba116c79 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec3(1.0h); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6b405ed73b --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; + +void f() { + const bool3 v = bool3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b29f4a40c7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; + +void f() { + const bool3 v = bool3(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000220C8376A10(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..260a24ee63 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec3 u = f16vec3(1.0hf); +void f() { + bvec3 v = bvec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.msl new file mode 100644 index 0000000000..53fa36ad1d --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half3 tint_symbol = half3(1.0h); + bool3 const v = bool3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..54a12308c6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v3half = OpTypePointer Private %v3half + %u = OpVariable %_ptr_Private_v3half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %17 = OpConstantNull %v3half +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3half %u + %13 = OpFUnordNotEqual %v3bool %16 %17 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..59fc203760 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-bool.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec3(1.0h); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl b/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl new file mode 100644 index 0000000000..94e2793757 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec3(1.0h); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ef6a7f0df4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; + +void f() { + const float3 v = float3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..89633884b4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; + +void f() { + const float3 v = float3(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001C38EE28800(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..bf700ee015 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec3 u = f16vec3(1.0hf); +void f() { + vec3 v = vec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..020ca0a60c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half3 tint_symbol = half3(1.0h); + float3 const v = float3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..311a89476f --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v3half = OpTypePointer Private %v3half + %u = OpVariable %_ptr_Private_v3half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3half %u + %13 = OpFConvert %v3float %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..d64e11a63f --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec3(1.0h); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl new file mode 100644 index 0000000000..75b7b36979 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec3(1.0h); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..47cc85a6e0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; + +void f() { + const int3 v = int3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..80988a4c0b --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; + +void f() { + const int3 v = int3(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002B8E3AD58E0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..e7fb6500cd --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec3 u = f16vec3(1.0hf); +void f() { + ivec3 v = ivec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.msl new file mode 100644 index 0000000000..197a3ce894 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half3 tint_symbol = half3(1.0h); + int3 const v = int3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..e46a82c803 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v3half = OpTypePointer Private %v3half + %u = OpVariable %_ptr_Private_v3half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3half %u + %13 = OpConvertFToS %v3int %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..4aa1f87fc8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-i32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec3(1.0h); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl new file mode 100644 index 0000000000..32894a1b80 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec3(1.0h); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c87c0125c6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; + +void f() { + const uint3 v = uint3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9e52dbfbed --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxx; + +void f() { + const uint3 v = uint3(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001D88B216170(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..6293893df3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec3 u = f16vec3(1.0hf); +void f() { + uvec3 v = uvec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.msl new file mode 100644 index 0000000000..d299b78ad3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half3 tint_symbol = half3(1.0h); + uint3 const v = uint3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..b8b65a9266 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v3half = OpTypePointer Private %v3half + %u = OpVariable %_ptr_Private_v3half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3half %u + %13 = OpConvertFToU %v3uint %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..5720d0eb55 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f16-u32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec3(1.0h); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl b/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl new file mode 100644 index 0000000000..c6b5c04952 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl @@ -0,0 +1,4 @@ +var u = vec3(1.0f); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..38c8aa0377 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; + +void f() { + const bool3 v = bool3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..38c8aa0377 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; + +void f() { + const bool3 v = bool3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..9a7ae8b365 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec3 u = vec3(1.0f); +void f() { + bvec3 v = bvec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..3d33f82589 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float3 tint_symbol = float3(1.0f); + bool3 const v = bool3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..f65cc848cd --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %u = OpVariable %_ptr_Private_v3float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %17 = OpConstantNull %v3float +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3float %u + %13 = OpFUnordNotEqual %v3bool %16 %17 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..d98ea6fc14 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-bool.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec3(1.0f); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl b/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl new file mode 100644 index 0000000000..0d0a08f849 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec3(1.0f); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f07fbf35cd --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; + +void f() { + const vector v = vector(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ac81691d24 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; + +void f() { + const vector v = vector(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000019E912623E0(9,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..0a70a00e8b --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec3 u = vec3(1.0f); +void f() { + f16vec3 v = f16vec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..f79e5ace07 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float3 tint_symbol = float3(1.0f); + half3 const v = half3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..2baa1c418c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %u = OpVariable %_ptr_Private_v3float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3float %u + %13 = OpFConvert %v3half %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..1e161e20da --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec3(1.0f); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl new file mode 100644 index 0000000000..754834e77e --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl @@ -0,0 +1,4 @@ +var u = vec3(1.0f); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cb31dc69a0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; + +void f() { + const int3 v = int3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..cb31dc69a0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; + +void f() { + const int3 v = int3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..93877628ff --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec3 u = vec3(1.0f); +void f() { + ivec3 v = ivec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..26733a93b1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float3 tint_symbol = float3(1.0f); + int3 const v = int3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..5e130df2d8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %u = OpVariable %_ptr_Private_v3float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3float %u + %13 = OpConvertFToS %v3int %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..ed3fd0a895 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec3(1.0f); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl new file mode 100644 index 0000000000..ddd72bdfe0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl @@ -0,0 +1,4 @@ +var u = vec3(1.0f); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0a43c892be --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; + +void f() { + const uint3 v = uint3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0a43c892be --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float3 u = (1.0f).xxx; + +void f() { + const uint3 v = uint3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..df8584b2a3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec3 u = vec3(1.0f); +void f() { + uvec3 v = uvec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..0dfd1bee2f --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float3 tint_symbol = float3(1.0f); + uint3 const v = uint3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..cd46d1e852 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%_ptr_Private_v3float = OpTypePointer Private %v3float + %u = OpVariable %_ptr_Private_v3float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3float %u + %13 = OpConvertFToU %v3uint %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..24a233ffda --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/f32-u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec3(1.0f); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl b/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl new file mode 100644 index 0000000000..a9f58e8333 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl @@ -0,0 +1,4 @@ +var u = vec3(1i); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..1b21a01128 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; + +void f() { + const bool3 v = bool3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1b21a01128 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; + +void f() { + const bool3 v = bool3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..8a7fa9c40a --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec3 u = ivec3(1); +void f() { + bvec3 v = bvec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..d173df67b4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int3 tint_symbol = int3(1); + bool3 const v = bool3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..e1e829b400 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Private_v3int = OpTypePointer Private %v3int + %u = OpVariable %_ptr_Private_v3int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %17 = OpConstantNull %v3int +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3int %u + %13 = OpINotEqual %v3bool %16 %17 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..63fde3cb00 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-bool.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec3(1i); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl b/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl new file mode 100644 index 0000000000..7c5d3b5a06 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec3(1i); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..98f09484e5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; + +void f() { + const vector v = vector(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..38f14855b5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; + +void f() { + const vector v = vector(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000002E64F7B24A0(9,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..6c9b5e61ac --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec3 u = ivec3(1); +void f() { + f16vec3 v = f16vec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..0dd85c1656 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int3 tint_symbol = int3(1); + half3 const v = half3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..0d1a428b2c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Private_v3int = OpTypePointer Private %v3int + %u = OpVariable %_ptr_Private_v3int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3int %u + %13 = OpConvertSToF %v3half %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..1eb10285cb --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec3(1i); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl b/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl new file mode 100644 index 0000000000..c593c77e88 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl @@ -0,0 +1,4 @@ +var u = vec3(1i); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..23b254f766 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; + +void f() { + const float3 v = float3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..23b254f766 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; + +void f() { + const float3 v = float3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..b78248115c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec3 u = ivec3(1); +void f() { + vec3 v = vec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..d00b316a28 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int3 tint_symbol = int3(1); + float3 const v = float3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..9e3ad20e1d --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Private_v3int = OpTypePointer Private %v3int + %u = OpVariable %_ptr_Private_v3int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3int %u + %13 = OpConvertSToF %v3float %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..cf61b2a9e4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec3(1i); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl b/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl new file mode 100644 index 0000000000..89432dd1c7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl @@ -0,0 +1,4 @@ +var u = vec3(1i); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ab79be0d48 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; + +void f() { + const uint3 v = uint3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ab79be0d48 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int3 u = (1).xxx; + +void f() { + const uint3 v = uint3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..76f60cba16 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec3 u = ivec3(1); +void f() { + uvec3 v = uvec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..4b1d15a481 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int3 tint_symbol = int3(1); + uint3 const v = uint3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..4ceae595c3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v3int %int_1 %int_1 %int_1 +%_ptr_Private_v3int = OpTypePointer Private %v3int + %u = OpVariable %_ptr_Private_v3int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3int %u + %13 = OpBitcast %v3uint %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..aeab50322f --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/i32-u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec3(1i); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl b/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl new file mode 100644 index 0000000000..68e67724b2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl @@ -0,0 +1,4 @@ +var u = vec3(1u); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..105249c940 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; + +void f() { + const bool3 v = bool3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..105249c940 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; + +void f() { + const bool3 v = bool3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..6a76744de3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec3 u = uvec3(1u); +void f() { + bvec3 v = bvec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..9ed8565166 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint3 tint_symbol = uint3(1u); + bool3 const v = bool3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..54d6d4f9ea --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %u = OpVariable %_ptr_Private_v3uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool + %v3bool = OpTypeVector %bool 3 + %17 = OpConstantNull %v3uint +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3uint %u + %13 = OpINotEqual %v3bool %16 %17 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..141c4d2c71 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-bool.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec3(1u); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl b/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl new file mode 100644 index 0000000000..c510824988 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec3(1u); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2e007d8428 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; + +void f() { + const vector v = vector(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..60daa3d004 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; + +void f() { + const vector v = vector(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000140A91D3590(9,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..a111c8a165 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec3 u = uvec3(1u); +void f() { + f16vec3 v = f16vec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..d03edd866b --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint3 tint_symbol = uint3(1u); + half3 const v = half3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..50bf09057c --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %u = OpVariable %_ptr_Private_v3uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v3half = OpTypeVector %half 3 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3uint %u + %13 = OpConvertUToF %v3half %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..20d3931aa1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec3(1u); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl b/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl new file mode 100644 index 0000000000..4b5b64bcbe --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl @@ -0,0 +1,4 @@ +var u = vec3(1u); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a7bbe27f95 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; + +void f() { + const float3 v = float3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a7bbe27f95 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; + +void f() { + const float3 v = float3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..c3b5d95ae0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec3 u = uvec3(1u); +void f() { + vec3 v = vec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..462c81a290 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint3 tint_symbol = uint3(1u); + float3 const v = float3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..36949694c9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %u = OpVariable %_ptr_Private_v3uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3uint %u + %13 = OpConvertUToF %v3float %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..a920d064da --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec3(1u); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl b/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl new file mode 100644 index 0000000000..42d5542a13 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl @@ -0,0 +1,4 @@ +var u = vec3(1u); +fn f() { + let v : vec3 = vec3(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e7b11ed400 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; + +void f() { + const int3 v = int3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e7b11ed400 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint3 u = (1u).xxx; + +void f() { + const int3 v = int3(u); +} diff --git a/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..745e53df30 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec3 u = uvec3(1u); +void f() { + ivec3 v = ivec3(u); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..7e8031a096 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint3 tint_symbol = uint3(1u); + int3 const v = int3(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..a3c959c3aa --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %u = OpVariable %_ptr_Private_v3uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v3uint %u + %13 = OpBitcast %v3int %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..8ba3c8cd28 --- /dev/null +++ b/test/tint/expressions/type_conv/vec3/var/u32-i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec3(1u); + +fn f() { + let v : vec3 = vec3(u); +} diff --git a/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl b/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl new file mode 100644 index 0000000000..83cfe662e8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : bool; +fn m() -> vec4 { + t = true; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..35b70ea3d7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool4 m() { + t = true; + return bool4((t).xxxx); +} + +void f() { + const bool4 tint_symbol = m(); + vector v = vector(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8b1ede8d6b --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool4 m() { + t = true; + return bool4((t).xxxx); +} + +void f() { + const bool4 tint_symbol = m(); + vector v = vector(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001EBBB9F6C50(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..4f76ad0ae0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bvec4 m() { + t = true; + return bvec4(t); +} + +void f() { + bvec4 tint_symbol = m(); + f16vec4 v = f16vec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.msl new file mode 100644 index 0000000000..86e91ccbcd --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool4 m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool4(tint_symbol_1); +} + +void f() { + bool4 const tint_symbol = m(); + half4 v = half4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..dae3c60e87 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.spvasm @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4bool = OpTypeVector %bool 4 + %9 = OpTypeFunction %v4bool + %true = OpConstantTrue %bool + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%half_0x0p_0 = OpConstant %half 0x0p+0 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %24 = OpConstantComposite %v4half %half_0x0p_0 %half_0x0p_0 %half_0x0p_0 %half_0x0p_0 + %25 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Function_v4half = OpTypePointer Function %v4half + %28 = OpConstantNull %v4half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4bool None %9 + %12 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + %15 = OpCompositeConstruct %v4bool %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4half Function %28 + %18 = OpFunctionCall %v4bool %m + %19 = OpSelect %v4half %18 %25 %24 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..dee8293d8d --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : bool; + +fn m() -> vec4 { + t = true; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl b/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl new file mode 100644 index 0000000000..c8792c2c4b --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl @@ -0,0 +1,8 @@ +var t : bool; +fn m() -> vec4 { + t = true; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..23c5ef62fa --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool4 m() { + t = true; + return bool4((t).xxxx); +} + +void f() { + const bool4 tint_symbol = m(); + float4 v = float4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..23c5ef62fa --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool4 m() { + t = true; + return bool4((t).xxxx); +} + +void f() { + const bool4 tint_symbol = m(); + float4 v = float4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..c5d1b13413 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bvec4 m() { + t = true; + return bvec4(t); +} + +void f() { + bvec4 tint_symbol = m(); + vec4 v = vec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.msl new file mode 100644 index 0000000000..432aff7824 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool4 m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool4(tint_symbol_1); +} + +void f() { + bool4 const tint_symbol = m(); + float4 v = float4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..40ad6483d7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4bool = OpTypeVector %bool 4 + %9 = OpTypeFunction %v4bool + %true = OpConstantTrue %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %24 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %25 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %28 = OpConstantNull %v4float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4bool None %9 + %12 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + %15 = OpCompositeConstruct %v4bool %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %28 + %18 = OpFunctionCall %v4bool %m + %19 = OpSelect %v4float %18 %25 %24 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..5fba3af814 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-f32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : bool; + +fn m() -> vec4 { + t = true; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl b/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl new file mode 100644 index 0000000000..e65d69d9a2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl @@ -0,0 +1,8 @@ +var t : bool; +fn m() -> vec4 { + t = true; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f1b250c6a2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool4 m() { + t = true; + return bool4((t).xxxx); +} + +void f() { + const bool4 tint_symbol = m(); + int4 v = int4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f1b250c6a2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool4 m() { + t = true; + return bool4((t).xxxx); +} + +void f() { + const bool4 tint_symbol = m(); + int4 v = int4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..2c44dbe521 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bvec4 m() { + t = true; + return bvec4(t); +} + +void f() { + bvec4 tint_symbol = m(); + ivec4 v = ivec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.msl new file mode 100644 index 0000000000..015c2855fa --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool4 m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool4(tint_symbol_1); +} + +void f() { + bool4 const tint_symbol = m(); + int4 v = int4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..e3ca72d14f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4bool = OpTypeVector %bool 4 + %9 = OpTypeFunction %v4bool + %true = OpConstantTrue %bool + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %24 = OpConstantComposite %v4int %int_0 %int_0 %int_0 %int_0 + %25 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %28 = OpConstantNull %v4int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4bool None %9 + %12 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + %15 = OpCompositeConstruct %v4bool %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4int Function %28 + %18 = OpFunctionCall %v4bool %m + %19 = OpSelect %v4int %18 %25 %24 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..2db1040c15 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-i32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : bool; + +fn m() -> vec4 { + t = true; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl b/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl new file mode 100644 index 0000000000..166db1b856 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl @@ -0,0 +1,8 @@ +var t : bool; +fn m() -> vec4 { + t = true; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b4fbab148d --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool4 m() { + t = true; + return bool4((t).xxxx); +} + +void f() { + const bool4 tint_symbol = m(); + uint4 v = uint4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b4fbab148d --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool t = false; + +bool4 m() { + t = true; + return bool4((t).xxxx); +} + +void f() { + const bool4 tint_symbol = m(); + uint4 v = uint4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..4f3e5eeda9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bool t = false; +bvec4 m() { + t = true; + return bvec4(t); +} + +void f() { + bvec4 tint_symbol = m(); + uvec4 v = uvec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.msl new file mode 100644 index 0000000000..11bedfb277 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +bool4 m() { + thread bool tint_symbol_1 = false; + tint_symbol_1 = true; + return bool4(tint_symbol_1); +} + +void f() { + bool4 const tint_symbol = m(); + uint4 v = uint4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..45db09d213 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %bool = OpTypeBool +%_ptr_Private_bool = OpTypePointer Private %bool + %4 = OpConstantNull %bool + %t = OpVariable %_ptr_Private_bool Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4bool = OpTypeVector %bool 4 + %9 = OpTypeFunction %v4bool + %true = OpConstantTrue %bool + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %24 = OpConstantComposite %v4uint %uint_0 %uint_0 %uint_0 %uint_0 + %25 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %28 = OpConstantNull %v4uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4bool None %9 + %12 = OpLabel + OpStore %t %true + %14 = OpLoad %bool %t + %15 = OpCompositeConstruct %v4bool %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4uint Function %28 + %18 = OpFunctionCall %v4bool %m + %19 = OpSelect %v4uint %18 %25 %24 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..e2b90dc3d5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/bool-u32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : bool; + +fn m() -> vec4 { + t = true; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl b/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl new file mode 100644 index 0000000000..e9f93272a1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> vec4 { + t = 1.0h; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c05b37f93e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxxx); +} + +void f() { + const vector tint_symbol = m(); + bool4 v = bool4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..09cddf2491 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxxx); +} + +void f() { + const vector tint_symbol = m(); + bool4 v = bool4(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000241137215B0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..71d56797b2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16vec4 m() { + t = 1.0hf; + return f16vec4(t); +} + +void f() { + f16vec4 tint_symbol = m(); + bvec4 v = bvec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.msl new file mode 100644 index 0000000000..5273225ddd --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half4 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half4(tint_symbol_1); +} + +void f() { + half4 const tint_symbol = m(); + bool4 v = bool4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..09479ec5a9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.spvasm @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4half = OpTypeVector %half 4 + %9 = OpTypeFunction %v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %22 = OpConstantNull %v4half +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %25 = OpConstantNull %v4bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4half None %9 + %12 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + %15 = OpCompositeConstruct %v4half %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4bool Function %25 + %18 = OpFunctionCall %v4half %m + %19 = OpFUnordNotEqual %v4bool %18 %22 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..a940fcebe9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-bool.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> vec4 { + t = 1.0h; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl b/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl new file mode 100644 index 0000000000..a76ee7fc32 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> vec4 { + t = 1.0h; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..53ff55e393 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxxx); +} + +void f() { + const vector tint_symbol = m(); + float4 v = float4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..27ca0e1596 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxxx); +} + +void f() { + const vector tint_symbol = m(); + float4 v = float4(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001C8C12524D0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..0106be3df3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16vec4 m() { + t = 1.0hf; + return f16vec4(t); +} + +void f() { + f16vec4 tint_symbol = m(); + vec4 v = vec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..30ca6fa6fc --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half4 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half4(tint_symbol_1); +} + +void f() { + half4 const tint_symbol = m(); + float4 v = float4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..070812db49 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4half = OpTypeVector %half 4 + %9 = OpTypeFunction %v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %24 = OpConstantNull %v4float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4half None %9 + %12 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + %15 = OpCompositeConstruct %v4half %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %24 + %18 = OpFunctionCall %v4half %m + %19 = OpFConvert %v4float %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..2da5282f8f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> vec4 { + t = 1.0h; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl new file mode 100644 index 0000000000..c400ad39f2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> vec4 { + t = 1.0h; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b2842ce13e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxxx); +} + +void f() { + const vector tint_symbol = m(); + int4 v = int4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ebe33589c7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxxx); +} + +void f() { + const vector tint_symbol = m(); + int4 v = int4(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000236210144B0(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..5041738a3c --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16vec4 m() { + t = 1.0hf; + return f16vec4(t); +} + +void f() { + f16vec4 tint_symbol = m(); + ivec4 v = ivec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.msl new file mode 100644 index 0000000000..c0f860526d --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half4 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half4(tint_symbol_1); +} + +void f() { + half4 const tint_symbol = m(); + int4 v = int4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..cda766199e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4half = OpTypeVector %half 4 + %9 = OpTypeFunction %v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %24 = OpConstantNull %v4int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4half None %9 + %12 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + %15 = OpCompositeConstruct %v4half %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4int Function %24 + %18 = OpFunctionCall %v4half %m + %19 = OpConvertFToS %v4int %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..a1859012c0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-i32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> vec4 { + t = 1.0h; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl new file mode 100644 index 0000000000..97bcf34c92 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f16; +fn m() -> vec4 { + t = 1.0h; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e49b61d50d --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxxx); +} + +void f() { + const vector tint_symbol = m(); + uint4 v = uint4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..54d5af4085 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float16_t t = float16_t(0.0h); + +vector m() { + t = float16_t(1.0h); + return vector((t).xxxx); +} + +void f() { + const vector tint_symbol = m(); + uint4 v = uint4(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000020C76A92440(6,8-16): error X3000: unrecognized identifier 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..54fe7e0bfe --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float16_t t = 0.0hf; +f16vec4 m() { + t = 1.0hf; + return f16vec4(t); +} + +void f() { + f16vec4 tint_symbol = m(); + uvec4 v = uvec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.msl new file mode 100644 index 0000000000..cf49e3961f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +half4 m() { + thread half tint_symbol_1 = 0.0h; + tint_symbol_1 = 1.0h; + return half4(tint_symbol_1); +} + +void f() { + half4 const tint_symbol = m(); + uint4 v = uint4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..ca1f50c703 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %half = OpTypeFloat 16 +%_ptr_Private_half = OpTypePointer Private %half + %4 = OpConstantNull %half + %t = OpVariable %_ptr_Private_half Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4half = OpTypeVector %half 4 + %9 = OpTypeFunction %v4half +%half_0x1p_0 = OpConstant %half 0x1p+0 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %24 = OpConstantNull %v4uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4half None %9 + %12 = OpLabel + OpStore %t %half_0x1p_0 + %14 = OpLoad %half %t + %15 = OpCompositeConstruct %v4half %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4uint Function %24 + %18 = OpFunctionCall %v4half %m + %19 = OpConvertFToU %v4uint %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..8966ffd584 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f16-u32.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f16; + +fn m() -> vec4 { + t = 1.0h; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl b/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl new file mode 100644 index 0000000000..436ef953ee --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl @@ -0,0 +1,8 @@ +var t : f32; +fn m() -> vec4 { + t = 1.0f; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..7a6344b4e4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float4 m() { + t = 1.0f; + return float4((t).xxxx); +} + +void f() { + const float4 tint_symbol = m(); + bool4 v = bool4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7a6344b4e4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float4 m() { + t = 1.0f; + return float4((t).xxxx); +} + +void f() { + const float4 tint_symbol = m(); + bool4 v = bool4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..4771ec64cb --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +vec4 m() { + t = 1.0f; + return vec4(t); +} + +void f() { + vec4 tint_symbol = m(); + bvec4 v = bvec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..469620bdd0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float4 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float4(tint_symbol_1); +} + +void f() { + float4 const tint_symbol = m(); + bool4 v = bool4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..f9ce92b0aa --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %9 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %22 = OpConstantNull %v4float +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %25 = OpConstantNull %v4bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4float None %9 + %12 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + %15 = OpCompositeConstruct %v4float %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4bool Function %25 + %18 = OpFunctionCall %v4float %m + %19 = OpFUnordNotEqual %v4bool %18 %22 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..3f85354011 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-bool.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : f32; + +fn m() -> vec4 { + t = 1.0f; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl b/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl new file mode 100644 index 0000000000..7c0f66d59e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : f32; +fn m() -> vec4 { + t = 1.0f; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..c66f887ce4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float4 m() { + t = 1.0f; + return float4((t).xxxx); +} + +void f() { + const float4 tint_symbol = m(); + vector v = vector(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..32fd0fc0e7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float4 m() { + t = 1.0f; + return float4((t).xxxx); +} + +void f() { + const float4 tint_symbol = m(); + vector v = vector(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001BEFD841DB0(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..12a0f5a457 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +vec4 m() { + t = 1.0f; + return vec4(t); +} + +void f() { + vec4 tint_symbol = m(); + f16vec4 v = f16vec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..98a23c77b8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float4 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float4(tint_symbol_1); +} + +void f() { + float4 const tint_symbol = m(); + half4 v = half4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..ec2cdfc968 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %9 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpConstantNull %v4half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4float None %9 + %12 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + %15 = OpCompositeConstruct %v4float %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4half Function %24 + %18 = OpFunctionCall %v4float %m + %19 = OpFConvert %v4half %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..fab35fbf50 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : f32; + +fn m() -> vec4 { + t = 1.0f; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl new file mode 100644 index 0000000000..d6879bb4dd --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl @@ -0,0 +1,8 @@ +var t : f32; +fn m() -> vec4 { + t = 1.0f; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2ee04dff86 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float4 m() { + t = 1.0f; + return float4((t).xxxx); +} + +void f() { + const float4 tint_symbol = m(); + int4 v = int4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..2ee04dff86 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float4 m() { + t = 1.0f; + return float4((t).xxxx); +} + +void f() { + const float4 tint_symbol = m(); + int4 v = int4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..7f69604848 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +vec4 m() { + t = 1.0f; + return vec4(t); +} + +void f() { + vec4 tint_symbol = m(); + ivec4 v = ivec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..e43ebcffa3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float4 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float4(tint_symbol_1); +} + +void f() { + float4 const tint_symbol = m(); + int4 v = int4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..8fd42260c3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %9 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %24 = OpConstantNull %v4int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4float None %9 + %12 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + %15 = OpCompositeConstruct %v4float %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4int Function %24 + %18 = OpFunctionCall %v4float %m + %19 = OpConvertFToS %v4int %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..3f359b3252 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-i32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : f32; + +fn m() -> vec4 { + t = 1.0f; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl new file mode 100644 index 0000000000..9e27b61519 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl @@ -0,0 +1,8 @@ +var t : f32; +fn m() -> vec4 { + t = 1.0f; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8b64a91e37 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float4 m() { + t = 1.0f; + return float4((t).xxxx); +} + +void f() { + const float4 tint_symbol = m(); + uint4 v = uint4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..8b64a91e37 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float t = 0.0f; + +float4 m() { + t = 1.0f; + return float4((t).xxxx); +} + +void f() { + const float4 tint_symbol = m(); + uint4 v = uint4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..59158b9526 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +float t = 0.0f; +vec4 m() { + t = 1.0f; + return vec4(t); +} + +void f() { + vec4 tint_symbol = m(); + uvec4 v = uvec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..5f87293245 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +float4 m() { + thread float tint_symbol_1 = 0.0f; + tint_symbol_1 = 1.0f; + return float4(tint_symbol_1); +} + +void f() { + float4 const tint_symbol = m(); + uint4 v = uint4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..8655677cad --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %4 = OpConstantNull %float + %t = OpVariable %_ptr_Private_float Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4float = OpTypeVector %float 4 + %9 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %24 = OpConstantNull %v4uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4float None %9 + %12 = OpLabel + OpStore %t %float_1 + %14 = OpLoad %float %t + %15 = OpCompositeConstruct %v4float %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4uint Function %24 + %18 = OpFunctionCall %v4float %m + %19 = OpConvertFToU %v4uint %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..740dc46692 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/f32-u32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : f32; + +fn m() -> vec4 { + t = 1.0f; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl b/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl new file mode 100644 index 0000000000..91ee2e1f12 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl @@ -0,0 +1,8 @@ +var t : i32; +fn m() -> vec4 { + t = 1i; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..47de1b263d --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int4 m() { + t = 1; + return int4((t).xxxx); +} + +void f() { + const int4 tint_symbol = m(); + bool4 v = bool4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..47de1b263d --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int4 m() { + t = 1; + return int4((t).xxxx); +} + +void f() { + const int4 tint_symbol = m(); + bool4 v = bool4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..b96bb51189 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +ivec4 m() { + t = 1; + return ivec4(t); +} + +void f() { + ivec4 tint_symbol = m(); + bvec4 v = bvec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..059bb99041 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int4 m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int4(tint_symbol_1); +} + +void f() { + int4 const tint_symbol = m(); + bool4 v = bool4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..fdb13d812e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int + %int_1 = OpConstant %int 1 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %22 = OpConstantNull %v4int +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %25 = OpConstantNull %v4bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4int None %9 + %12 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + %15 = OpCompositeConstruct %v4int %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4bool Function %25 + %18 = OpFunctionCall %v4int %m + %19 = OpINotEqual %v4bool %18 %22 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..2b3619de2d --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-bool.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : i32; + +fn m() -> vec4 { + t = 1i; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl b/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl new file mode 100644 index 0000000000..a10b73720e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : i32; +fn m() -> vec4 { + t = 1i; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..8414922550 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int4 m() { + t = 1; + return int4((t).xxxx); +} + +void f() { + const int4 tint_symbol = m(); + vector v = vector(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..432afc6ddb --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int4 m() { + t = 1; + return int4((t).xxxx); +} + +void f() { + const int4 tint_symbol = m(); + vector v = vector(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000272AD4875E0(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..3afae7c40b --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +ivec4 m() { + t = 1; + return ivec4(t); +} + +void f() { + ivec4 tint_symbol = m(); + f16vec4 v = f16vec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..c501b92d8e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int4 m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int4(tint_symbol_1); +} + +void f() { + int4 const tint_symbol = m(); + half4 v = half4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..b4b3894924 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int + %int_1 = OpConstant %int 1 + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpConstantNull %v4half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4int None %9 + %12 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + %15 = OpCompositeConstruct %v4int %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4half Function %24 + %18 = OpFunctionCall %v4int %m + %19 = OpConvertSToF %v4half %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..2a95c1bf2b --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : i32; + +fn m() -> vec4 { + t = 1i; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl b/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl new file mode 100644 index 0000000000..3f09fff0d7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl @@ -0,0 +1,8 @@ +var t : i32; +fn m() -> vec4 { + t = 1i; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..acca5370a4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int4 m() { + t = 1; + return int4((t).xxxx); +} + +void f() { + const int4 tint_symbol = m(); + float4 v = float4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..acca5370a4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int4 m() { + t = 1; + return int4((t).xxxx); +} + +void f() { + const int4 tint_symbol = m(); + float4 v = float4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..cebbacbc3c --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +ivec4 m() { + t = 1; + return ivec4(t); +} + +void f() { + ivec4 tint_symbol = m(); + vec4 v = vec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..dba6670df2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int4 m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int4(tint_symbol_1); +} + +void f() { + int4 const tint_symbol = m(); + float4 v = float4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..38090e9e88 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %24 = OpConstantNull %v4float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4int None %9 + %12 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + %15 = OpCompositeConstruct %v4int %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %24 + %18 = OpFunctionCall %v4int %m + %19 = OpConvertSToF %v4float %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..79fee1a241 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-f32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : i32; + +fn m() -> vec4 { + t = 1i; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl b/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl new file mode 100644 index 0000000000..b2416718f6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl @@ -0,0 +1,8 @@ +var t : i32; +fn m() -> vec4 { + t = 1i; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..540e6557cc --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int4 m() { + t = 1; + return int4((t).xxxx); +} + +void f() { + const int4 tint_symbol = m(); + uint4 v = uint4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..540e6557cc --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int t = 0; + +int4 m() { + t = 1; + return int4((t).xxxx); +} + +void f() { + const int4 tint_symbol = m(); + uint4 v = uint4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..e6d5d1d0fc --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +int t = 0; +ivec4 m() { + t = 1; + return ivec4(t); +} + +void f() { + ivec4 tint_symbol = m(); + uvec4 v = uvec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..b9fd25dfae --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +int4 m() { + thread int tint_symbol_1 = 0; + tint_symbol_1 = 1; + return int4(tint_symbol_1); +} + +void f() { + int4 const tint_symbol = m(); + uint4 v = uint4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..4193f84800 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %4 = OpConstantNull %int + %t = OpVariable %_ptr_Private_int Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4int = OpTypeVector %int 4 + %9 = OpTypeFunction %v4int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %24 = OpConstantNull %v4uint +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4int None %9 + %12 = OpLabel + OpStore %t %int_1 + %14 = OpLoad %int %t + %15 = OpCompositeConstruct %v4int %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4uint Function %24 + %18 = OpFunctionCall %v4int %m + %19 = OpBitcast %v4uint %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..ac98da0b41 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/i32-u32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : i32; + +fn m() -> vec4 { + t = 1i; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl b/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl new file mode 100644 index 0000000000..37063be909 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl @@ -0,0 +1,8 @@ +var t : u32; +fn m() -> vec4 { + t = 1u; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..0200c33aff --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint4 m() { + t = 1u; + return uint4((t).xxxx); +} + +void f() { + const uint4 tint_symbol = m(); + bool4 v = bool4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..0200c33aff --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint4 m() { + t = 1u; + return uint4((t).xxxx); +} + +void f() { + const uint4 tint_symbol = m(); + bool4 v = bool4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..046484e263 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uvec4 m() { + t = 1u; + return uvec4(t); +} + +void f() { + uvec4 tint_symbol = m(); + bvec4 v = bvec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..978a48d978 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint4 m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint4(tint_symbol_1); +} + +void f() { + uint4 const tint_symbol = m(); + bool4 v = bool4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..9400b88966 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.spvasm @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %22 = OpConstantNull %v4uint +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %25 = OpConstantNull %v4bool +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4uint None %9 + %12 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + %15 = OpCompositeConstruct %v4uint %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4bool Function %25 + %18 = OpFunctionCall %v4uint %m + %19 = OpINotEqual %v4bool %18 %22 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..96f2632167 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-bool.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : u32; + +fn m() -> vec4 { + t = 1u; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl b/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl new file mode 100644 index 0000000000..21b85e2834 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl @@ -0,0 +1,9 @@ +enable f16; +var t : u32; +fn m() -> vec4 { + t = 1u; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b06cf84718 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint4 m() { + t = 1u; + return uint4((t).xxxx); +} + +void f() { + const uint4 tint_symbol = m(); + vector v = vector(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..37692b2f3f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,21 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint4 m() { + t = 1u; + return uint4((t).xxxx); +} + +void f() { + const uint4 tint_symbol = m(); + vector v = vector(tint_symbol); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000026033CC14C0(15,10-18): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8f5d3f6542 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.glsl @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uvec4 m() { + t = 1u; + return uvec4(t); +} + +void f() { + uvec4 tint_symbol = m(); + f16vec4 v = f16vec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..693069d969 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint4 m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint4(tint_symbol_1); +} + +void f() { + uint4 const tint_symbol = m(); + half4 v = half4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..b49be675a3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.spvasm @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint + %uint_1 = OpConstant %uint 1 + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%_ptr_Function_v4half = OpTypePointer Function %v4half + %24 = OpConstantNull %v4half +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4uint None %9 + %12 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + %15 = OpCompositeConstruct %v4uint %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4half Function %24 + %18 = OpFunctionCall %v4uint %m + %19 = OpConvertUToF %v4half %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..2a25752c5a --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-f16.wgsl.expected.wgsl @@ -0,0 +1,12 @@ +enable f16; + +var t : u32; + +fn m() -> vec4 { + t = 1u; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl b/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl new file mode 100644 index 0000000000..0becfffa88 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl @@ -0,0 +1,8 @@ +var t : u32; +fn m() -> vec4 { + t = 1u; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..e7206faa68 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint4 m() { + t = 1u; + return uint4((t).xxxx); +} + +void f() { + const uint4 tint_symbol = m(); + float4 v = float4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..e7206faa68 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint4 m() { + t = 1u; + return uint4((t).xxxx); +} + +void f() { + const uint4 tint_symbol = m(); + float4 v = float4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..140bfb066f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uvec4 m() { + t = 1u; + return uvec4(t); +} + +void f() { + uvec4 tint_symbol = m(); + vec4 v = vec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..1d10727fa3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint4 m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint4(tint_symbol_1); +} + +void f() { + uint4 const tint_symbol = m(); + float4 v = float4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..ccc37e2007 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint + %uint_1 = OpConstant %uint 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %24 = OpConstantNull %v4float +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4uint None %9 + %12 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + %15 = OpCompositeConstruct %v4uint %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function %24 + %18 = OpFunctionCall %v4uint %m + %19 = OpConvertUToF %v4float %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..17c8591475 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-f32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : u32; + +fn m() -> vec4 { + t = 1u; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl b/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl new file mode 100644 index 0000000000..2d377dcf91 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl @@ -0,0 +1,8 @@ +var t : u32; +fn m() -> vec4 { + t = 1u; + return vec4(t); +} +fn f() { + var v : vec4 = vec4(m()); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..de86c5e50f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint4 m() { + t = 1u; + return uint4((t).xxxx); +} + +void f() { + const uint4 tint_symbol = m(); + int4 v = int4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..de86c5e50f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,16 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint t = 0u; + +uint4 m() { + t = 1u; + return uint4((t).xxxx); +} + +void f() { + const uint4 tint_symbol = m(); + int4 v = int4(tint_symbol); +} diff --git a/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..469219e037 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.glsl @@ -0,0 +1,17 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uint t = 0u; +uvec4 m() { + t = 1u; + return uvec4(t); +} + +void f() { + uvec4 tint_symbol = m(); + ivec4 v = ivec4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..3d01461a42 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +uint4 m() { + thread uint tint_symbol_1 = 0u; + tint_symbol_1 = 1u; + return uint4(tint_symbol_1); +} + +void f() { + uint4 const tint_symbol = m(); + int4 v = int4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..d0676cc002 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.spvasm @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %t "t" + OpName %unused_entry_point "unused_entry_point" + OpName %m "m" + OpName %f "f" + OpName %v "v" + %uint = OpTypeInt 32 0 +%_ptr_Private_uint = OpTypePointer Private %uint + %4 = OpConstantNull %uint + %t = OpVariable %_ptr_Private_uint Private %4 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %9 = OpTypeFunction %v4uint + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %24 = OpConstantNull %v4int +%unused_entry_point = OpFunction %void None %5 + %8 = OpLabel + OpReturn + OpFunctionEnd + %m = OpFunction %v4uint None %9 + %12 = OpLabel + OpStore %t %uint_1 + %14 = OpLoad %uint %t + %15 = OpCompositeConstruct %v4uint %14 %14 %14 %14 + OpReturnValue %15 + OpFunctionEnd + %f = OpFunction %void None %5 + %17 = OpLabel + %v = OpVariable %_ptr_Function_v4int Function %24 + %18 = OpFunctionCall %v4uint %m + %19 = OpBitcast %v4int %18 + OpStore %v %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..1bc121edc6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/function/u32-i32.wgsl.expected.wgsl @@ -0,0 +1,10 @@ +var t : u32; + +fn m() -> vec4 { + t = 1u; + return vec4(t); +} + +fn f() { + var v : vec4 = vec4(m()); +} diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl b/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl new file mode 100644 index 0000000000..15b86254bd --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec4 = vec4(vec4(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b19e34fedd --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..4cba756fc3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001B383CD29D0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..34179896b2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec4 u = f16vec4(1.0hf); diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..59bfc2e744 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v4half = OpTypePointer Private %v4half + %u = OpVariable %_ptr_Private_v4half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..669fa6f081 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec4 = vec4(vec4(true)); diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl b/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl new file mode 100644 index 0000000000..47d86d178c --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..025ef77519 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..025ef77519 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..80d5dce395 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec4 u = vec4(1.0f); diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..75383c4862 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %u = OpVariable %_ptr_Private_v4float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..fbf1e3e42d --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(true)); diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl b/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl new file mode 100644 index 0000000000..bcae232541 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a6ed825d2e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a6ed825d2e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..68adc466b8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec4 u = ivec4(1); diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..21f3fcb6f9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Private_v4int = OpTypePointer Private %v4int + %u = OpVariable %_ptr_Private_v4int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..277112e4e5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-i32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(true)); diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl b/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl new file mode 100644 index 0000000000..3c3407ec02 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(true)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..64dca337b5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..64dca337b5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..c48939c7e1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec4 u = uvec4(1u); diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..3947540ec4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Private_v4uint = OpTypePointer Private %v4uint + %u = OpVariable %_ptr_Private_v4uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..67ff810820 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/bool-u32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(true)); diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl b/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl new file mode 100644 index 0000000000..8ea3ccff4c --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec4 = vec4(vec4(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9017efae27 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9017efae27 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..d9b051df6e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec4 u = bvec4(true); diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..385bea4fec --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Private_v4bool = OpTypePointer Private %v4bool + %u = OpVariable %_ptr_Private_v4bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..fe4e625a79 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-bool.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec4 = vec4(vec4(1.0h)); diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl b/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl new file mode 100644 index 0000000000..04507bd590 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec4 = vec4(vec4(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..025ef77519 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..025ef77519 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..01028949ef --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec4 u = vec4(1.0f); diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..6a88ed78cb --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %u = OpVariable %_ptr_Private_v4float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..f11b5ea3b0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec4 = vec4(vec4(1.0h)); diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl b/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl new file mode 100644 index 0000000000..92443eecc8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec4 = vec4(vec4(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a6ed825d2e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a6ed825d2e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..3921a03cb2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec4 u = ivec4(1); diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..53f16ba24c --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Private_v4int = OpTypePointer Private %v4int + %u = OpVariable %_ptr_Private_v4int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..90a6786842 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-i32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec4 = vec4(vec4(1.0h)); diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl b/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl new file mode 100644 index 0000000000..eb74263284 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec4 = vec4(vec4(1.0h)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..64dca337b5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..64dca337b5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..0b7891ebc6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec4 u = uvec4(1u); diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..a7c9b7df3d --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Private_v4uint = OpTypePointer Private %v4uint + %u = OpVariable %_ptr_Private_v4uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..30df0ca741 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f16-u32.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec4 = vec4(vec4(1.0h)); diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl b/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl new file mode 100644 index 0000000000..b209a00190 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9017efae27 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9017efae27 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..d6abe9a9b4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec4 u = bvec4(true); diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..6b101e41db --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Private_v4bool = OpTypePointer Private %v4bool + %u = OpVariable %_ptr_Private_v4bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..a9ed6a14c8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-bool.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1.0f)); diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl b/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl new file mode 100644 index 0000000000..44819ec151 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec4 = vec4(vec4(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b19e34fedd --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..569583a0ea --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x000001F94D6E2680(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..34179896b2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec4 u = f16vec4(1.0hf); diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..59bfc2e744 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v4half = OpTypePointer Private %v4half + %u = OpVariable %_ptr_Private_v4half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..41d0171693 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec4 = vec4(vec4(1.0f)); diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl b/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl new file mode 100644 index 0000000000..b1947b6e14 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a6ed825d2e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a6ed825d2e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..68adc466b8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec4 u = ivec4(1); diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..21f3fcb6f9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Private_v4int = OpTypePointer Private %v4int + %u = OpVariable %_ptr_Private_v4int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..c3075dd389 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-i32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1.0f)); diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl b/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl new file mode 100644 index 0000000000..a08debd035 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1.0f)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..64dca337b5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..64dca337b5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..c48939c7e1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec4 u = uvec4(1u); diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..3947540ec4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Private_v4uint = OpTypePointer Private %v4uint + %u = OpVariable %_ptr_Private_v4uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..0c31fb42da --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/f32-u32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1.0f)); diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl b/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl new file mode 100644 index 0000000000..1dad522c97 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9017efae27 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9017efae27 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..d6abe9a9b4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec4 u = bvec4(true); diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..6b101e41db --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Private_v4bool = OpTypePointer Private %v4bool + %u = OpVariable %_ptr_Private_v4bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..352d277261 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-bool.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1i)); diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl b/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl new file mode 100644 index 0000000000..548b47fcdc --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec4 = vec4(vec4(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b19e34fedd --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..1161d3c0dd --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000020644FC2930(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..34179896b2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec4 u = f16vec4(1.0hf); diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..59bfc2e744 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v4half = OpTypePointer Private %v4half + %u = OpVariable %_ptr_Private_v4half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..2f86a82d0d --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec4 = vec4(vec4(1i)); diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl b/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl new file mode 100644 index 0000000000..6859a091e5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..025ef77519 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..025ef77519 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..80d5dce395 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec4 u = vec4(1.0f); diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..75383c4862 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %u = OpVariable %_ptr_Private_v4float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..6ae4724c01 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1i)); diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl b/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl new file mode 100644 index 0000000000..3123d609b5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1i)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..64dca337b5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..64dca337b5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..c48939c7e1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec4 u = uvec4(1u); diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..3947540ec4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Private_v4uint = OpTypePointer Private %v4uint + %u = OpVariable %_ptr_Private_v4uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..43975b3595 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/i32-u32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1i)); diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl b/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl new file mode 100644 index 0000000000..747f25a27f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..9017efae27 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..9017efae27 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..d6abe9a9b4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec4 u = bvec4(true); diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..6b101e41db --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Private_v4bool = OpTypePointer Private %v4bool + %u = OpVariable %_ptr_Private_v4bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..499f83dd69 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-bool.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1u)); diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl b/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl new file mode 100644 index 0000000000..e82f0a5a70 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl @@ -0,0 +1,2 @@ +enable f16; +var u : vec4 = vec4(vec4(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..b19e34fedd --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..b856c1bc23 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,11 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000017E668629D0(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..34179896b2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.glsl @@ -0,0 +1,8 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec4 u = f16vec4(1.0hf); diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..59bfc2e744 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.spvasm @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v4half = OpTypePointer Private %v4half + %u = OpVariable %_ptr_Private_v4half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..20f3098fc5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-f16.wgsl.expected.wgsl @@ -0,0 +1,3 @@ +enable f16; + +var u : vec4 = vec4(vec4(1u)); diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl b/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl new file mode 100644 index 0000000000..4a7cc517c4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..025ef77519 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..025ef77519 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..80d5dce395 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec4 u = vec4(1.0f); diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..75383c4862 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %u = OpVariable %_ptr_Private_v4float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..6741ad367a --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-f32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1u)); diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl b/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl new file mode 100644 index 0000000000..bad4e12e7c --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1u)); \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a6ed825d2e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a6ed825d2e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,6 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..68adc466b8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.glsl @@ -0,0 +1,7 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec4 u = ivec4(1); diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..466ceaa5d6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.msl @@ -0,0 +1,3 @@ +#include + +using namespace metal; diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..21f3fcb6f9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.spvasm @@ -0,0 +1,23 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 11 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Private_v4int = OpTypePointer Private %v4int + %u = OpVariable %_ptr_Private_v4int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..25baa3b91b --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/literal/u32-i32.wgsl.expected.wgsl @@ -0,0 +1 @@ +var u : vec4 = vec4(vec4(1u)); diff --git a/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl b/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl new file mode 100644 index 0000000000..47caed63d7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec4(true); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..39be8072c8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; + +void f() { + const vector v = vector(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..664b1a0ca1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; + +void f() { + const vector v = vector(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000198D15D4D70(9,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..b26e8d9799 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec4 u = bvec4(true); +void f() { + f16vec4 v = f16vec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.msl new file mode 100644 index 0000000000..9b7a3f9075 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool4 tint_symbol = bool4(true); + half4 const v = half4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..a46c851f21 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.spvasm @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Private_v4bool = OpTypePointer Private %v4bool + %u = OpVariable %_ptr_Private_v4bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%half_0x0p_0 = OpConstant %half 0x0p+0 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %19 = OpConstantComposite %v4half %half_0x0p_0 %half_0x0p_0 %half_0x0p_0 %half_0x0p_0 + %20 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4bool %u + %13 = OpSelect %v4half %16 %20 %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..38a93673d4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec4(true); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl b/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl new file mode 100644 index 0000000000..06d2413fbc --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl @@ -0,0 +1,4 @@ +var u = vec4(true); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a3bea34320 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; + +void f() { + const float4 v = float4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a3bea34320 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; + +void f() { + const float4 v = float4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..4cfce9d908 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec4 u = bvec4(true); +void f() { + vec4 v = vec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.msl new file mode 100644 index 0000000000..a8141a0842 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool4 tint_symbol = bool4(true); + float4 const v = float4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..80b4e6149f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Private_v4bool = OpTypePointer Private %v4bool + %u = OpVariable %_ptr_Private_v4bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %19 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4bool %u + %13 = OpSelect %v4float %16 %20 %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..012c4afca1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec4(true); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl b/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl new file mode 100644 index 0000000000..42910cb164 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl @@ -0,0 +1,4 @@ +var u = vec4(true); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..bf0187f963 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; + +void f() { + const int4 v = int4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..bf0187f963 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; + +void f() { + const int4 v = int4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..c39982af18 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec4 u = bvec4(true); +void f() { + ivec4 v = ivec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.msl new file mode 100644 index 0000000000..3cbb3bddc5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool4 tint_symbol = bool4(true); + int4 const v = int4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..f66585da4c --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Private_v4bool = OpTypePointer Private %v4bool + %u = OpVariable %_ptr_Private_v4bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %19 = OpConstantComposite %v4int %int_0 %int_0 %int_0 %int_0 + %20 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4bool %u + %13 = OpSelect %v4int %16 %20 %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..34d72bd121 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec4(true); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl b/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl new file mode 100644 index 0000000000..8014ccbeb5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl @@ -0,0 +1,4 @@ +var u = vec4(true); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f3191ce2d1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; + +void f() { + const uint4 v = uint4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f3191ce2d1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static bool4 u = (true).xxxx; + +void f() { + const uint4 v = uint4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..f26748b1f9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +bvec4 u = bvec4(true); +void f() { + uvec4 v = uvec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.msl new file mode 100644 index 0000000000..027dc8ba62 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread bool4 tint_symbol = bool4(true); + uint4 const v = uint4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..79bfd4c8a8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %true = OpConstantTrue %bool + %4 = OpConstantComposite %v4bool %true %true %true %true +%_ptr_Private_v4bool = OpTypePointer Private %v4bool + %u = OpVariable %_ptr_Private_v4bool Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %19 = OpConstantComposite %v4uint %uint_0 %uint_0 %uint_0 %uint_0 + %20 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4bool %u + %13 = OpSelect %v4uint %16 %20 %19 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..94d8717901 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/bool-u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec4(true); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl b/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl new file mode 100644 index 0000000000..ed1a22e3c2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec4(1.0h); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2f5e25b213 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; + +void f() { + const bool4 v = bool4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..52ad4b0dbf --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; + +void f() { + const bool4 v = bool4(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000021275822660(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..a3d943a13b --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec4 u = f16vec4(1.0hf); +void f() { + bvec4 v = bvec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.msl new file mode 100644 index 0000000000..2f4290848e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half4 tint_symbol = half4(1.0h); + bool4 const v = bool4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..6d78b7374d --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.spvasm @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v4half = OpTypePointer Private %v4half + %u = OpVariable %_ptr_Private_v4half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %17 = OpConstantNull %v4half +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4half %u + %13 = OpFUnordNotEqual %v4bool %16 %17 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..9a52f49ba2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-bool.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec4(1.0h); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl b/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl new file mode 100644 index 0000000000..328419d384 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec4(1.0h); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..966a8bb698 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; + +void f() { + const float4 v = float4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3ca8b05f44 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; + +void f() { + const float4 v = float4(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x00000203C6842F20(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..ea7b7697b1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec4 u = f16vec4(1.0hf); +void f() { + vec4 v = vec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.msl new file mode 100644 index 0000000000..f3b5e74077 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half4 tint_symbol = half4(1.0h); + float4 const v = float4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..352f6454a2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v4half = OpTypePointer Private %v4half + %u = OpVariable %_ptr_Private_v4half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4half %u + %13 = OpFConvert %v4float %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..295f03525f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-f32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec4(1.0h); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl new file mode 100644 index 0000000000..0175e6945a --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec4(1.0h); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..11254e758b --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; + +void f() { + const int4 v = int4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..7db52690f8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; + +void f() { + const int4 v = int4(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000020709DB6170(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..3d197ca1dd --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec4 u = f16vec4(1.0hf); +void f() { + ivec4 v = ivec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.msl new file mode 100644 index 0000000000..cf6ae1d9e5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half4 tint_symbol = half4(1.0h); + int4 const v = int4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..3fb88bba64 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v4half = OpTypePointer Private %v4half + %u = OpVariable %_ptr_Private_v4half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4half %u + %13 = OpConvertFToS %v4int %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..c383549a9f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-i32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec4(1.0h); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl new file mode 100644 index 0000000000..16806cd180 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec4(1.0h); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..cc76bfb4f4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; + +void f() { + const uint4 v = uint4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..310be0b725 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static vector u = (float16_t(1.0h)).xxxx; + +void f() { + const uint4 v = uint4(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000024FA6C38800(6,15-23): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..d7346e6ac1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +f16vec4 u = f16vec4(1.0hf); +void f() { + uvec4 v = uvec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.msl new file mode 100644 index 0000000000..829e365f67 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread half4 tint_symbol = half4(1.0h); + uint4 const v = uint4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..e5c496b2fc --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%half_0x1p_0 = OpConstant %half 0x1p+0 + %4 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 +%_ptr_Private_v4half = OpTypePointer Private %v4half + %u = OpVariable %_ptr_Private_v4half Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4half %u + %13 = OpConvertFToU %v4uint %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..34a5e9db6c --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f16-u32.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec4(1.0h); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl b/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl new file mode 100644 index 0000000000..b20f1f2f5e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl @@ -0,0 +1,4 @@ +var u = vec4(1.0f); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..55401a3d59 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; + +void f() { + const bool4 v = bool4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..55401a3d59 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; + +void f() { + const bool4 v = bool4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..e6f107af6a --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec4 u = vec4(1.0f); +void f() { + bvec4 v = bvec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..a394670661 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float4 tint_symbol = float4(1.0f); + bool4 const v = bool4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..9d9aed880a --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %u = OpVariable %_ptr_Private_v4float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %17 = OpConstantNull %v4float +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4float %u + %13 = OpFUnordNotEqual %v4bool %16 %17 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..09ef828e27 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-bool.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec4(1.0f); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl b/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl new file mode 100644 index 0000000000..84299a25bf --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec4(1.0f); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..4373d4ee03 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; + +void f() { + const vector v = vector(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..95ddf743cb --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; + +void f() { + const vector v = vector(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000019C598E6800(9,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..a4546409ee --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec4 u = vec4(1.0f); +void f() { + f16vec4 v = f16vec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..fddac9cada --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float4 tint_symbol = float4(1.0f); + half4 const v = half4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..dca3178199 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %u = OpVariable %_ptr_Private_v4float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4float %u + %13 = OpFConvert %v4half %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..b94949f04f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec4(1.0f); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl new file mode 100644 index 0000000000..86dbe7ab60 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl @@ -0,0 +1,4 @@ +var u = vec4(1.0f); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..18aa48ac1f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; + +void f() { + const int4 v = int4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..18aa48ac1f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; + +void f() { + const int4 v = int4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..8d1d35ccd1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec4 u = vec4(1.0f); +void f() { + ivec4 v = ivec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..297888b86f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float4 tint_symbol = float4(1.0f); + int4 const v = int4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..9a3607a3e7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %u = OpVariable %_ptr_Private_v4float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4float %u + %13 = OpConvertFToS %v4int %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..fc956bfe4e --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec4(1.0f); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl new file mode 100644 index 0000000000..6d80da25f7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl @@ -0,0 +1,4 @@ +var u = vec4(1.0f); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f69250f1c0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; + +void f() { + const uint4 v = uint4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f69250f1c0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static float4 u = (1.0f).xxxx; + +void f() { + const uint4 v = uint4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..3dc90b66d7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +vec4 u = vec4(1.0f); +void f() { + uvec4 v = uvec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..ed3bb120c0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread float4 tint_symbol = float4(1.0f); + uint4 const v = uint4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..3916cbd769 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %4 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %u = OpVariable %_ptr_Private_v4float Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4float %u + %13 = OpConvertFToU %v4uint %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..c419d152ca --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/f32-u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec4(1.0f); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl b/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl new file mode 100644 index 0000000000..a49d3fa90b --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl @@ -0,0 +1,4 @@ +var u = vec4(1i); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..67551090f2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; + +void f() { + const bool4 v = bool4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..67551090f2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; + +void f() { + const bool4 v = bool4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..f45ae949b0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec4 u = ivec4(1); +void f() { + bvec4 v = bvec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..30c90bc0ec --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int4 tint_symbol = int4(1); + bool4 const v = bool4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..0f46ecc255 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Private_v4int = OpTypePointer Private %v4int + %u = OpVariable %_ptr_Private_v4int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %17 = OpConstantNull %v4int +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4int %u + %13 = OpINotEqual %v4bool %16 %17 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..a4f01fec36 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-bool.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec4(1i); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl b/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl new file mode 100644 index 0000000000..9b872ede24 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec4(1i); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..2538b985d0 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; + +void f() { + const vector v = vector(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3c1a6b01a5 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; + +void f() { + const vector v = vector(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000020AD0F04D70(9,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..4a9bbb26ec --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec4 u = ivec4(1); +void f() { + f16vec4 v = f16vec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..88675aa93b --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int4 tint_symbol = int4(1); + half4 const v = half4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..d3a076fe81 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Private_v4int = OpTypePointer Private %v4int + %u = OpVariable %_ptr_Private_v4int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4int %u + %13 = OpConvertSToF %v4half %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..cc3388c4d8 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec4(1i); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl b/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl new file mode 100644 index 0000000000..a26b159f6d --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl @@ -0,0 +1,4 @@ +var u = vec4(1i); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..3916fdd5c4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; + +void f() { + const float4 v = float4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..3916fdd5c4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; + +void f() { + const float4 v = float4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..91971bf8f4 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec4 u = ivec4(1); +void f() { + vec4 v = vec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..ccbcd16ab2 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int4 tint_symbol = int4(1); + float4 const v = float4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..9971314051 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Private_v4int = OpTypePointer Private %v4int + %u = OpVariable %_ptr_Private_v4int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4int %u + %13 = OpConvertSToF %v4float %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..ad3540a6d7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec4(1i); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl b/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl new file mode 100644 index 0000000000..846cb13e15 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl @@ -0,0 +1,4 @@ +var u = vec4(1i); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..098d20fb1d --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; + +void f() { + const uint4 v = uint4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..098d20fb1d --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static int4 u = (1).xxxx; + +void f() { + const uint4 v = uint4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.glsl new file mode 100644 index 0000000000..c84f56dc23 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +ivec4 u = ivec4(1); +void f() { + uvec4 v = uvec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.msl new file mode 100644 index 0000000000..3836150d51 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread int4 tint_symbol = int4(1); + uint4 const v = uint4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.spvasm new file mode 100644 index 0000000000..0eff084df7 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_1 = OpConstant %int 1 + %4 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 +%_ptr_Private_v4int = OpTypePointer Private %v4int + %u = OpVariable %_ptr_Private_v4int Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4int %u + %13 = OpBitcast %v4uint %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.wgsl new file mode 100644 index 0000000000..42d0a42c4b --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/i32-u32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec4(1i); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl b/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl new file mode 100644 index 0000000000..306e66a542 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl @@ -0,0 +1,4 @@ +var u = vec4(1u); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..27e4939e6f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; + +void f() { + const bool4 v = bool4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..27e4939e6f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; + +void f() { + const bool4 v = bool4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.glsl new file mode 100644 index 0000000000..afe1aac65f --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec4 u = uvec4(1u); +void f() { + bvec4 v = bvec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.msl new file mode 100644 index 0000000000..7ae3843213 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint4 tint_symbol = uint4(1u); + bool4 const v = bool4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.spvasm new file mode 100644 index 0000000000..9b931a37ec --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.spvasm @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 18 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Private_v4uint = OpTypePointer Private %v4uint + %u = OpVariable %_ptr_Private_v4uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %17 = OpConstantNull %v4uint +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4uint %u + %13 = OpINotEqual %v4bool %16 %17 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.wgsl new file mode 100644 index 0000000000..4f8545ad85 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-bool.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec4(1u); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl b/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl new file mode 100644 index 0000000000..184d8980a6 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl @@ -0,0 +1,5 @@ +enable f16; +var u = vec4(1u); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..dcc56ac5fa --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; + +void f() { + const vector v = vector(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..c301529809 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.fxc.hlsl @@ -0,0 +1,15 @@ +SKIP: FAILED + +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; + +void f() { + const vector v = vector(u); +} +FXC validation failure: +D:\Projects\RampUp\dawn\test\tint\expressions\type_conv\Shader@0x0000020D1A4520E0(9,16-24): error X3000: syntax error: unexpected token 'float16_t' + diff --git a/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.glsl new file mode 100644 index 0000000000..8749f8c010 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.glsl @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_AMD_gpu_shader_half_float : require + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec4 u = uvec4(1u); +void f() { + f16vec4 v = f16vec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.msl new file mode 100644 index 0000000000..1590b32fa9 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint4 tint_symbol = uint4(1u); + half4 const v = half4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.spvasm new file mode 100644 index 0000000000..424ea0865a --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.spvasm @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability UniformAndStorageBuffer16BitAccess + OpCapability StorageBuffer16BitAccess + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Private_v4uint = OpTypePointer Private %v4uint + %u = OpVariable %_ptr_Private_v4uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v4half = OpTypeVector %half 4 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4uint %u + %13 = OpConvertUToF %v4half %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.wgsl new file mode 100644 index 0000000000..5988d9492a --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-f16.wgsl.expected.wgsl @@ -0,0 +1,7 @@ +enable f16; + +var u = vec4(1u); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl b/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl new file mode 100644 index 0000000000..a06930b250 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl @@ -0,0 +1,4 @@ +var u = vec4(1u); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..f58fddb500 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; + +void f() { + const float4 v = float4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..f58fddb500 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; + +void f() { + const float4 v = float4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.glsl new file mode 100644 index 0000000000..62e3cd1dd1 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec4 u = uvec4(1u); +void f() { + vec4 v = vec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.msl new file mode 100644 index 0000000000..6a2d33eba3 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint4 tint_symbol = uint4(1u); + float4 const v = float4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.spvasm new file mode 100644 index 0000000000..0ba569cd76 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Private_v4uint = OpTypePointer Private %v4uint + %u = OpVariable %_ptr_Private_v4uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4uint %u + %13 = OpConvertUToF %v4float %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.wgsl new file mode 100644 index 0000000000..a6da4e3dca --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-f32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec4(1u); + +fn f() { + let v : vec4 = vec4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl b/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl new file mode 100644 index 0000000000..0e136e9641 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl @@ -0,0 +1,4 @@ +var u = vec4(1u); +fn f() { + let v : vec4 = vec4(u); +} \ No newline at end of file diff --git a/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.dxc.hlsl b/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..ad29b7e978 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.dxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; + +void f() { + const int4 v = int4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.fxc.hlsl b/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..ad29b7e978 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.fxc.hlsl @@ -0,0 +1,10 @@ +[numthreads(1, 1, 1)] +void unused_entry_point() { + return; +} + +static uint4 u = (1u).xxxx; + +void f() { + const int4 v = int4(u); +} diff --git a/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.glsl b/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.glsl new file mode 100644 index 0000000000..c65d0a4c16 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.glsl @@ -0,0 +1,11 @@ +#version 310 es + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void unused_entry_point() { + return; +} +uvec4 u = uvec4(1u); +void f() { + ivec4 v = ivec4(u); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.msl b/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.msl new file mode 100644 index 0000000000..48c573319a --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.msl @@ -0,0 +1,8 @@ +#include + +using namespace metal; +void f() { + thread uint4 tint_symbol = uint4(1u); + int4 const v = int4(tint_symbol); +} + diff --git a/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.spvasm b/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.spvasm new file mode 100644 index 0000000000..b00ef00e72 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.spvasm @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %unused_entry_point "unused_entry_point" + OpExecutionMode %unused_entry_point LocalSize 1 1 1 + OpName %u "u" + OpName %unused_entry_point "unused_entry_point" + OpName %f "f" + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %4 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 +%_ptr_Private_v4uint = OpTypePointer Private %v4uint + %u = OpVariable %_ptr_Private_v4uint Private %4 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%unused_entry_point = OpFunction %void None %7 + %10 = OpLabel + OpReturn + OpFunctionEnd + %f = OpFunction %void None %7 + %12 = OpLabel + %16 = OpLoad %v4uint %u + %13 = OpBitcast %v4int %16 + OpReturn + OpFunctionEnd diff --git a/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.wgsl b/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.wgsl new file mode 100644 index 0000000000..6429113c07 --- /dev/null +++ b/test/tint/expressions/type_conv/vec4/var/u32-i32.wgsl.expected.wgsl @@ -0,0 +1,5 @@ +var u = vec4(1u); + +fn f() { + let v : vec4 = vec4(u); +}