mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 13:38:00 +00:00
Merge remote-tracking branch 'tint/main' into HEAD
Integrates Tint repo into Dawn KIs: - Building docs for Tint is turned off, because it fails due to lack of annotations in Dawn source files. - Dawn CQ needs to be updated to run Tint specific tests - Significant post-merge cleanup needed R=bclayton,cwallez BUG=dawn:1339 Change-Id: I6c9714a0030934edd6c51f3cac4684dcd59d1ea3
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Copyright 2022 The Dawn Authors
|
||||
# Copyright 2022 The Dawn & Tint Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -12,11 +12,806 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("../../scripts/dawn_overrides_with_defaults.gni")
|
||||
import("//build_overrides/build.gni")
|
||||
import("//testing/test.gni")
|
||||
import("../../tint_overrides_with_defaults.gni")
|
||||
|
||||
# Target aliases to ease merging Tint->Dawn
|
||||
###############################################################################
|
||||
# Gtest Gmock - Handle building inside and outside of Chromium.
|
||||
###############################################################################
|
||||
# When building outside of Chromium we need to define our own targets for GTest
|
||||
# and GMock. However when compiling inside of Chromium we need to reuse the
|
||||
# existing targets, both because Chromium has a special harness for swarming
|
||||
# and because otherwise the "gn check" fails.
|
||||
|
||||
if (!build_with_chromium) {
|
||||
# When we aren't in Chromium we define out own targets based on the location
|
||||
# of the googletest repo.
|
||||
config("gtest_config") {
|
||||
include_dirs = [
|
||||
"${tint_googletest_dir}/googletest",
|
||||
"${tint_googletest_dir}/googletest/include",
|
||||
]
|
||||
}
|
||||
static_library("gtest") {
|
||||
testonly = true
|
||||
sources = [ "${tint_googletest_dir}/googletest/src/gtest-all.cc" ]
|
||||
public_configs = [ ":gtest_config" ]
|
||||
}
|
||||
|
||||
config("gmock_config") {
|
||||
include_dirs = [
|
||||
"${tint_googletest_dir}/googlemock",
|
||||
"${tint_googletest_dir}/googlemock/include",
|
||||
"${tint_googletest_dir}/googletest/include",
|
||||
]
|
||||
}
|
||||
|
||||
static_library("gmock") {
|
||||
testonly = true
|
||||
sources = [ "${tint_googletest_dir}/googlemock/src/gmock-all.cc" ]
|
||||
public_configs = [ ":gmock_config" ]
|
||||
}
|
||||
|
||||
group("gmock_and_gtest") {
|
||||
testonly = true
|
||||
public_deps = [
|
||||
":gmock",
|
||||
":gtest",
|
||||
]
|
||||
}
|
||||
} else {
|
||||
# When we are in Chromium we reuse its targets, and also add some deps that
|
||||
# are needed to launch the test in swarming mode.
|
||||
group("gmock_and_gtest") {
|
||||
testonly = true
|
||||
public_deps = [
|
||||
"//base",
|
||||
"//base/test:test_support",
|
||||
"//testing/gmock",
|
||||
"//testing/gtest",
|
||||
"//third_party/googletest:gmock",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Wrapping of Chromium targets
|
||||
###############################################################################
|
||||
# These targets are separated because they are Chromium sources files that
|
||||
# can't use the tint_internal config, otherwise Tint's warning flags get
|
||||
# applied while compiling a bunch of Chromium's //base (via header inclusion)
|
||||
source_set("tint_unittests_main") {
|
||||
testonly = true
|
||||
deps = [ ":gmock_and_gtest" ]
|
||||
if (build_with_chromium) {
|
||||
sources = [ "//gpu/tint_unittests_main.cc" ]
|
||||
} else {
|
||||
sources = [ "../../src/tint/test_main.cc" ]
|
||||
configs += [ ":tint_unittests_config" ]
|
||||
deps += [
|
||||
":tint_unittests_hlsl_writer_src",
|
||||
":tint_unittests_msl_writer_src",
|
||||
":tint_unittests_spv_reader_src",
|
||||
"${tint_root_dir}/src/tint:libtint",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Tests - For libtint core and optional modules
|
||||
###############################################################################
|
||||
config("tint_unittests_config") {
|
||||
include_dirs = [
|
||||
"${tint_googletest_dir}/googlemock/include",
|
||||
"${tint_googletest_dir}/googletest/include",
|
||||
]
|
||||
|
||||
configs = [
|
||||
"${tint_root_dir}/src/tint:tint_common_config",
|
||||
"${tint_root_dir}/src/tint:tint_public_config",
|
||||
]
|
||||
}
|
||||
|
||||
template("tint_unittests_source_set") {
|
||||
source_set(target_name) {
|
||||
forward_variables_from(invoker, "*", [ "configs" ])
|
||||
|
||||
if (defined(invoker.configs)) {
|
||||
configs += invoker.configs
|
||||
}
|
||||
configs += [ ":tint_unittests_config" ]
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
}
|
||||
|
||||
testonly = true
|
||||
|
||||
if (!defined(invoker.deps)) {
|
||||
deps = []
|
||||
}
|
||||
deps += [
|
||||
":gmock_and_gtest",
|
||||
"${tint_root_dir}/src/tint:libtint",
|
||||
"${tint_root_dir}/src/tint:tint_utils_io",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_ast_src") {
|
||||
sources = [
|
||||
"../../src/tint/ast/alias_test.cc",
|
||||
"../../src/tint/ast/array_test.cc",
|
||||
"../../src/tint/ast/assignment_statement_test.cc",
|
||||
"../../src/tint/ast/atomic_test.cc",
|
||||
"../../src/tint/ast/binary_expression_test.cc",
|
||||
"../../src/tint/ast/binding_attribute_test.cc",
|
||||
"../../src/tint/ast/bitcast_expression_test.cc",
|
||||
"../../src/tint/ast/block_statement_test.cc",
|
||||
"../../src/tint/ast/bool_literal_expression_test.cc",
|
||||
"../../src/tint/ast/bool_test.cc",
|
||||
"../../src/tint/ast/break_statement_test.cc",
|
||||
"../../src/tint/ast/builtin_attribute_test.cc",
|
||||
"../../src/tint/ast/builtin_texture_helper_test.cc",
|
||||
"../../src/tint/ast/builtin_texture_helper_test.h",
|
||||
"../../src/tint/ast/call_expression_test.cc",
|
||||
"../../src/tint/ast/call_statement_test.cc",
|
||||
"../../src/tint/ast/case_statement_test.cc",
|
||||
"../../src/tint/ast/compound_assignment_statement_test.cc",
|
||||
"../../src/tint/ast/continue_statement_test.cc",
|
||||
"../../src/tint/ast/depth_multisampled_texture_test.cc",
|
||||
"../../src/tint/ast/depth_texture_test.cc",
|
||||
"../../src/tint/ast/discard_statement_test.cc",
|
||||
"../../src/tint/ast/else_statement_test.cc",
|
||||
"../../src/tint/ast/external_texture_test.cc",
|
||||
"../../src/tint/ast/f32_test.cc",
|
||||
"../../src/tint/ast/fallthrough_statement_test.cc",
|
||||
"../../src/tint/ast/float_literal_expression_test.cc",
|
||||
"../../src/tint/ast/for_loop_statement_test.cc",
|
||||
"../../src/tint/ast/function_test.cc",
|
||||
"../../src/tint/ast/group_attribute_test.cc",
|
||||
"../../src/tint/ast/i32_test.cc",
|
||||
"../../src/tint/ast/id_attribute_test.cc",
|
||||
"../../src/tint/ast/identifier_expression_test.cc",
|
||||
"../../src/tint/ast/if_statement_test.cc",
|
||||
"../../src/tint/ast/index_accessor_expression_test.cc",
|
||||
"../../src/tint/ast/int_literal_expression_test.cc",
|
||||
"../../src/tint/ast/interpolate_attribute_test.cc",
|
||||
"../../src/tint/ast/invariant_attribute_test.cc",
|
||||
"../../src/tint/ast/location_attribute_test.cc",
|
||||
"../../src/tint/ast/loop_statement_test.cc",
|
||||
"../../src/tint/ast/matrix_test.cc",
|
||||
"../../src/tint/ast/member_accessor_expression_test.cc",
|
||||
"../../src/tint/ast/module_clone_test.cc",
|
||||
"../../src/tint/ast/module_test.cc",
|
||||
"../../src/tint/ast/multisampled_texture_test.cc",
|
||||
"../../src/tint/ast/phony_expression_test.cc",
|
||||
"../../src/tint/ast/pointer_test.cc",
|
||||
"../../src/tint/ast/return_statement_test.cc",
|
||||
"../../src/tint/ast/sampled_texture_test.cc",
|
||||
"../../src/tint/ast/sampler_test.cc",
|
||||
"../../src/tint/ast/sint_literal_expression_test.cc",
|
||||
"../../src/tint/ast/stage_attribute_test.cc",
|
||||
"../../src/tint/ast/storage_texture_test.cc",
|
||||
"../../src/tint/ast/stride_attribute_test.cc",
|
||||
"../../src/tint/ast/struct_member_align_attribute_test.cc",
|
||||
"../../src/tint/ast/struct_member_offset_attribute_test.cc",
|
||||
"../../src/tint/ast/struct_member_size_attribute_test.cc",
|
||||
"../../src/tint/ast/struct_member_test.cc",
|
||||
"../../src/tint/ast/struct_test.cc",
|
||||
"../../src/tint/ast/switch_statement_test.cc",
|
||||
"../../src/tint/ast/test_helper.h",
|
||||
"../../src/tint/ast/texture_test.cc",
|
||||
"../../src/tint/ast/traverse_expressions_test.cc",
|
||||
"../../src/tint/ast/u32_test.cc",
|
||||
"../../src/tint/ast/uint_literal_expression_test.cc",
|
||||
"../../src/tint/ast/unary_op_expression_test.cc",
|
||||
"../../src/tint/ast/variable_decl_statement_test.cc",
|
||||
"../../src/tint/ast/variable_test.cc",
|
||||
"../../src/tint/ast/vector_test.cc",
|
||||
"../../src/tint/ast/workgroup_attribute_test.cc",
|
||||
]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_diagnostic_src") {
|
||||
sources = [
|
||||
"../../src/tint/diagnostic/diagnostic_test.cc",
|
||||
"../../src/tint/diagnostic/formatter_test.cc",
|
||||
"../../src/tint/diagnostic/printer_test.cc",
|
||||
]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_inspector_src") {
|
||||
sources = [
|
||||
"../../src/tint/inspector/inspector_test.cc",
|
||||
"../../src/tint/inspector/test_inspector_builder.cc",
|
||||
"../../src/tint/inspector/test_inspector_builder.h",
|
||||
"../../src/tint/inspector/test_inspector_runner.cc",
|
||||
"../../src/tint/inspector/test_inspector_runner.h",
|
||||
]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_resolver_src") {
|
||||
sources = [
|
||||
"../../src/tint/resolver/array_accessor_test.cc",
|
||||
"../../src/tint/resolver/assignment_validation_test.cc",
|
||||
"../../src/tint/resolver/atomics_test.cc",
|
||||
"../../src/tint/resolver/atomics_validation_test.cc",
|
||||
"../../src/tint/resolver/attribute_validation_test.cc",
|
||||
"../../src/tint/resolver/bitcast_validation_test.cc",
|
||||
"../../src/tint/resolver/builtin_test.cc",
|
||||
"../../src/tint/resolver/builtin_validation_test.cc",
|
||||
"../../src/tint/resolver/builtins_validation_test.cc",
|
||||
"../../src/tint/resolver/call_test.cc",
|
||||
"../../src/tint/resolver/call_validation_test.cc",
|
||||
"../../src/tint/resolver/compound_assignment_validation_test.cc",
|
||||
"../../src/tint/resolver/compound_statement_test.cc",
|
||||
"../../src/tint/resolver/control_block_validation_test.cc",
|
||||
"../../src/tint/resolver/dependency_graph_test.cc",
|
||||
"../../src/tint/resolver/entry_point_validation_test.cc",
|
||||
"../../src/tint/resolver/function_validation_test.cc",
|
||||
"../../src/tint/resolver/host_shareable_validation_test.cc",
|
||||
"../../src/tint/resolver/is_host_shareable_test.cc",
|
||||
"../../src/tint/resolver/is_storeable_test.cc",
|
||||
"../../src/tint/resolver/pipeline_overridable_constant_test.cc",
|
||||
"../../src/tint/resolver/ptr_ref_test.cc",
|
||||
"../../src/tint/resolver/ptr_ref_validation_test.cc",
|
||||
"../../src/tint/resolver/resolver_behavior_test.cc",
|
||||
"../../src/tint/resolver/resolver_constants_test.cc",
|
||||
"../../src/tint/resolver/resolver_test.cc",
|
||||
"../../src/tint/resolver/resolver_test_helper.cc",
|
||||
"../../src/tint/resolver/resolver_test_helper.h",
|
||||
"../../src/tint/resolver/side_effects_test.cc",
|
||||
"../../src/tint/resolver/storage_class_layout_validation_test.cc",
|
||||
"../../src/tint/resolver/storage_class_validation_test.cc",
|
||||
"../../src/tint/resolver/struct_layout_test.cc",
|
||||
"../../src/tint/resolver/struct_pipeline_stage_use_test.cc",
|
||||
"../../src/tint/resolver/struct_storage_class_use_test.cc",
|
||||
"../../src/tint/resolver/type_constructor_validation_test.cc",
|
||||
"../../src/tint/resolver/type_validation_test.cc",
|
||||
"../../src/tint/resolver/validation_test.cc",
|
||||
"../../src/tint/resolver/var_let_test.cc",
|
||||
"../../src/tint/resolver/var_let_validation_test.cc",
|
||||
]
|
||||
deps = [ ":tint_unittests_ast_src" ]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_sem_src") {
|
||||
sources = [
|
||||
"../../src/tint/sem/atomic_type_test.cc",
|
||||
"../../src/tint/sem/bool_type_test.cc",
|
||||
"../../src/tint/sem/builtin_test.cc",
|
||||
"../../src/tint/sem/depth_multisampled_texture_type_test.cc",
|
||||
"../../src/tint/sem/depth_texture_type_test.cc",
|
||||
"../../src/tint/sem/external_texture_type_test.cc",
|
||||
"../../src/tint/sem/f32_type_test.cc",
|
||||
"../../src/tint/sem/i32_type_test.cc",
|
||||
"../../src/tint/sem/matrix_type_test.cc",
|
||||
"../../src/tint/sem/multisampled_texture_type_test.cc",
|
||||
"../../src/tint/sem/pointer_type_test.cc",
|
||||
"../../src/tint/sem/reference_type_test.cc",
|
||||
"../../src/tint/sem/sampled_texture_type_test.cc",
|
||||
"../../src/tint/sem/sampler_type_test.cc",
|
||||
"../../src/tint/sem/sem_array_test.cc",
|
||||
"../../src/tint/sem/sem_struct_test.cc",
|
||||
"../../src/tint/sem/storage_texture_type_test.cc",
|
||||
"../../src/tint/sem/texture_type_test.cc",
|
||||
"../../src/tint/sem/type_manager_test.cc",
|
||||
"../../src/tint/sem/u32_type_test.cc",
|
||||
"../../src/tint/sem/vector_type_test.cc",
|
||||
]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_text_src") {
|
||||
sources = [ "../../src/tint/text/unicode_test.cc" ]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_transform_src") {
|
||||
sources = [
|
||||
"../../src/tint/transform/add_empty_entry_point_test.cc",
|
||||
"../../src/tint/transform/add_spirv_block_attribute_test.cc",
|
||||
"../../src/tint/transform/array_length_from_uniform_test.cc",
|
||||
"../../src/tint/transform/binding_remapper_test.cc",
|
||||
"../../src/tint/transform/builtin_polyfill_test.cc",
|
||||
"../../src/tint/transform/calculate_array_length_test.cc",
|
||||
"../../src/tint/transform/canonicalize_entry_point_io_test.cc",
|
||||
"../../src/tint/transform/combine_samplers_test.cc",
|
||||
"../../src/tint/transform/decompose_memory_access_test.cc",
|
||||
"../../src/tint/transform/decompose_strided_array_test.cc",
|
||||
"../../src/tint/transform/decompose_strided_matrix_test.cc",
|
||||
"../../src/tint/transform/first_index_offset_test.cc",
|
||||
"../../src/tint/transform/fold_constants_test.cc",
|
||||
"../../src/tint/transform/fold_trivial_single_use_lets_test.cc",
|
||||
"../../src/tint/transform/for_loop_to_loop_test.cc",
|
||||
"../../src/tint/transform/expand_compound_assignment_test.cc",
|
||||
"../../src/tint/transform/localize_struct_array_assignment_test.cc",
|
||||
"../../src/tint/transform/loop_to_for_loop_test.cc",
|
||||
"../../src/tint/transform/module_scope_var_to_entry_point_param_test.cc",
|
||||
"../../src/tint/transform/multiplanar_external_texture_test.cc",
|
||||
"../../src/tint/transform/num_workgroups_from_uniform_test.cc",
|
||||
"../../src/tint/transform/promote_initializers_to_const_var_test.cc",
|
||||
"../../src/tint/transform/promote_side_effects_to_decl_test.cc",
|
||||
"../../src/tint/transform/remove_continue_in_switch_test.cc",
|
||||
"../../src/tint/transform/remove_phonies_test.cc",
|
||||
"../../src/tint/transform/remove_unreachable_statements_test.cc",
|
||||
"../../src/tint/transform/renamer_test.cc",
|
||||
"../../src/tint/transform/robustness_test.cc",
|
||||
"../../src/tint/transform/simplify_pointers_test.cc",
|
||||
"../../src/tint/transform/single_entry_point_test.cc",
|
||||
"../../src/tint/transform/test_helper.h",
|
||||
"../../src/tint/transform/transform_test.cc",
|
||||
"../../src/tint/transform/unshadow_test.cc",
|
||||
"../../src/tint/transform/unwind_discard_functions_test.cc",
|
||||
"../../src/tint/transform/utils/get_insertion_point_test.cc",
|
||||
"../../src/tint/transform/utils/hoist_to_decl_before_test.cc",
|
||||
"../../src/tint/transform/var_for_dynamic_index_test.cc",
|
||||
"../../src/tint/transform/vectorize_scalar_matrix_constructors_test.cc",
|
||||
"../../src/tint/transform/vertex_pulling_test.cc",
|
||||
"../../src/tint/transform/wrap_arrays_in_structs_test.cc",
|
||||
"../../src/tint/transform/zero_init_workgroup_memory_test.cc",
|
||||
]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_utils_src") {
|
||||
sources = [
|
||||
"../../src/tint/utils/crc32_test.cc",
|
||||
"../../src/tint/utils/defer_test.cc",
|
||||
"../../src/tint/utils/enum_set_test.cc",
|
||||
"../../src/tint/utils/hash_test.cc",
|
||||
"../../src/tint/utils/io/command_test.cc",
|
||||
"../../src/tint/utils/io/tmpfile_test.cc",
|
||||
"../../src/tint/utils/map_test.cc",
|
||||
"../../src/tint/utils/math_test.cc",
|
||||
"../../src/tint/utils/reverse_test.cc",
|
||||
"../../src/tint/utils/scoped_assignment_test.cc",
|
||||
"../../src/tint/utils/string_test.cc",
|
||||
"../../src/tint/utils/transform_test.cc",
|
||||
"../../src/tint/utils/unique_allocator_test.cc",
|
||||
"../../src/tint/utils/unique_vector_test.cc",
|
||||
]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_writer_src") {
|
||||
sources = [
|
||||
"../../src/tint/writer/append_vector_test.cc",
|
||||
"../../src/tint/writer/float_to_string_test.cc",
|
||||
"../../src/tint/writer/generate_external_texture_bindings_test.cc",
|
||||
"../../src/tint/writer/text_generator_test.cc",
|
||||
]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_spv_reader_src") {
|
||||
sources = [
|
||||
"../../src/tint/reader/spirv/enum_converter_test.cc",
|
||||
"../../src/tint/reader/spirv/fail_stream_test.cc",
|
||||
"../../src/tint/reader/spirv/function_arithmetic_test.cc",
|
||||
"../../src/tint/reader/spirv/function_bit_test.cc",
|
||||
"../../src/tint/reader/spirv/function_call_test.cc",
|
||||
"../../src/tint/reader/spirv/function_cfg_test.cc",
|
||||
"../../src/tint/reader/spirv/function_composite_test.cc",
|
||||
"../../src/tint/reader/spirv/function_conversion_test.cc",
|
||||
"../../src/tint/reader/spirv/function_decl_test.cc",
|
||||
"../../src/tint/reader/spirv/function_glsl_std_450_test.cc",
|
||||
"../../src/tint/reader/spirv/function_logical_test.cc",
|
||||
"../../src/tint/reader/spirv/function_memory_test.cc",
|
||||
"../../src/tint/reader/spirv/function_misc_test.cc",
|
||||
"../../src/tint/reader/spirv/function_var_test.cc",
|
||||
"../../src/tint/reader/spirv/namer_test.cc",
|
||||
"../../src/tint/reader/spirv/parser_impl_barrier_test.cc",
|
||||
"../../src/tint/reader/spirv/parser_impl_convert_member_decoration_test.cc",
|
||||
"../../src/tint/reader/spirv/parser_impl_convert_type_test.cc",
|
||||
"../../src/tint/reader/spirv/parser_impl_function_decl_test.cc",
|
||||
"../../src/tint/reader/spirv/parser_impl_get_decorations_test.cc",
|
||||
"../../src/tint/reader/spirv/parser_impl_handle_test.cc",
|
||||
"../../src/tint/reader/spirv/parser_impl_import_test.cc",
|
||||
"../../src/tint/reader/spirv/parser_impl_module_var_test.cc",
|
||||
"../../src/tint/reader/spirv/parser_impl_named_types_test.cc",
|
||||
"../../src/tint/reader/spirv/parser_impl_test.cc",
|
||||
"../../src/tint/reader/spirv/parser_impl_test_helper.cc",
|
||||
"../../src/tint/reader/spirv/parser_impl_test_helper.h",
|
||||
"../../src/tint/reader/spirv/parser_impl_user_name_test.cc",
|
||||
"../../src/tint/reader/spirv/parser_test.cc",
|
||||
"../../src/tint/reader/spirv/parser_type_test.cc",
|
||||
"../../src/tint/reader/spirv/spirv_tools_helpers_test.cc",
|
||||
"../../src/tint/reader/spirv/spirv_tools_helpers_test.h",
|
||||
"../../src/tint/reader/spirv/usage_test.cc",
|
||||
]
|
||||
|
||||
deps = [ "${tint_root_dir}/src/tint:libtint_spv_reader_src" ]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_spv_writer_src") {
|
||||
sources = [
|
||||
"../../src/tint/writer/spirv/binary_writer_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_accessor_expression_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_assign_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_binary_expression_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_bitcast_expression_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_block_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_builtin_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_builtin_texture_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_call_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_constructor_expression_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_discard_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_entry_point_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_format_conversion_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_function_attribute_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_function_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_function_variable_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_global_variable_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_ident_expression_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_if_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_literal_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_loop_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_return_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_switch_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_type_test.cc",
|
||||
"../../src/tint/writer/spirv/builder_unary_op_expression_test.cc",
|
||||
"../../src/tint/writer/spirv/instruction_test.cc",
|
||||
"../../src/tint/writer/spirv/operand_test.cc",
|
||||
"../../src/tint/writer/spirv/scalar_constant_test.cc",
|
||||
"../../src/tint/writer/spirv/spv_dump.cc",
|
||||
"../../src/tint/writer/spirv/spv_dump.h",
|
||||
"../../src/tint/writer/spirv/test_helper.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":tint_unittests_ast_src",
|
||||
"${tint_root_dir}/src/tint:libtint_spv_writer_src",
|
||||
"${tint_spirv_tools_dir}/:spvtools",
|
||||
]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_wgsl_reader_src") {
|
||||
sources = [
|
||||
"../../src/tint/reader/wgsl/lexer_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_additive_expression_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_and_expression_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_argument_expression_list_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_assignment_stmt_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_body_stmt_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_break_stmt_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_bug_cases_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_call_stmt_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_case_body_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_const_expr_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_const_literal_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_continue_stmt_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_continuing_stmt_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_depth_texture_type_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_elseif_stmt_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_equality_expression_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_error_msg_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_error_resync_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_exclusive_or_expression_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_external_texture_type_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_for_stmt_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_function_attribute_list_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_function_attribute_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_function_decl_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_function_header_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_global_constant_decl_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_global_decl_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_global_variable_decl_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_if_stmt_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_inclusive_or_expression_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_logical_and_expression_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_logical_or_expression_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_loop_stmt_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_multiplicative_expression_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_param_list_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_paren_rhs_stmt_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_pipeline_stage_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_primary_expression_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_relational_expression_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_reserved_keyword_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_sampled_texture_type_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_sampler_type_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_shift_expression_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_singular_expression_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_statement_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_statements_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_storage_class_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_storage_texture_type_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_struct_attribute_decl_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_struct_body_decl_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_struct_decl_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_struct_member_attribute_decl_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_struct_member_attribute_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_struct_member_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_switch_body_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_switch_stmt_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_test_helper.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_test_helper.h",
|
||||
"../../src/tint/reader/wgsl/parser_impl_texel_format_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_texture_sampler_types_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_type_alias_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_type_decl_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_unary_expression_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_variable_attribute_list_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_variable_attribute_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_variable_decl_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_variable_ident_decl_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_variable_qualifier_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_impl_variable_stmt_test.cc",
|
||||
"../../src/tint/reader/wgsl/parser_test.cc",
|
||||
"../../src/tint/reader/wgsl/token_test.cc",
|
||||
]
|
||||
|
||||
deps = [ "${tint_root_dir}/src/tint:libtint_wgsl_reader_src" ]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_wgsl_writer_src") {
|
||||
sources = [
|
||||
"../../src/tint/writer/wgsl/generator_impl_alias_type_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_array_accessor_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_assign_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_binary_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_bitcast_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_block_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_break_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_call_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_case_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_cast_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_constructor_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_continue_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_discard_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_fallthrough_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_function_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_global_decl_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_identifier_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_if_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_literal_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_loop_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_member_accessor_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_return_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_switch_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_type_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_unary_op_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_variable_decl_statement_test.cc",
|
||||
"../../src/tint/writer/wgsl/generator_impl_variable_test.cc",
|
||||
"../../src/tint/writer/wgsl/test_helper.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":tint_unittests_ast_src",
|
||||
"${tint_root_dir}/src/tint:libtint_wgsl_writer_src",
|
||||
]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_msl_writer_src") {
|
||||
sources = [
|
||||
"../../src/tint/writer/msl/generator_impl_array_accessor_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_assign_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_binary_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_bitcast_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_block_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_break_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_builtin_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_builtin_texture_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_call_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_case_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_cast_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_constructor_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_continue_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_discard_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_function_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_identifier_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_if_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_import_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_loop_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_member_accessor_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_module_constant_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_return_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_sanitizer_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_switch_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_type_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_unary_op_test.cc",
|
||||
"../../src/tint/writer/msl/generator_impl_variable_decl_statement_test.cc",
|
||||
"../../src/tint/writer/msl/test_helper.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":tint_unittests_ast_src",
|
||||
"${tint_root_dir}/src/tint:libtint_msl_writer_src",
|
||||
]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_hlsl_writer_src") {
|
||||
sources = [
|
||||
"../../src/tint/writer/hlsl/generator_impl_array_accessor_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_assign_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_binary_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_bitcast_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_block_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_break_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_builtin_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_builtin_texture_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_call_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_case_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_cast_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_constructor_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_continue_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_discard_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_function_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_identifier_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_if_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_import_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_loop_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_member_accessor_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_module_constant_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_return_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_sanitizer_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_switch_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_type_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_unary_op_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_variable_decl_statement_test.cc",
|
||||
"../../src/tint/writer/hlsl/generator_impl_workgroup_var_test.cc",
|
||||
"../../src/tint/writer/hlsl/test_helper.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":tint_unittests_ast_src",
|
||||
"${tint_root_dir}/src/tint:libtint_hlsl_writer_src",
|
||||
]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_glsl_writer_src") {
|
||||
sources = [
|
||||
"../../src/tint/transform/glsl_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_array_accessor_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_assign_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_binary_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_bitcast_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_block_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_break_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_builtin_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_builtin_texture_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_call_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_case_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_cast_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_constructor_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_continue_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_discard_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_function_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_identifier_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_if_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_import_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_loop_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_member_accessor_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_module_constant_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_return_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_sanitizer_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_storage_buffer_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_switch_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_type_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_unary_op_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_uniform_buffer_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_variable_decl_statement_test.cc",
|
||||
"../../src/tint/writer/glsl/generator_impl_workgroup_var_test.cc",
|
||||
"../../src/tint/writer/glsl/test_helper.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":tint_unittests_ast_src",
|
||||
":tint_unittests_transform_src",
|
||||
"${tint_root_dir}/src/tint:libtint_glsl_writer_src",
|
||||
]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_core_src") {
|
||||
sources = [
|
||||
"../../src/tint/builtin_table_test.cc",
|
||||
"../../src/tint/castable_test.cc",
|
||||
"../../src/tint/clone_context_test.cc",
|
||||
"../../src/tint/debug_test.cc",
|
||||
"../../src/tint/demangler_test.cc",
|
||||
"../../src/tint/program_builder_test.cc",
|
||||
"../../src/tint/program_test.cc",
|
||||
"../../src/tint/scope_stack_test.cc",
|
||||
"../../src/tint/source_test.cc",
|
||||
"../../src/tint/symbol_table_test.cc",
|
||||
"../../src/tint/symbol_test.cc",
|
||||
"../../src/tint/traits_test.cc",
|
||||
"../../src/tint/utils/block_allocator_test.cc",
|
||||
]
|
||||
|
||||
deps = [ ":tint_unittests_ast_src" ]
|
||||
}
|
||||
|
||||
if (build_with_chromium) {
|
||||
tint_unittests_source_set("tint_unittests_fuzzer_src") {
|
||||
sources = [ "../../src/tint/fuzzers/random_generator_test.cc" ]
|
||||
|
||||
deps = [
|
||||
":tint_unittests_core_src",
|
||||
"${tint_root_dir}/src/tint/fuzzers:tint_fuzzer_common_src",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
source_set("tint_unittests_src") {
|
||||
testonly = true
|
||||
|
||||
deps = [
|
||||
":tint_unittests_ast_src",
|
||||
":tint_unittests_core_src",
|
||||
":tint_unittests_diagnostic_src",
|
||||
":tint_unittests_inspector_src",
|
||||
":tint_unittests_resolver_src",
|
||||
":tint_unittests_sem_src",
|
||||
":tint_unittests_text_src",
|
||||
":tint_unittests_transform_src",
|
||||
":tint_unittests_utils_src",
|
||||
":tint_unittests_writer_src",
|
||||
"${tint_root_dir}/src/tint:libtint_wgsl_reader_src",
|
||||
"${tint_root_dir}/src/tint:libtint_wgsl_writer_src",
|
||||
]
|
||||
|
||||
if (tint_build_spv_reader) {
|
||||
deps += [ ":tint_unittests_spv_reader_src" ]
|
||||
}
|
||||
|
||||
if (tint_build_spv_writer) {
|
||||
deps += [ ":tint_unittests_spv_writer_src" ]
|
||||
}
|
||||
|
||||
if (tint_build_wgsl_reader) {
|
||||
deps += [ ":tint_unittests_wgsl_reader_src" ]
|
||||
}
|
||||
|
||||
if (tint_build_wgsl_writer) {
|
||||
deps += [ ":tint_unittests_wgsl_writer_src" ]
|
||||
}
|
||||
|
||||
if (tint_build_msl_writer) {
|
||||
deps += [ ":tint_unittests_msl_writer_src" ]
|
||||
}
|
||||
|
||||
if (tint_build_hlsl_writer) {
|
||||
deps += [ ":tint_unittests_hlsl_writer_src" ]
|
||||
}
|
||||
|
||||
if (tint_build_glsl_writer) {
|
||||
deps += [ ":tint_unittests_glsl_writer_src" ]
|
||||
}
|
||||
|
||||
if (build_with_chromium) {
|
||||
deps += [ ":tint_unittests_fuzzer_src" ]
|
||||
}
|
||||
|
||||
configs += [ ":tint_unittests_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
}
|
||||
}
|
||||
|
||||
test("tint_unittests") {
|
||||
deps = [
|
||||
":gmock_and_gtest",
|
||||
":tint_unittests_src",
|
||||
"${tint_spirv_tools_dir}/:spvtools",
|
||||
"${tint_spirv_tools_dir}/:spvtools_opt",
|
||||
"${tint_spirv_tools_dir}/:spvtools_val",
|
||||
]
|
||||
|
||||
deps += [ ":tint_unittests_main" ]
|
||||
|
||||
configs += [ ":tint_unittests_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
}
|
||||
|
||||
group("tint_unittests") {
|
||||
deps = [ "${dawn_tint_dir}/test/tint:tint_unittests" ]
|
||||
testonly = true
|
||||
}
|
||||
|
||||
36
test/tint/access/let/matrix.spvasm
Normal file
36
test/tint/access/let/matrix.spvasm
Normal file
@@ -0,0 +1,36 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 25
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main "main"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%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
|
||||
%11 = OpConstantComposite %v3float %float_1 %float_2 %float_3
|
||||
%float_4 = OpConstant %float 4
|
||||
%float_5 = OpConstant %float 5
|
||||
%float_6 = OpConstant %float 6
|
||||
%15 = OpConstantComposite %v3float %float_4 %float_5 %float_6
|
||||
%float_7 = OpConstant %float 7
|
||||
%float_8 = OpConstant %float 8
|
||||
%float_9 = OpConstant %float 9
|
||||
%19 = OpConstantComposite %v3float %float_7 %float_8 %float_9
|
||||
%20 = OpConstantComposite %mat3v3float %11 %15 %19
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%23 = OpCompositeExtract %v3float %20 1
|
||||
%24 = OpCompositeExtract %float %23 1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
16
test/tint/access/let/matrix.spvasm.expected.glsl
Normal file
16
test/tint/access/let/matrix.spvasm.expected.glsl
Normal file
@@ -0,0 +1,16 @@
|
||||
#version 310 es
|
||||
|
||||
void main_1() {
|
||||
float x_24 = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f))[1u].y;
|
||||
return;
|
||||
}
|
||||
|
||||
void tint_symbol() {
|
||||
main_1();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
10
test/tint/access/let/matrix.spvasm.expected.hlsl
Normal file
10
test/tint/access/let/matrix.spvasm.expected.hlsl
Normal file
@@ -0,0 +1,10 @@
|
||||
void main_1() {
|
||||
const float x_24 = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))[1u].y;
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
main_1();
|
||||
return;
|
||||
}
|
||||
13
test/tint/access/let/matrix.spvasm.expected.msl
Normal file
13
test/tint/access/let/matrix.spvasm.expected.msl
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void main_1() {
|
||||
float const x_24 = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))[1u][1];
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void tint_symbol() {
|
||||
main_1();
|
||||
return;
|
||||
}
|
||||
|
||||
42
test/tint/access/let/matrix.spvasm.expected.spvasm
Normal file
42
test/tint/access/let/matrix.spvasm.expected.spvasm
Normal file
@@ -0,0 +1,42 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 28
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main_1 "main_1"
|
||||
OpName %main "main"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%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
|
||||
%11 = OpConstantComposite %v3float %float_1 %float_2 %float_3
|
||||
%float_4 = OpConstant %float 4
|
||||
%float_5 = OpConstant %float 5
|
||||
%float_6 = OpConstant %float 6
|
||||
%15 = OpConstantComposite %v3float %float_4 %float_5 %float_6
|
||||
%float_7 = OpConstant %float 7
|
||||
%float_8 = OpConstant %float 8
|
||||
%float_9 = OpConstant %float 9
|
||||
%19 = OpConstantComposite %v3float %float_7 %float_8 %float_9
|
||||
%20 = OpConstantComposite %mat3v3float %11 %15 %19
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%main_1 = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%23 = OpCompositeExtract %v3float %20 1
|
||||
%24 = OpCompositeExtract %float %23 1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %1
|
||||
%26 = OpLabel
|
||||
%27 = OpFunctionCall %void %main_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
9
test/tint/access/let/matrix.spvasm.expected.wgsl
Normal file
9
test/tint/access/let/matrix.spvasm.expected.wgsl
Normal file
@@ -0,0 +1,9 @@
|
||||
fn main_1() {
|
||||
let x_24 : f32 = mat3x3<f32>(vec3<f32>(1.0, 2.0, 3.0), vec3<f32>(4.0, 5.0, 6.0), vec3<f32>(7.0, 8.0, 9.0))[1u].y;
|
||||
return;
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1, 1, 1)
|
||||
fn main() {
|
||||
main_1();
|
||||
}
|
||||
6
test/tint/access/let/matrix.wgsl
Normal file
6
test/tint/access/let/matrix.wgsl
Normal file
@@ -0,0 +1,6 @@
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
let m : mat3x3<f32> = mat3x3<f32>(vec3<f32>(1., 2., 3.), vec3<f32>(4., 5., 6.), vec3<f32>(7., 8., 9.));
|
||||
let v : vec3<f32> = m[1];
|
||||
let f : f32 = v[1];
|
||||
}
|
||||
13
test/tint/access/let/matrix.wgsl.expected.glsl
Normal file
13
test/tint/access/let/matrix.wgsl.expected.glsl
Normal file
@@ -0,0 +1,13 @@
|
||||
#version 310 es
|
||||
|
||||
void tint_symbol() {
|
||||
mat3 m = mat3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f));
|
||||
vec3 v = m[1];
|
||||
float f = v[1];
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
7
test/tint/access/let/matrix.wgsl.expected.hlsl
Normal file
7
test/tint/access/let/matrix.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,7 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
|
||||
const float3 v = m[1];
|
||||
const float f = v[1];
|
||||
return;
|
||||
}
|
||||
10
test/tint/access/let/matrix.wgsl.expected.msl
Normal file
10
test/tint/access/let/matrix.wgsl.expected.msl
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void tint_symbol() {
|
||||
float3x3 const m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
|
||||
float3 const v = m[1];
|
||||
float const f = v[1];
|
||||
return;
|
||||
}
|
||||
|
||||
36
test/tint/access/let/matrix.wgsl.expected.spvasm
Normal file
36
test/tint/access/let/matrix.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,36 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 25
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main "main"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%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
|
||||
%11 = OpConstantComposite %v3float %float_1 %float_2 %float_3
|
||||
%float_4 = OpConstant %float 4
|
||||
%float_5 = OpConstant %float 5
|
||||
%float_6 = OpConstant %float 6
|
||||
%15 = OpConstantComposite %v3float %float_4 %float_5 %float_6
|
||||
%float_7 = OpConstant %float 7
|
||||
%float_8 = OpConstant %float 8
|
||||
%float_9 = OpConstant %float 9
|
||||
%19 = OpConstantComposite %v3float %float_7 %float_8 %float_9
|
||||
%20 = OpConstantComposite %mat3v3float %11 %15 %19
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%main = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%23 = OpCompositeExtract %v3float %20 1
|
||||
%24 = OpCompositeExtract %float %23 1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
6
test/tint/access/let/matrix.wgsl.expected.wgsl
Normal file
6
test/tint/access/let/matrix.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,6 @@
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
let m : mat3x3<f32> = mat3x3<f32>(vec3<f32>(1.0, 2.0, 3.0), vec3<f32>(4.0, 5.0, 6.0), vec3<f32>(7.0, 8.0, 9.0));
|
||||
let v : vec3<f32> = m[1];
|
||||
let f : f32 = v[1];
|
||||
}
|
||||
26
test/tint/access/let/vector.spvasm
Normal file
26
test/tint/access/let/vector.spvasm
Normal file
@@ -0,0 +1,26 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 15
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main "main"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_2 = OpConstant %float 2
|
||||
%float_3 = OpConstant %float 3
|
||||
%10 = OpConstantComposite %v3float %float_1 %float_2 %float_3
|
||||
%v2float = OpTypeVector %float 2
|
||||
%main = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%11 = OpCompositeExtract %float %10 1
|
||||
%13 = OpVectorShuffle %v2float %10 %10 0 2
|
||||
%14 = OpVectorShuffle %v3float %10 %10 0 2 1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
18
test/tint/access/let/vector.spvasm.expected.glsl
Normal file
18
test/tint/access/let/vector.spvasm.expected.glsl
Normal file
@@ -0,0 +1,18 @@
|
||||
#version 310 es
|
||||
|
||||
void main_1() {
|
||||
float x_11 = vec3(1.0f, 2.0f, 3.0f).y;
|
||||
vec2 x_13 = vec2(vec3(1.0f, 2.0f, 3.0f).x, vec3(1.0f, 2.0f, 3.0f).z);
|
||||
vec3 x_14 = vec3(vec3(1.0f, 2.0f, 3.0f).x, vec3(1.0f, 2.0f, 3.0f).z, vec3(1.0f, 2.0f, 3.0f).y);
|
||||
return;
|
||||
}
|
||||
|
||||
void tint_symbol() {
|
||||
main_1();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
12
test/tint/access/let/vector.spvasm.expected.hlsl
Normal file
12
test/tint/access/let/vector.spvasm.expected.hlsl
Normal file
@@ -0,0 +1,12 @@
|
||||
void main_1() {
|
||||
const float x_11 = float3(1.0f, 2.0f, 3.0f).y;
|
||||
const float2 x_13 = float2(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z);
|
||||
const float3 x_14 = float3(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z, float3(1.0f, 2.0f, 3.0f).y);
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
main_1();
|
||||
return;
|
||||
}
|
||||
15
test/tint/access/let/vector.spvasm.expected.msl
Normal file
15
test/tint/access/let/vector.spvasm.expected.msl
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void main_1() {
|
||||
float const x_11 = float3(1.0f, 2.0f, 3.0f)[1];
|
||||
float2 const x_13 = float2(float3(1.0f, 2.0f, 3.0f)[0], float3(1.0f, 2.0f, 3.0f)[2]);
|
||||
float3 const x_14 = float3(float3(1.0f, 2.0f, 3.0f)[0], float3(1.0f, 2.0f, 3.0f)[2], float3(1.0f, 2.0f, 3.0f)[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void tint_symbol() {
|
||||
main_1();
|
||||
return;
|
||||
}
|
||||
|
||||
37
test/tint/access/let/vector.spvasm.expected.spvasm
Normal file
37
test/tint/access/let/vector.spvasm.expected.spvasm
Normal file
@@ -0,0 +1,37 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 23
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main_1 "main_1"
|
||||
OpName %main "main"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_2 = OpConstant %float 2
|
||||
%float_3 = OpConstant %float 3
|
||||
%10 = OpConstantComposite %v3float %float_1 %float_2 %float_3
|
||||
%v2float = OpTypeVector %float 2
|
||||
%main_1 = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%11 = OpCompositeExtract %float %10 1
|
||||
%13 = OpCompositeExtract %float %10 0
|
||||
%14 = OpCompositeExtract %float %10 2
|
||||
%15 = OpCompositeConstruct %v2float %13 %14
|
||||
%16 = OpCompositeExtract %float %10 0
|
||||
%17 = OpCompositeExtract %float %10 2
|
||||
%18 = OpCompositeExtract %float %10 1
|
||||
%19 = OpCompositeConstruct %v3float %16 %17 %18
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %1
|
||||
%21 = OpLabel
|
||||
%22 = OpFunctionCall %void %main_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
11
test/tint/access/let/vector.spvasm.expected.wgsl
Normal file
11
test/tint/access/let/vector.spvasm.expected.wgsl
Normal file
@@ -0,0 +1,11 @@
|
||||
fn main_1() {
|
||||
let x_11 : f32 = vec3<f32>(1.0, 2.0, 3.0).y;
|
||||
let x_13 : vec2<f32> = vec2<f32>(vec3<f32>(1.0, 2.0, 3.0).x, vec3<f32>(1.0, 2.0, 3.0).z);
|
||||
let x_14 : vec3<f32> = vec3<f32>(vec3<f32>(1.0, 2.0, 3.0).x, vec3<f32>(1.0, 2.0, 3.0).z, vec3<f32>(1.0, 2.0, 3.0).y);
|
||||
return;
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1, 1, 1)
|
||||
fn main() {
|
||||
main_1();
|
||||
}
|
||||
7
test/tint/access/let/vector.wgsl
Normal file
7
test/tint/access/let/vector.wgsl
Normal file
@@ -0,0 +1,7 @@
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
let v : vec3<f32> = vec3<f32>(1., 2., 3.);
|
||||
let scalar : f32 = v.y;
|
||||
let swizzle2 : vec2<f32> = v.xz;
|
||||
let swizzle3 : vec3<f32> = v.xzy;
|
||||
}
|
||||
14
test/tint/access/let/vector.wgsl.expected.glsl
Normal file
14
test/tint/access/let/vector.wgsl.expected.glsl
Normal file
@@ -0,0 +1,14 @@
|
||||
#version 310 es
|
||||
|
||||
void tint_symbol() {
|
||||
vec3 v = vec3(1.0f, 2.0f, 3.0f);
|
||||
float scalar = v.y;
|
||||
vec2 swizzle2 = v.xz;
|
||||
vec3 swizzle3 = v.xzy;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
8
test/tint/access/let/vector.wgsl.expected.hlsl
Normal file
8
test/tint/access/let/vector.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,8 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
const float3 v = float3(1.0f, 2.0f, 3.0f);
|
||||
const float scalar = v.y;
|
||||
const float2 swizzle2 = v.xz;
|
||||
const float3 swizzle3 = v.xzy;
|
||||
return;
|
||||
}
|
||||
11
test/tint/access/let/vector.wgsl.expected.msl
Normal file
11
test/tint/access/let/vector.wgsl.expected.msl
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void tint_symbol() {
|
||||
float3 const v = float3(1.0f, 2.0f, 3.0f);
|
||||
float const scalar = v[1];
|
||||
float2 const swizzle2 = float3(v).xz;
|
||||
float3 const swizzle3 = float3(v).xzy;
|
||||
return;
|
||||
}
|
||||
|
||||
26
test/tint/access/let/vector.wgsl.expected.spvasm
Normal file
26
test/tint/access/let/vector.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,26 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 15
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main "main"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_2 = OpConstant %float 2
|
||||
%float_3 = OpConstant %float 3
|
||||
%10 = OpConstantComposite %v3float %float_1 %float_2 %float_3
|
||||
%v2float = OpTypeVector %float 2
|
||||
%main = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%11 = OpCompositeExtract %float %10 1
|
||||
%13 = OpVectorShuffle %v2float %10 %10 0 2
|
||||
%14 = OpVectorShuffle %v3float %10 %10 0 2 1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
7
test/tint/access/let/vector.wgsl.expected.wgsl
Normal file
7
test/tint/access/let/vector.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,7 @@
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
let v : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
|
||||
let scalar : f32 = v.y;
|
||||
let swizzle2 : vec2<f32> = v.xz;
|
||||
let swizzle3 : vec3<f32> = v.xzy;
|
||||
}
|
||||
29
test/tint/access/var/matrix.spvasm
Normal file
29
test/tint/access/var/matrix.spvasm
Normal file
@@ -0,0 +1,29 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 17
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main "main"
|
||||
OpName %m "m"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat3v3float = OpTypeMatrix %v3float 3
|
||||
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
|
||||
%10 = OpConstantNull %mat3v3float
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%main = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%m = OpVariable %_ptr_Function_mat3v3float Function %10
|
||||
%14 = OpAccessChain %_ptr_Function_v3float %m %int_1
|
||||
%15 = OpLoad %v3float %14
|
||||
%16 = OpCompositeExtract %float %15 1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
18
test/tint/access/var/matrix.spvasm.expected.glsl
Normal file
18
test/tint/access/var/matrix.spvasm.expected.glsl
Normal file
@@ -0,0 +1,18 @@
|
||||
#version 310 es
|
||||
|
||||
void main_1() {
|
||||
mat3 m = mat3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
vec3 x_15 = m[1];
|
||||
float x_16 = x_15.y;
|
||||
return;
|
||||
}
|
||||
|
||||
void tint_symbol() {
|
||||
main_1();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
12
test/tint/access/var/matrix.spvasm.expected.hlsl
Normal file
12
test/tint/access/var/matrix.spvasm.expected.hlsl
Normal file
@@ -0,0 +1,12 @@
|
||||
void main_1() {
|
||||
float3x3 m = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
const float3 x_15 = m[1];
|
||||
const float x_16 = x_15.y;
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
main_1();
|
||||
return;
|
||||
}
|
||||
15
test/tint/access/var/matrix.spvasm.expected.msl
Normal file
15
test/tint/access/var/matrix.spvasm.expected.msl
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void main_1() {
|
||||
float3x3 m = float3x3();
|
||||
float3 const x_15 = m[1];
|
||||
float const x_16 = x_15[1];
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void tint_symbol() {
|
||||
main_1();
|
||||
return;
|
||||
}
|
||||
|
||||
36
test/tint/access/var/matrix.spvasm.expected.spvasm
Normal file
36
test/tint/access/var/matrix.spvasm.expected.spvasm
Normal file
@@ -0,0 +1,36 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 20
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main_1 "main_1"
|
||||
OpName %m "m"
|
||||
OpName %main "main"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat3v3float = OpTypeMatrix %v3float 3
|
||||
%8 = OpConstantNull %mat3v3float
|
||||
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%main_1 = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%m = OpVariable %_ptr_Function_mat3v3float Function %8
|
||||
OpStore %m %8
|
||||
%14 = OpAccessChain %_ptr_Function_v3float %m %int_1
|
||||
%15 = OpLoad %v3float %14
|
||||
%16 = OpCompositeExtract %float %15 1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %1
|
||||
%18 = OpLabel
|
||||
%19 = OpFunctionCall %void %main_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
11
test/tint/access/var/matrix.spvasm.expected.wgsl
Normal file
11
test/tint/access/var/matrix.spvasm.expected.wgsl
Normal file
@@ -0,0 +1,11 @@
|
||||
fn main_1() {
|
||||
var m : mat3x3<f32> = mat3x3<f32>();
|
||||
let x_15 : vec3<f32> = m[1];
|
||||
let x_16 : f32 = x_15.y;
|
||||
return;
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1, 1, 1)
|
||||
fn main() {
|
||||
main_1();
|
||||
}
|
||||
6
test/tint/access/var/matrix.wgsl
Normal file
6
test/tint/access/var/matrix.wgsl
Normal file
@@ -0,0 +1,6 @@
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
var m : mat3x3<f32>;
|
||||
let v : vec3<f32> = m[1];
|
||||
let f : f32 = v[1];
|
||||
}
|
||||
13
test/tint/access/var/matrix.wgsl.expected.glsl
Normal file
13
test/tint/access/var/matrix.wgsl.expected.glsl
Normal file
@@ -0,0 +1,13 @@
|
||||
#version 310 es
|
||||
|
||||
void tint_symbol() {
|
||||
mat3 m = mat3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
vec3 v = m[1];
|
||||
float f = v[1];
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
7
test/tint/access/var/matrix.wgsl.expected.hlsl
Normal file
7
test/tint/access/var/matrix.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,7 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
float3x3 m = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
const float3 v = m[1];
|
||||
const float f = v[1];
|
||||
return;
|
||||
}
|
||||
10
test/tint/access/var/matrix.wgsl.expected.msl
Normal file
10
test/tint/access/var/matrix.wgsl.expected.msl
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void tint_symbol() {
|
||||
float3x3 m = float3x3(0.0f);
|
||||
float3 const v = m[1];
|
||||
float const f = v[1];
|
||||
return;
|
||||
}
|
||||
|
||||
29
test/tint/access/var/matrix.wgsl.expected.spvasm
Normal file
29
test/tint/access/var/matrix.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,29 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 17
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main "main"
|
||||
OpName %m "m"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat3v3float = OpTypeMatrix %v3float 3
|
||||
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
|
||||
%10 = OpConstantNull %mat3v3float
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%main = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%m = OpVariable %_ptr_Function_mat3v3float Function %10
|
||||
%14 = OpAccessChain %_ptr_Function_v3float %m %int_1
|
||||
%15 = OpLoad %v3float %14
|
||||
%16 = OpCompositeExtract %float %15 1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
6
test/tint/access/var/matrix.wgsl.expected.wgsl
Normal file
6
test/tint/access/var/matrix.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,6 @@
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
var m : mat3x3<f32>;
|
||||
let v : vec3<f32> = m[1];
|
||||
let f : f32 = v[1];
|
||||
}
|
||||
32
test/tint/access/var/vector.spvasm
Normal file
32
test/tint/access/var/vector.spvasm
Normal file
@@ -0,0 +1,32 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 20
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main "main"
|
||||
OpName %v "v"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%9 = OpConstantNull %v3float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%v2float = OpTypeVector %float 2
|
||||
%main = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%v = OpVariable %_ptr_Function_v3float Function %9
|
||||
%13 = OpAccessChain %_ptr_Function_float %v %uint_1
|
||||
%14 = OpLoad %float %13
|
||||
%16 = OpLoad %v3float %v
|
||||
%17 = OpVectorShuffle %v2float %16 %16 0 2
|
||||
%18 = OpLoad %v3float %v
|
||||
%19 = OpVectorShuffle %v3float %18 %18 0 2 1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
21
test/tint/access/var/vector.spvasm.expected.glsl
Normal file
21
test/tint/access/var/vector.spvasm.expected.glsl
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 310 es
|
||||
|
||||
void main_1() {
|
||||
vec3 v = vec3(0.0f, 0.0f, 0.0f);
|
||||
float x_14 = v.y;
|
||||
vec3 x_16 = v;
|
||||
vec2 x_17 = vec2(x_16.x, x_16.z);
|
||||
vec3 x_18 = v;
|
||||
vec3 x_19 = vec3(x_18.x, x_18.z, x_18.y);
|
||||
return;
|
||||
}
|
||||
|
||||
void tint_symbol() {
|
||||
main_1();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
15
test/tint/access/var/vector.spvasm.expected.hlsl
Normal file
15
test/tint/access/var/vector.spvasm.expected.hlsl
Normal file
@@ -0,0 +1,15 @@
|
||||
void main_1() {
|
||||
float3 v = float3(0.0f, 0.0f, 0.0f);
|
||||
const float x_14 = v.y;
|
||||
const float3 x_16 = v;
|
||||
const float2 x_17 = float2(x_16.x, x_16.z);
|
||||
const float3 x_18 = v;
|
||||
const float3 x_19 = float3(x_18.x, x_18.z, x_18.y);
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
main_1();
|
||||
return;
|
||||
}
|
||||
18
test/tint/access/var/vector.spvasm.expected.msl
Normal file
18
test/tint/access/var/vector.spvasm.expected.msl
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void main_1() {
|
||||
float3 v = float3();
|
||||
float const x_14 = v[1];
|
||||
float3 const x_16 = v;
|
||||
float2 const x_17 = float2(x_16[0], x_16[2]);
|
||||
float3 const x_18 = v;
|
||||
float3 const x_19 = float3(x_18[0], x_18[2], x_18[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void tint_symbol() {
|
||||
main_1();
|
||||
return;
|
||||
}
|
||||
|
||||
44
test/tint/access/var/vector.spvasm.expected.spvasm
Normal file
44
test/tint/access/var/vector.spvasm.expected.spvasm
Normal file
@@ -0,0 +1,44 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 28
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main_1 "main_1"
|
||||
OpName %v "v"
|
||||
OpName %main "main"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%7 = OpConstantNull %v3float
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%v2float = OpTypeVector %float 2
|
||||
%main_1 = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%v = OpVariable %_ptr_Function_v3float Function %7
|
||||
OpStore %v %7
|
||||
%13 = OpAccessChain %_ptr_Function_float %v %uint_1
|
||||
%14 = OpLoad %float %13
|
||||
%15 = OpLoad %v3float %v
|
||||
%17 = OpCompositeExtract %float %15 0
|
||||
%18 = OpCompositeExtract %float %15 2
|
||||
%19 = OpCompositeConstruct %v2float %17 %18
|
||||
%20 = OpLoad %v3float %v
|
||||
%21 = OpCompositeExtract %float %20 0
|
||||
%22 = OpCompositeExtract %float %20 2
|
||||
%23 = OpCompositeExtract %float %20 1
|
||||
%24 = OpCompositeConstruct %v3float %21 %22 %23
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %1
|
||||
%26 = OpLabel
|
||||
%27 = OpFunctionCall %void %main_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
14
test/tint/access/var/vector.spvasm.expected.wgsl
Normal file
14
test/tint/access/var/vector.spvasm.expected.wgsl
Normal file
@@ -0,0 +1,14 @@
|
||||
fn main_1() {
|
||||
var v : vec3<f32> = vec3<f32>();
|
||||
let x_14 : f32 = v.y;
|
||||
let x_16 : vec3<f32> = v;
|
||||
let x_17 : vec2<f32> = vec2<f32>(x_16.x, x_16.z);
|
||||
let x_18 : vec3<f32> = v;
|
||||
let x_19 : vec3<f32> = vec3<f32>(x_18.x, x_18.z, x_18.y);
|
||||
return;
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1, 1, 1)
|
||||
fn main() {
|
||||
main_1();
|
||||
}
|
||||
7
test/tint/access/var/vector.wgsl
Normal file
7
test/tint/access/var/vector.wgsl
Normal file
@@ -0,0 +1,7 @@
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
var v : vec3<f32>;
|
||||
let scalar : f32 = v.y;
|
||||
let swizzle2 : vec2<f32> = v.xz;
|
||||
let swizzle3 : vec3<f32> = v.xzy;
|
||||
}
|
||||
14
test/tint/access/var/vector.wgsl.expected.glsl
Normal file
14
test/tint/access/var/vector.wgsl.expected.glsl
Normal file
@@ -0,0 +1,14 @@
|
||||
#version 310 es
|
||||
|
||||
void tint_symbol() {
|
||||
vec3 v = vec3(0.0f, 0.0f, 0.0f);
|
||||
float scalar = v.y;
|
||||
vec2 swizzle2 = v.xz;
|
||||
vec3 swizzle3 = v.xzy;
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
8
test/tint/access/var/vector.wgsl.expected.hlsl
Normal file
8
test/tint/access/var/vector.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,8 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
float3 v = float3(0.0f, 0.0f, 0.0f);
|
||||
const float scalar = v.y;
|
||||
const float2 swizzle2 = v.xz;
|
||||
const float3 swizzle3 = v.xzy;
|
||||
return;
|
||||
}
|
||||
11
test/tint/access/var/vector.wgsl.expected.msl
Normal file
11
test/tint/access/var/vector.wgsl.expected.msl
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void tint_symbol() {
|
||||
float3 v = 0.0f;
|
||||
float const scalar = v[1];
|
||||
float2 const swizzle2 = float3(v).xz;
|
||||
float3 const swizzle3 = float3(v).xzy;
|
||||
return;
|
||||
}
|
||||
|
||||
32
test/tint/access/var/vector.wgsl.expected.spvasm
Normal file
32
test/tint/access/var/vector.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,32 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 20
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %main "main"
|
||||
OpName %v "v"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%9 = OpConstantNull %v3float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%v2float = OpTypeVector %float 2
|
||||
%main = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%v = OpVariable %_ptr_Function_v3float Function %9
|
||||
%13 = OpAccessChain %_ptr_Function_float %v %uint_1
|
||||
%14 = OpLoad %float %13
|
||||
%16 = OpLoad %v3float %v
|
||||
%17 = OpVectorShuffle %v2float %16 %16 0 2
|
||||
%18 = OpLoad %v3float %v
|
||||
%19 = OpVectorShuffle %v3float %18 %18 0 2 1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
7
test/tint/access/var/vector.wgsl.expected.wgsl
Normal file
7
test/tint/access/var/vector.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,7 @@
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
var v : vec3<f32>;
|
||||
let scalar : f32 = v.y;
|
||||
let swizzle2 : vec2<f32> = v.xz;
|
||||
let swizzle3 : vec3<f32> = v.xzy;
|
||||
}
|
||||
52
test/tint/array/assign_to_function_var.wgsl
Normal file
52
test/tint/array/assign_to_function_var.wgsl
Normal file
@@ -0,0 +1,52 @@
|
||||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType,
|
||||
};
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
var<workgroup> src_workgroup : ArrayType;
|
||||
@group(0) @binding(0) var<uniform> src_uniform : S;
|
||||
@group(0) @binding(1) var<storage, read_write> src_storage : S;
|
||||
|
||||
fn ret_arr() -> ArrayType {
|
||||
return ArrayType();
|
||||
}
|
||||
|
||||
fn ret_struct_arr() -> S {
|
||||
return S();
|
||||
}
|
||||
|
||||
fn foo(src_param : ArrayType) {
|
||||
var src_function : ArrayType;
|
||||
|
||||
var dst : ArrayType;
|
||||
|
||||
// Assign from type constructor.
|
||||
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
||||
|
||||
// Assign from parameter.
|
||||
dst = src_param;
|
||||
|
||||
// Assign from function call.
|
||||
dst = ret_arr();
|
||||
|
||||
// Assign from constant.
|
||||
let src_let : ArrayType = ArrayType();
|
||||
dst = src_let;
|
||||
|
||||
// Assign from var, various storage classes.
|
||||
dst = src_function;
|
||||
dst = src_private;
|
||||
dst = src_workgroup;
|
||||
|
||||
// Assign from struct.arr, various storage classes.
|
||||
dst = ret_struct_arr().arr;
|
||||
dst = src_uniform.arr;
|
||||
dst = src_storage.arr;
|
||||
|
||||
// Nested assignment.
|
||||
var dst_nested : array<array<array<i32, 2>, 3>, 4>;
|
||||
var src_nested : array<array<array<i32, 2>, 3>, 4>;
|
||||
dst_nested = src_nested;
|
||||
}
|
||||
50
test/tint/array/assign_to_function_var.wgsl.expected.glsl
Normal file
50
test/tint/array/assign_to_function_var.wgsl.expected.glsl
Normal file
@@ -0,0 +1,50 @@
|
||||
#version 310 es
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
struct S {
|
||||
ivec4 arr[4];
|
||||
};
|
||||
|
||||
ivec4 src_private[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
shared ivec4 src_workgroup[4];
|
||||
layout(binding = 0) uniform S_1 {
|
||||
ivec4 arr[4];
|
||||
} src_uniform;
|
||||
|
||||
layout(binding = 1, std430) buffer S_2 {
|
||||
ivec4 arr[4];
|
||||
} src_storage;
|
||||
ivec4[4] ret_arr() {
|
||||
ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
S ret_struct_arr() {
|
||||
S tint_symbol_2 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
|
||||
return tint_symbol_2;
|
||||
}
|
||||
|
||||
void foo(ivec4 src_param[4]) {
|
||||
ivec4 src_function[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
ivec4 dst[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
ivec4 tint_symbol_3[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
|
||||
dst = tint_symbol_3;
|
||||
dst = src_param;
|
||||
dst = ret_arr();
|
||||
ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
dst = src_let;
|
||||
dst = src_function;
|
||||
dst = src_private;
|
||||
dst = src_workgroup;
|
||||
S tint_symbol = ret_struct_arr();
|
||||
dst = tint_symbol.arr;
|
||||
dst = src_uniform.arr;
|
||||
dst = src_storage.arr;
|
||||
int dst_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
|
||||
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
|
||||
dst_nested = src_nested;
|
||||
}
|
||||
|
||||
70
test/tint/array/assign_to_function_var.wgsl.expected.hlsl
Normal file
70
test/tint/array/assign_to_function_var.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,70 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
|
||||
struct S {
|
||||
int4 arr[4];
|
||||
};
|
||||
|
||||
static int4 src_private[4] = (int4[4])0;
|
||||
groupshared int4 src_workgroup[4];
|
||||
cbuffer cbuffer_src_uniform : register(b0, space0) {
|
||||
uint4 src_uniform[4];
|
||||
};
|
||||
RWByteAddressBuffer src_storage : register(u1, space0);
|
||||
|
||||
typedef int4 ret_arr_ret[4];
|
||||
ret_arr_ret ret_arr() {
|
||||
const int4 tint_symbol_6[4] = (int4[4])0;
|
||||
return tint_symbol_6;
|
||||
}
|
||||
|
||||
S ret_struct_arr() {
|
||||
const S tint_symbol_7 = (S)0;
|
||||
return tint_symbol_7;
|
||||
}
|
||||
|
||||
typedef int4 tint_symbol_2_ret[4];
|
||||
tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) {
|
||||
int4 arr_1[4] = (int4[4])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
const uint scalar_offset = ((offset + (i * 16u))) / 4;
|
||||
arr_1[i] = asint(buffer[scalar_offset / 4]);
|
||||
}
|
||||
}
|
||||
return arr_1;
|
||||
}
|
||||
|
||||
typedef int4 tint_symbol_4_ret[4];
|
||||
tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
|
||||
int4 arr_2[4] = (int4[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr_2[i_1] = asint(buffer.Load4((offset + (i_1 * 16u))));
|
||||
}
|
||||
}
|
||||
return arr_2;
|
||||
}
|
||||
|
||||
void foo(int4 src_param[4]) {
|
||||
int4 src_function[4] = (int4[4])0;
|
||||
int4 tint_symbol[4] = (int4[4])0;
|
||||
const int4 tint_symbol_8[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
|
||||
tint_symbol = tint_symbol_8;
|
||||
tint_symbol = src_param;
|
||||
tint_symbol = ret_arr();
|
||||
const int4 src_let[4] = (int4[4])0;
|
||||
tint_symbol = src_let;
|
||||
tint_symbol = src_function;
|
||||
tint_symbol = src_private;
|
||||
tint_symbol = src_workgroup;
|
||||
const S tint_symbol_1 = ret_struct_arr();
|
||||
tint_symbol = tint_symbol_1.arr;
|
||||
tint_symbol = tint_symbol_2(src_uniform, 0u);
|
||||
tint_symbol = tint_symbol_4(src_storage, 0u);
|
||||
int dst_nested[4][3][2] = (int[4][3][2])0;
|
||||
int src_nested[4][3][2] = (int[4][3][2])0;
|
||||
dst_nested = src_nested;
|
||||
}
|
||||
54
test/tint/array/assign_to_function_var.wgsl.expected.msl
Normal file
54
test/tint/array/assign_to_function_var.wgsl.expected.msl
Normal file
@@ -0,0 +1,54 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ int4 arr[4];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ tint_array_wrapper arr;
|
||||
};
|
||||
|
||||
tint_array_wrapper ret_arr() {
|
||||
tint_array_wrapper const tint_symbol_1 = {.arr={}};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
S ret_struct_arr() {
|
||||
S const tint_symbol_2 = {};
|
||||
return tint_symbol_2;
|
||||
}
|
||||
|
||||
struct tint_array_wrapper_3 {
|
||||
int arr[2];
|
||||
};
|
||||
|
||||
struct tint_array_wrapper_2 {
|
||||
tint_array_wrapper_3 arr[3];
|
||||
};
|
||||
|
||||
struct tint_array_wrapper_1 {
|
||||
tint_array_wrapper_2 arr[4];
|
||||
};
|
||||
|
||||
void foo(tint_array_wrapper src_param, thread tint_array_wrapper* const tint_symbol_4, threadgroup tint_array_wrapper* const tint_symbol_5, const constant S* const tint_symbol_6, device S* const tint_symbol_7) {
|
||||
tint_array_wrapper src_function = {};
|
||||
tint_array_wrapper dst = {};
|
||||
tint_array_wrapper const tint_symbol_3 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
|
||||
dst = tint_symbol_3;
|
||||
dst = src_param;
|
||||
dst = ret_arr();
|
||||
tint_array_wrapper const src_let = {.arr={}};
|
||||
dst = src_let;
|
||||
dst = src_function;
|
||||
dst = *(tint_symbol_4);
|
||||
dst = *(tint_symbol_5);
|
||||
S const tint_symbol = ret_struct_arr();
|
||||
dst = tint_symbol.arr;
|
||||
dst = (*(tint_symbol_6)).arr;
|
||||
dst = (*(tint_symbol_7)).arr;
|
||||
tint_array_wrapper_1 dst_nested = {};
|
||||
tint_array_wrapper_1 src_nested = {};
|
||||
dst_nested = src_nested;
|
||||
}
|
||||
|
||||
117
test/tint/array/assign_to_function_var.wgsl.expected.spvasm
Normal file
117
test/tint/array/assign_to_function_var.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,117 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 64
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||
OpName %src_private "src_private"
|
||||
OpName %src_workgroup "src_workgroup"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "arr"
|
||||
OpName %src_uniform "src_uniform"
|
||||
OpName %src_storage "src_storage"
|
||||
OpName %unused_entry_point "unused_entry_point"
|
||||
OpName %ret_arr "ret_arr"
|
||||
OpName %ret_struct_arr "ret_struct_arr"
|
||||
OpName %foo "foo"
|
||||
OpName %src_param "src_param"
|
||||
OpName %src_function "src_function"
|
||||
OpName %dst "dst"
|
||||
OpName %dst_nested "dst_nested"
|
||||
OpName %src_nested "src_nested"
|
||||
OpDecorate %_arr_v4int_uint_4 ArrayStride 16
|
||||
OpDecorate %S Block
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpDecorate %src_uniform NonWritable
|
||||
OpDecorate %src_uniform DescriptorSet 0
|
||||
OpDecorate %src_uniform Binding 0
|
||||
OpDecorate %src_storage DescriptorSet 0
|
||||
OpDecorate %src_storage Binding 1
|
||||
OpDecorate %_arr_int_uint_2 ArrayStride 4
|
||||
OpDecorate %_arr__arr_int_uint_2_uint_3 ArrayStride 8
|
||||
OpDecorate %_arr__arr__arr_int_uint_2_uint_3_uint_4 ArrayStride 24
|
||||
%int = OpTypeInt 32 1
|
||||
%v4int = OpTypeVector %int 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_v4int_uint_4 = OpTypeArray %v4int %uint_4
|
||||
%_ptr_Private__arr_v4int_uint_4 = OpTypePointer Private %_arr_v4int_uint_4
|
||||
%8 = OpConstantNull %_arr_v4int_uint_4
|
||||
%src_private = OpVariable %_ptr_Private__arr_v4int_uint_4 Private %8
|
||||
%_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4
|
||||
%src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup
|
||||
%S = OpTypeStruct %_arr_v4int_uint_4
|
||||
%_ptr_Uniform_S = OpTypePointer Uniform %S
|
||||
%src_uniform = OpVariable %_ptr_Uniform_S Uniform
|
||||
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
|
||||
%src_storage = OpVariable %_ptr_StorageBuffer_S StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%20 = OpTypeFunction %_arr_v4int_uint_4
|
||||
%23 = OpTypeFunction %S
|
||||
%26 = OpConstantNull %S
|
||||
%27 = OpTypeFunction %void %_arr_v4int_uint_4
|
||||
%_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4
|
||||
%int_1 = OpConstant %int 1
|
||||
%35 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
|
||||
%int_2 = OpConstant %int 2
|
||||
%37 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2
|
||||
%int_3 = OpConstant %int 3
|
||||
%39 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3
|
||||
%40 = OpConstantComposite %_arr_v4int_uint_4 %35 %37 %39 %39
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
|
||||
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_int_uint_2 = OpTypeArray %int %uint_2
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr__arr_int_uint_2_uint_3 = OpTypeArray %_arr_int_uint_2 %uint_3
|
||||
%_arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_int_uint_2_uint_3 %uint_4
|
||||
%_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4
|
||||
%61 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4
|
||||
%unused_entry_point = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%ret_arr = OpFunction %_arr_v4int_uint_4 None %20
|
||||
%22 = OpLabel
|
||||
OpReturnValue %8
|
||||
OpFunctionEnd
|
||||
%ret_struct_arr = OpFunction %S None %23
|
||||
%25 = OpLabel
|
||||
OpReturnValue %26
|
||||
OpFunctionEnd
|
||||
%foo = OpFunction %void None %27
|
||||
%src_param = OpFunctionParameter %_arr_v4int_uint_4
|
||||
%30 = OpLabel
|
||||
%src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
|
||||
%dst = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
|
||||
%dst_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %61
|
||||
%src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %61
|
||||
OpStore %dst %40
|
||||
OpStore %dst %src_param
|
||||
%41 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
|
||||
OpStore %dst %41
|
||||
OpStore %dst %8
|
||||
%42 = OpLoad %_arr_v4int_uint_4 %src_function
|
||||
OpStore %dst %42
|
||||
%43 = OpLoad %_arr_v4int_uint_4 %src_private
|
||||
OpStore %dst %43
|
||||
%44 = OpLoad %_arr_v4int_uint_4 %src_workgroup
|
||||
OpStore %dst %44
|
||||
%45 = OpFunctionCall %S %ret_struct_arr
|
||||
%46 = OpCompositeExtract %_arr_v4int_uint_4 %45 0
|
||||
OpStore %dst %46
|
||||
%49 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0
|
||||
%50 = OpLoad %_arr_v4int_uint_4 %49
|
||||
OpStore %dst %50
|
||||
%52 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0
|
||||
%53 = OpLoad %_arr_v4int_uint_4 %52
|
||||
OpStore %dst %53
|
||||
%63 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested
|
||||
OpStore %dst_nested %63
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
40
test/tint/array/assign_to_function_var.wgsl.expected.wgsl
Normal file
40
test/tint/array/assign_to_function_var.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,40 @@
|
||||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType,
|
||||
}
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
|
||||
var<workgroup> src_workgroup : ArrayType;
|
||||
|
||||
@group(0) @binding(0) var<uniform> src_uniform : S;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> src_storage : S;
|
||||
|
||||
fn ret_arr() -> ArrayType {
|
||||
return ArrayType();
|
||||
}
|
||||
|
||||
fn ret_struct_arr() -> S {
|
||||
return S();
|
||||
}
|
||||
|
||||
fn foo(src_param : ArrayType) {
|
||||
var src_function : ArrayType;
|
||||
var dst : ArrayType;
|
||||
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
||||
dst = src_param;
|
||||
dst = ret_arr();
|
||||
let src_let : ArrayType = ArrayType();
|
||||
dst = src_let;
|
||||
dst = src_function;
|
||||
dst = src_private;
|
||||
dst = src_workgroup;
|
||||
dst = ret_struct_arr().arr;
|
||||
dst = src_uniform.arr;
|
||||
dst = src_storage.arr;
|
||||
var dst_nested : array<array<array<i32, 2>, 3>, 4>;
|
||||
var src_nested : array<array<array<i32, 2>, 3>, 4>;
|
||||
dst_nested = src_nested;
|
||||
}
|
||||
52
test/tint/array/assign_to_private_var.wgsl
Normal file
52
test/tint/array/assign_to_private_var.wgsl
Normal file
@@ -0,0 +1,52 @@
|
||||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType,
|
||||
};
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
var<workgroup> src_workgroup : ArrayType;
|
||||
@group(0) @binding(0) var<uniform> src_uniform : S;
|
||||
@group(0) @binding(1) var<storage, read_write> src_storage : S;
|
||||
|
||||
var<private> dst : ArrayType;
|
||||
var<private> dst_nested : array<array<array<i32, 2>, 3>, 4>;
|
||||
|
||||
fn ret_arr() -> ArrayType {
|
||||
return ArrayType();
|
||||
}
|
||||
|
||||
fn ret_struct_arr() -> S {
|
||||
return S();
|
||||
}
|
||||
|
||||
fn foo(src_param : ArrayType) {
|
||||
var src_function : ArrayType;
|
||||
|
||||
// Assign from type constructor.
|
||||
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
||||
|
||||
// Assign from parameter.
|
||||
dst = src_param;
|
||||
|
||||
// Assign from function call.
|
||||
dst = ret_arr();
|
||||
|
||||
// Assign from constant.
|
||||
let src_let : ArrayType = ArrayType();
|
||||
dst = src_let;
|
||||
|
||||
// Assign from var, various storage classes.
|
||||
dst = src_function;
|
||||
dst = src_private;
|
||||
dst = src_workgroup;
|
||||
|
||||
// Assign from struct.arr, various storage classes.
|
||||
dst = ret_struct_arr().arr;
|
||||
dst = src_uniform.arr;
|
||||
dst = src_storage.arr;
|
||||
|
||||
// Nested assignment.
|
||||
var src_nested : array<array<array<i32, 2>, 3>, 4>;
|
||||
dst_nested = src_nested;
|
||||
}
|
||||
50
test/tint/array/assign_to_private_var.wgsl.expected.glsl
Normal file
50
test/tint/array/assign_to_private_var.wgsl.expected.glsl
Normal file
@@ -0,0 +1,50 @@
|
||||
#version 310 es
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
struct S {
|
||||
ivec4 arr[4];
|
||||
};
|
||||
|
||||
ivec4 src_private[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
shared ivec4 src_workgroup[4];
|
||||
layout(binding = 0) uniform S_1 {
|
||||
ivec4 arr[4];
|
||||
} src_uniform;
|
||||
|
||||
layout(binding = 1, std430) buffer S_2 {
|
||||
ivec4 arr[4];
|
||||
} src_storage;
|
||||
ivec4 dst[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
int dst_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
|
||||
ivec4[4] ret_arr() {
|
||||
ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
S ret_struct_arr() {
|
||||
S tint_symbol_2 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
|
||||
return tint_symbol_2;
|
||||
}
|
||||
|
||||
void foo(ivec4 src_param[4]) {
|
||||
ivec4 src_function[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
ivec4 tint_symbol_3[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
|
||||
dst = tint_symbol_3;
|
||||
dst = src_param;
|
||||
dst = ret_arr();
|
||||
ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
dst = src_let;
|
||||
dst = src_function;
|
||||
dst = src_private;
|
||||
dst = src_workgroup;
|
||||
S tint_symbol = ret_struct_arr();
|
||||
dst = tint_symbol.arr;
|
||||
dst = src_uniform.arr;
|
||||
dst = src_storage.arr;
|
||||
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
|
||||
dst_nested = src_nested;
|
||||
}
|
||||
|
||||
70
test/tint/array/assign_to_private_var.wgsl.expected.hlsl
Normal file
70
test/tint/array/assign_to_private_var.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,70 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
|
||||
struct S {
|
||||
int4 arr[4];
|
||||
};
|
||||
|
||||
static int4 src_private[4] = (int4[4])0;
|
||||
groupshared int4 src_workgroup[4];
|
||||
cbuffer cbuffer_src_uniform : register(b0, space0) {
|
||||
uint4 src_uniform[4];
|
||||
};
|
||||
RWByteAddressBuffer src_storage : register(u1, space0);
|
||||
static int4 tint_symbol[4] = (int4[4])0;
|
||||
static int dst_nested[4][3][2] = (int[4][3][2])0;
|
||||
|
||||
typedef int4 ret_arr_ret[4];
|
||||
ret_arr_ret ret_arr() {
|
||||
const int4 tint_symbol_6[4] = (int4[4])0;
|
||||
return tint_symbol_6;
|
||||
}
|
||||
|
||||
S ret_struct_arr() {
|
||||
const S tint_symbol_7 = (S)0;
|
||||
return tint_symbol_7;
|
||||
}
|
||||
|
||||
typedef int4 tint_symbol_2_ret[4];
|
||||
tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) {
|
||||
int4 arr_1[4] = (int4[4])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
const uint scalar_offset = ((offset + (i * 16u))) / 4;
|
||||
arr_1[i] = asint(buffer[scalar_offset / 4]);
|
||||
}
|
||||
}
|
||||
return arr_1;
|
||||
}
|
||||
|
||||
typedef int4 tint_symbol_4_ret[4];
|
||||
tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
|
||||
int4 arr_2[4] = (int4[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr_2[i_1] = asint(buffer.Load4((offset + (i_1 * 16u))));
|
||||
}
|
||||
}
|
||||
return arr_2;
|
||||
}
|
||||
|
||||
void foo(int4 src_param[4]) {
|
||||
int4 src_function[4] = (int4[4])0;
|
||||
const int4 tint_symbol_8[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
|
||||
tint_symbol = tint_symbol_8;
|
||||
tint_symbol = src_param;
|
||||
tint_symbol = ret_arr();
|
||||
const int4 src_let[4] = (int4[4])0;
|
||||
tint_symbol = src_let;
|
||||
tint_symbol = src_function;
|
||||
tint_symbol = src_private;
|
||||
tint_symbol = src_workgroup;
|
||||
const S tint_symbol_1 = ret_struct_arr();
|
||||
tint_symbol = tint_symbol_1.arr;
|
||||
tint_symbol = tint_symbol_2(src_uniform, 0u);
|
||||
tint_symbol = tint_symbol_4(src_storage, 0u);
|
||||
int src_nested[4][3][2] = (int[4][3][2])0;
|
||||
dst_nested = src_nested;
|
||||
}
|
||||
52
test/tint/array/assign_to_private_var.wgsl.expected.msl
Normal file
52
test/tint/array/assign_to_private_var.wgsl.expected.msl
Normal file
@@ -0,0 +1,52 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ int4 arr[4];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ tint_array_wrapper arr;
|
||||
};
|
||||
|
||||
struct tint_array_wrapper_3 {
|
||||
int arr[2];
|
||||
};
|
||||
|
||||
struct tint_array_wrapper_2 {
|
||||
tint_array_wrapper_3 arr[3];
|
||||
};
|
||||
|
||||
struct tint_array_wrapper_1 {
|
||||
tint_array_wrapper_2 arr[4];
|
||||
};
|
||||
|
||||
tint_array_wrapper ret_arr() {
|
||||
tint_array_wrapper const tint_symbol_1 = {.arr={}};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
S ret_struct_arr() {
|
||||
S const tint_symbol_2 = {};
|
||||
return tint_symbol_2;
|
||||
}
|
||||
|
||||
void foo(tint_array_wrapper src_param, thread tint_array_wrapper* const tint_symbol_4, thread tint_array_wrapper* const tint_symbol_5, threadgroup tint_array_wrapper* const tint_symbol_6, const constant S* const tint_symbol_7, device S* const tint_symbol_8, thread tint_array_wrapper_1* const tint_symbol_9) {
|
||||
tint_array_wrapper src_function = {};
|
||||
tint_array_wrapper const tint_symbol_3 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
|
||||
*(tint_symbol_4) = tint_symbol_3;
|
||||
*(tint_symbol_4) = src_param;
|
||||
*(tint_symbol_4) = ret_arr();
|
||||
tint_array_wrapper const src_let = {.arr={}};
|
||||
*(tint_symbol_4) = src_let;
|
||||
*(tint_symbol_4) = src_function;
|
||||
*(tint_symbol_4) = *(tint_symbol_5);
|
||||
*(tint_symbol_4) = *(tint_symbol_6);
|
||||
S const tint_symbol = ret_struct_arr();
|
||||
*(tint_symbol_4) = tint_symbol.arr;
|
||||
*(tint_symbol_4) = (*(tint_symbol_7)).arr;
|
||||
*(tint_symbol_4) = (*(tint_symbol_8)).arr;
|
||||
tint_array_wrapper_1 src_nested = {};
|
||||
*(tint_symbol_9) = src_nested;
|
||||
}
|
||||
|
||||
118
test/tint/array/assign_to_private_var.wgsl.expected.spvasm
Normal file
118
test/tint/array/assign_to_private_var.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,118 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 65
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||
OpName %src_private "src_private"
|
||||
OpName %src_workgroup "src_workgroup"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "arr"
|
||||
OpName %src_uniform "src_uniform"
|
||||
OpName %src_storage "src_storage"
|
||||
OpName %dst "dst"
|
||||
OpName %dst_nested "dst_nested"
|
||||
OpName %unused_entry_point "unused_entry_point"
|
||||
OpName %ret_arr "ret_arr"
|
||||
OpName %ret_struct_arr "ret_struct_arr"
|
||||
OpName %foo "foo"
|
||||
OpName %src_param "src_param"
|
||||
OpName %src_function "src_function"
|
||||
OpName %src_nested "src_nested"
|
||||
OpDecorate %_arr_v4int_uint_4 ArrayStride 16
|
||||
OpDecorate %S Block
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpDecorate %src_uniform NonWritable
|
||||
OpDecorate %src_uniform DescriptorSet 0
|
||||
OpDecorate %src_uniform Binding 0
|
||||
OpDecorate %src_storage DescriptorSet 0
|
||||
OpDecorate %src_storage Binding 1
|
||||
OpDecorate %_arr_int_uint_2 ArrayStride 4
|
||||
OpDecorate %_arr__arr_int_uint_2_uint_3 ArrayStride 8
|
||||
OpDecorate %_arr__arr__arr_int_uint_2_uint_3_uint_4 ArrayStride 24
|
||||
%int = OpTypeInt 32 1
|
||||
%v4int = OpTypeVector %int 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_v4int_uint_4 = OpTypeArray %v4int %uint_4
|
||||
%_ptr_Private__arr_v4int_uint_4 = OpTypePointer Private %_arr_v4int_uint_4
|
||||
%8 = OpConstantNull %_arr_v4int_uint_4
|
||||
%src_private = OpVariable %_ptr_Private__arr_v4int_uint_4 Private %8
|
||||
%_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4
|
||||
%src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup
|
||||
%S = OpTypeStruct %_arr_v4int_uint_4
|
||||
%_ptr_Uniform_S = OpTypePointer Uniform %S
|
||||
%src_uniform = OpVariable %_ptr_Uniform_S Uniform
|
||||
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
|
||||
%src_storage = OpVariable %_ptr_StorageBuffer_S StorageBuffer
|
||||
%dst = OpVariable %_ptr_Private__arr_v4int_uint_4 Private %8
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_int_uint_2 = OpTypeArray %int %uint_2
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr__arr_int_uint_2_uint_3 = OpTypeArray %_arr_int_uint_2 %uint_3
|
||||
%_arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_int_uint_2_uint_3 %uint_4
|
||||
%_ptr_Private__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Private %_arr__arr__arr_int_uint_2_uint_3_uint_4
|
||||
%24 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4
|
||||
%dst_nested = OpVariable %_ptr_Private__arr__arr__arr_int_uint_2_uint_3_uint_4 Private %24
|
||||
%void = OpTypeVoid
|
||||
%25 = OpTypeFunction %void
|
||||
%29 = OpTypeFunction %_arr_v4int_uint_4
|
||||
%32 = OpTypeFunction %S
|
||||
%35 = OpConstantNull %S
|
||||
%36 = OpTypeFunction %void %_arr_v4int_uint_4
|
||||
%_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4
|
||||
%int_1 = OpConstant %int 1
|
||||
%43 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
|
||||
%int_2 = OpConstant %int 2
|
||||
%45 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2
|
||||
%int_3 = OpConstant %int 3
|
||||
%47 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3
|
||||
%48 = OpConstantComposite %_arr_v4int_uint_4 %43 %45 %47 %47
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
|
||||
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
|
||||
%_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4
|
||||
%unused_entry_point = OpFunction %void None %25
|
||||
%28 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%ret_arr = OpFunction %_arr_v4int_uint_4 None %29
|
||||
%31 = OpLabel
|
||||
OpReturnValue %8
|
||||
OpFunctionEnd
|
||||
%ret_struct_arr = OpFunction %S None %32
|
||||
%34 = OpLabel
|
||||
OpReturnValue %35
|
||||
OpFunctionEnd
|
||||
%foo = OpFunction %void None %36
|
||||
%src_param = OpFunctionParameter %_arr_v4int_uint_4
|
||||
%39 = OpLabel
|
||||
%src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
|
||||
%src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %24
|
||||
OpStore %dst %48
|
||||
OpStore %dst %src_param
|
||||
%49 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
|
||||
OpStore %dst %49
|
||||
OpStore %dst %8
|
||||
%50 = OpLoad %_arr_v4int_uint_4 %src_function
|
||||
OpStore %dst %50
|
||||
%51 = OpLoad %_arr_v4int_uint_4 %src_private
|
||||
OpStore %dst %51
|
||||
%52 = OpLoad %_arr_v4int_uint_4 %src_workgroup
|
||||
OpStore %dst %52
|
||||
%53 = OpFunctionCall %S %ret_struct_arr
|
||||
%54 = OpCompositeExtract %_arr_v4int_uint_4 %53 0
|
||||
OpStore %dst %54
|
||||
%57 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0
|
||||
%58 = OpLoad %_arr_v4int_uint_4 %57
|
||||
OpStore %dst %58
|
||||
%60 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0
|
||||
%61 = OpLoad %_arr_v4int_uint_4 %60
|
||||
OpStore %dst %61
|
||||
%64 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested
|
||||
OpStore %dst_nested %64
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
42
test/tint/array/assign_to_private_var.wgsl.expected.wgsl
Normal file
42
test/tint/array/assign_to_private_var.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,42 @@
|
||||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType,
|
||||
}
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
|
||||
var<workgroup> src_workgroup : ArrayType;
|
||||
|
||||
@group(0) @binding(0) var<uniform> src_uniform : S;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> src_storage : S;
|
||||
|
||||
var<private> dst : ArrayType;
|
||||
|
||||
var<private> dst_nested : array<array<array<i32, 2>, 3>, 4>;
|
||||
|
||||
fn ret_arr() -> ArrayType {
|
||||
return ArrayType();
|
||||
}
|
||||
|
||||
fn ret_struct_arr() -> S {
|
||||
return S();
|
||||
}
|
||||
|
||||
fn foo(src_param : ArrayType) {
|
||||
var src_function : ArrayType;
|
||||
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
||||
dst = src_param;
|
||||
dst = ret_arr();
|
||||
let src_let : ArrayType = ArrayType();
|
||||
dst = src_let;
|
||||
dst = src_function;
|
||||
dst = src_private;
|
||||
dst = src_workgroup;
|
||||
dst = ret_struct_arr().arr;
|
||||
dst = src_uniform.arr;
|
||||
dst = src_storage.arr;
|
||||
var src_nested : array<array<array<i32, 2>, 3>, 4>;
|
||||
dst_nested = src_nested;
|
||||
}
|
||||
56
test/tint/array/assign_to_storage_var.wgsl
Normal file
56
test/tint/array/assign_to_storage_var.wgsl
Normal file
@@ -0,0 +1,56 @@
|
||||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType,
|
||||
};
|
||||
|
||||
struct S_nested {
|
||||
arr : array<array<array<i32, 2>, 3>, 4>,
|
||||
};
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
var<workgroup> src_workgroup : ArrayType;
|
||||
@group(0) @binding(0) var<uniform> src_uniform : S;
|
||||
@group(0) @binding(1) var<storage, read_write> src_storage : S;
|
||||
|
||||
@group(0) @binding(2) var<storage, read_write> dst : S;
|
||||
@group(0) @binding(3) var<storage, read_write> dst_nested : S_nested;
|
||||
|
||||
fn ret_arr() -> ArrayType {
|
||||
return ArrayType();
|
||||
}
|
||||
|
||||
fn ret_struct_arr() -> S {
|
||||
return S();
|
||||
}
|
||||
|
||||
fn foo(src_param : ArrayType) {
|
||||
var src_function : ArrayType;
|
||||
|
||||
// Assign from type constructor.
|
||||
dst.arr = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
||||
|
||||
// Assign from parameter.
|
||||
dst.arr = src_param;
|
||||
|
||||
// Assign from function call.
|
||||
dst.arr = ret_arr();
|
||||
|
||||
// Assign from constant.
|
||||
let src_let : ArrayType = ArrayType();
|
||||
dst.arr = src_let;
|
||||
|
||||
// Assign from var, various storage classes.
|
||||
dst.arr = src_function;
|
||||
dst.arr = src_private;
|
||||
dst.arr = src_workgroup;
|
||||
|
||||
// Assign from struct.arr, various storage classes.
|
||||
dst.arr = ret_struct_arr().arr;
|
||||
dst.arr = src_uniform.arr;
|
||||
dst.arr = src_storage.arr;
|
||||
|
||||
// Nested assignment.
|
||||
var src_nested : array<array<array<i32, 2>, 3>, 4>;
|
||||
dst_nested.arr = src_nested;
|
||||
}
|
||||
59
test/tint/array/assign_to_storage_var.wgsl.expected.glsl
Normal file
59
test/tint/array/assign_to_storage_var.wgsl.expected.glsl
Normal file
@@ -0,0 +1,59 @@
|
||||
#version 310 es
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
struct S {
|
||||
ivec4 arr[4];
|
||||
};
|
||||
|
||||
struct S_nested {
|
||||
int arr[4][3][2];
|
||||
};
|
||||
|
||||
ivec4 src_private[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
shared ivec4 src_workgroup[4];
|
||||
layout(binding = 0) uniform S_1 {
|
||||
ivec4 arr[4];
|
||||
} src_uniform;
|
||||
|
||||
layout(binding = 1, std430) buffer S_2 {
|
||||
ivec4 arr[4];
|
||||
} src_storage;
|
||||
layout(binding = 2, std430) buffer S_3 {
|
||||
ivec4 arr[4];
|
||||
} dst;
|
||||
layout(binding = 3, std430) buffer S_nested_1 {
|
||||
int arr[4][3][2];
|
||||
} dst_nested;
|
||||
ivec4[4] ret_arr() {
|
||||
ivec4 tint_symbol_2[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
return tint_symbol_2;
|
||||
}
|
||||
|
||||
S ret_struct_arr() {
|
||||
S tint_symbol_3 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
|
||||
return tint_symbol_3;
|
||||
}
|
||||
|
||||
void foo(ivec4 src_param[4]) {
|
||||
ivec4 src_function[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
ivec4 tint_symbol_4[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
|
||||
dst.arr = tint_symbol_4;
|
||||
dst.arr = src_param;
|
||||
ivec4 tint_symbol[4] = ret_arr();
|
||||
dst.arr = tint_symbol;
|
||||
ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
dst.arr = src_let;
|
||||
dst.arr = src_function;
|
||||
dst.arr = src_private;
|
||||
dst.arr = src_workgroup;
|
||||
S tint_symbol_1 = ret_struct_arr();
|
||||
dst.arr = tint_symbol_1.arr;
|
||||
dst.arr = src_uniform.arr;
|
||||
dst.arr = src_storage.arr;
|
||||
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
|
||||
dst_nested.arr = src_nested;
|
||||
}
|
||||
|
||||
107
test/tint/array/assign_to_storage_var.wgsl.expected.hlsl
Normal file
107
test/tint/array/assign_to_storage_var.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,107 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
|
||||
struct S {
|
||||
int4 arr[4];
|
||||
};
|
||||
|
||||
static int4 src_private[4] = (int4[4])0;
|
||||
groupshared int4 src_workgroup[4];
|
||||
cbuffer cbuffer_src_uniform : register(b0, space0) {
|
||||
uint4 src_uniform[4];
|
||||
};
|
||||
RWByteAddressBuffer src_storage : register(u1, space0);
|
||||
RWByteAddressBuffer tint_symbol : register(u2, space0);
|
||||
RWByteAddressBuffer dst_nested : register(u3, space0);
|
||||
|
||||
typedef int4 ret_arr_ret[4];
|
||||
ret_arr_ret ret_arr() {
|
||||
const int4 tint_symbol_13[4] = (int4[4])0;
|
||||
return tint_symbol_13;
|
||||
}
|
||||
|
||||
S ret_struct_arr() {
|
||||
const S tint_symbol_14 = (S)0;
|
||||
return tint_symbol_14;
|
||||
}
|
||||
|
||||
void tint_symbol_3(RWByteAddressBuffer buffer, uint offset, int4 value[4]) {
|
||||
int4 array[4] = value;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
buffer.Store4((offset + (i * 16u)), asuint(array[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef int4 tint_symbol_5_ret[4];
|
||||
tint_symbol_5_ret tint_symbol_5(uint4 buffer[4], uint offset) {
|
||||
int4 arr_1[4] = (int4[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
const uint scalar_offset = ((offset + (i_1 * 16u))) / 4;
|
||||
arr_1[i_1] = asint(buffer[scalar_offset / 4]);
|
||||
}
|
||||
}
|
||||
return arr_1;
|
||||
}
|
||||
|
||||
typedef int4 tint_symbol_7_ret[4];
|
||||
tint_symbol_7_ret tint_symbol_7(RWByteAddressBuffer buffer, uint offset) {
|
||||
int4 arr_2[4] = (int4[4])0;
|
||||
{
|
||||
[loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) {
|
||||
arr_2[i_2] = asint(buffer.Load4((offset + (i_2 * 16u))));
|
||||
}
|
||||
}
|
||||
return arr_2;
|
||||
}
|
||||
|
||||
void tint_symbol_11(RWByteAddressBuffer buffer, uint offset, int value[2]) {
|
||||
int array_3[2] = value;
|
||||
{
|
||||
[loop] for(uint i_3 = 0u; (i_3 < 2u); i_3 = (i_3 + 1u)) {
|
||||
buffer.Store((offset + (i_3 * 4u)), asuint(array_3[i_3]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, int value[3][2]) {
|
||||
int array_2[3][2] = value;
|
||||
{
|
||||
[loop] for(uint i_4 = 0u; (i_4 < 3u); i_4 = (i_4 + 1u)) {
|
||||
tint_symbol_11(buffer, (offset + (i_4 * 8u)), array_2[i_4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, int value[4][3][2]) {
|
||||
int array_1[4][3][2] = value;
|
||||
{
|
||||
[loop] for(uint i_5 = 0u; (i_5 < 4u); i_5 = (i_5 + 1u)) {
|
||||
tint_symbol_10(buffer, (offset + (i_5 * 24u)), array_1[i_5]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void foo(int4 src_param[4]) {
|
||||
int4 src_function[4] = (int4[4])0;
|
||||
const int4 tint_symbol_15[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
|
||||
tint_symbol_3(tint_symbol, 0u, tint_symbol_15);
|
||||
tint_symbol_3(tint_symbol, 0u, src_param);
|
||||
const int4 tint_symbol_1[4] = ret_arr();
|
||||
tint_symbol_3(tint_symbol, 0u, tint_symbol_1);
|
||||
const int4 src_let[4] = (int4[4])0;
|
||||
tint_symbol_3(tint_symbol, 0u, src_let);
|
||||
tint_symbol_3(tint_symbol, 0u, src_function);
|
||||
tint_symbol_3(tint_symbol, 0u, src_private);
|
||||
tint_symbol_3(tint_symbol, 0u, src_workgroup);
|
||||
const S tint_symbol_2 = ret_struct_arr();
|
||||
tint_symbol_3(tint_symbol, 0u, tint_symbol_2.arr);
|
||||
tint_symbol_3(tint_symbol, 0u, tint_symbol_5(src_uniform, 0u));
|
||||
tint_symbol_3(tint_symbol, 0u, tint_symbol_7(src_storage, 0u));
|
||||
int src_nested[4][3][2] = (int[4][3][2])0;
|
||||
tint_symbol_9(dst_nested, 0u, src_nested);
|
||||
}
|
||||
57
test/tint/array/assign_to_storage_var.wgsl.expected.msl
Normal file
57
test/tint/array/assign_to_storage_var.wgsl.expected.msl
Normal file
@@ -0,0 +1,57 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ int4 arr[4];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ tint_array_wrapper arr;
|
||||
};
|
||||
|
||||
struct tint_array_wrapper_3 {
|
||||
/* 0x0000 */ int arr[2];
|
||||
};
|
||||
|
||||
struct tint_array_wrapper_2 {
|
||||
/* 0x0000 */ tint_array_wrapper_3 arr[3];
|
||||
};
|
||||
|
||||
struct tint_array_wrapper_1 {
|
||||
/* 0x0000 */ tint_array_wrapper_2 arr[4];
|
||||
};
|
||||
|
||||
struct S_nested {
|
||||
/* 0x0000 */ tint_array_wrapper_1 arr;
|
||||
};
|
||||
|
||||
tint_array_wrapper ret_arr() {
|
||||
tint_array_wrapper const tint_symbol_2 = {.arr={}};
|
||||
return tint_symbol_2;
|
||||
}
|
||||
|
||||
S ret_struct_arr() {
|
||||
S const tint_symbol_3 = {};
|
||||
return tint_symbol_3;
|
||||
}
|
||||
|
||||
void foo(tint_array_wrapper src_param, device S* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6, threadgroup tint_array_wrapper* const tint_symbol_7, const constant S* const tint_symbol_8, device S* const tint_symbol_9, device S_nested* const tint_symbol_10) {
|
||||
tint_array_wrapper src_function = {};
|
||||
tint_array_wrapper const tint_symbol_4 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
|
||||
(*(tint_symbol_5)).arr = tint_symbol_4;
|
||||
(*(tint_symbol_5)).arr = src_param;
|
||||
tint_array_wrapper const tint_symbol = ret_arr();
|
||||
(*(tint_symbol_5)).arr = tint_symbol;
|
||||
tint_array_wrapper const src_let = {.arr={}};
|
||||
(*(tint_symbol_5)).arr = src_let;
|
||||
(*(tint_symbol_5)).arr = src_function;
|
||||
(*(tint_symbol_5)).arr = *(tint_symbol_6);
|
||||
(*(tint_symbol_5)).arr = *(tint_symbol_7);
|
||||
S const tint_symbol_1 = ret_struct_arr();
|
||||
(*(tint_symbol_5)).arr = tint_symbol_1.arr;
|
||||
(*(tint_symbol_5)).arr = (*(tint_symbol_8)).arr;
|
||||
(*(tint_symbol_5)).arr = (*(tint_symbol_9)).arr;
|
||||
tint_array_wrapper_1 src_nested = {};
|
||||
(*(tint_symbol_10)).arr = src_nested;
|
||||
}
|
||||
|
||||
139
test/tint/array/assign_to_storage_var.wgsl.expected.spvasm
Normal file
139
test/tint/array/assign_to_storage_var.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,139 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 78
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||
OpName %src_private "src_private"
|
||||
OpName %src_workgroup "src_workgroup"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "arr"
|
||||
OpName %src_uniform "src_uniform"
|
||||
OpName %src_storage "src_storage"
|
||||
OpName %dst "dst"
|
||||
OpName %S_nested "S_nested"
|
||||
OpMemberName %S_nested 0 "arr"
|
||||
OpName %dst_nested "dst_nested"
|
||||
OpName %unused_entry_point "unused_entry_point"
|
||||
OpName %ret_arr "ret_arr"
|
||||
OpName %ret_struct_arr "ret_struct_arr"
|
||||
OpName %foo "foo"
|
||||
OpName %src_param "src_param"
|
||||
OpName %src_function "src_function"
|
||||
OpName %src_nested "src_nested"
|
||||
OpDecorate %_arr_v4int_uint_4 ArrayStride 16
|
||||
OpDecorate %S Block
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpDecorate %src_uniform NonWritable
|
||||
OpDecorate %src_uniform DescriptorSet 0
|
||||
OpDecorate %src_uniform Binding 0
|
||||
OpDecorate %src_storage DescriptorSet 0
|
||||
OpDecorate %src_storage Binding 1
|
||||
OpDecorate %dst DescriptorSet 0
|
||||
OpDecorate %dst Binding 2
|
||||
OpDecorate %S_nested Block
|
||||
OpMemberDecorate %S_nested 0 Offset 0
|
||||
OpDecorate %_arr_int_uint_2 ArrayStride 4
|
||||
OpDecorate %_arr__arr_int_uint_2_uint_3 ArrayStride 8
|
||||
OpDecorate %_arr__arr__arr_int_uint_2_uint_3_uint_4 ArrayStride 24
|
||||
OpDecorate %dst_nested DescriptorSet 0
|
||||
OpDecorate %dst_nested Binding 3
|
||||
%int = OpTypeInt 32 1
|
||||
%v4int = OpTypeVector %int 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_v4int_uint_4 = OpTypeArray %v4int %uint_4
|
||||
%_ptr_Private__arr_v4int_uint_4 = OpTypePointer Private %_arr_v4int_uint_4
|
||||
%8 = OpConstantNull %_arr_v4int_uint_4
|
||||
%src_private = OpVariable %_ptr_Private__arr_v4int_uint_4 Private %8
|
||||
%_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4
|
||||
%src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup
|
||||
%S = OpTypeStruct %_arr_v4int_uint_4
|
||||
%_ptr_Uniform_S = OpTypePointer Uniform %S
|
||||
%src_uniform = OpVariable %_ptr_Uniform_S Uniform
|
||||
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
|
||||
%src_storage = OpVariable %_ptr_StorageBuffer_S StorageBuffer
|
||||
%dst = OpVariable %_ptr_StorageBuffer_S StorageBuffer
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_int_uint_2 = OpTypeArray %int %uint_2
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr__arr_int_uint_2_uint_3 = OpTypeArray %_arr_int_uint_2 %uint_3
|
||||
%_arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_int_uint_2_uint_3 %uint_4
|
||||
%S_nested = OpTypeStruct %_arr__arr__arr_int_uint_2_uint_3_uint_4
|
||||
%_ptr_StorageBuffer_S_nested = OpTypePointer StorageBuffer %S_nested
|
||||
%dst_nested = OpVariable %_ptr_StorageBuffer_S_nested StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%25 = OpTypeFunction %void
|
||||
%29 = OpTypeFunction %_arr_v4int_uint_4
|
||||
%32 = OpTypeFunction %S
|
||||
%35 = OpConstantNull %S
|
||||
%36 = OpTypeFunction %void %_arr_v4int_uint_4
|
||||
%_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
|
||||
%int_1 = OpConstant %int 1
|
||||
%46 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
|
||||
%int_2 = OpConstant %int 2
|
||||
%48 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2
|
||||
%int_3 = OpConstant %int 3
|
||||
%50 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3
|
||||
%51 = OpConstantComposite %_arr_v4int_uint_4 %46 %48 %50 %50
|
||||
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
|
||||
%_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4
|
||||
%74 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4
|
||||
%_ptr_StorageBuffer__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer StorageBuffer %_arr__arr__arr_int_uint_2_uint_3_uint_4
|
||||
%unused_entry_point = OpFunction %void None %25
|
||||
%28 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%ret_arr = OpFunction %_arr_v4int_uint_4 None %29
|
||||
%31 = OpLabel
|
||||
OpReturnValue %8
|
||||
OpFunctionEnd
|
||||
%ret_struct_arr = OpFunction %S None %32
|
||||
%34 = OpLabel
|
||||
OpReturnValue %35
|
||||
OpFunctionEnd
|
||||
%foo = OpFunction %void None %36
|
||||
%src_param = OpFunctionParameter %_arr_v4int_uint_4
|
||||
%39 = OpLabel
|
||||
%src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
|
||||
%src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %74
|
||||
%44 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
|
||||
OpStore %44 %51
|
||||
%52 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
|
||||
OpStore %52 %src_param
|
||||
%53 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
|
||||
%54 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
|
||||
OpStore %54 %53
|
||||
%55 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
|
||||
OpStore %55 %8
|
||||
%56 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
|
||||
%57 = OpLoad %_arr_v4int_uint_4 %src_function
|
||||
OpStore %56 %57
|
||||
%58 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
|
||||
%59 = OpLoad %_arr_v4int_uint_4 %src_private
|
||||
OpStore %58 %59
|
||||
%60 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
|
||||
%61 = OpLoad %_arr_v4int_uint_4 %src_workgroup
|
||||
OpStore %60 %61
|
||||
%62 = OpFunctionCall %S %ret_struct_arr
|
||||
%63 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
|
||||
%64 = OpCompositeExtract %_arr_v4int_uint_4 %62 0
|
||||
OpStore %63 %64
|
||||
%65 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
|
||||
%67 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0
|
||||
%68 = OpLoad %_arr_v4int_uint_4 %67
|
||||
OpStore %65 %68
|
||||
%69 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
|
||||
%70 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0
|
||||
%71 = OpLoad %_arr_v4int_uint_4 %70
|
||||
OpStore %69 %71
|
||||
%76 = OpAccessChain %_ptr_StorageBuffer__arr__arr__arr_int_uint_2_uint_3_uint_4 %dst_nested %uint_0
|
||||
%77 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested
|
||||
OpStore %76 %77
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
46
test/tint/array/assign_to_storage_var.wgsl.expected.wgsl
Normal file
46
test/tint/array/assign_to_storage_var.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,46 @@
|
||||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType,
|
||||
}
|
||||
|
||||
struct S_nested {
|
||||
arr : array<array<array<i32, 2>, 3>, 4>,
|
||||
}
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
|
||||
var<workgroup> src_workgroup : ArrayType;
|
||||
|
||||
@group(0) @binding(0) var<uniform> src_uniform : S;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> src_storage : S;
|
||||
|
||||
@group(0) @binding(2) var<storage, read_write> dst : S;
|
||||
|
||||
@group(0) @binding(3) var<storage, read_write> dst_nested : S_nested;
|
||||
|
||||
fn ret_arr() -> ArrayType {
|
||||
return ArrayType();
|
||||
}
|
||||
|
||||
fn ret_struct_arr() -> S {
|
||||
return S();
|
||||
}
|
||||
|
||||
fn foo(src_param : ArrayType) {
|
||||
var src_function : ArrayType;
|
||||
dst.arr = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
||||
dst.arr = src_param;
|
||||
dst.arr = ret_arr();
|
||||
let src_let : ArrayType = ArrayType();
|
||||
dst.arr = src_let;
|
||||
dst.arr = src_function;
|
||||
dst.arr = src_private;
|
||||
dst.arr = src_workgroup;
|
||||
dst.arr = ret_struct_arr().arr;
|
||||
dst.arr = src_uniform.arr;
|
||||
dst.arr = src_storage.arr;
|
||||
var src_nested : array<array<array<i32, 2>, 3>, 4>;
|
||||
dst_nested.arr = src_nested;
|
||||
}
|
||||
27
test/tint/array/assign_to_subexpr.wgsl
Normal file
27
test/tint/array/assign_to_subexpr.wgsl
Normal file
@@ -0,0 +1,27 @@
|
||||
type ArrayType = array<i32, 4>;
|
||||
|
||||
struct S {
|
||||
arr : array<i32, 4>,
|
||||
};
|
||||
|
||||
fn foo() {
|
||||
let src : ArrayType = ArrayType();
|
||||
|
||||
var dst : ArrayType;
|
||||
var dst_struct : S;
|
||||
var dst_array : array<ArrayType, 2>;
|
||||
let dst_ptr : ptr<function, ArrayType> = &dst;
|
||||
let dst_struct_ptr : ptr<function, S> = &dst_struct;
|
||||
let dst_array_ptr : ptr<function, array<ArrayType, 2>> = &dst_array;
|
||||
|
||||
// Assign to struct.member.
|
||||
dst_struct.arr = src;
|
||||
|
||||
// Assign to array[index].
|
||||
dst_array[1] = src;
|
||||
|
||||
// Assign via pointers.
|
||||
*dst_ptr = src;
|
||||
(*dst_struct_ptr).arr = src;
|
||||
(*dst_array_ptr)[0] = src;
|
||||
}
|
||||
22
test/tint/array/assign_to_subexpr.wgsl.expected.glsl
Normal file
22
test/tint/array/assign_to_subexpr.wgsl.expected.glsl
Normal file
@@ -0,0 +1,22 @@
|
||||
#version 310 es
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
struct S {
|
||||
int arr[4];
|
||||
};
|
||||
|
||||
void foo() {
|
||||
int src[4] = int[4](0, 0, 0, 0);
|
||||
int dst[4] = int[4](0, 0, 0, 0);
|
||||
S dst_struct = S(int[4](0, 0, 0, 0));
|
||||
int dst_array[2][4] = int[2][4](int[4](0, 0, 0, 0), int[4](0, 0, 0, 0));
|
||||
dst_struct.arr = src;
|
||||
dst_array[1] = src;
|
||||
dst = src;
|
||||
dst_struct.arr = src;
|
||||
dst_array[0] = src;
|
||||
}
|
||||
|
||||
20
test/tint/array/assign_to_subexpr.wgsl.expected.hlsl
Normal file
20
test/tint/array/assign_to_subexpr.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,20 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
|
||||
struct S {
|
||||
int arr[4];
|
||||
};
|
||||
|
||||
void foo() {
|
||||
const int src[4] = (int[4])0;
|
||||
int tint_symbol[4] = (int[4])0;
|
||||
S dst_struct = (S)0;
|
||||
int dst_array[2][4] = (int[2][4])0;
|
||||
dst_struct.arr = src;
|
||||
dst_array[1] = src;
|
||||
tint_symbol = src;
|
||||
dst_struct.arr = src;
|
||||
dst_array[0] = src;
|
||||
}
|
||||
27
test/tint/array/assign_to_subexpr.wgsl.expected.msl
Normal file
27
test/tint/array/assign_to_subexpr.wgsl.expected.msl
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_array_wrapper {
|
||||
int arr[4];
|
||||
};
|
||||
|
||||
struct S {
|
||||
tint_array_wrapper arr;
|
||||
};
|
||||
|
||||
struct tint_array_wrapper_1 {
|
||||
tint_array_wrapper arr[2];
|
||||
};
|
||||
|
||||
void foo() {
|
||||
tint_array_wrapper const src = {.arr={}};
|
||||
tint_array_wrapper dst = {};
|
||||
S dst_struct = {};
|
||||
tint_array_wrapper_1 dst_array = {};
|
||||
dst_struct.arr = src;
|
||||
dst_array.arr[1] = src;
|
||||
dst = src;
|
||||
dst_struct.arr = src;
|
||||
dst_array.arr[0] = src;
|
||||
}
|
||||
|
||||
57
test/tint/array/assign_to_subexpr.wgsl.expected.spvasm
Normal file
57
test/tint/array/assign_to_subexpr.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,57 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 30
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||
OpName %unused_entry_point "unused_entry_point"
|
||||
OpName %foo "foo"
|
||||
OpName %dst "dst"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "arr"
|
||||
OpName %dst_struct "dst_struct"
|
||||
OpName %dst_array "dst_array"
|
||||
OpDecorate %_arr_int_uint_4 ArrayStride 4
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpDecorate %_arr__arr_int_uint_4_uint_2 ArrayStride 16
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_int_uint_4 = OpTypeArray %int %uint_4
|
||||
%11 = OpConstantNull %_arr_int_uint_4
|
||||
%_ptr_Function__arr_int_uint_4 = OpTypePointer Function %_arr_int_uint_4
|
||||
%S = OpTypeStruct %_arr_int_uint_4
|
||||
%_ptr_Function_S = OpTypePointer Function %S
|
||||
%17 = OpConstantNull %S
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr__arr_int_uint_4_uint_2 = OpTypeArray %_arr_int_uint_4 %uint_2
|
||||
%_ptr_Function__arr__arr_int_uint_4_uint_2 = OpTypePointer Function %_arr__arr_int_uint_4_uint_2
|
||||
%22 = OpConstantNull %_arr__arr_int_uint_4_uint_2
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%unused_entry_point = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%foo = OpFunction %void None %1
|
||||
%6 = OpLabel
|
||||
%dst = OpVariable %_ptr_Function__arr_int_uint_4 Function %11
|
||||
%dst_struct = OpVariable %_ptr_Function_S Function %17
|
||||
%dst_array = OpVariable %_ptr_Function__arr__arr_int_uint_4_uint_2 Function %22
|
||||
%24 = OpAccessChain %_ptr_Function__arr_int_uint_4 %dst_struct %uint_0
|
||||
OpStore %24 %11
|
||||
%26 = OpAccessChain %_ptr_Function__arr_int_uint_4 %dst_array %int_1
|
||||
OpStore %26 %11
|
||||
OpStore %dst %11
|
||||
%27 = OpAccessChain %_ptr_Function__arr_int_uint_4 %dst_struct %uint_0
|
||||
OpStore %27 %11
|
||||
%29 = OpAccessChain %_ptr_Function__arr_int_uint_4 %dst_array %int_0
|
||||
OpStore %29 %11
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
20
test/tint/array/assign_to_subexpr.wgsl.expected.wgsl
Normal file
20
test/tint/array/assign_to_subexpr.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,20 @@
|
||||
type ArrayType = array<i32, 4>;
|
||||
|
||||
struct S {
|
||||
arr : array<i32, 4>,
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
let src : ArrayType = ArrayType();
|
||||
var dst : ArrayType;
|
||||
var dst_struct : S;
|
||||
var dst_array : array<ArrayType, 2>;
|
||||
let dst_ptr : ptr<function, ArrayType> = &(dst);
|
||||
let dst_struct_ptr : ptr<function, S> = &(dst_struct);
|
||||
let dst_array_ptr : ptr<function, array<ArrayType, 2>> = &(dst_array);
|
||||
dst_struct.arr = src;
|
||||
dst_array[1] = src;
|
||||
*(dst_ptr) = src;
|
||||
(*(dst_struct_ptr)).arr = src;
|
||||
(*(dst_array_ptr))[0] = src;
|
||||
}
|
||||
52
test/tint/array/assign_to_workgroup_var.wgsl
Normal file
52
test/tint/array/assign_to_workgroup_var.wgsl
Normal file
@@ -0,0 +1,52 @@
|
||||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType,
|
||||
};
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
var<workgroup> src_workgroup : ArrayType;
|
||||
@group(0) @binding(0) var<uniform> src_uniform : S;
|
||||
@group(0) @binding(1) var<storage, read_write> src_storage : S;
|
||||
|
||||
var<workgroup> dst : ArrayType;
|
||||
var<workgroup> dst_nested : array<array<array<i32, 2>, 3>, 4>;
|
||||
|
||||
fn ret_arr() -> ArrayType {
|
||||
return ArrayType();
|
||||
}
|
||||
|
||||
fn ret_struct_arr() -> S {
|
||||
return S();
|
||||
}
|
||||
|
||||
fn foo(src_param : ArrayType) {
|
||||
var src_function : ArrayType;
|
||||
|
||||
// Assign from type constructor.
|
||||
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
||||
|
||||
// Assign from parameter.
|
||||
dst = src_param;
|
||||
|
||||
// Assign from function call.
|
||||
dst = ret_arr();
|
||||
|
||||
// Assign from constant.
|
||||
let src_let : ArrayType = ArrayType();
|
||||
dst = src_let;
|
||||
|
||||
// Assign from var, various storage classes.
|
||||
dst = src_function;
|
||||
dst = src_private;
|
||||
dst = src_workgroup;
|
||||
|
||||
// Assign from struct.arr, various storage classes.
|
||||
dst = ret_struct_arr().arr;
|
||||
dst = src_uniform.arr;
|
||||
dst = src_storage.arr;
|
||||
|
||||
// Nested assignment.
|
||||
var src_nested : array<array<array<i32, 2>, 3>, 4>;
|
||||
dst_nested = src_nested;
|
||||
}
|
||||
50
test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl
Normal file
50
test/tint/array/assign_to_workgroup_var.wgsl.expected.glsl
Normal file
@@ -0,0 +1,50 @@
|
||||
#version 310 es
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
struct S {
|
||||
ivec4 arr[4];
|
||||
};
|
||||
|
||||
ivec4 src_private[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
shared ivec4 src_workgroup[4];
|
||||
layout(binding = 0) uniform S_1 {
|
||||
ivec4 arr[4];
|
||||
} src_uniform;
|
||||
|
||||
layout(binding = 1, std430) buffer S_2 {
|
||||
ivec4 arr[4];
|
||||
} src_storage;
|
||||
shared ivec4 dst[4];
|
||||
shared int dst_nested[4][3][2];
|
||||
ivec4[4] ret_arr() {
|
||||
ivec4 tint_symbol_1[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
S ret_struct_arr() {
|
||||
S tint_symbol_2 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
|
||||
return tint_symbol_2;
|
||||
}
|
||||
|
||||
void foo(ivec4 src_param[4]) {
|
||||
ivec4 src_function[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
ivec4 tint_symbol_3[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
|
||||
dst = tint_symbol_3;
|
||||
dst = src_param;
|
||||
dst = ret_arr();
|
||||
ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
|
||||
dst = src_let;
|
||||
dst = src_function;
|
||||
dst = src_private;
|
||||
dst = src_workgroup;
|
||||
S tint_symbol = ret_struct_arr();
|
||||
dst = tint_symbol.arr;
|
||||
dst = src_uniform.arr;
|
||||
dst = src_storage.arr;
|
||||
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
|
||||
dst_nested = src_nested;
|
||||
}
|
||||
|
||||
70
test/tint/array/assign_to_workgroup_var.wgsl.expected.hlsl
Normal file
70
test/tint/array/assign_to_workgroup_var.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,70 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
|
||||
struct S {
|
||||
int4 arr[4];
|
||||
};
|
||||
|
||||
static int4 src_private[4] = (int4[4])0;
|
||||
groupshared int4 src_workgroup[4];
|
||||
cbuffer cbuffer_src_uniform : register(b0, space0) {
|
||||
uint4 src_uniform[4];
|
||||
};
|
||||
RWByteAddressBuffer src_storage : register(u1, space0);
|
||||
groupshared int4 tint_symbol[4];
|
||||
groupshared int dst_nested[4][3][2];
|
||||
|
||||
typedef int4 ret_arr_ret[4];
|
||||
ret_arr_ret ret_arr() {
|
||||
const int4 tint_symbol_6[4] = (int4[4])0;
|
||||
return tint_symbol_6;
|
||||
}
|
||||
|
||||
S ret_struct_arr() {
|
||||
const S tint_symbol_7 = (S)0;
|
||||
return tint_symbol_7;
|
||||
}
|
||||
|
||||
typedef int4 tint_symbol_2_ret[4];
|
||||
tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) {
|
||||
int4 arr_1[4] = (int4[4])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
|
||||
const uint scalar_offset = ((offset + (i * 16u))) / 4;
|
||||
arr_1[i] = asint(buffer[scalar_offset / 4]);
|
||||
}
|
||||
}
|
||||
return arr_1;
|
||||
}
|
||||
|
||||
typedef int4 tint_symbol_4_ret[4];
|
||||
tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
|
||||
int4 arr_2[4] = (int4[4])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
|
||||
arr_2[i_1] = asint(buffer.Load4((offset + (i_1 * 16u))));
|
||||
}
|
||||
}
|
||||
return arr_2;
|
||||
}
|
||||
|
||||
void foo(int4 src_param[4]) {
|
||||
int4 src_function[4] = (int4[4])0;
|
||||
const int4 tint_symbol_8[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
|
||||
tint_symbol = tint_symbol_8;
|
||||
tint_symbol = src_param;
|
||||
tint_symbol = ret_arr();
|
||||
const int4 src_let[4] = (int4[4])0;
|
||||
tint_symbol = src_let;
|
||||
tint_symbol = src_function;
|
||||
tint_symbol = src_private;
|
||||
tint_symbol = src_workgroup;
|
||||
const S tint_symbol_1 = ret_struct_arr();
|
||||
tint_symbol = tint_symbol_1.arr;
|
||||
tint_symbol = tint_symbol_2(src_uniform, 0u);
|
||||
tint_symbol = tint_symbol_4(src_storage, 0u);
|
||||
int src_nested[4][3][2] = (int[4][3][2])0;
|
||||
dst_nested = src_nested;
|
||||
}
|
||||
52
test/tint/array/assign_to_workgroup_var.wgsl.expected.msl
Normal file
52
test/tint/array/assign_to_workgroup_var.wgsl.expected.msl
Normal file
@@ -0,0 +1,52 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ int4 arr[4];
|
||||
};
|
||||
|
||||
struct S {
|
||||
/* 0x0000 */ tint_array_wrapper arr;
|
||||
};
|
||||
|
||||
struct tint_array_wrapper_3 {
|
||||
int arr[2];
|
||||
};
|
||||
|
||||
struct tint_array_wrapper_2 {
|
||||
tint_array_wrapper_3 arr[3];
|
||||
};
|
||||
|
||||
struct tint_array_wrapper_1 {
|
||||
tint_array_wrapper_2 arr[4];
|
||||
};
|
||||
|
||||
tint_array_wrapper ret_arr() {
|
||||
tint_array_wrapper const tint_symbol_1 = {.arr={}};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
S ret_struct_arr() {
|
||||
S const tint_symbol_2 = {};
|
||||
return tint_symbol_2;
|
||||
}
|
||||
|
||||
void foo(tint_array_wrapper src_param, threadgroup tint_array_wrapper* const tint_symbol_4, thread tint_array_wrapper* const tint_symbol_5, threadgroup tint_array_wrapper* const tint_symbol_6, const constant S* const tint_symbol_7, device S* const tint_symbol_8, threadgroup tint_array_wrapper_1* const tint_symbol_9) {
|
||||
tint_array_wrapper src_function = {};
|
||||
tint_array_wrapper const tint_symbol_3 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
|
||||
*(tint_symbol_4) = tint_symbol_3;
|
||||
*(tint_symbol_4) = src_param;
|
||||
*(tint_symbol_4) = ret_arr();
|
||||
tint_array_wrapper const src_let = {.arr={}};
|
||||
*(tint_symbol_4) = src_let;
|
||||
*(tint_symbol_4) = src_function;
|
||||
*(tint_symbol_4) = *(tint_symbol_5);
|
||||
*(tint_symbol_4) = *(tint_symbol_6);
|
||||
S const tint_symbol = ret_struct_arr();
|
||||
*(tint_symbol_4) = tint_symbol.arr;
|
||||
*(tint_symbol_4) = (*(tint_symbol_7)).arr;
|
||||
*(tint_symbol_4) = (*(tint_symbol_8)).arr;
|
||||
tint_array_wrapper_1 src_nested = {};
|
||||
*(tint_symbol_9) = src_nested;
|
||||
}
|
||||
|
||||
118
test/tint/array/assign_to_workgroup_var.wgsl.expected.spvasm
Normal file
118
test/tint/array/assign_to_workgroup_var.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,118 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 65
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||
OpName %src_private "src_private"
|
||||
OpName %src_workgroup "src_workgroup"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "arr"
|
||||
OpName %src_uniform "src_uniform"
|
||||
OpName %src_storage "src_storage"
|
||||
OpName %dst "dst"
|
||||
OpName %dst_nested "dst_nested"
|
||||
OpName %unused_entry_point "unused_entry_point"
|
||||
OpName %ret_arr "ret_arr"
|
||||
OpName %ret_struct_arr "ret_struct_arr"
|
||||
OpName %foo "foo"
|
||||
OpName %src_param "src_param"
|
||||
OpName %src_function "src_function"
|
||||
OpName %src_nested "src_nested"
|
||||
OpDecorate %_arr_v4int_uint_4 ArrayStride 16
|
||||
OpDecorate %S Block
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpDecorate %src_uniform NonWritable
|
||||
OpDecorate %src_uniform DescriptorSet 0
|
||||
OpDecorate %src_uniform Binding 0
|
||||
OpDecorate %src_storage DescriptorSet 0
|
||||
OpDecorate %src_storage Binding 1
|
||||
OpDecorate %_arr_int_uint_2 ArrayStride 4
|
||||
OpDecorate %_arr__arr_int_uint_2_uint_3 ArrayStride 8
|
||||
OpDecorate %_arr__arr__arr_int_uint_2_uint_3_uint_4 ArrayStride 24
|
||||
%int = OpTypeInt 32 1
|
||||
%v4int = OpTypeVector %int 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_v4int_uint_4 = OpTypeArray %v4int %uint_4
|
||||
%_ptr_Private__arr_v4int_uint_4 = OpTypePointer Private %_arr_v4int_uint_4
|
||||
%8 = OpConstantNull %_arr_v4int_uint_4
|
||||
%src_private = OpVariable %_ptr_Private__arr_v4int_uint_4 Private %8
|
||||
%_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4
|
||||
%src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup
|
||||
%S = OpTypeStruct %_arr_v4int_uint_4
|
||||
%_ptr_Uniform_S = OpTypePointer Uniform %S
|
||||
%src_uniform = OpVariable %_ptr_Uniform_S Uniform
|
||||
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
|
||||
%src_storage = OpVariable %_ptr_StorageBuffer_S StorageBuffer
|
||||
%dst = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_int_uint_2 = OpTypeArray %int %uint_2
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr__arr_int_uint_2_uint_3 = OpTypeArray %_arr_int_uint_2 %uint_3
|
||||
%_arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_int_uint_2_uint_3 %uint_4
|
||||
%_ptr_Workgroup__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Workgroup %_arr__arr__arr_int_uint_2_uint_3_uint_4
|
||||
%dst_nested = OpVariable %_ptr_Workgroup__arr__arr__arr_int_uint_2_uint_3_uint_4 Workgroup
|
||||
%void = OpTypeVoid
|
||||
%24 = OpTypeFunction %void
|
||||
%28 = OpTypeFunction %_arr_v4int_uint_4
|
||||
%31 = OpTypeFunction %S
|
||||
%34 = OpConstantNull %S
|
||||
%35 = OpTypeFunction %void %_arr_v4int_uint_4
|
||||
%_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4
|
||||
%int_1 = OpConstant %int 1
|
||||
%42 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
|
||||
%int_2 = OpConstant %int 2
|
||||
%44 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2
|
||||
%int_3 = OpConstant %int 3
|
||||
%46 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3
|
||||
%47 = OpConstantComposite %_arr_v4int_uint_4 %42 %44 %46 %46
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
|
||||
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
|
||||
%_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4
|
||||
%63 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4
|
||||
%unused_entry_point = OpFunction %void None %24
|
||||
%27 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%ret_arr = OpFunction %_arr_v4int_uint_4 None %28
|
||||
%30 = OpLabel
|
||||
OpReturnValue %8
|
||||
OpFunctionEnd
|
||||
%ret_struct_arr = OpFunction %S None %31
|
||||
%33 = OpLabel
|
||||
OpReturnValue %34
|
||||
OpFunctionEnd
|
||||
%foo = OpFunction %void None %35
|
||||
%src_param = OpFunctionParameter %_arr_v4int_uint_4
|
||||
%38 = OpLabel
|
||||
%src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
|
||||
%src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %63
|
||||
OpStore %dst %47
|
||||
OpStore %dst %src_param
|
||||
%48 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
|
||||
OpStore %dst %48
|
||||
OpStore %dst %8
|
||||
%49 = OpLoad %_arr_v4int_uint_4 %src_function
|
||||
OpStore %dst %49
|
||||
%50 = OpLoad %_arr_v4int_uint_4 %src_private
|
||||
OpStore %dst %50
|
||||
%51 = OpLoad %_arr_v4int_uint_4 %src_workgroup
|
||||
OpStore %dst %51
|
||||
%52 = OpFunctionCall %S %ret_struct_arr
|
||||
%53 = OpCompositeExtract %_arr_v4int_uint_4 %52 0
|
||||
OpStore %dst %53
|
||||
%56 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0
|
||||
%57 = OpLoad %_arr_v4int_uint_4 %56
|
||||
OpStore %dst %57
|
||||
%59 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0
|
||||
%60 = OpLoad %_arr_v4int_uint_4 %59
|
||||
OpStore %dst %60
|
||||
%64 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested
|
||||
OpStore %dst_nested %64
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
42
test/tint/array/assign_to_workgroup_var.wgsl.expected.wgsl
Normal file
42
test/tint/array/assign_to_workgroup_var.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,42 @@
|
||||
type ArrayType = array<vec4<i32>, 4>;
|
||||
|
||||
struct S {
|
||||
arr : ArrayType,
|
||||
}
|
||||
|
||||
var<private> src_private : ArrayType;
|
||||
|
||||
var<workgroup> src_workgroup : ArrayType;
|
||||
|
||||
@group(0) @binding(0) var<uniform> src_uniform : S;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> src_storage : S;
|
||||
|
||||
var<workgroup> dst : ArrayType;
|
||||
|
||||
var<workgroup> dst_nested : array<array<array<i32, 2>, 3>, 4>;
|
||||
|
||||
fn ret_arr() -> ArrayType {
|
||||
return ArrayType();
|
||||
}
|
||||
|
||||
fn ret_struct_arr() -> S {
|
||||
return S();
|
||||
}
|
||||
|
||||
fn foo(src_param : ArrayType) {
|
||||
var src_function : ArrayType;
|
||||
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
||||
dst = src_param;
|
||||
dst = ret_arr();
|
||||
let src_let : ArrayType = ArrayType();
|
||||
dst = src_let;
|
||||
dst = src_function;
|
||||
dst = src_private;
|
||||
dst = src_workgroup;
|
||||
dst = ret_struct_arr().arr;
|
||||
dst = src_uniform.arr;
|
||||
dst = src_storage.arr;
|
||||
var src_nested : array<array<array<i32, 2>, 3>, 4>;
|
||||
dst_nested = src_nested;
|
||||
}
|
||||
21
test/tint/array/function_parameter.wgsl
Normal file
21
test/tint/array/function_parameter.wgsl
Normal file
@@ -0,0 +1,21 @@
|
||||
fn f1(a : array<f32, 4>) -> f32 {
|
||||
return a[3];
|
||||
}
|
||||
|
||||
fn f2(a : array<array<f32, 4>, 3>) -> f32 {
|
||||
return a[2][3];
|
||||
}
|
||||
|
||||
fn f3(a : array<array<array<f32, 4>, 3>, 2>) -> f32 {
|
||||
return a[1][2][3];
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
let a1 : array<f32, 4> = array<f32, 4>();
|
||||
let a2 : array<array<f32, 4>, 3> = array<array<f32, 4>, 3>();
|
||||
let a3 : array<array<array<f32, 4>, 3>, 2> = array<array<array<f32, 4>, 3>, 2>();
|
||||
let v1 : f32 = f1(a1);
|
||||
let v2 : f32 = f2(a2);
|
||||
let v3 : f32 = f3(a3);
|
||||
}
|
||||
28
test/tint/array/function_parameter.wgsl.expected.glsl
Normal file
28
test/tint/array/function_parameter.wgsl.expected.glsl
Normal file
@@ -0,0 +1,28 @@
|
||||
#version 310 es
|
||||
|
||||
float f1(float a[4]) {
|
||||
return a[3];
|
||||
}
|
||||
|
||||
float f2(float a[3][4]) {
|
||||
return a[2][3];
|
||||
}
|
||||
|
||||
float f3(float a[2][3][4]) {
|
||||
return a[1][2][3];
|
||||
}
|
||||
|
||||
void tint_symbol() {
|
||||
float a1[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float a2[3][4] = float[3][4](float[4](0.0f, 0.0f, 0.0f, 0.0f), float[4](0.0f, 0.0f, 0.0f, 0.0f), float[4](0.0f, 0.0f, 0.0f, 0.0f));
|
||||
float a3[2][3][4] = float[2][3][4](float[3][4](float[4](0.0f, 0.0f, 0.0f, 0.0f), float[4](0.0f, 0.0f, 0.0f, 0.0f), float[4](0.0f, 0.0f, 0.0f, 0.0f)), float[3][4](float[4](0.0f, 0.0f, 0.0f, 0.0f), float[4](0.0f, 0.0f, 0.0f, 0.0f), float[4](0.0f, 0.0f, 0.0f, 0.0f)));
|
||||
float v1 = f1(a1);
|
||||
float v2 = f2(a2);
|
||||
float v3 = f3(a3);
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
22
test/tint/array/function_parameter.wgsl.expected.hlsl
Normal file
22
test/tint/array/function_parameter.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,22 @@
|
||||
float f1(float a[4]) {
|
||||
return a[3];
|
||||
}
|
||||
|
||||
float f2(float a[3][4]) {
|
||||
return a[2][3];
|
||||
}
|
||||
|
||||
float f3(float a[2][3][4]) {
|
||||
return a[1][2][3];
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
const float a1[4] = (float[4])0;
|
||||
const float a2[3][4] = (float[3][4])0;
|
||||
const float a3[2][3][4] = (float[2][3][4])0;
|
||||
const float v1 = f1(a1);
|
||||
const float v2 = f2(a2);
|
||||
const float v3 = f3(a3);
|
||||
return;
|
||||
}
|
||||
37
test/tint/array/function_parameter.wgsl.expected.msl
Normal file
37
test/tint/array/function_parameter.wgsl.expected.msl
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_array_wrapper {
|
||||
float arr[4];
|
||||
};
|
||||
|
||||
float f1(tint_array_wrapper a) {
|
||||
return a.arr[3];
|
||||
}
|
||||
|
||||
struct tint_array_wrapper_1 {
|
||||
tint_array_wrapper arr[3];
|
||||
};
|
||||
|
||||
float f2(tint_array_wrapper_1 a) {
|
||||
return a.arr[2].arr[3];
|
||||
}
|
||||
|
||||
struct tint_array_wrapper_2 {
|
||||
tint_array_wrapper_1 arr[2];
|
||||
};
|
||||
|
||||
float f3(tint_array_wrapper_2 a) {
|
||||
return a.arr[1].arr[2].arr[3];
|
||||
}
|
||||
|
||||
kernel void tint_symbol() {
|
||||
tint_array_wrapper const a1 = {.arr={}};
|
||||
tint_array_wrapper_1 const a2 = {.arr={}};
|
||||
tint_array_wrapper_2 const a3 = {.arr={}};
|
||||
float const v1 = f1(a1);
|
||||
float const v2 = f2(a2);
|
||||
float const v3 = f3(a3);
|
||||
return;
|
||||
}
|
||||
|
||||
67
test/tint/array/function_parameter.wgsl.expected.spvasm
Normal file
67
test/tint/array/function_parameter.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,67 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 41
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %f1 "f1"
|
||||
OpName %a "a"
|
||||
OpName %f2 "f2"
|
||||
OpName %a_0 "a"
|
||||
OpName %f3 "f3"
|
||||
OpName %a_1 "a"
|
||||
OpName %main "main"
|
||||
OpDecorate %_arr_float_uint_4 ArrayStride 4
|
||||
OpDecorate %_arr__arr_float_uint_4_uint_3 ArrayStride 16
|
||||
OpDecorate %_arr__arr__arr_float_uint_4_uint_3_uint_2 ArrayStride 48
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%1 = OpTypeFunction %float %_arr_float_uint_4
|
||||
%int = OpTypeInt 32 1
|
||||
%int_3 = OpConstant %int 3
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr__arr_float_uint_4_uint_3 = OpTypeArray %_arr_float_uint_4 %uint_3
|
||||
%12 = OpTypeFunction %float %_arr__arr_float_uint_4_uint_3
|
||||
%int_2 = OpConstant %int 2
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr__arr__arr_float_uint_4_uint_3_uint_2 = OpTypeArray %_arr__arr_float_uint_4_uint_3 %uint_2
|
||||
%21 = OpTypeFunction %float %_arr__arr__arr_float_uint_4_uint_3_uint_2
|
||||
%int_1 = OpConstant %int 1
|
||||
%void = OpTypeVoid
|
||||
%31 = OpTypeFunction %void
|
||||
%35 = OpConstantNull %_arr_float_uint_4
|
||||
%36 = OpConstantNull %_arr__arr_float_uint_4_uint_3
|
||||
%37 = OpConstantNull %_arr__arr__arr_float_uint_4_uint_3_uint_2
|
||||
%f1 = OpFunction %float None %1
|
||||
%a = OpFunctionParameter %_arr_float_uint_4
|
||||
%8 = OpLabel
|
||||
%11 = OpCompositeExtract %float %a 3
|
||||
OpReturnValue %11
|
||||
OpFunctionEnd
|
||||
%f2 = OpFunction %float None %12
|
||||
%a_0 = OpFunctionParameter %_arr__arr_float_uint_4_uint_3
|
||||
%17 = OpLabel
|
||||
%19 = OpCompositeExtract %_arr_float_uint_4 %a_0 2
|
||||
%20 = OpCompositeExtract %float %19 3
|
||||
OpReturnValue %20
|
||||
OpFunctionEnd
|
||||
%f3 = OpFunction %float None %21
|
||||
%a_1 = OpFunctionParameter %_arr__arr__arr_float_uint_4_uint_3_uint_2
|
||||
%26 = OpLabel
|
||||
%28 = OpCompositeExtract %_arr__arr_float_uint_4_uint_3 %a_1 1
|
||||
%29 = OpCompositeExtract %_arr_float_uint_4 %28 2
|
||||
%30 = OpCompositeExtract %float %29 3
|
||||
OpReturnValue %30
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %31
|
||||
%34 = OpLabel
|
||||
%38 = OpFunctionCall %float %f1 %35
|
||||
%39 = OpFunctionCall %float %f2 %36
|
||||
%40 = OpFunctionCall %float %f3 %37
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
21
test/tint/array/function_parameter.wgsl.expected.wgsl
Normal file
21
test/tint/array/function_parameter.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,21 @@
|
||||
fn f1(a : array<f32, 4>) -> f32 {
|
||||
return a[3];
|
||||
}
|
||||
|
||||
fn f2(a : array<array<f32, 4>, 3>) -> f32 {
|
||||
return a[2][3];
|
||||
}
|
||||
|
||||
fn f3(a : array<array<array<f32, 4>, 3>, 2>) -> f32 {
|
||||
return a[1][2][3];
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
let a1 : array<f32, 4> = array<f32, 4>();
|
||||
let a2 : array<array<f32, 4>, 3> = array<array<f32, 4>, 3>();
|
||||
let a3 : array<array<array<f32, 4>, 3>, 2> = array<array<array<f32, 4>, 3>, 2>();
|
||||
let v1 : f32 = f1(a1);
|
||||
let v2 : f32 = f2(a2);
|
||||
let v3 : f32 = f3(a3);
|
||||
}
|
||||
18
test/tint/array/function_return_type.wgsl
Normal file
18
test/tint/array/function_return_type.wgsl
Normal file
@@ -0,0 +1,18 @@
|
||||
fn f1() -> array<f32, 4> {
|
||||
return array<f32, 4>();
|
||||
}
|
||||
|
||||
fn f2() -> array<array<f32, 4>, 3> {
|
||||
return array<array<f32, 4>, 3>(f1(), f1(), f1());
|
||||
}
|
||||
|
||||
fn f3() -> array<array<array<f32, 4>, 3>, 2> {
|
||||
return array<array<array<f32, 4>, 3>, 2>(f2(), f2());
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
let a1 : array<f32, 4> = f1();
|
||||
let a2 : array<array<f32, 4>, 3> = f2();
|
||||
let a3 : array<array<array<f32, 4>, 3>, 2> = f3();
|
||||
}
|
||||
33
test/tint/array/function_return_type.wgsl.expected.glsl
Normal file
33
test/tint/array/function_return_type.wgsl.expected.glsl
Normal file
@@ -0,0 +1,33 @@
|
||||
#version 310 es
|
||||
|
||||
float[4] f1() {
|
||||
float tint_symbol_6[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
|
||||
return tint_symbol_6;
|
||||
}
|
||||
|
||||
float[3][4] f2() {
|
||||
float tint_symbol_1[4] = f1();
|
||||
float tint_symbol_2[4] = f1();
|
||||
float tint_symbol_3[4] = f1();
|
||||
float tint_symbol_7[3][4] = float[3][4](tint_symbol_1, tint_symbol_2, tint_symbol_3);
|
||||
return tint_symbol_7;
|
||||
}
|
||||
|
||||
float[2][3][4] f3() {
|
||||
float tint_symbol_4[3][4] = f2();
|
||||
float tint_symbol_5[3][4] = f2();
|
||||
float tint_symbol_8[2][3][4] = float[2][3][4](tint_symbol_4, tint_symbol_5);
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
void tint_symbol() {
|
||||
float a1[4] = f1();
|
||||
float a2[3][4] = f2();
|
||||
float a3[2][3][4] = f3();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
30
test/tint/array/function_return_type.wgsl.expected.hlsl
Normal file
30
test/tint/array/function_return_type.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,30 @@
|
||||
typedef float f1_ret[4];
|
||||
f1_ret f1() {
|
||||
const float tint_symbol_5[4] = (float[4])0;
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
typedef float f2_ret[3][4];
|
||||
f2_ret f2() {
|
||||
const float tint_symbol[4] = f1();
|
||||
const float tint_symbol_1[4] = f1();
|
||||
const float tint_symbol_2[4] = f1();
|
||||
const float tint_symbol_6[3][4] = {tint_symbol, tint_symbol_1, tint_symbol_2};
|
||||
return tint_symbol_6;
|
||||
}
|
||||
|
||||
typedef float f3_ret[2][3][4];
|
||||
f3_ret f3() {
|
||||
const float tint_symbol_3[3][4] = f2();
|
||||
const float tint_symbol_4[3][4] = f2();
|
||||
const float tint_symbol_7[2][3][4] = {tint_symbol_3, tint_symbol_4};
|
||||
return tint_symbol_7;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
const float a1[4] = f1();
|
||||
const float a2[3][4] = f2();
|
||||
const float a3[2][3][4] = f3();
|
||||
return;
|
||||
}
|
||||
42
test/tint/array/function_return_type.wgsl.expected.msl
Normal file
42
test/tint/array/function_return_type.wgsl.expected.msl
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_array_wrapper {
|
||||
float arr[4];
|
||||
};
|
||||
|
||||
tint_array_wrapper f1() {
|
||||
tint_array_wrapper const tint_symbol_6 = {.arr={}};
|
||||
return tint_symbol_6;
|
||||
}
|
||||
|
||||
struct tint_array_wrapper_1 {
|
||||
tint_array_wrapper arr[3];
|
||||
};
|
||||
|
||||
tint_array_wrapper_1 f2() {
|
||||
tint_array_wrapper const tint_symbol_1 = f1();
|
||||
tint_array_wrapper const tint_symbol_2 = f1();
|
||||
tint_array_wrapper const tint_symbol_3 = f1();
|
||||
tint_array_wrapper_1 const tint_symbol_7 = {.arr={tint_symbol_1, tint_symbol_2, tint_symbol_3}};
|
||||
return tint_symbol_7;
|
||||
}
|
||||
|
||||
struct tint_array_wrapper_2 {
|
||||
tint_array_wrapper_1 arr[2];
|
||||
};
|
||||
|
||||
tint_array_wrapper_2 f3() {
|
||||
tint_array_wrapper_1 const tint_symbol_4 = f2();
|
||||
tint_array_wrapper_1 const tint_symbol_5 = f2();
|
||||
tint_array_wrapper_2 const tint_symbol_8 = {.arr={tint_symbol_4, tint_symbol_5}};
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
kernel void tint_symbol() {
|
||||
tint_array_wrapper const a1 = f1();
|
||||
tint_array_wrapper_1 const a2 = f2();
|
||||
tint_array_wrapper_2 const a3 = f3();
|
||||
return;
|
||||
}
|
||||
|
||||
56
test/tint/array/function_return_type.wgsl.expected.spvasm
Normal file
56
test/tint/array/function_return_type.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,56 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 33
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %f1 "f1"
|
||||
OpName %f2 "f2"
|
||||
OpName %f3 "f3"
|
||||
OpName %main "main"
|
||||
OpDecorate %_arr_float_uint_4 ArrayStride 4
|
||||
OpDecorate %_arr__arr_float_uint_4_uint_3 ArrayStride 16
|
||||
OpDecorate %_arr__arr__arr_float_uint_4_uint_3_uint_2 ArrayStride 48
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_float_uint_4 = OpTypeArray %float %uint_4
|
||||
%1 = OpTypeFunction %_arr_float_uint_4
|
||||
%8 = OpConstantNull %_arr_float_uint_4
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr__arr_float_uint_4_uint_3 = OpTypeArray %_arr_float_uint_4 %uint_3
|
||||
%9 = OpTypeFunction %_arr__arr_float_uint_4_uint_3
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr__arr__arr_float_uint_4_uint_3_uint_2 = OpTypeArray %_arr__arr_float_uint_4_uint_3 %uint_2
|
||||
%18 = OpTypeFunction %_arr__arr__arr_float_uint_4_uint_3_uint_2
|
||||
%void = OpTypeVoid
|
||||
%26 = OpTypeFunction %void
|
||||
%f1 = OpFunction %_arr_float_uint_4 None %1
|
||||
%7 = OpLabel
|
||||
OpReturnValue %8
|
||||
OpFunctionEnd
|
||||
%f2 = OpFunction %_arr__arr_float_uint_4_uint_3 None %9
|
||||
%13 = OpLabel
|
||||
%14 = OpFunctionCall %_arr_float_uint_4 %f1
|
||||
%15 = OpFunctionCall %_arr_float_uint_4 %f1
|
||||
%16 = OpFunctionCall %_arr_float_uint_4 %f1
|
||||
%17 = OpCompositeConstruct %_arr__arr_float_uint_4_uint_3 %14 %15 %16
|
||||
OpReturnValue %17
|
||||
OpFunctionEnd
|
||||
%f3 = OpFunction %_arr__arr__arr_float_uint_4_uint_3_uint_2 None %18
|
||||
%22 = OpLabel
|
||||
%23 = OpFunctionCall %_arr__arr_float_uint_4_uint_3 %f2
|
||||
%24 = OpFunctionCall %_arr__arr_float_uint_4_uint_3 %f2
|
||||
%25 = OpCompositeConstruct %_arr__arr__arr_float_uint_4_uint_3_uint_2 %23 %24
|
||||
OpReturnValue %25
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %26
|
||||
%29 = OpLabel
|
||||
%30 = OpFunctionCall %_arr_float_uint_4 %f1
|
||||
%31 = OpFunctionCall %_arr__arr_float_uint_4_uint_3 %f2
|
||||
%32 = OpFunctionCall %_arr__arr__arr_float_uint_4_uint_3_uint_2 %f3
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
18
test/tint/array/function_return_type.wgsl.expected.wgsl
Normal file
18
test/tint/array/function_return_type.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,18 @@
|
||||
fn f1() -> array<f32, 4> {
|
||||
return array<f32, 4>();
|
||||
}
|
||||
|
||||
fn f2() -> array<array<f32, 4>, 3> {
|
||||
return array<array<f32, 4>, 3>(f1(), f1(), f1());
|
||||
}
|
||||
|
||||
fn f3() -> array<array<array<f32, 4>, 3>, 2> {
|
||||
return array<array<array<f32, 4>, 3>, 2>(f2(), f2());
|
||||
}
|
||||
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn main() {
|
||||
let a1 : array<f32, 4> = f1();
|
||||
let a2 : array<array<f32, 4>, 3> = f2();
|
||||
let a3 : array<array<array<f32, 4>, 3>, 2> = f3();
|
||||
}
|
||||
14
test/tint/array/size.wgsl
Normal file
14
test/tint/array/size.wgsl
Normal file
@@ -0,0 +1,14 @@
|
||||
let slen = 4;
|
||||
let ulen = 4u;
|
||||
|
||||
@stage(fragment)
|
||||
fn main() {
|
||||
var signed_literal : array<f32, 4>;
|
||||
var unsigned_literal : array<f32, 4u>;
|
||||
var signed_constant : array<f32, slen>;
|
||||
var unsigned_constant : array<f32, ulen>;
|
||||
|
||||
// Ensure that the types are compatible.
|
||||
signed_literal = unsigned_constant;
|
||||
signed_constant = unsigned_literal;
|
||||
}
|
||||
18
test/tint/array/size.wgsl.expected.glsl
Normal file
18
test/tint/array/size.wgsl.expected.glsl
Normal file
@@ -0,0 +1,18 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
const int slen = 4;
|
||||
const uint ulen = 4u;
|
||||
void tint_symbol() {
|
||||
float signed_literal[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float unsigned_literal[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float signed_constant[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float unsigned_constant[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
|
||||
signed_literal = unsigned_constant;
|
||||
signed_constant = unsigned_literal;
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol();
|
||||
return;
|
||||
}
|
||||
12
test/tint/array/size.wgsl.expected.hlsl
Normal file
12
test/tint/array/size.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,12 @@
|
||||
static const int slen = 4;
|
||||
static const uint ulen = 4u;
|
||||
|
||||
void main() {
|
||||
float signed_literal[4] = (float[4])0;
|
||||
float unsigned_literal[4] = (float[4])0;
|
||||
float signed_constant[4] = (float[4])0;
|
||||
float unsigned_constant[4] = (float[4])0;
|
||||
signed_literal = unsigned_constant;
|
||||
signed_constant = unsigned_literal;
|
||||
return;
|
||||
}
|
||||
21
test/tint/array/size.wgsl.expected.msl
Normal file
21
test/tint/array/size.wgsl.expected.msl
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
constant int slen = 4;
|
||||
|
||||
constant uint ulen = 4u;
|
||||
|
||||
struct tint_array_wrapper {
|
||||
float arr[4];
|
||||
};
|
||||
|
||||
fragment void tint_symbol() {
|
||||
tint_array_wrapper signed_literal = {};
|
||||
tint_array_wrapper unsigned_literal = {};
|
||||
tint_array_wrapper signed_constant = {};
|
||||
tint_array_wrapper unsigned_constant = {};
|
||||
signed_literal = unsigned_constant;
|
||||
signed_constant = unsigned_literal;
|
||||
return;
|
||||
}
|
||||
|
||||
39
test/tint/array/size.wgsl.expected.spvasm
Normal file
39
test/tint/array/size.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,39 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 19
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main"
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %slen "slen"
|
||||
OpName %ulen "ulen"
|
||||
OpName %main "main"
|
||||
OpName %signed_literal "signed_literal"
|
||||
OpName %unsigned_literal "unsigned_literal"
|
||||
OpName %signed_constant "signed_constant"
|
||||
OpName %unsigned_constant "unsigned_constant"
|
||||
OpDecorate %_arr_float_ulen ArrayStride 4
|
||||
%int = OpTypeInt 32 1
|
||||
%slen = OpConstant %int 4
|
||||
%uint = OpTypeInt 32 0
|
||||
%ulen = OpConstant %uint 4
|
||||
%void = OpTypeVoid
|
||||
%5 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%_arr_float_ulen = OpTypeArray %float %ulen
|
||||
%_ptr_Function__arr_float_ulen = OpTypePointer Function %_arr_float_ulen
|
||||
%13 = OpConstantNull %_arr_float_ulen
|
||||
%main = OpFunction %void None %5
|
||||
%8 = OpLabel
|
||||
%signed_literal = OpVariable %_ptr_Function__arr_float_ulen Function %13
|
||||
%unsigned_literal = OpVariable %_ptr_Function__arr_float_ulen Function %13
|
||||
%signed_constant = OpVariable %_ptr_Function__arr_float_ulen Function %13
|
||||
%unsigned_constant = OpVariable %_ptr_Function__arr_float_ulen Function %13
|
||||
%17 = OpLoad %_arr_float_ulen %unsigned_constant
|
||||
OpStore %signed_literal %17
|
||||
%18 = OpLoad %_arr_float_ulen %unsigned_literal
|
||||
OpStore %signed_constant %18
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
13
test/tint/array/size.wgsl.expected.wgsl
Normal file
13
test/tint/array/size.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,13 @@
|
||||
let slen = 4;
|
||||
|
||||
let ulen = 4u;
|
||||
|
||||
@stage(fragment)
|
||||
fn main() {
|
||||
var signed_literal : array<f32, 4>;
|
||||
var unsigned_literal : array<f32, 4u>;
|
||||
var signed_constant : array<f32, slen>;
|
||||
var unsigned_constant : array<f32, ulen>;
|
||||
signed_literal = unsigned_constant;
|
||||
signed_constant = unsigned_literal;
|
||||
}
|
||||
71
test/tint/array/strides.spvasm
Normal file
71
test/tint/array/strides.spvasm
Normal file
@@ -0,0 +1,71 @@
|
||||
; type ARR_A = @stride(8) array<f32, 2>;
|
||||
; type ARR_B = @stride(128) array<@stride(16) array<ARR_A, 4>, 3>;
|
||||
; struct S {
|
||||
; a : ARR_B,
|
||||
; };
|
||||
; @group(0) @binding(0) var<storage, read_write> s : S;
|
||||
;
|
||||
; @stage(compute) @workgroup_size(1)
|
||||
; fn f() {
|
||||
; let a : ARR_B = s.a;
|
||||
; let b : array<@stride(8) array<f32, 2>, 3> = s.a[3];
|
||||
; let c = s.a[3][2];
|
||||
; let d = s.a[3][2][1];
|
||||
; s.a = ARR_B();
|
||||
; s.a[3][2][1] = 5.0;
|
||||
; }
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f"
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "a"
|
||||
OpName %s "s"
|
||||
OpName %f "f"
|
||||
OpDecorate %S Block
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpDecorate %_arr_float_uint_2 ArrayStride 8
|
||||
OpDecorate %_arr__arr_float_uint_2_uint_3 ArrayStride 16
|
||||
OpDecorate %_arr__arr__arr_float_uint_2_uint_3_uint_4 ArrayStride 128
|
||||
OpDecorate %s DescriptorSet 0
|
||||
OpDecorate %s Binding 0
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr__arr_float_uint_2_uint_3 = OpTypeArray %_arr_float_uint_2 %uint_3
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr__arr__arr_float_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_float_uint_2_uint_3 %uint_4
|
||||
%S = OpTypeStruct %_arr__arr__arr_float_uint_2_uint_3_uint_4
|
||||
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
|
||||
%s = OpVariable %_ptr_StorageBuffer_S StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%12 = OpTypeFunction %void
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer__arr__arr__arr_float_uint_2_uint_3_uint_4 = OpTypePointer StorageBuffer %_arr__arr__arr_float_uint_2_uint_3_uint_4
|
||||
%int = OpTypeInt 32 1
|
||||
%int_3 = OpConstant %int 3
|
||||
%_ptr_StorageBuffer__arr__arr_float_uint_2_uint_3 = OpTypePointer StorageBuffer %_arr__arr_float_uint_2_uint_3
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_StorageBuffer__arr_float_uint_2 = OpTypePointer StorageBuffer %_arr_float_uint_2
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
|
||||
%34 = OpConstantNull %_arr__arr__arr_float_uint_2_uint_3_uint_4
|
||||
%float_5 = OpConstant %float 5
|
||||
%f = OpFunction %void None %12
|
||||
%15 = OpLabel
|
||||
%18 = OpAccessChain %_ptr_StorageBuffer__arr__arr__arr_float_uint_2_uint_3_uint_4 %s %uint_0
|
||||
%19 = OpLoad %_arr__arr__arr_float_uint_2_uint_3_uint_4 %18
|
||||
%23 = OpAccessChain %_ptr_StorageBuffer__arr__arr_float_uint_2_uint_3 %s %uint_0 %int_3
|
||||
%24 = OpLoad %_arr__arr_float_uint_2_uint_3 %23
|
||||
%27 = OpAccessChain %_ptr_StorageBuffer__arr_float_uint_2 %s %uint_0 %int_3 %int_2
|
||||
%28 = OpLoad %_arr_float_uint_2 %27
|
||||
%31 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_3 %int_2 %int_1
|
||||
%32 = OpLoad %float %31
|
||||
%33 = OpAccessChain %_ptr_StorageBuffer__arr__arr__arr_float_uint_2_uint_3_uint_4 %s %uint_0
|
||||
OpStore %33 %34
|
||||
%35 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_3 %int_2 %int_1
|
||||
OpStore %35 %float_5
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
37
test/tint/array/strides.spvasm.expected.glsl
Normal file
37
test/tint/array/strides.spvasm.expected.glsl
Normal file
@@ -0,0 +1,37 @@
|
||||
#version 310 es
|
||||
|
||||
struct strided_arr {
|
||||
float el;
|
||||
};
|
||||
|
||||
struct strided_arr_1 {
|
||||
strided_arr el[3][2];
|
||||
};
|
||||
|
||||
struct S {
|
||||
strided_arr_1 a[4];
|
||||
};
|
||||
|
||||
layout(binding = 0, std430) buffer S_1 {
|
||||
strided_arr_1 a[4];
|
||||
} s;
|
||||
void f_1() {
|
||||
strided_arr_1 x_19[4] = s.a;
|
||||
strided_arr x_24[3][2] = s.a[3].el;
|
||||
strided_arr x_28[2] = s.a[3].el[2];
|
||||
float x_32 = s.a[3].el[2][1].el;
|
||||
strided_arr_1 tint_symbol[4] = strided_arr_1[4](strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)))), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)))), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)))), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)))));
|
||||
s.a = tint_symbol;
|
||||
s.a[3].el[2][1].el = 5.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
void f() {
|
||||
f_1();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f();
|
||||
return;
|
||||
}
|
||||
103
test/tint/array/strides.spvasm.expected.hlsl
Normal file
103
test/tint/array/strides.spvasm.expected.hlsl
Normal file
@@ -0,0 +1,103 @@
|
||||
struct strided_arr {
|
||||
float el;
|
||||
};
|
||||
struct strided_arr_1 {
|
||||
strided_arr el[3][2];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer s : register(u0, space0);
|
||||
|
||||
strided_arr tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
|
||||
const strided_arr tint_symbol_12 = {asfloat(buffer.Load((offset + 0u)))};
|
||||
return tint_symbol_12;
|
||||
}
|
||||
|
||||
typedef strided_arr tint_symbol_3_ret[2];
|
||||
tint_symbol_3_ret tint_symbol_3(RWByteAddressBuffer buffer, uint offset) {
|
||||
strided_arr arr[2] = (strided_arr[2])0;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 2u); i = (i + 1u)) {
|
||||
arr[i] = tint_symbol_4(buffer, (offset + (i * 8u)));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
typedef strided_arr tint_symbol_2_ret[3][2];
|
||||
tint_symbol_2_ret tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
|
||||
strided_arr arr_1[3][2] = (strided_arr[3][2])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 3u); i_1 = (i_1 + 1u)) {
|
||||
arr_1[i_1] = tint_symbol_3(buffer, (offset + (i_1 * 16u)));
|
||||
}
|
||||
}
|
||||
return arr_1;
|
||||
}
|
||||
|
||||
strided_arr_1 tint_symbol_1(RWByteAddressBuffer buffer, uint offset) {
|
||||
const strided_arr_1 tint_symbol_13 = {tint_symbol_2(buffer, (offset + 0u))};
|
||||
return tint_symbol_13;
|
||||
}
|
||||
|
||||
typedef strided_arr_1 tint_symbol_ret[4];
|
||||
tint_symbol_ret tint_symbol(RWByteAddressBuffer buffer, uint offset) {
|
||||
strided_arr_1 arr_2[4] = (strided_arr_1[4])0;
|
||||
{
|
||||
[loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) {
|
||||
arr_2[i_2] = tint_symbol_1(buffer, (offset + (i_2 * 128u)));
|
||||
}
|
||||
}
|
||||
return arr_2;
|
||||
}
|
||||
|
||||
void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, strided_arr value) {
|
||||
buffer.Store((offset + 0u), asuint(value.el));
|
||||
}
|
||||
|
||||
void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, strided_arr value[2]) {
|
||||
strided_arr array_2[2] = value;
|
||||
{
|
||||
[loop] for(uint i_3 = 0u; (i_3 < 2u); i_3 = (i_3 + 1u)) {
|
||||
tint_symbol_10(buffer, (offset + (i_3 * 8u)), array_2[i_3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, strided_arr value[3][2]) {
|
||||
strided_arr array_1[3][2] = value;
|
||||
{
|
||||
[loop] for(uint i_4 = 0u; (i_4 < 3u); i_4 = (i_4 + 1u)) {
|
||||
tint_symbol_9(buffer, (offset + (i_4 * 16u)), array_1[i_4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tint_symbol_7(RWByteAddressBuffer buffer, uint offset, strided_arr_1 value) {
|
||||
tint_symbol_8(buffer, (offset + 0u), value.el);
|
||||
}
|
||||
|
||||
void tint_symbol_6(RWByteAddressBuffer buffer, uint offset, strided_arr_1 value[4]) {
|
||||
strided_arr_1 array[4] = value;
|
||||
{
|
||||
[loop] for(uint i_5 = 0u; (i_5 < 4u); i_5 = (i_5 + 1u)) {
|
||||
tint_symbol_7(buffer, (offset + (i_5 * 128u)), array[i_5]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void f_1() {
|
||||
const strided_arr_1 x_19[4] = tint_symbol(s, 0u);
|
||||
const strided_arr x_24[3][2] = tint_symbol_2(s, 384u);
|
||||
const strided_arr x_28[2] = tint_symbol_3(s, 416u);
|
||||
const float x_32 = asfloat(s.Load(424u));
|
||||
const strided_arr_1 tint_symbol_14[4] = (strided_arr_1[4])0;
|
||||
tint_symbol_6(s, 0u, tint_symbol_14);
|
||||
s.Store(424u, asuint(5.0f));
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
f_1();
|
||||
return;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user