diff --git a/include/tint/tint.h b/include/tint/tint.h index cdda85c596..c405175205 100644 --- a/include/tint/tint.h +++ b/include/tint/tint.h @@ -32,7 +32,6 @@ #include "src/tint/transform/manager.h" #include "src/tint/transform/multiplanar_external_texture.h" #include "src/tint/transform/renamer.h" -#include "src/tint/transform/robustness.h" #include "src/tint/transform/single_entry_point.h" #include "src/tint/transform/substitute_override.h" #include "src/tint/transform/vertex_pulling.h" diff --git a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp index 6b8d28f281..93eb8b9d6b 100644 --- a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp +++ b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp @@ -331,10 +331,6 @@ ResultOrError TranslateToHLSL( std::move(r.substituteOverrideConfig).value()); } - if (r.isRobustnessEnabled) { - transformManager.Add(); - } - transformManager.Add(); // D3D12 registers like `t3` and `c3` have the same bindingOffset number in @@ -383,6 +379,7 @@ ResultOrError TranslateToHLSL( } tint::writer::hlsl::Options options; + options.disable_robustness = !r.isRobustnessEnabled; options.disable_workgroup_init = r.disableWorkgroupInit; if (r.usesNumWorkgroups) { options.root_constant_binding_point = diff --git a/src/dawn/native/metal/ShaderModuleMTL.mm b/src/dawn/native/metal/ShaderModuleMTL.mm index 318d3734ff..0d46257d5d 100644 --- a/src/dawn/native/metal/ShaderModuleMTL.mm +++ b/src/dawn/native/metal/ShaderModuleMTL.mm @@ -222,9 +222,6 @@ ResultOrError> TranslateToMSL( std::move(r.substituteOverrideConfig).value()); } - if (r.isRobustnessEnabled) { - transformManager.Add(); - } transformManager.Add(); transformInputs.Add(std::move(r.bindingPoints), BindingRemapper::AccessControls{}, @@ -262,6 +259,7 @@ ResultOrError> TranslateToMSL( } tint::writer::msl::Options options; + options.disable_robustness = !r.isRobustnessEnabled; options.buffer_size_ubo_index = kBufferLengthBufferSlot; options.fixed_sample_mask = r.sampleMask; options.disable_workgroup_init = r.disableWorkgroupInit; diff --git a/src/dawn/native/null/DeviceNull.cpp b/src/dawn/native/null/DeviceNull.cpp index 6437d44c7b..c9d32ad3e2 100644 --- a/src/dawn/native/null/DeviceNull.cpp +++ b/src/dawn/native/null/DeviceNull.cpp @@ -391,8 +391,6 @@ MaybeError ComputePipeline::Initialize() { tint::transform::Manager transformManager; tint::transform::DataMap transformInputs; - transformManager.Add(); - if (!computeStage.metadata->overrides.empty()) { transformManager.Add(); transformInputs.Add( diff --git a/src/dawn/native/opengl/ShaderModuleGL.cpp b/src/dawn/native/opengl/ShaderModuleGL.cpp index 4cd29af9af..542ad4359e 100644 --- a/src/dawn/native/opengl/ShaderModuleGL.cpp +++ b/src/dawn/native/opengl/ShaderModuleGL.cpp @@ -228,6 +228,9 @@ ResultOrError ShaderModule::CompileShader(const OpenGLFunctions& gl, tintOptions.version = tint::writer::glsl::Version(ToTintGLStandard(r.glVersionStandard), r.glVersionMajor, r.glVersionMinor); + // TODO(crbug.com/dawn/1686): Robustness causes shader compilation failures. + tintOptions.disable_robustness = true; + // When textures are accessed without a sampler (e.g., textureLoad()), // GetSamplerTextureUses() will return this sentinel value. BindingPoint placeholderBindingPoint{static_cast(kMaxBindGroupsTyped), 0}; diff --git a/src/dawn/native/vulkan/ShaderModuleVk.cpp b/src/dawn/native/vulkan/ShaderModuleVk.cpp index aa4575681e..173e4040c0 100644 --- a/src/dawn/native/vulkan/ShaderModuleVk.cpp +++ b/src/dawn/native/vulkan/ShaderModuleVk.cpp @@ -293,10 +293,6 @@ ResultOrError ShaderModule::GetHandleAndSpirv( std::move(r.substituteOverrideConfig).value()); } - if (r.isRobustnessEnabled) { - transformManager.append(std::make_unique()); - } - // Run the binding remapper after SingleEntryPoint to avoid collisions with // unused entryPoints. transformManager.append(std::make_unique()); @@ -344,6 +340,7 @@ ResultOrError ShaderModule::GetHandleAndSpirv( } tint::writer::spirv::Options options; + options.disable_robustness = !r.isRobustnessEnabled; options.emit_vertex_point_size = true; options.disable_workgroup_init = r.disableWorkgroupInit; options.use_zero_initialize_workgroup_memory_extension = diff --git a/src/tint/cmd/main.cc b/src/tint/cmd/main.cc index 12d5b8c068..0b2aad271f 100644 --- a/src/tint/cmd/main.cc +++ b/src/tint/cmd/main.cc @@ -79,6 +79,7 @@ struct Options { bool print_hash = false; bool demangle = false; bool dump_inspector_bindings = false; + bool enable_robustness = false; std::unordered_set skip_hash; @@ -533,6 +534,7 @@ bool GenerateSpirv(const tint::Program* program, const Options& options) { #if TINT_BUILD_SPV_WRITER // TODO(jrprice): Provide a way for the user to set non-default options. tint::writer::spirv::Options gen_options; + gen_options.disable_robustness = !options.enable_robustness; gen_options.disable_workgroup_init = options.disable_workgroup_init; gen_options.generate_external_texture_bindings = true; auto result = tint::writer::spirv::Generate(program, gen_options); @@ -639,6 +641,7 @@ bool GenerateMsl(const tint::Program* program, const Options& options) { // TODO(jrprice): Provide a way for the user to set non-default options. tint::writer::msl::Options gen_options; + gen_options.disable_robustness = !options.enable_robustness; gen_options.disable_workgroup_init = options.disable_workgroup_init; gen_options.generate_external_texture_bindings = true; auto result = tint::writer::msl::Generate(input_program, gen_options); @@ -699,6 +702,7 @@ bool GenerateHlsl(const tint::Program* program, const Options& options) { #if TINT_BUILD_HLSL_WRITER // TODO(jrprice): Provide a way for the user to set non-default options. tint::writer::hlsl::Options gen_options; + gen_options.disable_robustness = !options.enable_robustness; gen_options.disable_workgroup_init = options.disable_workgroup_init; gen_options.generate_external_texture_bindings = true; gen_options.root_constant_binding_point = options.hlsl_root_constant_binding_point; @@ -838,6 +842,7 @@ bool GenerateGlsl(const tint::Program* program, const Options& options) { auto generate = [&](const tint::Program* prg, const std::string entry_point_name) -> bool { tint::writer::glsl::Options gen_options; + gen_options.disable_robustness = !options.enable_robustness; gen_options.generate_external_texture_bindings = true; auto result = tint::writer::glsl::Generate(prg, gen_options, entry_point_name); if (!result.success) { @@ -946,8 +951,9 @@ int main(int argc, const char** argv) { return true; }}, {"robustness", - [](tint::inspector::Inspector&, tint::transform::Manager& m, tint::transform::DataMap&) { - m.Add(); + [&](tint::inspector::Inspector&, tint::transform::Manager&, + tint::transform::DataMap&) { // enabled via writer option + options.enable_robustness = true; return true; }}, {"substitute_override", diff --git a/src/tint/fuzzers/tint_reader_writer_fuzzer.h b/src/tint/fuzzers/tint_reader_writer_fuzzer.h index 0104c9dd9b..b5d0a9590f 100644 --- a/src/tint/fuzzers/tint_reader_writer_fuzzer.h +++ b/src/tint/fuzzers/tint_reader_writer_fuzzer.h @@ -43,16 +43,14 @@ class ReaderWriterFuzzer : public CommonFuzzer { CommonFuzzer::SetTransformManager(tm, inputs); } - /// Pass through to the CommonFuzzer implementation, but will setup a - /// robustness transform, if no other transforms have been set. - /// @param data buffer of data that will interpreted as a byte array or string - /// depending on the shader input format. + /// Pass through to the CommonFuzzer implementation. + /// @param data buffer of data that will interpreted as a byte array or string depending on the + /// shader input format. /// @param size number of elements in buffer /// @returns 0, this is what libFuzzer expects int Run(const uint8_t* data, size_t size) { if (!tm_set_) { tb_ = std::make_unique(data, size); - tb_->AddTransform(); SetTransformManager(tb_->manager(), tb_->data_map()); } diff --git a/src/tint/fuzzers/tint_robustness_fuzzer.cc b/src/tint/fuzzers/tint_robustness_fuzzer.cc index dfc9a03c65..4b5eaa6da9 100644 --- a/src/tint/fuzzers/tint_robustness_fuzzer.cc +++ b/src/tint/fuzzers/tint_robustness_fuzzer.cc @@ -15,6 +15,7 @@ #include "src/tint/fuzzers/fuzzer_init.h" #include "src/tint/fuzzers/tint_common_fuzzer.h" #include "src/tint/fuzzers/transform_builder.h" +#include "src/tint/transform/robustness.h" namespace tint::fuzzers { diff --git a/src/tint/fuzzers/transform_builder.h b/src/tint/fuzzers/transform_builder.h index 73b5b51bb5..787abb9385 100644 --- a/src/tint/fuzzers/transform_builder.h +++ b/src/tint/fuzzers/transform_builder.h @@ -22,6 +22,7 @@ #include "src/tint/fuzzers/data_builder.h" #include "src/tint/fuzzers/shuffle_transform.h" +#include "src/tint/transform/robustness.h" namespace tint::fuzzers { @@ -61,7 +62,6 @@ class TransformBuilder { /// Helper that invokes Add*Transform for all of the platform independent /// passes. void AddPlatformIndependentPasses() { - AddTransform(); AddTransform(); AddTransform(); AddTransform(); diff --git a/src/tint/transform/pad_structs.h b/src/tint/transform/pad_structs.h index e9996d4e92..1add1d68e3 100644 --- a/src/tint/transform/pad_structs.h +++ b/src/tint/transform/pad_structs.h @@ -22,6 +22,8 @@ namespace tint::transform { /// This transform turns all explicit alignment and sizing into padding /// members of structs. This is required for GLSL ES, since it not support /// the offset= decoration. +/// +/// @note This transform requires the CanonicalizeEntryPointIO transform to have been run first. class PadStructs final : public Castable { public: /// Constructor diff --git a/src/tint/transform/robustness.h b/src/tint/transform/robustness.h index 14c5fe12a3..780eab9213 100644 --- a/src/tint/transform/robustness.h +++ b/src/tint/transform/robustness.h @@ -31,6 +31,7 @@ namespace tint::transform { /// the bounds of the array. Any access before the start of the array will clamp /// to zero and any access past the end of the array will clamp to /// (array length - 1). +/// @note This transform must come before the BuiltinPolyfill transform class Robustness final : public Castable { public: /// Address space to be skipped in the transform diff --git a/src/tint/writer/glsl/generator.h b/src/tint/writer/glsl/generator.h index 4d31bdf152..2bb4b03979 100644 --- a/src/tint/writer/glsl/generator.h +++ b/src/tint/writer/glsl/generator.h @@ -63,6 +63,9 @@ struct Options { /// transform std::unordered_map access_controls; + /// Set to `true` to disable software robustness that prevents out-of-bounds accesses. + bool disable_robustness = false; + /// If true, then validation will be disabled for binding point collisions /// generated by the BindingRemapper transform bool allow_collisions = false; @@ -75,6 +78,13 @@ struct Options { /// The GLSL version to emit Version version; + + /// Reflect the fields of this class so that it can be used by tint::ForeachField() + TINT_REFLECT(disable_robustness, + allow_collisions, + disable_workgroup_init, + generate_external_texture_bindings, + version); }; /// The result produced when generating GLSL. diff --git a/src/tint/writer/glsl/generator_impl.cc b/src/tint/writer/glsl/generator_impl.cc index 46428b051a..24c6386db0 100644 --- a/src/tint/writer/glsl/generator_impl.cc +++ b/src/tint/writer/glsl/generator_impl.cc @@ -57,6 +57,7 @@ #include "src/tint/transform/promote_side_effects_to_decl.h" #include "src/tint/transform/remove_phonies.h" #include "src/tint/transform/renamer.h" +#include "src/tint/transform/robustness.h" #include "src/tint/transform/simplify_pointers.h" #include "src/tint/transform/single_entry_point.h" #include "src/tint/transform/std140.h" @@ -149,6 +150,33 @@ SanitizedResult Sanitize(const Program* in, // ExpandCompoundAssignment must come before BuiltinPolyfill manager.Add(); + if (!entry_point.empty()) { + manager.Add(); + data.Add(entry_point); + } + manager.Add(); + data.Add(transform::Renamer::Target::kGlslKeywords, + /* preserve_unicode */ false); + + manager.Add(); // Must come before DirectVariableAccess + + manager.Add(); // Must come before DirectVariableAccess + manager.Add(); + + manager.Add(); + + if (!options.disable_robustness) { + // Robustness must come before BuiltinPolyfill + manager.Add(); + } + + if (options.generate_external_texture_bindings) { + // Note: it is more efficient for MultiplanarExternalTexture to come after Robustness + auto new_bindings_map = writer::GenerateExternalTextureBindings(in); + data.Add(new_bindings_map); + manager.Add(); + } + { // Builtin polyfills transform::BuiltinPolyfill::Builtins polyfills; polyfills.acosh = transform::BuiltinPolyfill::Level::kRangeCheck; @@ -169,26 +197,16 @@ SanitizedResult Sanitize(const Program* in, manager.Add(); } - if (!entry_point.empty()) { - manager.Add(); - data.Add(entry_point); - } - manager.Add(); - data.Add(transform::Renamer::Target::kGlslKeywords, - /* preserve_unicode */ false); - - manager.Add(); // Must come before DirectVariableAccess - - manager.Add(); // Must come before DirectVariableAccess - manager.Add(); - if (!options.disable_workgroup_init) { // ZeroInitWorkgroupMemory must come before CanonicalizeEntryPointIO as // ZeroInitWorkgroupMemory may inject new builtin parameters. manager.Add(); } + + // CanonicalizeEntryPointIO must come after Robustness manager.Add(); - manager.Add(); + + // PadStructs must come after CanonicalizeEntryPointIO manager.Add(); // DemoteToHelper must come after PromoteSideEffectsToDecl and ExpandCompoundAssignment. @@ -196,12 +214,6 @@ SanitizedResult Sanitize(const Program* in, manager.Add(); - if (options.generate_external_texture_bindings) { - auto new_bindings_map = writer::GenerateExternalTextureBindings(in); - data.Add(new_bindings_map); - } - manager.Add(); - data.Add(options.binding_map, options.placeholder_binding_point); manager.Add(); diff --git a/src/tint/writer/glsl/test_helper.h b/src/tint/writer/glsl/test_helper.h index 2f806ce4f3..98c7d8d152 100644 --- a/src/tint/writer/glsl/test_helper.h +++ b/src/tint/writer/glsl/test_helper.h @@ -32,6 +32,14 @@ class TestHelperBase : public BODY, public ProgramBuilder { TestHelperBase() = default; ~TestHelperBase() override = default; + /// @returns the default generator options for SanitizeAndBuild(), if no explicit options are + /// provided. + static Options DefaultOptions() { + Options opts; + opts.disable_robustness = true; + return opts; + } + /// Builds the program and returns a GeneratorImpl from the program. /// @note The generator is only built once. Multiple calls to Build() will /// return the same GeneratorImpl without rebuilding. @@ -60,7 +68,8 @@ class TestHelperBase : public BODY, public ProgramBuilder { /// @param version the GLSL version /// @param options the GLSL backend options /// @return the built generator - GeneratorImpl& SanitizeAndBuild(Version version = Version(), const Options& options = {}) { + GeneratorImpl& SanitizeAndBuild(Version version = Version(), + const Options& options = DefaultOptions()) { if (gen_) { return *gen_; } diff --git a/src/tint/writer/hlsl/generator.h b/src/tint/writer/hlsl/generator.h index 80dd518ad8..74d79ba15b 100644 --- a/src/tint/writer/hlsl/generator.h +++ b/src/tint/writer/hlsl/generator.h @@ -49,23 +49,32 @@ struct Options { /// @returns this Options Options& operator=(const Options&); + /// Set to `true` to disable software robustness that prevents out-of-bounds accesses. + bool disable_robustness = false; + /// The binding point to use for information passed via root constants. std::optional root_constant_binding_point; + /// Set to `true` to disable workgroup memory zero initialization bool disable_workgroup_init = false; + /// Set to 'true' to generates binding mappings for external textures bool generate_external_texture_bindings = false; + /// Options used to specify a mapping of binding points to indices into a UBO /// from which to load buffer sizes. ArrayLengthFromUniformOptions array_length_from_uniform = {}; + /// Interstage locations actually used as inputs in the next stage of the pipeline. /// This is potentially used for truncating unused interstage outputs at current shader stage. std::bitset<16> interstage_locations; + /// Set to `true` to generate polyfill for `reflect` builtin for vec2 bool polyfill_reflect_vec2_f32 = false; /// Reflect the fields of this class so that it can be used by tint::ForeachField() - TINT_REFLECT(root_constant_binding_point, + TINT_REFLECT(disable_robustness, + root_constant_binding_point, disable_workgroup_init, generate_external_texture_bindings, array_length_from_uniform); diff --git a/src/tint/writer/hlsl/generator_impl.cc b/src/tint/writer/hlsl/generator_impl.cc index 2bb4a9f0ca..823e6bd163 100644 --- a/src/tint/writer/hlsl/generator_impl.cc +++ b/src/tint/writer/hlsl/generator_impl.cc @@ -57,6 +57,7 @@ #include "src/tint/transform/promote_side_effects_to_decl.h" #include "src/tint/transform/remove_continue_in_switch.h" #include "src/tint/transform/remove_phonies.h" +#include "src/tint/transform/robustness.h" #include "src/tint/transform/simplify_pointers.h" #include "src/tint/transform/truncate_interstage_variables.h" #include "src/tint/transform/unshadow.h" @@ -165,6 +166,33 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { // ExpandCompoundAssignment must come before BuiltinPolyfill manager.Add(); + manager.Add(); // Must come before DirectVariableAccess + + manager.Add(); + + // LocalizeStructArrayAssignment must come after: + // * SimplifyPointers, because it assumes assignment to arrays in structs are + // done directly, not indirectly. + // TODO(crbug.com/tint/1340): See if we can get rid of the duplicate + // SimplifyPointers transform. Can't do it right now because + // LocalizeStructArrayAssignment introduces pointers. + manager.Add(); + manager.Add(); + + manager.Add(); + + if (!options.disable_robustness) { + // Robustness must come before BuiltinPolyfill + manager.Add(); + } + + if (options.generate_external_texture_bindings) { + // Note: it is more efficient for MultiplanarExternalTexture to come after Robustness + auto new_bindings_map = GenerateExternalTextureBindings(in); + data.Add(new_bindings_map); + manager.Add(); + } + { // Builtin polyfills transform::BuiltinPolyfill::Builtins polyfills; polyfills.acosh = transform::BuiltinPolyfill::Level::kFull; @@ -189,37 +217,13 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { manager.Add(); } - // Build the config for the internal ArrayLengthFromUniform transform. - auto& array_length_from_uniform = options.array_length_from_uniform; - transform::ArrayLengthFromUniform::Config array_length_from_uniform_cfg( - array_length_from_uniform.ubo_binding); - array_length_from_uniform_cfg.bindpoint_to_size_index = - array_length_from_uniform.bindpoint_to_size_index; - - if (options.generate_external_texture_bindings) { - auto new_bindings_map = GenerateExternalTextureBindings(in); - data.Add(new_bindings_map); - } - manager.Add(); - - manager.Add(); // Must come before DirectVariableAccess - - manager.Add(); - - // LocalizeStructArrayAssignment must come after: - // * SimplifyPointers, because it assumes assignment to arrays in structs are - // done directly, not indirectly. - // TODO(crbug.com/tint/1340): See if we can get rid of the duplicate - // SimplifyPointers transform. Can't do it right now because - // LocalizeStructArrayAssignment introduces pointers. - manager.Add(); - manager.Add(); - if (!options.disable_workgroup_init) { // ZeroInitWorkgroupMemory must come before CanonicalizeEntryPointIO as // ZeroInitWorkgroupMemory may inject new builtin parameters. manager.Add(); } + + // CanonicalizeEntryPointIO must come after Robustness manager.Add(); if (options.interstage_locations.any()) { @@ -246,11 +250,17 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { // assumes that num_workgroups builtins only appear as struct members and are // only accessed directly via member accessors. manager.Add(); - manager.Add(); manager.Add(); manager.Add(); manager.Add(); + // Build the config for the internal ArrayLengthFromUniform transform. + auto& array_length_from_uniform = options.array_length_from_uniform; + transform::ArrayLengthFromUniform::Config array_length_from_uniform_cfg( + array_length_from_uniform.ubo_binding); + array_length_from_uniform_cfg.bindpoint_to_size_index = + array_length_from_uniform.bindpoint_to_size_index; + // DemoteToHelper must come after CanonicalizeEntryPointIO, PromoteSideEffectsToDecl, and // ExpandCompoundAssignment. // TODO(crbug.com/tint/1752): This is only necessary when FXC is being used. diff --git a/src/tint/writer/hlsl/test_helper.h b/src/tint/writer/hlsl/test_helper.h index 8fd6bae9c6..24eb56a804 100644 --- a/src/tint/writer/hlsl/test_helper.h +++ b/src/tint/writer/hlsl/test_helper.h @@ -34,6 +34,14 @@ class TestHelperBase : public BODY, public ProgramBuilder { TestHelperBase() = default; ~TestHelperBase() override = default; + /// @returns the default generator options for SanitizeAndBuild(), if no explicit options are + /// provided. + static Options DefaultOptions() { + Options opts; + opts.disable_robustness = true; + return opts; + } + /// Builds the program and returns a GeneratorImpl from the program. /// @note The generator is only built once. Multiple calls to Build() will /// return the same GeneratorImpl without rebuilding. @@ -60,7 +68,7 @@ class TestHelperBase : public BODY, public ProgramBuilder { /// @note The generator is only built once. Multiple calls to Build() will /// return the same GeneratorImpl without rebuilding. /// @return the built generator - GeneratorImpl& SanitizeAndBuild(const Options& options = {}) { + GeneratorImpl& SanitizeAndBuild(const Options& options = DefaultOptions()) { if (gen_) { return *gen_; } diff --git a/src/tint/writer/msl/generator.h b/src/tint/writer/msl/generator.h index bdc2be58b7..1add25957a 100644 --- a/src/tint/writer/msl/generator.h +++ b/src/tint/writer/msl/generator.h @@ -44,6 +44,9 @@ struct Options { /// @returns this Options Options& operator=(const Options&); + /// Set to `true` to disable software robustness that prevents out-of-bounds accesses. + bool disable_robustness = false; + /// The index to use when generating a UBO to receive storage buffer sizes. /// Defaults to 30, which is the last valid buffer slot. uint32_t buffer_size_ubo_index = 30; @@ -67,7 +70,8 @@ struct Options { ArrayLengthFromUniformOptions array_length_from_uniform = {}; /// Reflect the fields of this class so that it can be used by tint::ForeachField() - TINT_REFLECT(buffer_size_ubo_index, + TINT_REFLECT(disable_robustness, + buffer_size_ubo_index, fixed_sample_mask, emit_vertex_point_size, disable_workgroup_init, diff --git a/src/tint/writer/msl/generator_impl.cc b/src/tint/writer/msl/generator_impl.cc index 81b32c04e3..b2c9ffaf3f 100644 --- a/src/tint/writer/msl/generator_impl.cc +++ b/src/tint/writer/msl/generator_impl.cc @@ -53,6 +53,7 @@ #include "src/tint/transform/promote_initializers_to_let.h" #include "src/tint/transform/promote_side_effects_to_decl.h" #include "src/tint/transform/remove_phonies.h" +#include "src/tint/transform/robustness.h" #include "src/tint/transform/simplify_pointers.h" #include "src/tint/transform/unshadow.h" #include "src/tint/transform/vectorize_scalar_matrix_initializers.h" @@ -171,24 +172,6 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { // ExpandCompoundAssignment must come before BuiltinPolyfill manager.Add(); - { // Builtin polyfills - transform::BuiltinPolyfill::Builtins polyfills; - polyfills.acosh = transform::BuiltinPolyfill::Level::kRangeCheck; - polyfills.atanh = transform::BuiltinPolyfill::Level::kRangeCheck; - polyfills.bitshift_modulo = true; // crbug.com/tint/1543 - polyfills.clamp_int = true; - polyfills.extract_bits = transform::BuiltinPolyfill::Level::kClampParameters; - polyfills.first_leading_bit = true; - polyfills.first_trailing_bit = true; - polyfills.insert_bits = transform::BuiltinPolyfill::Level::kClampParameters; - polyfills.int_div_mod = true; - polyfills.sign_int = true; - polyfills.texture_sample_base_clamp_to_edge_2d_f32 = true; - polyfills.workgroup_uniform_load = true; - data.Add(polyfills); - manager.Add(); - } - // Build the config for the internal ArrayLengthFromUniform transform. auto& array_length_from_uniform = options.array_length_from_uniform; transform::ArrayLengthFromUniform::Config array_length_from_uniform_cfg( @@ -217,23 +200,51 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { transform::CanonicalizeEntryPointIO::ShaderStyle::kMsl, options.fixed_sample_mask, options.emit_vertex_point_size); - if (options.generate_external_texture_bindings) { - auto new_bindings_map = GenerateExternalTextureBindings(in); - data.Add(new_bindings_map); - } - manager.Add(); - manager.Add(); manager.Add(); + manager.Add(); + + if (!options.disable_robustness) { + // Robustness must come before BuiltinPolyfill + manager.Add(); + } + + { // Builtin polyfills + transform::BuiltinPolyfill::Builtins polyfills; + polyfills.acosh = transform::BuiltinPolyfill::Level::kRangeCheck; + polyfills.atanh = transform::BuiltinPolyfill::Level::kRangeCheck; + polyfills.bitshift_modulo = true; // crbug.com/tint/1543 + polyfills.clamp_int = true; + polyfills.extract_bits = transform::BuiltinPolyfill::Level::kClampParameters; + polyfills.first_leading_bit = true; + polyfills.first_trailing_bit = true; + polyfills.insert_bits = transform::BuiltinPolyfill::Level::kClampParameters; + polyfills.int_div_mod = true; + polyfills.sign_int = true; + polyfills.texture_sample_base_clamp_to_edge_2d_f32 = true; + polyfills.workgroup_uniform_load = true; + data.Add(polyfills); + manager.Add(); + } + + if (options.generate_external_texture_bindings) { + // Note: it is more efficient for MultiplanarExternalTexture to come after Robustness + auto new_bindings_map = GenerateExternalTextureBindings(in); + data.Add(new_bindings_map); + manager.Add(); + } + if (!options.disable_workgroup_init) { // ZeroInitWorkgroupMemory must come before CanonicalizeEntryPointIO as // ZeroInitWorkgroupMemory may inject new builtin parameters. manager.Add(); } + + // CanonicalizeEntryPointIO must come after Robustness manager.Add(); - manager.Add(); + manager.Add(); // DemoteToHelper must come after PromoteSideEffectsToDecl and ExpandCompoundAssignment. diff --git a/src/tint/writer/msl/test_helper.h b/src/tint/writer/msl/test_helper.h index f1b530d22b..17802d7c22 100644 --- a/src/tint/writer/msl/test_helper.h +++ b/src/tint/writer/msl/test_helper.h @@ -33,6 +33,14 @@ class TestHelperBase : public BASE, public ProgramBuilder { TestHelperBase() = default; ~TestHelperBase() override = default; + /// @returns the default generator options for SanitizeAndBuild(), if no explicit options are + /// provided. + static Options DefaultOptions() { + Options opts; + opts.disable_robustness = true; + return opts; + } + /// Builds and returns a GeneratorImpl from the program. /// @note The generator is only built once. Multiple calls to Build() will /// return the same GeneratorImpl without rebuilding. @@ -59,7 +67,7 @@ class TestHelperBase : public BASE, public ProgramBuilder { /// @note The generator is only built once. Multiple calls to Build() will /// return the same GeneratorImpl without rebuilding. /// @return the built generator - GeneratorImpl& SanitizeAndBuild(const Options& options = {}) { + GeneratorImpl& SanitizeAndBuild(const Options& options = DefaultOptions()) { if (gen_) { return *gen_; } diff --git a/src/tint/writer/spirv/builder_builtin_test.cc b/src/tint/writer/spirv/builder_builtin_test.cc index 1645ee612b..5db867a556 100644 --- a/src/tint/writer/spirv/builder_builtin_test.cc +++ b/src/tint/writer/spirv/builder_builtin_test.cc @@ -2107,7 +2107,7 @@ OpEntryPoint Fragment %24 "a_func" OpExecutionMode %24 OriginUpperLeft OpName %5 "v" OpName %8 "tint_quantizeToF16" -OpName %9 "v_1" +OpName %9 "v" OpName %24 "a_func" %2 = OpTypeFloat 32 %1 = OpTypeVector %2 3 diff --git a/src/tint/writer/spirv/generator.h b/src/tint/writer/spirv/generator.h index e406f6ea1e..8b34032a98 100644 --- a/src/tint/writer/spirv/generator.h +++ b/src/tint/writer/spirv/generator.h @@ -35,6 +35,9 @@ namespace tint::writer::spirv { /// Configuration options used for generating SPIR-V. struct Options { + /// Set to `true` to disable software robustness that prevents out-of-bounds accesses. + bool disable_robustness = false; + /// Set to `true` to generate a PointSize builtin and have it set to 1.0 /// from all vertex shaders in the module. bool emit_vertex_point_size = true; @@ -50,7 +53,8 @@ struct Options { bool use_zero_initialize_workgroup_memory_extension = false; /// Reflect the fields of this class so that it can be used by tint::ForeachField() - TINT_REFLECT(emit_vertex_point_size, + TINT_REFLECT(disable_robustness, + emit_vertex_point_size, disable_workgroup_init, generate_external_texture_bindings, use_zero_initialize_workgroup_memory_extension); diff --git a/src/tint/writer/spirv/generator_impl.cc b/src/tint/writer/spirv/generator_impl.cc index ef6aa2d3da..c46bf9a7fa 100644 --- a/src/tint/writer/spirv/generator_impl.cc +++ b/src/tint/writer/spirv/generator_impl.cc @@ -32,6 +32,7 @@ #include "src/tint/transform/promote_side_effects_to_decl.h" #include "src/tint/transform/remove_phonies.h" #include "src/tint/transform/remove_unreachable_statements.h" +#include "src/tint/transform/robustness.h" #include "src/tint/transform/simplify_pointers.h" #include "src/tint/transform/std140.h" #include "src/tint/transform/unshadow.h" @@ -53,7 +54,34 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { // ExpandCompoundAssignment must come before BuiltinPolyfill manager.Add(); + manager.Add(); // Must come before DirectVariableAccess + + manager.Add(); // Must come before DirectVariableAccess + + manager.Add(); + manager.Add(); + manager.Add(); // Required for arrayLength() + manager.Add(); + manager.Add(); + manager.Add(); + manager.Add(); // ZeroInitWorkgroupMemory + manager.Add(); + + if (!options.disable_robustness) { + // Robustness must come before BuiltinPolyfill + manager.Add(); + } + + if (options.generate_external_texture_bindings) { + // Note: it is more efficient for MultiplanarExternalTexture to come after Robustness + auto new_bindings_map = GenerateExternalTextureBindings(in); + data.Add(new_bindings_map); + manager.Add(); + } + { // Builtin polyfills + // BuiltinPolyfill must come before DirectVariableAccess, due to the use of pointer + // parameter for workgroupUniformLoad() transform::BuiltinPolyfill::Builtins polyfills; polyfills.acosh = transform::BuiltinPolyfill::Level::kRangeCheck; polyfills.atanh = transform::BuiltinPolyfill::Level::kRangeCheck; @@ -75,18 +103,11 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { manager.Add(); } - if (options.generate_external_texture_bindings) { - auto new_bindings_map = GenerateExternalTextureBindings(in); - data.Add(new_bindings_map); - } - manager.Add(); - - manager.Add(); // Must come before DirectVariableAccess - - manager.Add(); // Must come before DirectVariableAccess bool disable_workgroup_init_in_sanitizer = options.disable_workgroup_init || options.use_zero_initialize_workgroup_memory_extension; if (!disable_workgroup_init_in_sanitizer) { + // ZeroInitWorkgroupMemory must come before CanonicalizeEntryPointIO as + // ZeroInitWorkgroupMemory may inject new builtin parameters. manager.Add(); } @@ -98,16 +119,11 @@ SanitizedResult Sanitize(const Program* in, const Options& options) { manager.Add(); } - manager.Add(); - manager.Add(); - manager.Add(); // Required for arrayLength() - manager.Add(); - manager.Add(); - manager.Add(); - manager.Add(); // ZeroInitWorkgroupMemory - manager.Add(); + // CanonicalizeEntryPointIO must come after Robustness manager.Add(); manager.Add(); + + // AddBlockAttribute must come after MultiplanarExternalTexture manager.Add(); // DemoteToHelper must come after CanonicalizeEntryPointIO, PromoteSideEffectsToDecl, and diff --git a/src/tint/writer/spirv/test_helper.h b/src/tint/writer/spirv/test_helper.h index 2e587602b8..028d363067 100644 --- a/src/tint/writer/spirv/test_helper.h +++ b/src/tint/writer/spirv/test_helper.h @@ -33,6 +33,14 @@ class TestHelperBase : public ProgramBuilder, public BASE { TestHelperBase() = default; ~TestHelperBase() override = default; + /// @returns the default generator options for SanitizeAndBuild(), if no explicit options are + /// provided. + static Options DefaultOptions() { + Options opts; + opts.disable_robustness = true; + return opts; + } + /// Builds and returns a spirv::Builder from the program. /// @note The spirv::Builder is only built once. Multiple calls to Build() /// will return the same spirv::Builder without rebuilding. @@ -59,7 +67,7 @@ class TestHelperBase : public ProgramBuilder, public BASE { /// @note The spirv::Builder is only built once. Multiple calls to Build() /// will return the same spirv::Builder without rebuilding. /// @return the built spirv::Builder - spirv::Builder& SanitizeAndBuild(const Options& options = {}) { + spirv::Builder& SanitizeAndBuild(const Options& options = DefaultOptions()) { if (spirv_builder) { return *spirv_builder; } diff --git a/test/tint/buffer/storage/static_index/write_f16.wgsl.expected.msl b/test/tint/buffer/storage/static_index/write_f16.wgsl.expected.msl index a6aa784334..5ffea48bb5 100644 --- a/test/tint/buffer/storage/static_index/write_f16.wgsl.expected.msl +++ b/test/tint/buffer/storage/static_index/write_f16.wgsl.expected.msl @@ -215,12 +215,12 @@ kernel void tint_symbol(device S_tint_packed_vec3* tint_symbol_5 [[buffer(0)]]) (*(tint_symbol_5)).mat4x4_f16 = half4x4(half4(0.0h), half4(0.0h), half4(0.0h), half4(0.0h)); tint_array const tint_symbol_1 = tint_array{}; assign_and_preserve_padding_6(&((*(tint_symbol_5)).arr2_vec3_f32), tint_symbol_1); - tint_array const tint_symbol_4 = tint_array{}; - (*(tint_symbol_5)).arr2_mat4x2_f16 = tint_symbol_4; - Inner const tint_symbol_2 = Inner{}; - assign_and_preserve_padding_7(&((*(tint_symbol_5)).struct_inner), tint_symbol_2); - tint_array const tint_symbol_3 = tint_array{}; - assign_and_preserve_padding_8(&((*(tint_symbol_5)).array_struct_inner), tint_symbol_3); + tint_array const tint_symbol_2 = tint_array{}; + (*(tint_symbol_5)).arr2_mat4x2_f16 = tint_symbol_2; + Inner const tint_symbol_3 = Inner{}; + assign_and_preserve_padding_7(&((*(tint_symbol_5)).struct_inner), tint_symbol_3); + tint_array const tint_symbol_4 = tint_array{}; + assign_and_preserve_padding_8(&((*(tint_symbol_5)).array_struct_inner), tint_symbol_4); return; } diff --git a/test/tint/bug/chromium/1386647.wgsl.expected.dxc.hlsl b/test/tint/bug/chromium/1386647.wgsl.expected.dxc.hlsl index 424a72f575..c659c3b116 100644 --- a/test/tint/bug/chromium/1386647.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/chromium/1386647.wgsl.expected.dxc.hlsl @@ -7,9 +7,7 @@ struct tint_symbol_1 { }; void f_inner(uint3 v) { - const uint tint_symbol_2 = v.x; - const uint tint_symbol_3 = tint_mod(v.y, 1u); - const uint l = (tint_symbol_2 << (tint_symbol_3 & 31u)); + const uint l = (v.x << (tint_mod(v.y, 1u) & 31u)); } [numthreads(1, 1, 1)] diff --git a/test/tint/bug/chromium/1386647.wgsl.expected.fxc.hlsl b/test/tint/bug/chromium/1386647.wgsl.expected.fxc.hlsl index 424a72f575..c659c3b116 100644 --- a/test/tint/bug/chromium/1386647.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/chromium/1386647.wgsl.expected.fxc.hlsl @@ -7,9 +7,7 @@ struct tint_symbol_1 { }; void f_inner(uint3 v) { - const uint tint_symbol_2 = v.x; - const uint tint_symbol_3 = tint_mod(v.y, 1u); - const uint l = (tint_symbol_2 << (tint_symbol_3 & 31u)); + const uint l = (v.x << (tint_mod(v.y, 1u) & 31u)); } [numthreads(1, 1, 1)] diff --git a/test/tint/bug/chromium/1386647.wgsl.expected.glsl b/test/tint/bug/chromium/1386647.wgsl.expected.glsl index ab0cb6e517..8f7b5c8210 100644 --- a/test/tint/bug/chromium/1386647.wgsl.expected.glsl +++ b/test/tint/bug/chromium/1386647.wgsl.expected.glsl @@ -5,9 +5,7 @@ uint tint_mod(uint lhs, uint rhs) { } void f(uvec3 v) { - uint tint_symbol = v.x; - uint tint_symbol_1 = tint_mod(v.y, 1u); - uint l = (tint_symbol << (tint_symbol_1 & 31u)); + uint l = (v.x << (tint_mod(v.y, 1u) & 31u)); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/bug/chromium/1386647.wgsl.expected.msl b/test/tint/bug/chromium/1386647.wgsl.expected.msl index 694a88a216..d85fa99d77 100644 --- a/test/tint/bug/chromium/1386647.wgsl.expected.msl +++ b/test/tint/bug/chromium/1386647.wgsl.expected.msl @@ -6,9 +6,7 @@ uint tint_mod(uint lhs, uint rhs) { } void f_inner(uint3 v) { - uint const tint_symbol = v[0]; - uint const tint_symbol_1 = tint_mod(v[1], 1u); - uint const l = (tint_symbol << (tint_symbol_1 & 31u)); + uint const l = (v[0] << (tint_mod(v[1], 1u) & 31u)); } kernel void f(uint3 v [[thread_position_in_grid]]) { diff --git a/test/tint/bug/tint/1076.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1076.wgsl.expected.dxc.hlsl index 868773bfbf..71abaff4a6 100644 --- a/test/tint/bug/tint/1076.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/tint/1076.wgsl.expected.dxc.hlsl @@ -16,13 +16,13 @@ FragIn main_inner(FragIn tint_symbol, float b) { if ((tint_symbol.mask == 0u)) { return tint_symbol; } - const FragIn tint_symbol_4 = {b, 1u}; - return tint_symbol_4; + const FragIn tint_symbol_5 = {b, 1u}; + return tint_symbol_5; } tint_symbol_3 main(tint_symbol_2 tint_symbol_1) { - const FragIn tint_symbol_5 = {tint_symbol_1.a, tint_symbol_1.mask}; - const FragIn inner_result = main_inner(tint_symbol_5, tint_symbol_1.b); + const FragIn tint_symbol_4 = {tint_symbol_1.a, tint_symbol_1.mask}; + const FragIn inner_result = main_inner(tint_symbol_4, tint_symbol_1.b); tint_symbol_3 wrapper_result = (tint_symbol_3)0; wrapper_result.a = inner_result.a; wrapper_result.mask = inner_result.mask; diff --git a/test/tint/bug/tint/1076.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1076.wgsl.expected.fxc.hlsl index 868773bfbf..71abaff4a6 100644 --- a/test/tint/bug/tint/1076.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/tint/1076.wgsl.expected.fxc.hlsl @@ -16,13 +16,13 @@ FragIn main_inner(FragIn tint_symbol, float b) { if ((tint_symbol.mask == 0u)) { return tint_symbol; } - const FragIn tint_symbol_4 = {b, 1u}; - return tint_symbol_4; + const FragIn tint_symbol_5 = {b, 1u}; + return tint_symbol_5; } tint_symbol_3 main(tint_symbol_2 tint_symbol_1) { - const FragIn tint_symbol_5 = {tint_symbol_1.a, tint_symbol_1.mask}; - const FragIn inner_result = main_inner(tint_symbol_5, tint_symbol_1.b); + const FragIn tint_symbol_4 = {tint_symbol_1.a, tint_symbol_1.mask}; + const FragIn inner_result = main_inner(tint_symbol_4, tint_symbol_1.b); tint_symbol_3 wrapper_result = (tint_symbol_3)0; wrapper_result.a = inner_result.a; wrapper_result.mask = inner_result.mask; diff --git a/test/tint/bug/tint/1076.wgsl.expected.msl b/test/tint/bug/tint/1076.wgsl.expected.msl index 926bbcbdb0..b01d931e50 100644 --- a/test/tint/bug/tint/1076.wgsl.expected.msl +++ b/test/tint/bug/tint/1076.wgsl.expected.msl @@ -20,13 +20,13 @@ FragIn tint_symbol_inner(FragIn in, float b) { if ((in.mask == 0u)) { return in; } - FragIn const tint_symbol_4 = {.a=b, .mask=1u}; - return tint_symbol_4; + FragIn const tint_symbol_5 = {.a=b, .mask=1u}; + return tint_symbol_5; } fragment tint_symbol_3 tint_symbol(uint mask [[sample_mask]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { - FragIn const tint_symbol_5 = {.a=tint_symbol_1.a, .mask=mask}; - FragIn const inner_result = tint_symbol_inner(tint_symbol_5, tint_symbol_1.b); + FragIn const tint_symbol_4 = {.a=tint_symbol_1.a, .mask=mask}; + FragIn const inner_result = tint_symbol_inner(tint_symbol_4, tint_symbol_1.b); tint_symbol_3 wrapper_result = {}; wrapper_result.a = inner_result.a; wrapper_result.mask = inner_result.mask; diff --git a/test/tint/bug/tint/1113.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1113.wgsl.expected.dxc.hlsl index e6e0b7acc1..aa083e3334 100644 --- a/test/tint/bug/tint/1113.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/tint/1113.wgsl.expected.dxc.hlsl @@ -67,7 +67,7 @@ void doIgnore() { int g55 = LUTatomicLoad(0u); } -struct tint_symbol_1 { +struct tint_symbol_2 { uint3 GlobalInvocationID : SV_DispatchThreadID; }; @@ -103,12 +103,12 @@ void main_count_inner(uint3 GlobalInvocationID) { } [numthreads(128, 1, 1)] -void main_count(tint_symbol_1 tint_symbol) { - main_count_inner(tint_symbol.GlobalInvocationID); +void main_count(tint_symbol_2 tint_symbol_1) { + main_count_inner(tint_symbol_1.GlobalInvocationID); return; } -struct tint_symbol_3 { +struct tint_symbol_4 { uint3 GlobalInvocationID : SV_DispatchThreadID; }; @@ -135,19 +135,19 @@ void main_create_lut_inner(uint3 GlobalInvocationID) { uint numTriangles = countersatomicLoad((4u * voxelIndex)); int offset = -1; if ((numTriangles > 0u)) { - const uint tint_symbol_6 = dbgatomicAdd(0u, numTriangles); - offset = int(tint_symbol_6); + const uint tint_symbol = dbgatomicAdd(0u, numTriangles); + offset = int(tint_symbol); } LUTatomicStore((4u * voxelIndex), offset); } [numthreads(128, 1, 1)] -void main_create_lut(tint_symbol_3 tint_symbol_2) { - main_create_lut_inner(tint_symbol_2.GlobalInvocationID); +void main_create_lut(tint_symbol_4 tint_symbol_3) { + main_create_lut_inner(tint_symbol_3.GlobalInvocationID); return; } -struct tint_symbol_5 { +struct tint_symbol_6 { uint3 GlobalInvocationID : SV_DispatchThreadID; }; @@ -177,7 +177,7 @@ void main_sort_triangles_inner(uint3 GlobalInvocationID) { } [numthreads(128, 1, 1)] -void main_sort_triangles(tint_symbol_5 tint_symbol_4) { - main_sort_triangles_inner(tint_symbol_4.GlobalInvocationID); +void main_sort_triangles(tint_symbol_6 tint_symbol_5) { + main_sort_triangles_inner(tint_symbol_5.GlobalInvocationID); return; } diff --git a/test/tint/bug/tint/1113.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1113.wgsl.expected.fxc.hlsl index e6e0b7acc1..aa083e3334 100644 --- a/test/tint/bug/tint/1113.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/tint/1113.wgsl.expected.fxc.hlsl @@ -67,7 +67,7 @@ void doIgnore() { int g55 = LUTatomicLoad(0u); } -struct tint_symbol_1 { +struct tint_symbol_2 { uint3 GlobalInvocationID : SV_DispatchThreadID; }; @@ -103,12 +103,12 @@ void main_count_inner(uint3 GlobalInvocationID) { } [numthreads(128, 1, 1)] -void main_count(tint_symbol_1 tint_symbol) { - main_count_inner(tint_symbol.GlobalInvocationID); +void main_count(tint_symbol_2 tint_symbol_1) { + main_count_inner(tint_symbol_1.GlobalInvocationID); return; } -struct tint_symbol_3 { +struct tint_symbol_4 { uint3 GlobalInvocationID : SV_DispatchThreadID; }; @@ -135,19 +135,19 @@ void main_create_lut_inner(uint3 GlobalInvocationID) { uint numTriangles = countersatomicLoad((4u * voxelIndex)); int offset = -1; if ((numTriangles > 0u)) { - const uint tint_symbol_6 = dbgatomicAdd(0u, numTriangles); - offset = int(tint_symbol_6); + const uint tint_symbol = dbgatomicAdd(0u, numTriangles); + offset = int(tint_symbol); } LUTatomicStore((4u * voxelIndex), offset); } [numthreads(128, 1, 1)] -void main_create_lut(tint_symbol_3 tint_symbol_2) { - main_create_lut_inner(tint_symbol_2.GlobalInvocationID); +void main_create_lut(tint_symbol_4 tint_symbol_3) { + main_create_lut_inner(tint_symbol_3.GlobalInvocationID); return; } -struct tint_symbol_5 { +struct tint_symbol_6 { uint3 GlobalInvocationID : SV_DispatchThreadID; }; @@ -177,7 +177,7 @@ void main_sort_triangles_inner(uint3 GlobalInvocationID) { } [numthreads(128, 1, 1)] -void main_sort_triangles(tint_symbol_5 tint_symbol_4) { - main_sort_triangles_inner(tint_symbol_4.GlobalInvocationID); +void main_sort_triangles(tint_symbol_6 tint_symbol_5) { + main_sort_triangles_inner(tint_symbol_5.GlobalInvocationID); return; } diff --git a/test/tint/bug/tint/1520.spvasm.expected.dxc.hlsl b/test/tint/bug/tint/1520.spvasm.expected.dxc.hlsl index fbfa52cedb..33d4b13771 100644 --- a/test/tint/bug/tint/1520.spvasm.expected.dxc.hlsl +++ b/test/tint/bug/tint/1520.spvasm.expected.dxc.hlsl @@ -25,8 +25,7 @@ bool test_int_S1_c0_b() { ok = true; x_41 = false; if (true) { - const int4 tint_symbol_3 = tint_div((0).xxxx, int4(x_27, x_27, x_27, x_27)); - x_40 = all((tint_symbol_3 == (0).xxxx)); + x_40 = all((tint_div((0).xxxx, int4(x_27, x_27, x_27, x_27)) == (0).xxxx)); x_41 = x_40; } ok = x_41; @@ -152,8 +151,8 @@ main_out main_inner(bool sk_Clockwise_param, float4 vcolor_S0_param) { sk_Clockwise = sk_Clockwise_param; vcolor_S0 = vcolor_S0_param; main_1(); - const main_out tint_symbol_4 = {sk_FragColor}; - return tint_symbol_4; + const main_out tint_symbol_3 = {sk_FragColor}; + return tint_symbol_3; } tint_symbol_2 main(tint_symbol_1 tint_symbol) { diff --git a/test/tint/bug/tint/1520.spvasm.expected.fxc.hlsl b/test/tint/bug/tint/1520.spvasm.expected.fxc.hlsl index fbfa52cedb..33d4b13771 100644 --- a/test/tint/bug/tint/1520.spvasm.expected.fxc.hlsl +++ b/test/tint/bug/tint/1520.spvasm.expected.fxc.hlsl @@ -25,8 +25,7 @@ bool test_int_S1_c0_b() { ok = true; x_41 = false; if (true) { - const int4 tint_symbol_3 = tint_div((0).xxxx, int4(x_27, x_27, x_27, x_27)); - x_40 = all((tint_symbol_3 == (0).xxxx)); + x_40 = all((tint_div((0).xxxx, int4(x_27, x_27, x_27, x_27)) == (0).xxxx)); x_41 = x_40; } ok = x_41; @@ -152,8 +151,8 @@ main_out main_inner(bool sk_Clockwise_param, float4 vcolor_S0_param) { sk_Clockwise = sk_Clockwise_param; vcolor_S0 = vcolor_S0_param; main_1(); - const main_out tint_symbol_4 = {sk_FragColor}; - return tint_symbol_4; + const main_out tint_symbol_3 = {sk_FragColor}; + return tint_symbol_3; } tint_symbol_2 main(tint_symbol_1 tint_symbol) { diff --git a/test/tint/bug/tint/1520.spvasm.expected.glsl b/test/tint/bug/tint/1520.spvasm.expected.glsl index 8cd026fe7c..0ae257902d 100644 --- a/test/tint/bug/tint/1520.spvasm.expected.glsl +++ b/test/tint/bug/tint/1520.spvasm.expected.glsl @@ -44,8 +44,7 @@ bool test_int_S1_c0_b() { ok = true; x_41 = false; if (true) { - ivec4 tint_symbol_1 = tint_div(ivec4(0), ivec4(x_27, x_27, x_27, x_27)); - x_40 = all(equal(tint_symbol_1, ivec4(0))); + x_40 = all(equal(tint_div(ivec4(0), ivec4(x_27, x_27, x_27, x_27)), ivec4(0))); x_41 = x_40; } ok = x_41; @@ -164,8 +163,8 @@ main_out tint_symbol(bool sk_Clockwise_param, vec4 vcolor_S0_param) { sk_Clockwise = sk_Clockwise_param; vcolor_S0 = vcolor_S0_param; main_1(); - main_out tint_symbol_2 = main_out(sk_FragColor); - return tint_symbol_2; + main_out tint_symbol_1 = main_out(sk_FragColor); + return tint_symbol_1; } void main() { diff --git a/test/tint/bug/tint/1520.spvasm.expected.msl b/test/tint/bug/tint/1520.spvasm.expected.msl index 472b6e8112..d03b423046 100644 --- a/test/tint/bug/tint/1520.spvasm.expected.msl +++ b/test/tint/bug/tint/1520.spvasm.expected.msl @@ -39,7 +39,7 @@ int4 tint_div(int4 lhs, int4 rhs) { return (lhs / select(rhs, int4(1), ((rhs == int4(0)) | ((lhs == int4((-2147483647 - 1))) & (rhs == int4(-1)))))); } -bool test_int_S1_c0_b(const constant UniformBuffer_tint_packed_vec3* const tint_symbol_6) { +bool test_int_S1_c0_b(const constant UniformBuffer_tint_packed_vec3* const tint_symbol_5) { int unknown = 0; bool ok = false; int4 val = 0; @@ -49,14 +49,13 @@ bool test_int_S1_c0_b(const constant UniformBuffer_tint_packed_vec3* const tint_ bool x_55 = false; bool x_65 = false; bool x_66 = false; - float const x_26 = (*(tint_symbol_6)).unknownInput_S1_c0; + float const x_26 = (*(tint_symbol_5)).unknownInput_S1_c0; int const x_27 = int(x_26); unknown = x_27; ok = true; x_41 = false; if (true) { - int4 const tint_symbol_4 = tint_div(int4(0), int4(x_27, x_27, x_27, x_27)); - x_40 = all((tint_symbol_4 == int4(0))); + x_40 = all((tint_div(int4(0), int4(x_27, x_27, x_27, x_27)) == int4(0))); x_41 = x_40; } ok = x_41; @@ -93,7 +92,7 @@ bool test_int_S1_c0_b(const constant UniformBuffer_tint_packed_vec3* const tint_ return x_66; } -void main_1(thread float4* const tint_symbol_7, const constant UniformBuffer_tint_packed_vec3* const tint_symbol_8, thread float4* const tint_symbol_9) { +void main_1(thread float4* const tint_symbol_6, const constant UniformBuffer_tint_packed_vec3* const tint_symbol_7, thread float4* const tint_symbol_8) { float4 outputColor_S0 = 0.0f; float4 output_S1 = 0.0f; float x_8_unknown = 0.0f; @@ -108,9 +107,9 @@ void main_1(thread float4* const tint_symbol_7, const constant UniformBuffer_tin bool x_111 = false; bool x_114 = false; bool x_115 = false; - float4 const x_72 = *(tint_symbol_7); + float4 const x_72 = *(tint_symbol_6); outputColor_S0 = x_72; - float const x_77 = (*(tint_symbol_8)).unknownInput_S1_c0; + float const x_77 = (*(tint_symbol_7)).unknownInput_S1_c0; x_8_unknown = x_77; x_9_ok = true; x_87 = false; @@ -151,19 +150,19 @@ void main_1(thread float4* const tint_symbol_7, const constant UniformBuffer_tin x_9_ok = x_111; x_115 = false; if (x_111) { - x_114 = test_int_S1_c0_b(tint_symbol_8); + x_114 = test_int_S1_c0_b(tint_symbol_7); x_115 = x_114; } if (x_115) { - float4 const x_122 = (*(tint_symbol_8)).ucolorGreen_S1_c0; + float4 const x_122 = (*(tint_symbol_7)).ucolorGreen_S1_c0; x_116 = x_122; } else { - float4 const x_124 = (*(tint_symbol_8)).ucolorRed_S1_c0; + float4 const x_124 = (*(tint_symbol_7)).ucolorRed_S1_c0; x_116 = x_124; } float4 const x_125 = x_116; output_S1 = x_125; - *(tint_symbol_9) = x_125; + *(tint_symbol_8) = x_125; return; } @@ -179,19 +178,19 @@ struct tint_symbol_3 { float4 sk_FragColor_1 [[color(0)]]; }; -main_out tint_symbol_inner(bool sk_Clockwise_param, float4 vcolor_S0_param, thread float4* const tint_symbol_11, const constant UniformBuffer_tint_packed_vec3* const tint_symbol_12, thread float4* const tint_symbol_13) { - thread bool tint_symbol_10 = false; - tint_symbol_10 = sk_Clockwise_param; - *(tint_symbol_11) = vcolor_S0_param; - main_1(tint_symbol_11, tint_symbol_12, tint_symbol_13); - main_out const tint_symbol_5 = {.sk_FragColor_1=*(tint_symbol_13)}; - return tint_symbol_5; +main_out tint_symbol_inner(bool sk_Clockwise_param, float4 vcolor_S0_param, thread float4* const tint_symbol_10, const constant UniformBuffer_tint_packed_vec3* const tint_symbol_11, thread float4* const tint_symbol_12) { + thread bool tint_symbol_9 = false; + tint_symbol_9 = sk_Clockwise_param; + *(tint_symbol_10) = vcolor_S0_param; + main_1(tint_symbol_10, tint_symbol_11, tint_symbol_12); + main_out const tint_symbol_4 = {.sk_FragColor_1=*(tint_symbol_12)}; + return tint_symbol_4; } -fragment tint_symbol_3 tint_symbol(const constant UniformBuffer_tint_packed_vec3* tint_symbol_15 [[buffer(0)]], bool sk_Clockwise_param [[front_facing]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { - thread float4 tint_symbol_14 = 0.0f; - thread float4 tint_symbol_16 = 0.0f; - main_out const inner_result = tint_symbol_inner(sk_Clockwise_param, tint_symbol_1.vcolor_S0_param, &(tint_symbol_14), tint_symbol_15, &(tint_symbol_16)); +fragment tint_symbol_3 tint_symbol(const constant UniformBuffer_tint_packed_vec3* tint_symbol_14 [[buffer(0)]], bool sk_Clockwise_param [[front_facing]], tint_symbol_2 tint_symbol_1 [[stage_in]]) { + thread float4 tint_symbol_13 = 0.0f; + thread float4 tint_symbol_15 = 0.0f; + main_out const inner_result = tint_symbol_inner(sk_Clockwise_param, tint_symbol_1.vcolor_S0_param, &(tint_symbol_13), tint_symbol_14, &(tint_symbol_15)); tint_symbol_3 wrapper_result = {}; wrapper_result.sk_FragColor_1 = inner_result.sk_FragColor_1; return wrapper_result; diff --git a/test/tint/bug/tint/1520.spvasm.expected.spvasm b/test/tint/bug/tint/1520.spvasm.expected.spvasm index 3a07adf01b..98e5816263 100644 --- a/test/tint/bug/tint/1520.spvasm.expected.spvasm +++ b/test/tint/bug/tint/1520.spvasm.expected.spvasm @@ -161,11 +161,11 @@ OpSelectionMerge %68 None OpBranchConditional %true %69 %68 %69 = OpLabel - %71 = OpCompositeConstruct %v4int %66 %66 %66 %66 - %70 = OpFunctionCall %v4int %tint_div %31 %71 - %73 = OpIEqual %v4bool %70 %31 - %72 = OpAll %bool %73 - OpStore %x_40 %72 + %72 = OpCompositeConstruct %v4int %66 %66 %66 %66 + %71 = OpFunctionCall %v4int %tint_div %31 %72 + %73 = OpIEqual %v4bool %71 %31 + %70 = OpAll %bool %73 + OpStore %x_40 %70 %74 = OpLoad %bool %x_40 OpStore %x_41 %74 OpBranch %68 diff --git a/test/tint/bug/tint/1563.wgsl.expected.wgsl b/test/tint/bug/tint/1563.wgsl.expected.wgsl index cb6ed350ac..e89aa30a87 100644 --- a/test/tint/bug/tint/1563.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1563.wgsl.expected.wgsl @@ -1,7 +1,7 @@ fn foo() -> f32 { let oob = 99; - let b = vec4()[min(u32(oob), 3u)]; + let b = vec4()[oob]; var v : vec4; - v[min(u32(oob), 3u)] = b; + v[oob] = b; return b; } diff --git a/test/tint/bug/tint/1725.wgsl.expected.wgsl b/test/tint/bug/tint/1725.wgsl.expected.wgsl index eefb5824cc..b20dd4705f 100644 --- a/test/tint/bug/tint/1725.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1725.wgsl.expected.wgsl @@ -5,5 +5,5 @@ fn tint_symbol_1(@builtin(local_invocation_index) tint_symbol_2 : u32) { let tint_symbol_3 = 0; let tint_symbol_4 = 0; let tint_symbol_5 = 0; - let tint_symbol_6 = tint_symbol[min(tint_symbol_2, (arrayLength(&(tint_symbol)) - 1u))]; + let tint_symbol_6 = tint_symbol[tint_symbol_2]; } diff --git a/test/tint/bug/tint/1739.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1739.wgsl.expected.dxc.hlsl index 1d22d68df1..59b8b93b91 100644 --- a/test/tint/bug/tint/1739.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/tint/1739.wgsl.expected.dxc.hlsl @@ -1,4 +1,8 @@ -int2 tint_clamp(int2 e, int2 low, int2 high) { +int tint_clamp(int e, int low, int high) { + return min(max(e, low), high); +} + +int2 tint_clamp_1(int2 e, int2 low, int2 high) { return min(max(e, low), high); } @@ -40,9 +44,27 @@ float4 textureLoadExternal(Texture2D plane0, Texture2D plane1, i const int2 coord1 = (coord >> (1u).xx); float3 color = float3(0.0f, 0.0f, 0.0f); if ((params.numPlanes == 1u)) { - color = plane0.Load(int3(coord, 0)).rgb; + int3 tint_tmp; + int3 tint_tmp_1; + plane0.GetDimensions(0, tint_tmp_1.x, tint_tmp_1.y, tint_tmp_1.z); + plane0.GetDimensions(tint_clamp(0, 0, int((uint(tint_tmp_1.z) - 1u))), tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 tint_tmp_2; + plane0.GetDimensions(0, tint_tmp_2.x, tint_tmp_2.y, tint_tmp_2.z); + color = plane0.Load(int3(tint_clamp_1(coord, (0).xx, int2((uint2(tint_tmp.xy) - (1u).xx))), tint_clamp(0, 0, int((uint(tint_tmp_2.z) - 1u))))).rgb; } else { - color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f)); + int3 tint_tmp_3; + int3 tint_tmp_4; + plane0.GetDimensions(0, tint_tmp_4.x, tint_tmp_4.y, tint_tmp_4.z); + plane0.GetDimensions(tint_clamp(0, 0, int((uint(tint_tmp_4.z) - 1u))), tint_tmp_3.x, tint_tmp_3.y, tint_tmp_3.z); + int3 tint_tmp_5; + plane0.GetDimensions(0, tint_tmp_5.x, tint_tmp_5.y, tint_tmp_5.z); + int3 tint_tmp_6; + int3 tint_tmp_7; + plane1.GetDimensions(0, tint_tmp_7.x, tint_tmp_7.y, tint_tmp_7.z); + plane1.GetDimensions(tint_clamp(0, 0, int((uint(tint_tmp_7.z) - 1u))), tint_tmp_6.x, tint_tmp_6.y, tint_tmp_6.z); + int3 tint_tmp_8; + plane1.GetDimensions(0, tint_tmp_8.x, tint_tmp_8.y, tint_tmp_8.z); + color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(tint_clamp_1(coord, (0).xx, int2((uint2(tint_tmp_3.xy) - (1u).xx))), tint_clamp(0, 0, int((uint(tint_tmp_5.z) - 1u))))).r, plane1.Load(int3(tint_clamp_1(coord1, (0).xx, int2((uint2(tint_tmp_6.xy) - (1u).xx))), tint_clamp(0, 0, int((uint(tint_tmp_8.z) - 1u))))).rg, 1.0f)); } if ((params.doYuvToRgbConversionOnly == 0u)) { color = gammaCorrection(color, params.gammaDecodeParams); @@ -68,8 +90,8 @@ GammaTransferParams ext_tex_params_load_4(uint offset) { const uint scalar_offset_8 = ((offset + 20u)) / 4; const uint scalar_offset_9 = ((offset + 24u)) / 4; const uint scalar_offset_10 = ((offset + 28u)) / 4; - const GammaTransferParams tint_symbol_4 = {asfloat(ext_tex_params[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(ext_tex_params[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(ext_tex_params[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(ext_tex_params[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(ext_tex_params[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(ext_tex_params[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(ext_tex_params[scalar_offset_9 / 4][scalar_offset_9 % 4]), ext_tex_params[scalar_offset_10 / 4][scalar_offset_10 % 4]}; - return tint_symbol_4; + const GammaTransferParams tint_symbol = {asfloat(ext_tex_params[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(ext_tex_params[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(ext_tex_params[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(ext_tex_params[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(ext_tex_params[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(ext_tex_params[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(ext_tex_params[scalar_offset_9 / 4][scalar_offset_9 % 4]), ext_tex_params[scalar_offset_10 / 4][scalar_offset_10 % 4]}; + return tint_symbol; } float3x3 ext_tex_params_load_6(uint offset) { @@ -92,27 +114,19 @@ float3x2 ext_tex_params_load_8(uint offset) { ExternalTextureParams ext_tex_params_load(uint offset) { const uint scalar_offset_17 = ((offset + 0u)) / 4; const uint scalar_offset_18 = ((offset + 4u)) / 4; - const ExternalTextureParams tint_symbol_5 = {ext_tex_params[scalar_offset_17 / 4][scalar_offset_17 % 4], ext_tex_params[scalar_offset_18 / 4][scalar_offset_18 % 4], ext_tex_params_load_2((offset + 16u)), ext_tex_params_load_4((offset + 64u)), ext_tex_params_load_4((offset + 96u)), ext_tex_params_load_6((offset + 128u)), ext_tex_params_load_8((offset + 176u))}; - return tint_symbol_5; + const ExternalTextureParams tint_symbol_1 = {ext_tex_params[scalar_offset_17 / 4][scalar_offset_17 % 4], ext_tex_params[scalar_offset_18 / 4][scalar_offset_18 % 4], ext_tex_params_load_2((offset + 16u)), ext_tex_params_load_4((offset + 64u)), ext_tex_params_load_4((offset + 96u)), ext_tex_params_load_6((offset + 128u)), ext_tex_params_load_8((offset + 176u))}; + return tint_symbol_1; } [numthreads(1, 1, 1)] void main() { - int2 tint_tmp; - t.GetDimensions(tint_tmp.x, tint_tmp.y); - const int2 tint_symbol = tint_clamp((10).xx, (0).xx, int2((uint2(tint_tmp) - (1u).xx))); - float4 red = textureLoadExternal(t, ext_tex_plane_1, tint_symbol, ext_tex_params_load(0u)); - int2 tint_tmp_1; - outImage.GetDimensions(tint_tmp_1.x, tint_tmp_1.y); - const int2 tint_symbol_1 = tint_clamp((0).xx, (0).xx, int2((uint2(tint_tmp_1) - (1u).xx))); - outImage[tint_symbol_1] = red; - int2 tint_tmp_2; - t.GetDimensions(tint_tmp_2.x, tint_tmp_2.y); - const int2 tint_symbol_2 = tint_clamp(int2(70, 118), (0).xx, int2((uint2(tint_tmp_2) - (1u).xx))); - float4 green = textureLoadExternal(t, ext_tex_plane_1, tint_symbol_2, ext_tex_params_load(0u)); - int2 tint_tmp_3; - outImage.GetDimensions(tint_tmp_3.x, tint_tmp_3.y); - const int2 tint_symbol_3 = tint_clamp(int2(1, 0), (0).xx, int2((uint2(tint_tmp_3) - (1u).xx))); - outImage[tint_symbol_3] = green; + float4 red = textureLoadExternal(t, ext_tex_plane_1, (10).xx, ext_tex_params_load(0u)); + int2 tint_tmp_9; + outImage.GetDimensions(tint_tmp_9.x, tint_tmp_9.y); + outImage[tint_clamp_1((0).xx, (0).xx, int2((uint2(tint_tmp_9) - (1u).xx)))] = red; + float4 green = textureLoadExternal(t, ext_tex_plane_1, int2(70, 118), ext_tex_params_load(0u)); + int2 tint_tmp_10; + outImage.GetDimensions(tint_tmp_10.x, tint_tmp_10.y); + outImage[tint_clamp_1(int2(1, 0), (0).xx, int2((uint2(tint_tmp_10) - (1u).xx)))] = green; return; } diff --git a/test/tint/bug/tint/1739.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1739.wgsl.expected.fxc.hlsl index 1d22d68df1..59b8b93b91 100644 --- a/test/tint/bug/tint/1739.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/tint/1739.wgsl.expected.fxc.hlsl @@ -1,4 +1,8 @@ -int2 tint_clamp(int2 e, int2 low, int2 high) { +int tint_clamp(int e, int low, int high) { + return min(max(e, low), high); +} + +int2 tint_clamp_1(int2 e, int2 low, int2 high) { return min(max(e, low), high); } @@ -40,9 +44,27 @@ float4 textureLoadExternal(Texture2D plane0, Texture2D plane1, i const int2 coord1 = (coord >> (1u).xx); float3 color = float3(0.0f, 0.0f, 0.0f); if ((params.numPlanes == 1u)) { - color = plane0.Load(int3(coord, 0)).rgb; + int3 tint_tmp; + int3 tint_tmp_1; + plane0.GetDimensions(0, tint_tmp_1.x, tint_tmp_1.y, tint_tmp_1.z); + plane0.GetDimensions(tint_clamp(0, 0, int((uint(tint_tmp_1.z) - 1u))), tint_tmp.x, tint_tmp.y, tint_tmp.z); + int3 tint_tmp_2; + plane0.GetDimensions(0, tint_tmp_2.x, tint_tmp_2.y, tint_tmp_2.z); + color = plane0.Load(int3(tint_clamp_1(coord, (0).xx, int2((uint2(tint_tmp.xy) - (1u).xx))), tint_clamp(0, 0, int((uint(tint_tmp_2.z) - 1u))))).rgb; } else { - color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f)); + int3 tint_tmp_3; + int3 tint_tmp_4; + plane0.GetDimensions(0, tint_tmp_4.x, tint_tmp_4.y, tint_tmp_4.z); + plane0.GetDimensions(tint_clamp(0, 0, int((uint(tint_tmp_4.z) - 1u))), tint_tmp_3.x, tint_tmp_3.y, tint_tmp_3.z); + int3 tint_tmp_5; + plane0.GetDimensions(0, tint_tmp_5.x, tint_tmp_5.y, tint_tmp_5.z); + int3 tint_tmp_6; + int3 tint_tmp_7; + plane1.GetDimensions(0, tint_tmp_7.x, tint_tmp_7.y, tint_tmp_7.z); + plane1.GetDimensions(tint_clamp(0, 0, int((uint(tint_tmp_7.z) - 1u))), tint_tmp_6.x, tint_tmp_6.y, tint_tmp_6.z); + int3 tint_tmp_8; + plane1.GetDimensions(0, tint_tmp_8.x, tint_tmp_8.y, tint_tmp_8.z); + color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(tint_clamp_1(coord, (0).xx, int2((uint2(tint_tmp_3.xy) - (1u).xx))), tint_clamp(0, 0, int((uint(tint_tmp_5.z) - 1u))))).r, plane1.Load(int3(tint_clamp_1(coord1, (0).xx, int2((uint2(tint_tmp_6.xy) - (1u).xx))), tint_clamp(0, 0, int((uint(tint_tmp_8.z) - 1u))))).rg, 1.0f)); } if ((params.doYuvToRgbConversionOnly == 0u)) { color = gammaCorrection(color, params.gammaDecodeParams); @@ -68,8 +90,8 @@ GammaTransferParams ext_tex_params_load_4(uint offset) { const uint scalar_offset_8 = ((offset + 20u)) / 4; const uint scalar_offset_9 = ((offset + 24u)) / 4; const uint scalar_offset_10 = ((offset + 28u)) / 4; - const GammaTransferParams tint_symbol_4 = {asfloat(ext_tex_params[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(ext_tex_params[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(ext_tex_params[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(ext_tex_params[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(ext_tex_params[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(ext_tex_params[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(ext_tex_params[scalar_offset_9 / 4][scalar_offset_9 % 4]), ext_tex_params[scalar_offset_10 / 4][scalar_offset_10 % 4]}; - return tint_symbol_4; + const GammaTransferParams tint_symbol = {asfloat(ext_tex_params[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(ext_tex_params[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(ext_tex_params[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(ext_tex_params[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(ext_tex_params[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(ext_tex_params[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(ext_tex_params[scalar_offset_9 / 4][scalar_offset_9 % 4]), ext_tex_params[scalar_offset_10 / 4][scalar_offset_10 % 4]}; + return tint_symbol; } float3x3 ext_tex_params_load_6(uint offset) { @@ -92,27 +114,19 @@ float3x2 ext_tex_params_load_8(uint offset) { ExternalTextureParams ext_tex_params_load(uint offset) { const uint scalar_offset_17 = ((offset + 0u)) / 4; const uint scalar_offset_18 = ((offset + 4u)) / 4; - const ExternalTextureParams tint_symbol_5 = {ext_tex_params[scalar_offset_17 / 4][scalar_offset_17 % 4], ext_tex_params[scalar_offset_18 / 4][scalar_offset_18 % 4], ext_tex_params_load_2((offset + 16u)), ext_tex_params_load_4((offset + 64u)), ext_tex_params_load_4((offset + 96u)), ext_tex_params_load_6((offset + 128u)), ext_tex_params_load_8((offset + 176u))}; - return tint_symbol_5; + const ExternalTextureParams tint_symbol_1 = {ext_tex_params[scalar_offset_17 / 4][scalar_offset_17 % 4], ext_tex_params[scalar_offset_18 / 4][scalar_offset_18 % 4], ext_tex_params_load_2((offset + 16u)), ext_tex_params_load_4((offset + 64u)), ext_tex_params_load_4((offset + 96u)), ext_tex_params_load_6((offset + 128u)), ext_tex_params_load_8((offset + 176u))}; + return tint_symbol_1; } [numthreads(1, 1, 1)] void main() { - int2 tint_tmp; - t.GetDimensions(tint_tmp.x, tint_tmp.y); - const int2 tint_symbol = tint_clamp((10).xx, (0).xx, int2((uint2(tint_tmp) - (1u).xx))); - float4 red = textureLoadExternal(t, ext_tex_plane_1, tint_symbol, ext_tex_params_load(0u)); - int2 tint_tmp_1; - outImage.GetDimensions(tint_tmp_1.x, tint_tmp_1.y); - const int2 tint_symbol_1 = tint_clamp((0).xx, (0).xx, int2((uint2(tint_tmp_1) - (1u).xx))); - outImage[tint_symbol_1] = red; - int2 tint_tmp_2; - t.GetDimensions(tint_tmp_2.x, tint_tmp_2.y); - const int2 tint_symbol_2 = tint_clamp(int2(70, 118), (0).xx, int2((uint2(tint_tmp_2) - (1u).xx))); - float4 green = textureLoadExternal(t, ext_tex_plane_1, tint_symbol_2, ext_tex_params_load(0u)); - int2 tint_tmp_3; - outImage.GetDimensions(tint_tmp_3.x, tint_tmp_3.y); - const int2 tint_symbol_3 = tint_clamp(int2(1, 0), (0).xx, int2((uint2(tint_tmp_3) - (1u).xx))); - outImage[tint_symbol_3] = green; + float4 red = textureLoadExternal(t, ext_tex_plane_1, (10).xx, ext_tex_params_load(0u)); + int2 tint_tmp_9; + outImage.GetDimensions(tint_tmp_9.x, tint_tmp_9.y); + outImage[tint_clamp_1((0).xx, (0).xx, int2((uint2(tint_tmp_9) - (1u).xx)))] = red; + float4 green = textureLoadExternal(t, ext_tex_plane_1, int2(70, 118), ext_tex_params_load(0u)); + int2 tint_tmp_10; + outImage.GetDimensions(tint_tmp_10.x, tint_tmp_10.y); + outImage[tint_clamp_1(int2(1, 0), (0).xx, int2((uint2(tint_tmp_10) - (1u).xx)))] = green; return; } diff --git a/test/tint/bug/tint/1739.wgsl.expected.glsl b/test/tint/bug/tint/1739.wgsl.expected.glsl index cdc0b3c285..3bbb84002c 100644 --- a/test/tint/bug/tint/1739.wgsl.expected.glsl +++ b/test/tint/bug/tint/1739.wgsl.expected.glsl @@ -1,3 +1,5 @@ +SKIP: FAILED + #version 310 es struct GammaTransferParams { @@ -57,9 +59,9 @@ vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ive ivec2 coord1 = (coord >> uvec2(1u)); vec3 color = vec3(0.0f, 0.0f, 0.0f); if ((params.numPlanes == 1u)) { - color = texelFetch(plane0_1, coord, 0).rgb; + color = texelFetch(plane0_1, clamp(coord, ivec2(0), ivec2((uvec2(uvec2(textureSize(plane0_1, clamp(0, 0, int((uint(uint(textureQueryLevels(plane0_1))) - 1u)))))) - uvec2(1u)))), clamp(0, 0, int((uint(uint(textureQueryLevels(plane0_1))) - 1u)))).rgb; } else { - color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); + color = (vec4(texelFetch(plane0_1, clamp(coord, ivec2(0), ivec2((uvec2(uvec2(textureSize(plane0_1, clamp(0, 0, int((uint(uint(textureQueryLevels(plane0_1))) - 1u)))))) - uvec2(1u)))), clamp(0, 0, int((uint(uint(textureQueryLevels(plane0_1))) - 1u)))).r, texelFetch(plane1_1, clamp(coord1, ivec2(0), ivec2((uvec2(uvec2(textureSize(plane1_1, clamp(0, 0, int((uint(uint(textureQueryLevels(plane1_1))) - 1u)))))) - uvec2(1u)))), clamp(0, 0, int((uint(uint(textureQueryLevels(plane1_1))) - 1u)))).rg, 1.0f) * params.yuvToRgbConversionMatrix); } if ((params.doYuvToRgbConversionOnly == 0u)) { color = gammaCorrection(color, params.gammaDecodeParams); @@ -76,9 +78,9 @@ ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 va } void tint_symbol() { - vec4 red = textureLoadExternal(t_2, ext_tex_plane_1_1, clamp(ivec2(10), ivec2(0), ivec2((uvec2(uvec2(textureSize(t_2, 0))) - uvec2(1u)))), conv_ExternalTextureParams(ext_tex_params.inner)); + vec4 red = textureLoadExternal(t_2, ext_tex_plane_1_1, ivec2(10), conv_ExternalTextureParams(ext_tex_params.inner)); imageStore(outImage, clamp(ivec2(0), ivec2(0), ivec2((uvec2(uvec2(imageSize(outImage))) - uvec2(1u)))), red); - vec4 green = textureLoadExternal(t_2, ext_tex_plane_1_1, clamp(ivec2(70, 118), ivec2(0), ivec2((uvec2(uvec2(textureSize(t_2, 0))) - uvec2(1u)))), conv_ExternalTextureParams(ext_tex_params.inner)); + vec4 green = textureLoadExternal(t_2, ext_tex_plane_1_1, ivec2(70, 118), conv_ExternalTextureParams(ext_tex_params.inner)); imageStore(outImage, clamp(ivec2(1, 0), ivec2(0), ivec2((uvec2(uvec2(imageSize(outImage))) - uvec2(1u)))), green); return; } @@ -88,3 +90,10 @@ void main() { tint_symbol(); return; } +Error parsing GLSL shader: +ERROR: 0:60: 'textureQueryLevels' : no matching overloaded function found +ERROR: 0:60: '' : compilation terminated +ERROR: 2 compilation errors. No code generated. + + + diff --git a/test/tint/bug/tint/1739.wgsl.expected.msl b/test/tint/bug/tint/1739.wgsl.expected.msl index cdd5da4345..55a4fffe95 100644 --- a/test/tint/bug/tint/1739.wgsl.expected.msl +++ b/test/tint/bug/tint/1739.wgsl.expected.msl @@ -72,7 +72,11 @@ ExternalTextureParams tint_unpack_vec3_in_composite_1(ExternalTextureParams_tint return result; } -int2 tint_clamp(int2 e, int2 low, int2 high) { +int tint_clamp(int e, int low, int high) { + return min(max(e, low), high); +} + +int2 tint_clamp_1(int2 e, int2 low, int2 high) { return min(max(e, low), high); } @@ -87,9 +91,9 @@ float4 textureLoadExternal(texture2d plane0, texture2d> uint2(1u)); float3 color = 0.0f; if ((params.numPlanes == 1u)) { - color = plane0.read(uint2(coord), 0).rgb; + color = plane0.read(uint2(tint_clamp_1(coord, int2(0), int2((uint2(uint2(plane0.get_width(tint_clamp(0, 0, int((uint(plane0.get_num_mip_levels()) - 1u)))), plane0.get_height(tint_clamp(0, 0, int((uint(plane0.get_num_mip_levels()) - 1u)))))) - uint2(1u))))), tint_clamp(0, 0, int((uint(plane0.get_num_mip_levels()) - 1u)))).rgb; } else { - color = (float4(plane0.read(uint2(coord), 0)[0], plane1.read(uint2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); + color = (float4(plane0.read(uint2(tint_clamp_1(coord, int2(0), int2((uint2(uint2(plane0.get_width(tint_clamp(0, 0, int((uint(plane0.get_num_mip_levels()) - 1u)))), plane0.get_height(tint_clamp(0, 0, int((uint(plane0.get_num_mip_levels()) - 1u)))))) - uint2(1u))))), tint_clamp(0, 0, int((uint(plane0.get_num_mip_levels()) - 1u))))[0], plane1.read(uint2(tint_clamp_1(coord1, int2(0), int2((uint2(uint2(plane1.get_width(tint_clamp(0, 0, int((uint(plane1.get_num_mip_levels()) - 1u)))), plane1.get_height(tint_clamp(0, 0, int((uint(plane1.get_num_mip_levels()) - 1u)))))) - uint2(1u))))), tint_clamp(0, 0, int((uint(plane1.get_num_mip_levels()) - 1u)))).rg, 1.0f) * params.yuvToRgbConversionMatrix); } if ((params.doYuvToRgbConversionOnly == 0u)) { color = gammaCorrection(color, params.gammaDecodeParams); @@ -99,15 +103,11 @@ float4 textureLoadExternal(texture2d plane0, texture2d tint_symbol_5 [[texture(0)]], texture2d tint_symbol_6 [[texture(1)]], const constant ExternalTextureParams_tint_packed_vec3* tint_symbol_7 [[buffer(0)]], texture2d tint_symbol_8 [[texture(2)]]) { - int2 const tint_symbol_1 = tint_clamp(int2(10), int2(0), int2((uint2(uint2(tint_symbol_5.get_width(), tint_symbol_5.get_height())) - uint2(1u)))); - float4 red = textureLoadExternal(tint_symbol_5, tint_symbol_6, tint_symbol_1, tint_unpack_vec3_in_composite_1(*(tint_symbol_7))); - int2 const tint_symbol_2 = tint_clamp(int2(0), int2(0), int2((uint2(uint2(tint_symbol_8.get_width(), tint_symbol_8.get_height())) - uint2(1u)))); - tint_symbol_8.write(red, uint2(tint_symbol_2)); - int2 const tint_symbol_3 = tint_clamp(int2(70, 118), int2(0), int2((uint2(uint2(tint_symbol_5.get_width(), tint_symbol_5.get_height())) - uint2(1u)))); - float4 green = textureLoadExternal(tint_symbol_5, tint_symbol_6, tint_symbol_3, tint_unpack_vec3_in_composite_1(*(tint_symbol_7))); - int2 const tint_symbol_4 = tint_clamp(int2(1, 0), int2(0), int2((uint2(uint2(tint_symbol_8.get_width(), tint_symbol_8.get_height())) - uint2(1u)))); - tint_symbol_8.write(green, uint2(tint_symbol_4)); +kernel void tint_symbol(texture2d tint_symbol_1 [[texture(0)]], texture2d tint_symbol_2 [[texture(1)]], const constant ExternalTextureParams_tint_packed_vec3* tint_symbol_3 [[buffer(0)]], texture2d tint_symbol_4 [[texture(2)]]) { + float4 red = textureLoadExternal(tint_symbol_1, tint_symbol_2, int2(10), tint_unpack_vec3_in_composite_1(*(tint_symbol_3))); + tint_symbol_4.write(red, uint2(tint_clamp_1(int2(0), int2(0), int2((uint2(uint2(tint_symbol_4.get_width(), tint_symbol_4.get_height())) - uint2(1u)))))); + float4 green = textureLoadExternal(tint_symbol_1, tint_symbol_2, int2(70, 118), tint_unpack_vec3_in_composite_1(*(tint_symbol_3))); + tint_symbol_4.write(green, uint2(tint_clamp_1(int2(1, 0), int2(0), int2((uint2(uint2(tint_symbol_4.get_width(), tint_symbol_4.get_height())) - uint2(1u)))))); return; } diff --git a/test/tint/bug/tint/1739.wgsl.expected.spvasm b/test/tint/bug/tint/1739.wgsl.expected.spvasm index 059885cc09..32f8da92c8 100644 --- a/test/tint/bug/tint/1739.wgsl.expected.spvasm +++ b/test/tint/bug/tint/1739.wgsl.expected.spvasm @@ -1,11 +1,11 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 197 +; Bound: 237 ; Schema: 0 OpCapability Shader OpCapability ImageQuery - %29 = OpExtInstImport "GLSL.std.450" + %28 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 @@ -38,6 +38,10 @@ OpName %e "e" OpName %low "low" OpName %high "high" + OpName %tint_clamp_1 "tint_clamp_1" + OpName %e_0 "e" + OpName %low_0 "low" + OpName %high_0 "high" OpName %gammaCorrection "gammaCorrection" OpName %v "v" OpName %params "params" @@ -126,198 +130,233 @@ %_ptr_UniformConstant_19 = OpTypePointer UniformConstant %19 %outImage = OpVariable %_ptr_UniformConstant_19 UniformConstant %int = OpTypeInt 32 1 + %20 = OpTypeFunction %int %int %int %int %v2int = OpTypeVector %int 2 - %20 = OpTypeFunction %v2int %v2int %v2int %v2int - %31 = OpTypeFunction %v3float %v3float %GammaTransferParams + %30 = OpTypeFunction %v2int %v2int %v2int %v2int + %39 = OpTypeFunction %v3float %v3float %GammaTransferParams %bool = OpTypeBool %v3bool = OpTypeVector %bool 3 %_ptr_Function_v3float = OpTypePointer Function %v3float - %50 = OpConstantNull %v3float + %58 = OpConstantNull %v3float %mat3v2float = OpTypeMatrix %v2float 3 %ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat3v2float - %70 = OpTypeFunction %v4float %3 %3 %v2int %ExternalTextureParams + %78 = OpTypeFunction %v4float %3 %3 %v2int %ExternalTextureParams %v2uint = OpTypeVector %uint 2 %uint_1 = OpConstant %uint 1 - %81 = OpConstantComposite %v2uint %uint_1 %uint_1 - %90 = OpConstantNull %int + %89 = OpConstantComposite %v2uint %uint_1 %uint_1 + %99 = OpConstantNull %v2int + %104 = OpConstantNull %int %float_1 = OpConstant %float 1 - %103 = OpConstantNull %uint - %121 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140 + %157 = OpConstantNull %uint + %175 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140 %void = OpTypeVoid - %136 = OpTypeFunction %void + %190 = OpTypeFunction %void %int_10 = OpConstant %int 10 - %142 = OpConstantComposite %v2int %int_10 %int_10 - %143 = OpConstantNull %v2int - %int_0 = OpConstant %int 0 + %198 = OpConstantComposite %v2int %int_10 %int_10 %uint_0 = OpConstant %uint 0 %_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140 %_ptr_Function_v4float = OpTypePointer Function %v4float - %160 = OpConstantNull %v4float + %206 = OpConstantNull %v4float %int_70 = OpConstant %int 70 %int_118 = OpConstant %int 118 - %173 = OpConstantComposite %v2int %int_70 %int_118 + %221 = OpConstantComposite %v2int %int_70 %int_118 %int_1 = OpConstant %int 1 - %188 = OpConstantComposite %v2int %int_1 %90 - %tint_clamp = OpFunction %v2int None %20 - %e = OpFunctionParameter %v2int - %low = OpFunctionParameter %v2int - %high = OpFunctionParameter %v2int - %27 = OpLabel - %30 = OpExtInst %v2int %29 SMax %e %low - %28 = OpExtInst %v2int %29 SMin %30 %high - OpReturnValue %28 + %230 = OpConstantComposite %v2int %int_1 %104 + %tint_clamp = OpFunction %int None %20 + %e = OpFunctionParameter %int + %low = OpFunctionParameter %int + %high = OpFunctionParameter %int + %26 = OpLabel + %29 = OpExtInst %int %28 SMax %e %low + %27 = OpExtInst %int %28 SMin %29 %high + OpReturnValue %27 OpFunctionEnd -%gammaCorrection = OpFunction %v3float None %31 +%tint_clamp_1 = OpFunction %v2int None %30 + %e_0 = OpFunctionParameter %v2int + %low_0 = OpFunctionParameter %v2int + %high_0 = OpFunctionParameter %v2int + %36 = OpLabel + %38 = OpExtInst %v2int %28 SMax %e_0 %low_0 + %37 = OpExtInst %v2int %28 SMin %38 %high_0 + OpReturnValue %37 + OpFunctionEnd +%gammaCorrection = OpFunction %v3float None %39 %v = OpFunctionParameter %v3float %params = OpFunctionParameter %GammaTransferParams - %35 = OpLabel - %48 = OpVariable %_ptr_Function_v3float Function %50 - %60 = OpVariable %_ptr_Function_v3float Function %50 - %66 = OpVariable %_ptr_Function_v3float Function %50 - %36 = OpExtInst %v3float %29 FAbs %v - %37 = OpCompositeExtract %float %params 4 - %38 = OpCompositeConstruct %v3float %37 %37 %37 - %39 = OpFOrdLessThan %v3bool %36 %38 - %42 = OpExtInst %v3float %29 FSign %v - %43 = OpCompositeExtract %float %params 3 - %44 = OpExtInst %v3float %29 FAbs %v - %45 = OpVectorTimesScalar %v3float %44 %43 - %46 = OpCompositeExtract %float %params 6 - %51 = OpCompositeConstruct %v3float %46 %46 %46 - %47 = OpFAdd %v3float %45 %51 - %52 = OpFMul %v3float %42 %47 - %53 = OpExtInst %v3float %29 FSign %v - %55 = OpCompositeExtract %float %params 1 - %56 = OpExtInst %v3float %29 FAbs %v - %57 = OpVectorTimesScalar %v3float %56 %55 - %58 = OpCompositeExtract %float %params 2 - %61 = OpCompositeConstruct %v3float %58 %58 %58 - %59 = OpFAdd %v3float %57 %61 - %62 = OpCompositeExtract %float %params 0 - %63 = OpCompositeConstruct %v3float %62 %62 %62 - %54 = OpExtInst %v3float %29 Pow %59 %63 - %64 = OpCompositeExtract %float %params 5 - %67 = OpCompositeConstruct %v3float %64 %64 %64 - %65 = OpFAdd %v3float %54 %67 - %68 = OpFMul %v3float %53 %65 - %69 = OpSelect %v3float %39 %52 %68 - OpReturnValue %69 + %43 = OpLabel + %56 = OpVariable %_ptr_Function_v3float Function %58 + %68 = OpVariable %_ptr_Function_v3float Function %58 + %74 = OpVariable %_ptr_Function_v3float Function %58 + %44 = OpExtInst %v3float %28 FAbs %v + %45 = OpCompositeExtract %float %params 4 + %46 = OpCompositeConstruct %v3float %45 %45 %45 + %47 = OpFOrdLessThan %v3bool %44 %46 + %50 = OpExtInst %v3float %28 FSign %v + %51 = OpCompositeExtract %float %params 3 + %52 = OpExtInst %v3float %28 FAbs %v + %53 = OpVectorTimesScalar %v3float %52 %51 + %54 = OpCompositeExtract %float %params 6 + %59 = OpCompositeConstruct %v3float %54 %54 %54 + %55 = OpFAdd %v3float %53 %59 + %60 = OpFMul %v3float %50 %55 + %61 = OpExtInst %v3float %28 FSign %v + %63 = OpCompositeExtract %float %params 1 + %64 = OpExtInst %v3float %28 FAbs %v + %65 = OpVectorTimesScalar %v3float %64 %63 + %66 = OpCompositeExtract %float %params 2 + %69 = OpCompositeConstruct %v3float %66 %66 %66 + %67 = OpFAdd %v3float %65 %69 + %70 = OpCompositeExtract %float %params 0 + %71 = OpCompositeConstruct %v3float %70 %70 %70 + %62 = OpExtInst %v3float %28 Pow %67 %71 + %72 = OpCompositeExtract %float %params 5 + %75 = OpCompositeConstruct %v3float %72 %72 %72 + %73 = OpFAdd %v3float %62 %75 + %76 = OpFMul %v3float %61 %73 + %77 = OpSelect %v3float %47 %60 %76 + OpReturnValue %77 OpFunctionEnd -%textureLoadExternal = OpFunction %v4float None %70 +%textureLoadExternal = OpFunction %v4float None %78 %plane0 = OpFunctionParameter %3 %plane1 = OpFunctionParameter %3 %coord = OpFunctionParameter %v2int %params_0 = OpFunctionParameter %ExternalTextureParams - %78 = OpLabel - %color = OpVariable %_ptr_Function_v3float Function %50 - %82 = OpShiftRightArithmetic %v2int %coord %81 - %84 = OpCompositeExtract %uint %params_0 0 - %85 = OpIEqual %bool %84 %uint_1 - OpSelectionMerge %86 None - OpBranchConditional %85 %87 %88 - %87 = OpLabel - %89 = OpImageFetch %v4float %plane0 %coord Lod %90 - %91 = OpVectorShuffle %v3float %89 %89 0 1 2 - OpStore %color %91 - OpBranch %86 - %88 = OpLabel - %92 = OpImageFetch %v4float %plane0 %coord Lod %90 - %93 = OpCompositeExtract %float %92 0 - %94 = OpImageFetch %v4float %plane1 %82 Lod %90 - %95 = OpVectorShuffle %v2float %94 %94 0 1 - %96 = OpCompositeExtract %float %95 0 - %97 = OpCompositeExtract %float %95 1 - %99 = OpCompositeConstruct %v4float %93 %96 %97 %float_1 - %100 = OpCompositeExtract %mat3v4float %params_0 2 - %101 = OpVectorTimesMatrix %v3float %99 %100 - OpStore %color %101 - OpBranch %86 %86 = OpLabel - %102 = OpCompositeExtract %uint %params_0 1 - %104 = OpIEqual %bool %102 %103 - OpSelectionMerge %105 None - OpBranchConditional %104 %106 %105 - %106 = OpLabel - %108 = OpLoad %v3float %color - %109 = OpCompositeExtract %GammaTransferParams %params_0 3 - %107 = OpFunctionCall %v3float %gammaCorrection %108 %109 - OpStore %color %107 - %110 = OpCompositeExtract %mat3v3float %params_0 5 - %111 = OpLoad %v3float %color - %112 = OpMatrixTimesVector %v3float %110 %111 - OpStore %color %112 - %114 = OpLoad %v3float %color - %115 = OpCompositeExtract %GammaTransferParams %params_0 4 - %113 = OpFunctionCall %v3float %gammaCorrection %114 %115 - OpStore %color %113 - OpBranch %105 - %105 = OpLabel - %116 = OpLoad %v3float %color - %117 = OpCompositeExtract %float %116 0 - %118 = OpCompositeExtract %float %116 1 - %119 = OpCompositeExtract %float %116 2 - %120 = OpCompositeConstruct %v4float %117 %118 %119 %float_1 - OpReturnValue %120 + %color = OpVariable %_ptr_Function_v3float Function %58 + %90 = OpShiftRightArithmetic %v2int %coord %89 + %92 = OpCompositeExtract %uint %params_0 0 + %93 = OpIEqual %bool %92 %uint_1 + OpSelectionMerge %94 None + OpBranchConditional %93 %95 %96 + %95 = OpLabel + %107 = OpImageQueryLevels %uint %plane0 + %108 = OpISub %uint %107 %uint_1 + %105 = OpBitcast %int %108 + %103 = OpFunctionCall %int %tint_clamp %104 %104 %105 + %102 = OpImageQuerySizeLod %v2uint %plane0 %103 + %109 = OpISub %v2uint %102 %89 + %100 = OpBitcast %v2int %109 + %98 = OpFunctionCall %v2int %tint_clamp_1 %coord %99 %100 + %113 = OpImageQueryLevels %uint %plane0 + %114 = OpISub %uint %113 %uint_1 + %111 = OpBitcast %int %114 + %110 = OpFunctionCall %int %tint_clamp %104 %104 %111 + %97 = OpImageFetch %v4float %plane0 %98 Lod %110 + %115 = OpVectorShuffle %v3float %97 %97 0 1 2 + OpStore %color %115 + OpBranch %94 + %96 = OpLabel + %124 = OpImageQueryLevels %uint %plane0 + %125 = OpISub %uint %124 %uint_1 + %122 = OpBitcast %int %125 + %121 = OpFunctionCall %int %tint_clamp %104 %104 %122 + %120 = OpImageQuerySizeLod %v2uint %plane0 %121 + %126 = OpISub %v2uint %120 %89 + %118 = OpBitcast %v2int %126 + %117 = OpFunctionCall %v2int %tint_clamp_1 %coord %99 %118 + %130 = OpImageQueryLevels %uint %plane0 + %131 = OpISub %uint %130 %uint_1 + %128 = OpBitcast %int %131 + %127 = OpFunctionCall %int %tint_clamp %104 %104 %128 + %116 = OpImageFetch %v4float %plane0 %117 Lod %127 + %132 = OpCompositeExtract %float %116 0 + %141 = OpImageQueryLevels %uint %plane1 + %142 = OpISub %uint %141 %uint_1 + %139 = OpBitcast %int %142 + %138 = OpFunctionCall %int %tint_clamp %104 %104 %139 + %137 = OpImageQuerySizeLod %v2uint %plane1 %138 + %143 = OpISub %v2uint %137 %89 + %135 = OpBitcast %v2int %143 + %134 = OpFunctionCall %v2int %tint_clamp_1 %90 %99 %135 + %147 = OpImageQueryLevels %uint %plane1 + %148 = OpISub %uint %147 %uint_1 + %145 = OpBitcast %int %148 + %144 = OpFunctionCall %int %tint_clamp %104 %104 %145 + %133 = OpImageFetch %v4float %plane1 %134 Lod %144 + %149 = OpVectorShuffle %v2float %133 %133 0 1 + %150 = OpCompositeExtract %float %149 0 + %151 = OpCompositeExtract %float %149 1 + %153 = OpCompositeConstruct %v4float %132 %150 %151 %float_1 + %154 = OpCompositeExtract %mat3v4float %params_0 2 + %155 = OpVectorTimesMatrix %v3float %153 %154 + OpStore %color %155 + OpBranch %94 + %94 = OpLabel + %156 = OpCompositeExtract %uint %params_0 1 + %158 = OpIEqual %bool %156 %157 + OpSelectionMerge %159 None + OpBranchConditional %158 %160 %159 + %160 = OpLabel + %162 = OpLoad %v3float %color + %163 = OpCompositeExtract %GammaTransferParams %params_0 3 + %161 = OpFunctionCall %v3float %gammaCorrection %162 %163 + OpStore %color %161 + %164 = OpCompositeExtract %mat3v3float %params_0 5 + %165 = OpLoad %v3float %color + %166 = OpMatrixTimesVector %v3float %164 %165 + OpStore %color %166 + %168 = OpLoad %v3float %color + %169 = OpCompositeExtract %GammaTransferParams %params_0 4 + %167 = OpFunctionCall %v3float %gammaCorrection %168 %169 + OpStore %color %167 + OpBranch %159 + %159 = OpLabel + %170 = OpLoad %v3float %color + %171 = OpCompositeExtract %float %170 0 + %172 = OpCompositeExtract %float %170 1 + %173 = OpCompositeExtract %float %170 2 + %174 = OpCompositeConstruct %v4float %171 %172 %173 %float_1 + OpReturnValue %174 OpFunctionEnd -%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %121 +%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %175 %val = OpFunctionParameter %ExternalTextureParams_std140 - %124 = OpLabel - %125 = OpCompositeExtract %uint %val 0 - %126 = OpCompositeExtract %uint %val 1 - %127 = OpCompositeExtract %mat3v4float %val 2 - %128 = OpCompositeExtract %GammaTransferParams %val 3 - %129 = OpCompositeExtract %GammaTransferParams %val 4 - %130 = OpCompositeExtract %mat3v3float %val 5 - %131 = OpCompositeExtract %v2float %val 6 - %132 = OpCompositeExtract %v2float %val 7 - %133 = OpCompositeExtract %v2float %val 8 - %134 = OpCompositeConstruct %mat3v2float %131 %132 %133 - %135 = OpCompositeConstruct %ExternalTextureParams %125 %126 %127 %128 %129 %130 %134 - OpReturnValue %135 + %178 = OpLabel + %179 = OpCompositeExtract %uint %val 0 + %180 = OpCompositeExtract %uint %val 1 + %181 = OpCompositeExtract %mat3v4float %val 2 + %182 = OpCompositeExtract %GammaTransferParams %val 3 + %183 = OpCompositeExtract %GammaTransferParams %val 4 + %184 = OpCompositeExtract %mat3v3float %val 5 + %185 = OpCompositeExtract %v2float %val 6 + %186 = OpCompositeExtract %v2float %val 7 + %187 = OpCompositeExtract %v2float %val 8 + %188 = OpCompositeConstruct %mat3v2float %185 %186 %187 + %189 = OpCompositeConstruct %ExternalTextureParams %179 %180 %181 %182 %183 %184 %188 + OpReturnValue %189 OpFunctionEnd - %main = OpFunction %void None %136 - %139 = OpLabel - %red = OpVariable %_ptr_Function_v4float Function %160 - %green = OpVariable %_ptr_Function_v4float Function %160 - %147 = OpLoad %3 %t - %146 = OpImageQuerySizeLod %v2uint %147 %int_0 - %149 = OpISub %v2uint %146 %81 - %144 = OpBitcast %v2int %149 - %140 = OpFunctionCall %v2int %tint_clamp %142 %143 %144 - %151 = OpLoad %3 %t - %152 = OpLoad %3 %ext_tex_plane_1 - %156 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0 - %157 = OpLoad %ExternalTextureParams_std140 %156 - %153 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %157 - %150 = OpFunctionCall %v4float %textureLoadExternal %151 %152 %140 %153 - OpStore %red %150 - %165 = OpLoad %19 %outImage - %164 = OpImageQuerySize %v2uint %165 - %166 = OpISub %v2uint %164 %81 - %162 = OpBitcast %v2int %166 - %161 = OpFunctionCall %v2int %tint_clamp %143 %143 %162 - %168 = OpLoad %19 %outImage - %169 = OpLoad %v4float %red - OpImageWrite %168 %161 %169 - %177 = OpLoad %3 %t - %176 = OpImageQuerySizeLod %v2uint %177 %int_0 - %178 = OpISub %v2uint %176 %81 - %174 = OpBitcast %v2int %178 - %170 = OpFunctionCall %v2int %tint_clamp %173 %143 %174 - %180 = OpLoad %3 %t - %181 = OpLoad %3 %ext_tex_plane_1 - %183 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0 - %184 = OpLoad %ExternalTextureParams_std140 %183 - %182 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %184 - %179 = OpFunctionCall %v4float %textureLoadExternal %180 %181 %170 %182 - OpStore %green %179 - %192 = OpLoad %19 %outImage - %191 = OpImageQuerySize %v2uint %192 - %193 = OpISub %v2uint %191 %81 - %189 = OpBitcast %v2int %193 - %186 = OpFunctionCall %v2int %tint_clamp %188 %143 %189 - %195 = OpLoad %19 %outImage - %196 = OpLoad %v4float %green - OpImageWrite %195 %186 %196 + %main = OpFunction %void None %190 + %193 = OpLabel + %red = OpVariable %_ptr_Function_v4float Function %206 + %green = OpVariable %_ptr_Function_v4float Function %206 + %195 = OpLoad %3 %t + %196 = OpLoad %3 %ext_tex_plane_1 + %202 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0 + %203 = OpLoad %ExternalTextureParams_std140 %202 + %199 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %203 + %194 = OpFunctionCall %v4float %textureLoadExternal %195 %196 %198 %199 + OpStore %red %194 + %208 = OpLoad %19 %outImage + %213 = OpLoad %19 %outImage + %212 = OpImageQuerySize %v2uint %213 + %214 = OpISub %v2uint %212 %89 + %210 = OpBitcast %v2int %214 + %209 = OpFunctionCall %v2int %tint_clamp_1 %99 %99 %210 + %215 = OpLoad %v4float %red + OpImageWrite %208 %209 %215 + %217 = OpLoad %3 %t + %218 = OpLoad %3 %ext_tex_plane_1 + %223 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0 + %224 = OpLoad %ExternalTextureParams_std140 %223 + %222 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %224 + %216 = OpFunctionCall %v4float %textureLoadExternal %217 %218 %221 %222 + OpStore %green %216 + %227 = OpLoad %19 %outImage + %234 = OpLoad %19 %outImage + %233 = OpImageQuerySize %v2uint %234 + %235 = OpISub %v2uint %233 %89 + %231 = OpBitcast %v2int %235 + %228 = OpFunctionCall %v2int %tint_clamp_1 %230 %99 %231 + %236 = OpLoad %v4float %green + OpImageWrite %227 %228 %236 OpReturn OpFunctionEnd diff --git a/test/tint/bug/tint/1739.wgsl.expected.wgsl b/test/tint/bug/tint/1739.wgsl.expected.wgsl index e87373cafc..403d2d7a74 100644 --- a/test/tint/bug/tint/1739.wgsl.expected.wgsl +++ b/test/tint/bug/tint/1739.wgsl.expected.wgsl @@ -52,9 +52,9 @@ fn textureLoadExternal(plane0 : texture_2d, plane1 : texture_2d, coord @compute @workgroup_size(1) fn main() { - var red : vec4 = textureLoadExternal(t, ext_tex_plane_1, clamp(vec2(10, 10), vec2(0), vec2((vec2(textureDimensions(t)) - vec2(1)))), ext_tex_params); - textureStore(outImage, clamp(vec2(0, 0), vec2(0), vec2((vec2(textureDimensions(outImage)) - vec2(1)))), red); - var green : vec4 = textureLoadExternal(t, ext_tex_plane_1, clamp(vec2(70, 118), vec2(0), vec2((vec2(textureDimensions(t)) - vec2(1)))), ext_tex_params); - textureStore(outImage, clamp(vec2(1, 0), vec2(0), vec2((vec2(textureDimensions(outImage)) - vec2(1)))), green); + var red : vec4 = textureLoadExternal(t, ext_tex_plane_1, vec2(10, 10), ext_tex_params); + textureStore(outImage, vec2(0, 0), red); + var green : vec4 = textureLoadExternal(t, ext_tex_plane_1, vec2(70, 118), ext_tex_params); + textureStore(outImage, vec2(1, 0), green); return; } diff --git a/test/tint/bug/tint/221.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/221.wgsl.expected.dxc.hlsl index 40385661d0..c5a8e9dcf4 100644 --- a/test/tint/bug/tint/221.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/tint/221.wgsl.expected.dxc.hlsl @@ -12,8 +12,7 @@ void main() { break; } const uint p_save = i; - const uint tint_symbol = tint_mod(i, 2u); - if ((tint_symbol == 0u)) { + if ((tint_mod(i, 2u) == 0u)) { { b.Store((4u + (4u * p_save)), asuint((b.Load((4u + (4u * p_save))) * 2u))); i = (i + 1u); diff --git a/test/tint/bug/tint/221.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/221.wgsl.expected.fxc.hlsl index 40385661d0..c5a8e9dcf4 100644 --- a/test/tint/bug/tint/221.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/tint/221.wgsl.expected.fxc.hlsl @@ -12,8 +12,7 @@ void main() { break; } const uint p_save = i; - const uint tint_symbol = tint_mod(i, 2u); - if ((tint_symbol == 0u)) { + if ((tint_mod(i, 2u) == 0u)) { { b.Store((4u + (4u * p_save)), asuint((b.Load((4u + (4u * p_save))) * 2u))); i = (i + 1u); diff --git a/test/tint/bug/tint/221.wgsl.expected.glsl b/test/tint/bug/tint/221.wgsl.expected.glsl index 4bcee5e013..eebf44d693 100644 --- a/test/tint/bug/tint/221.wgsl.expected.glsl +++ b/test/tint/bug/tint/221.wgsl.expected.glsl @@ -20,8 +20,7 @@ void tint_symbol() { break; } uint p_save = i; - uint tint_symbol_1 = tint_mod(i, 2u); - if ((tint_symbol_1 == 0u)) { + if ((tint_mod(i, 2u) == 0u)) { { b.inner.data[p_save] = (b.inner.data[p_save] * 2u); i = (i + 1u); diff --git a/test/tint/bug/tint/221.wgsl.expected.msl b/test/tint/bug/tint/221.wgsl.expected.msl index 8a82c4348c..9a2fe97475 100644 --- a/test/tint/bug/tint/221.wgsl.expected.msl +++ b/test/tint/bug/tint/221.wgsl.expected.msl @@ -23,24 +23,23 @@ uint tint_mod(uint lhs, uint rhs) { return (lhs % select(rhs, 1u, (rhs == 0u))); } -kernel void tint_symbol(device Buf* tint_symbol_2 [[buffer(0)]]) { +kernel void tint_symbol(device Buf* tint_symbol_1 [[buffer(0)]]) { uint i = 0u; while (true) { - if ((i >= (*(tint_symbol_2)).count)) { + if ((i >= (*(tint_symbol_1)).count)) { break; } uint const p_save = i; - uint const tint_symbol_1 = tint_mod(i, 2u); - if ((tint_symbol_1 == 0u)) { + if ((tint_mod(i, 2u) == 0u)) { { - (*(tint_symbol_2)).data[p_save] = ((*(tint_symbol_2)).data[p_save] * 2u); + (*(tint_symbol_1)).data[p_save] = ((*(tint_symbol_1)).data[p_save] * 2u); i = (i + 1u); } continue; } - (*(tint_symbol_2)).data[p_save] = 0u; + (*(tint_symbol_1)).data[p_save] = 0u; { - (*(tint_symbol_2)).data[p_save] = ((*(tint_symbol_2)).data[p_save] * 2u); + (*(tint_symbol_1)).data[p_save] = ((*(tint_symbol_1)).data[p_save] * 2u); i = (i + 1u); } } diff --git a/test/tint/bug/tint/534.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/534.wgsl.expected.dxc.hlsl index 2044cbb358..518d19cc05 100644 --- a/test/tint/bug/tint/534.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/tint/534.wgsl.expected.dxc.hlsl @@ -13,7 +13,7 @@ uint ConvertToFp16FloatValue(float fp32) { return 1u; } -struct tint_symbol_2 { +struct tint_symbol_3 { uint3 GlobalInvocationID : SV_DispatchThreadID; }; @@ -33,8 +33,8 @@ void main_inner(uint3 GlobalInvocationID) { uint4 dstColorBits = uint4(dstColor); { for(uint i = 0u; (i < uniforms[0].w); i = (i + 1u)) { - const uint tint_symbol_3 = ConvertToFp16FloatValue(srcColor[i]); - set_uint4(srcColorBits, i, tint_symbol_3); + const uint tint_symbol_1 = ConvertToFp16FloatValue(srcColor[i]); + set_uint4(srcColorBits, i, tint_symbol_1); bool tint_tmp_1 = success; if (tint_tmp_1) { tint_tmp_1 = (srcColorBits[i] == dstColorBits[i]); @@ -51,7 +51,7 @@ void main_inner(uint3 GlobalInvocationID) { } [numthreads(1, 1, 1)] -void main(tint_symbol_2 tint_symbol_1) { - main_inner(tint_symbol_1.GlobalInvocationID); +void main(tint_symbol_3 tint_symbol_2) { + main_inner(tint_symbol_2.GlobalInvocationID); return; } diff --git a/test/tint/bug/tint/534.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/534.wgsl.expected.fxc.hlsl index 2044cbb358..518d19cc05 100644 --- a/test/tint/bug/tint/534.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/tint/534.wgsl.expected.fxc.hlsl @@ -13,7 +13,7 @@ uint ConvertToFp16FloatValue(float fp32) { return 1u; } -struct tint_symbol_2 { +struct tint_symbol_3 { uint3 GlobalInvocationID : SV_DispatchThreadID; }; @@ -33,8 +33,8 @@ void main_inner(uint3 GlobalInvocationID) { uint4 dstColorBits = uint4(dstColor); { for(uint i = 0u; (i < uniforms[0].w); i = (i + 1u)) { - const uint tint_symbol_3 = ConvertToFp16FloatValue(srcColor[i]); - set_uint4(srcColorBits, i, tint_symbol_3); + const uint tint_symbol_1 = ConvertToFp16FloatValue(srcColor[i]); + set_uint4(srcColorBits, i, tint_symbol_1); bool tint_tmp_1 = success; if (tint_tmp_1) { tint_tmp_1 = (srcColorBits[i] == dstColorBits[i]); @@ -51,7 +51,7 @@ void main_inner(uint3 GlobalInvocationID) { } [numthreads(1, 1, 1)] -void main(tint_symbol_2 tint_symbol_1) { - main_inner(tint_symbol_1.GlobalInvocationID); +void main(tint_symbol_3 tint_symbol_2) { + main_inner(tint_symbol_2.GlobalInvocationID); return; } diff --git a/test/tint/bug/tint/913.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/913.wgsl.expected.dxc.hlsl index f95b95ca7e..df80614d6c 100644 --- a/test/tint/bug/tint/913.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/tint/913.wgsl.expected.dxc.hlsl @@ -9,7 +9,7 @@ bool aboutEqual(float value, float expect) { return (abs((value - expect)) < 0.001f); } -struct tint_symbol_2 { +struct tint_symbol_8 { uint3 GlobalInvocationID : SV_DispatchThreadID; }; @@ -49,33 +49,33 @@ void main_inner(uint3 GlobalInvocationID) { const float4 srcColor = src.Load(int3(int2(srcTexCoord), 0)); const float4 dstColor = tint_symbol.Load(int3(int2(dstTexCoord), 0)); if ((uniforms[0].y == 2u)) { - bool tint_symbol_4 = success; - if (tint_symbol_4) { - tint_symbol_4 = aboutEqual(dstColor.r, srcColor.r); + bool tint_symbol_2 = success; + if (tint_symbol_2) { + tint_symbol_2 = aboutEqual(dstColor.r, srcColor.r); } - bool tint_symbol_3 = tint_symbol_4; - if (tint_symbol_3) { - tint_symbol_3 = aboutEqual(dstColor.g, srcColor.g); + bool tint_symbol_1 = tint_symbol_2; + if (tint_symbol_1) { + tint_symbol_1 = aboutEqual(dstColor.g, srcColor.g); } - success = tint_symbol_3; + success = tint_symbol_1; } else { - bool tint_symbol_8 = success; - if (tint_symbol_8) { - tint_symbol_8 = aboutEqual(dstColor.r, srcColor.r); - } - bool tint_symbol_7 = tint_symbol_8; - if (tint_symbol_7) { - tint_symbol_7 = aboutEqual(dstColor.g, srcColor.g); - } - bool tint_symbol_6 = tint_symbol_7; + bool tint_symbol_6 = success; if (tint_symbol_6) { - tint_symbol_6 = aboutEqual(dstColor.b, srcColor.b); + tint_symbol_6 = aboutEqual(dstColor.r, srcColor.r); } bool tint_symbol_5 = tint_symbol_6; if (tint_symbol_5) { - tint_symbol_5 = aboutEqual(dstColor.a, srcColor.a); + tint_symbol_5 = aboutEqual(dstColor.g, srcColor.g); } - success = tint_symbol_5; + bool tint_symbol_4 = tint_symbol_5; + if (tint_symbol_4) { + tint_symbol_4 = aboutEqual(dstColor.b, srcColor.b); + } + bool tint_symbol_3 = tint_symbol_4; + if (tint_symbol_3) { + tint_symbol_3 = aboutEqual(dstColor.a, srcColor.a); + } + success = tint_symbol_3; } } const uint outputIndex = ((GlobalInvocationID.y * dstSize.x) + GlobalInvocationID.x); @@ -87,7 +87,7 @@ void main_inner(uint3 GlobalInvocationID) { } [numthreads(1, 1, 1)] -void main(tint_symbol_2 tint_symbol_1) { - main_inner(tint_symbol_1.GlobalInvocationID); +void main(tint_symbol_8 tint_symbol_7) { + main_inner(tint_symbol_7.GlobalInvocationID); return; } diff --git a/test/tint/bug/tint/913.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/913.wgsl.expected.fxc.hlsl index f95b95ca7e..df80614d6c 100644 --- a/test/tint/bug/tint/913.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/tint/913.wgsl.expected.fxc.hlsl @@ -9,7 +9,7 @@ bool aboutEqual(float value, float expect) { return (abs((value - expect)) < 0.001f); } -struct tint_symbol_2 { +struct tint_symbol_8 { uint3 GlobalInvocationID : SV_DispatchThreadID; }; @@ -49,33 +49,33 @@ void main_inner(uint3 GlobalInvocationID) { const float4 srcColor = src.Load(int3(int2(srcTexCoord), 0)); const float4 dstColor = tint_symbol.Load(int3(int2(dstTexCoord), 0)); if ((uniforms[0].y == 2u)) { - bool tint_symbol_4 = success; - if (tint_symbol_4) { - tint_symbol_4 = aboutEqual(dstColor.r, srcColor.r); + bool tint_symbol_2 = success; + if (tint_symbol_2) { + tint_symbol_2 = aboutEqual(dstColor.r, srcColor.r); } - bool tint_symbol_3 = tint_symbol_4; - if (tint_symbol_3) { - tint_symbol_3 = aboutEqual(dstColor.g, srcColor.g); + bool tint_symbol_1 = tint_symbol_2; + if (tint_symbol_1) { + tint_symbol_1 = aboutEqual(dstColor.g, srcColor.g); } - success = tint_symbol_3; + success = tint_symbol_1; } else { - bool tint_symbol_8 = success; - if (tint_symbol_8) { - tint_symbol_8 = aboutEqual(dstColor.r, srcColor.r); - } - bool tint_symbol_7 = tint_symbol_8; - if (tint_symbol_7) { - tint_symbol_7 = aboutEqual(dstColor.g, srcColor.g); - } - bool tint_symbol_6 = tint_symbol_7; + bool tint_symbol_6 = success; if (tint_symbol_6) { - tint_symbol_6 = aboutEqual(dstColor.b, srcColor.b); + tint_symbol_6 = aboutEqual(dstColor.r, srcColor.r); } bool tint_symbol_5 = tint_symbol_6; if (tint_symbol_5) { - tint_symbol_5 = aboutEqual(dstColor.a, srcColor.a); + tint_symbol_5 = aboutEqual(dstColor.g, srcColor.g); } - success = tint_symbol_5; + bool tint_symbol_4 = tint_symbol_5; + if (tint_symbol_4) { + tint_symbol_4 = aboutEqual(dstColor.b, srcColor.b); + } + bool tint_symbol_3 = tint_symbol_4; + if (tint_symbol_3) { + tint_symbol_3 = aboutEqual(dstColor.a, srcColor.a); + } + success = tint_symbol_3; } } const uint outputIndex = ((GlobalInvocationID.y * dstSize.x) + GlobalInvocationID.x); @@ -87,7 +87,7 @@ void main_inner(uint3 GlobalInvocationID) { } [numthreads(1, 1, 1)] -void main(tint_symbol_2 tint_symbol_1) { - main_inner(tint_symbol_1.GlobalInvocationID); +void main(tint_symbol_8 tint_symbol_7) { + main_inner(tint_symbol_7.GlobalInvocationID); return; } diff --git a/test/tint/bug/tint/914.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/914.wgsl.expected.dxc.hlsl index 6b741d66d6..f0d36c840b 100644 --- a/test/tint/bug/tint/914.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/tint/914.wgsl.expected.dxc.hlsl @@ -47,7 +47,7 @@ uint tint_div(uint lhs, uint rhs) { return (lhs / ((rhs == 0u) ? 1u : rhs)); } -struct tint_symbol_1 { +struct tint_symbol_3 { uint3 local_id : SV_GroupThreadID; uint local_invocation_index : SV_GroupIndex; uint3 global_id : SV_DispatchThreadID; @@ -67,8 +67,7 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) { const uint tileCol = (local_id.x * 4u); const uint globalRow = (global_id.y * 4u); const uint globalCol = (global_id.x * 4u); - const uint tint_symbol_2 = tint_div((uniforms[0].y - 1u), 64u); - const uint numTiles = (tint_symbol_2 + 1u); + const uint numTiles = (tint_div((uniforms[0].y - 1u), 64u) + 1u); float acc[16] = (float[16])0; float ACached = 0.0f; float BCached[4] = (float[4])0; @@ -89,8 +88,8 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) { for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) { const uint inputRow = (tileRow + innerRow); const uint inputCol = (tileColA + innerCol); - const float tint_symbol_3 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol)); - mm_Asub[inputRow][inputCol] = tint_symbol_3; + const float tint_symbol = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol)); + mm_Asub[inputRow][inputCol] = tint_symbol; } } } @@ -101,8 +100,8 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) { for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { const uint inputRow = (tileRowB + innerRow); const uint inputCol = (tileCol + innerCol); - const float tint_symbol_4 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol)); - mm_Bsub[innerCol][inputCol] = tint_symbol_4; + const float tint_symbol_1 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol)); + mm_Bsub[innerCol][inputCol] = tint_symbol_1; } } } @@ -144,7 +143,7 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) { } [numthreads(16, 16, 1)] -void main(tint_symbol_1 tint_symbol) { - main_inner(tint_symbol.local_id, tint_symbol.global_id, tint_symbol.local_invocation_index); +void main(tint_symbol_3 tint_symbol_2) { + main_inner(tint_symbol_2.local_id, tint_symbol_2.global_id, tint_symbol_2.local_invocation_index); return; } diff --git a/test/tint/bug/tint/914.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/914.wgsl.expected.fxc.hlsl index 6b741d66d6..f0d36c840b 100644 --- a/test/tint/bug/tint/914.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/tint/914.wgsl.expected.fxc.hlsl @@ -47,7 +47,7 @@ uint tint_div(uint lhs, uint rhs) { return (lhs / ((rhs == 0u) ? 1u : rhs)); } -struct tint_symbol_1 { +struct tint_symbol_3 { uint3 local_id : SV_GroupThreadID; uint local_invocation_index : SV_GroupIndex; uint3 global_id : SV_DispatchThreadID; @@ -67,8 +67,7 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) { const uint tileCol = (local_id.x * 4u); const uint globalRow = (global_id.y * 4u); const uint globalCol = (global_id.x * 4u); - const uint tint_symbol_2 = tint_div((uniforms[0].y - 1u), 64u); - const uint numTiles = (tint_symbol_2 + 1u); + const uint numTiles = (tint_div((uniforms[0].y - 1u), 64u) + 1u); float acc[16] = (float[16])0; float ACached = 0.0f; float BCached[4] = (float[4])0; @@ -89,8 +88,8 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) { for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) { const uint inputRow = (tileRow + innerRow); const uint inputCol = (tileColA + innerCol); - const float tint_symbol_3 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol)); - mm_Asub[inputRow][inputCol] = tint_symbol_3; + const float tint_symbol = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol)); + mm_Asub[inputRow][inputCol] = tint_symbol; } } } @@ -101,8 +100,8 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) { for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { const uint inputRow = (tileRowB + innerRow); const uint inputCol = (tileCol + innerCol); - const float tint_symbol_4 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol)); - mm_Bsub[innerCol][inputCol] = tint_symbol_4; + const float tint_symbol_1 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol)); + mm_Bsub[innerCol][inputCol] = tint_symbol_1; } } } @@ -144,7 +143,7 @@ void main_inner(uint3 local_id, uint3 global_id, uint local_invocation_index) { } [numthreads(16, 16, 1)] -void main(tint_symbol_1 tint_symbol) { - main_inner(tint_symbol.local_id, tint_symbol.global_id, tint_symbol.local_invocation_index); +void main(tint_symbol_3 tint_symbol_2) { + main_inner(tint_symbol_2.local_id, tint_symbol_2.global_id, tint_symbol_2.local_invocation_index); return; } diff --git a/test/tint/bug/tint/914.wgsl.expected.glsl b/test/tint/bug/tint/914.wgsl.expected.glsl index fe3d6bcce6..cf748ec1ec 100644 --- a/test/tint/bug/tint/914.wgsl.expected.glsl +++ b/test/tint/bug/tint/914.wgsl.expected.glsl @@ -78,8 +78,7 @@ void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) { uint tileCol = (local_id.x * 4u); uint globalRow = (global_id.y * 4u); uint globalCol = (global_id.x * 4u); - uint tint_symbol_1 = tint_div((uniforms.inner.dimInner - 1u), 64u); - uint numTiles = (tint_symbol_1 + 1u); + uint numTiles = (tint_div((uniforms.inner.dimInner - 1u), 64u) + 1u); float acc[16] = float[16](0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); float ACached = 0.0f; float BCached[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f); @@ -100,8 +99,8 @@ void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) { for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) { uint inputRow = (tileRow + innerRow); uint inputCol = (tileColA + innerCol); - float tint_symbol_2 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol)); - mm_Asub[inputRow][inputCol] = tint_symbol_2; + float tint_symbol_1 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol)); + mm_Asub[inputRow][inputCol] = tint_symbol_1; } } } @@ -112,8 +111,8 @@ void tint_symbol(uvec3 local_id, uvec3 global_id, uint local_invocation_index) { for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { uint inputRow = (tileRowB + innerRow); uint inputCol = (tileCol + innerCol); - float tint_symbol_3 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol)); - mm_Bsub[innerCol][inputCol] = tint_symbol_3; + float tint_symbol_2 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol)); + mm_Bsub[innerCol][inputCol] = tint_symbol_2; } } } diff --git a/test/tint/bug/tint/914.wgsl.expected.msl b/test/tint/bug/tint/914.wgsl.expected.msl index 5ea78f26fd..acbc540477 100644 --- a/test/tint/bug/tint/914.wgsl.expected.msl +++ b/test/tint/bug/tint/914.wgsl.expected.msl @@ -24,26 +24,26 @@ struct Matrix { /* 0x0000 */ tint_array numbers; }; -float mm_readA(uint row, uint col, const constant Uniforms* const tint_symbol_4, const device Matrix* const tint_symbol_5) { - if (((row < (*(tint_symbol_4)).dimAOuter) && (col < (*(tint_symbol_4)).dimInner))) { - float const result = (*(tint_symbol_5)).numbers[((row * (*(tint_symbol_4)).dimInner) + col)]; +float mm_readA(uint row, uint col, const constant Uniforms* const tint_symbol_3, const device Matrix* const tint_symbol_4) { + if (((row < (*(tint_symbol_3)).dimAOuter) && (col < (*(tint_symbol_3)).dimInner))) { + float const result = (*(tint_symbol_4)).numbers[((row * (*(tint_symbol_3)).dimInner) + col)]; return result; } return 0.0f; } -float mm_readB(uint row, uint col, const constant Uniforms* const tint_symbol_6, const device Matrix* const tint_symbol_7) { - if (((row < (*(tint_symbol_6)).dimInner) && (col < (*(tint_symbol_6)).dimBOuter))) { - float const result = (*(tint_symbol_7)).numbers[((row * (*(tint_symbol_6)).dimBOuter) + col)]; +float mm_readB(uint row, uint col, const constant Uniforms* const tint_symbol_5, const device Matrix* const tint_symbol_6) { + if (((row < (*(tint_symbol_5)).dimInner) && (col < (*(tint_symbol_5)).dimBOuter))) { + float const result = (*(tint_symbol_6)).numbers[((row * (*(tint_symbol_5)).dimBOuter) + col)]; return result; } return 0.0f; } -void mm_write(uint row, uint col, float value, const constant Uniforms* const tint_symbol_8, device Matrix* const tint_symbol_9) { - if (((row < (*(tint_symbol_8)).dimAOuter) && (col < (*(tint_symbol_8)).dimBOuter))) { - uint const index = (col + (row * (*(tint_symbol_8)).dimBOuter)); - (*(tint_symbol_9)).numbers[index] = value; +void mm_write(uint row, uint col, float value, const constant Uniforms* const tint_symbol_7, device Matrix* const tint_symbol_8) { + if (((row < (*(tint_symbol_7)).dimAOuter) && (col < (*(tint_symbol_7)).dimBOuter))) { + uint const index = (col + (row * (*(tint_symbol_7)).dimBOuter)); + (*(tint_symbol_8)).numbers[index] = value; } } @@ -51,20 +51,19 @@ uint tint_div(uint lhs, uint rhs) { return (lhs / select(rhs, 1u, (rhs == 0u))); } -void tint_symbol_inner(uint3 local_id, uint3 global_id, uint local_invocation_index, threadgroup tint_array, 64>* const tint_symbol_10, threadgroup tint_array, 64>* const tint_symbol_11, const constant Uniforms* const tint_symbol_12, const device Matrix* const tint_symbol_13, const device Matrix* const tint_symbol_14, device Matrix* const tint_symbol_15) { +void tint_symbol_inner(uint3 local_id, uint3 global_id, uint local_invocation_index, threadgroup tint_array, 64>* const tint_symbol_9, threadgroup tint_array, 64>* const tint_symbol_10, const constant Uniforms* const tint_symbol_11, const device Matrix* const tint_symbol_12, const device Matrix* const tint_symbol_13, device Matrix* const tint_symbol_14) { for(uint idx = local_invocation_index; (idx < 4096u); idx = (idx + 256u)) { uint const i = (idx / 64u); uint const i_1 = (idx % 64u); + (*(tint_symbol_9))[i][i_1] = 0.0f; (*(tint_symbol_10))[i][i_1] = 0.0f; - (*(tint_symbol_11))[i][i_1] = 0.0f; } threadgroup_barrier(mem_flags::mem_threadgroup); uint const tileRow = (local_id[1] * 4u); uint const tileCol = (local_id[0] * 4u); uint const globalRow = (global_id[1] * 4u); uint const globalCol = (global_id[0] * 4u); - uint const tint_symbol_1 = tint_div(((*(tint_symbol_12)).dimInner - 1u), 64u); - uint const numTiles = (tint_symbol_1 + 1u); + uint const numTiles = (tint_div(((*(tint_symbol_11)).dimInner - 1u), 64u) + 1u); tint_array acc = {}; float ACached = 0.0f; tint_array BCached = {}; @@ -80,25 +79,25 @@ void tint_symbol_inner(uint3 local_id, uint3 global_id, uint local_invocation_in for(uint innerCol = 0u; (innerCol < ColPerThreadA); innerCol = (innerCol + 1u)) { uint const inputRow = (tileRow + innerRow); uint const inputCol = (tileColA + innerCol); - float const tint_symbol_2 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol), tint_symbol_12, tint_symbol_13); - (*(tint_symbol_10))[inputRow][inputCol] = tint_symbol_2; + float const tint_symbol_1 = mm_readA((globalRow + innerRow), ((t * 64u) + inputCol), tint_symbol_11, tint_symbol_12); + (*(tint_symbol_9))[inputRow][inputCol] = tint_symbol_1; } } for(uint innerRow = 0u; (innerRow < RowPerThreadB); innerRow = (innerRow + 1u)) { for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { uint const inputRow = (tileRowB + innerRow); uint const inputCol = (tileCol + innerCol); - float const tint_symbol_3 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol), tint_symbol_12, tint_symbol_14); - (*(tint_symbol_11))[innerCol][inputCol] = tint_symbol_3; + float const tint_symbol_2 = mm_readB(((t * 64u) + inputRow), (globalCol + innerCol), tint_symbol_11, tint_symbol_13); + (*(tint_symbol_10))[innerCol][inputCol] = tint_symbol_2; } } threadgroup_barrier(mem_flags::mem_threadgroup); for(uint k = 0u; (k < 64u); k = (k + 1u)) { for(uint inner = 0u; (inner < 4u); inner = (inner + 1u)) { - BCached[inner] = (*(tint_symbol_11))[k][(tileCol + inner)]; + BCached[inner] = (*(tint_symbol_10))[k][(tileCol + inner)]; } for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) { - ACached = (*(tint_symbol_10))[(tileRow + innerRow)][k]; + ACached = (*(tint_symbol_9))[(tileRow + innerRow)][k]; for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { uint const index = ((innerRow * 4u) + innerCol); acc[index] = (acc[index] + (ACached * BCached[innerCol])); @@ -110,15 +109,15 @@ void tint_symbol_inner(uint3 local_id, uint3 global_id, uint local_invocation_in for(uint innerRow = 0u; (innerRow < 4u); innerRow = (innerRow + 1u)) { for(uint innerCol = 0u; (innerCol < 4u); innerCol = (innerCol + 1u)) { uint const index = ((innerRow * 4u) + innerCol); - mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index], tint_symbol_12, tint_symbol_15); + mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index], tint_symbol_11, tint_symbol_14); } } } -kernel void tint_symbol(const constant Uniforms* tint_symbol_18 [[buffer(0)]], const device Matrix* tint_symbol_19 [[buffer(2)]], const device Matrix* tint_symbol_20 [[buffer(3)]], device Matrix* tint_symbol_21 [[buffer(1)]], uint3 local_id [[thread_position_in_threadgroup]], uint3 global_id [[thread_position_in_grid]], uint local_invocation_index [[thread_index_in_threadgroup]]) { +kernel void tint_symbol(const constant Uniforms* tint_symbol_17 [[buffer(0)]], const device Matrix* tint_symbol_18 [[buffer(2)]], const device Matrix* tint_symbol_19 [[buffer(3)]], device Matrix* tint_symbol_20 [[buffer(1)]], uint3 local_id [[thread_position_in_threadgroup]], uint3 global_id [[thread_position_in_grid]], uint local_invocation_index [[thread_index_in_threadgroup]]) { + threadgroup tint_array, 64> tint_symbol_15; threadgroup tint_array, 64> tint_symbol_16; - threadgroup tint_array, 64> tint_symbol_17; - tint_symbol_inner(local_id, global_id, local_invocation_index, &(tint_symbol_16), &(tint_symbol_17), tint_symbol_18, tint_symbol_19, tint_symbol_20, tint_symbol_21); + tint_symbol_inner(local_id, global_id, local_invocation_index, &(tint_symbol_15), &(tint_symbol_16), tint_symbol_17, tint_symbol_18, tint_symbol_19, tint_symbol_20); return; } diff --git a/test/tint/bug/tint/980.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/980.wgsl.expected.dxc.hlsl index 9401dcb838..32fbf9d156 100644 --- a/test/tint/bug/tint/980.wgsl.expected.dxc.hlsl +++ b/test/tint/bug/tint/980.wgsl.expected.dxc.hlsl @@ -10,17 +10,17 @@ float3 Bad(uint index, float3 rd) { RWByteAddressBuffer io : register(u0, space0); -struct tint_symbol_1 { +struct tint_symbol_2 { uint idx : SV_GroupIndex; }; void main_inner(uint idx) { - const float3 tint_symbol_2 = Bad(io.Load(12u), asfloat(io.Load3(0u))); - io.Store3(0u, asuint(tint_symbol_2)); + const float3 tint_symbol = Bad(io.Load(12u), asfloat(io.Load3(0u))); + io.Store3(0u, asuint(tint_symbol)); } [numthreads(1, 1, 1)] -void main(tint_symbol_1 tint_symbol) { - main_inner(tint_symbol.idx); +void main(tint_symbol_2 tint_symbol_1) { + main_inner(tint_symbol_1.idx); return; } diff --git a/test/tint/bug/tint/980.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/980.wgsl.expected.fxc.hlsl index 9401dcb838..32fbf9d156 100644 --- a/test/tint/bug/tint/980.wgsl.expected.fxc.hlsl +++ b/test/tint/bug/tint/980.wgsl.expected.fxc.hlsl @@ -10,17 +10,17 @@ float3 Bad(uint index, float3 rd) { RWByteAddressBuffer io : register(u0, space0); -struct tint_symbol_1 { +struct tint_symbol_2 { uint idx : SV_GroupIndex; }; void main_inner(uint idx) { - const float3 tint_symbol_2 = Bad(io.Load(12u), asfloat(io.Load3(0u))); - io.Store3(0u, asuint(tint_symbol_2)); + const float3 tint_symbol = Bad(io.Load(12u), asfloat(io.Load3(0u))); + io.Store3(0u, asuint(tint_symbol)); } [numthreads(1, 1, 1)] -void main(tint_symbol_1 tint_symbol) { - main_inner(tint_symbol.idx); +void main(tint_symbol_2 tint_symbol_1) { + main_inner(tint_symbol_1.idx); return; } diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.dxc.hlsl index 0c3cc70cf8..2704bfd198 100644 --- a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.dxc.hlsl +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.dxc.hlsl @@ -20,11 +20,8 @@ void compute_main_inner(uint local_invocation_index_2) { const uint x_31 = idx; const uint x_33 = idx; const uint x_35 = idx; - const uint tint_symbol_2 = tint_div(x_31, 2u); - const uint tint_symbol_3 = tint_mod(x_33, 2u); - const uint tint_symbol_4 = tint_mod(x_35, 1u); uint atomic_result = 0u; - InterlockedExchange(wg[tint_symbol_2][tint_symbol_3][tint_symbol_4], 0u, atomic_result); + InterlockedExchange(wg[tint_div(x_31, 2u)][tint_mod(x_33, 2u)][tint_mod(x_35, 1u)], 0u, atomic_result); { const uint x_42 = idx; idx = (x_42 + 1u); diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.fxc.hlsl index 0c3cc70cf8..2704bfd198 100644 --- a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.fxc.hlsl +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.fxc.hlsl @@ -20,11 +20,8 @@ void compute_main_inner(uint local_invocation_index_2) { const uint x_31 = idx; const uint x_33 = idx; const uint x_35 = idx; - const uint tint_symbol_2 = tint_div(x_31, 2u); - const uint tint_symbol_3 = tint_mod(x_33, 2u); - const uint tint_symbol_4 = tint_mod(x_35, 1u); uint atomic_result = 0u; - InterlockedExchange(wg[tint_symbol_2][tint_symbol_3][tint_symbol_4], 0u, atomic_result); + InterlockedExchange(wg[tint_div(x_31, 2u)][tint_mod(x_33, 2u)][tint_mod(x_35, 1u)], 0u, atomic_result); { const uint x_42 = idx; idx = (x_42 + 1u); diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.glsl b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.glsl index 800af68e1e..b6f4776847 100644 --- a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.glsl +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.glsl @@ -21,10 +21,7 @@ void compute_main_inner(uint local_invocation_index_2) { uint x_31 = idx; uint x_33 = idx; uint x_35 = idx; - uint tint_symbol = tint_div(x_31, 2u); - uint tint_symbol_1 = tint_mod(x_33, 2u); - uint tint_symbol_2 = tint_mod(x_35, 1u); - atomicExchange(wg[tint_symbol][tint_symbol_1][tint_symbol_2], 0u); + atomicExchange(wg[tint_div(x_31, 2u)][tint_mod(x_33, 2u)][tint_mod(x_35, 1u)], 0u); { uint x_42 = idx; idx = (x_42 + 1u); diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.msl b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.msl index d17c9b4d04..e7a3bfedfa 100644 --- a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.msl +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.msl @@ -22,7 +22,7 @@ uint tint_mod(uint lhs, uint rhs) { return (lhs % select(rhs, 1u, (rhs == 0u))); } -void compute_main_inner(uint local_invocation_index_2, threadgroup tint_array, 2>, 3>* const tint_symbol_3) { +void compute_main_inner(uint local_invocation_index_2, threadgroup tint_array, 2>, 3>* const tint_symbol) { uint idx = 0u; idx = local_invocation_index_2; while (true) { @@ -33,42 +33,39 @@ void compute_main_inner(uint local_invocation_index_2, threadgroup tint_array, 2>, 3>* const tint_symbol_5) { - uint const x_57 = *(tint_symbol_4); - compute_main_inner(x_57, tint_symbol_5); +void compute_main_1(thread uint* const tint_symbol_1, threadgroup tint_array, 2>, 3>* const tint_symbol_2) { + uint const x_57 = *(tint_symbol_1); + compute_main_inner(x_57, tint_symbol_2); return; } -void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup tint_array, 2>, 3>* const tint_symbol_6, thread uint* const tint_symbol_7) { +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup tint_array, 2>, 3>* const tint_symbol_3, thread uint* const tint_symbol_4) { for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 6u); idx_1 = (idx_1 + 1u)) { uint const i = (idx_1 / 2u); uint const i_1 = (idx_1 % 2u); uint const i_2 = (idx_1 % 1u); - atomic_store_explicit(&((*(tint_symbol_6))[i][i_1][i_2]), 0u, memory_order_relaxed); + atomic_store_explicit(&((*(tint_symbol_3))[i][i_1][i_2]), 0u, memory_order_relaxed); } threadgroup_barrier(mem_flags::mem_threadgroup); - *(tint_symbol_7) = local_invocation_index_1_param; - compute_main_1(tint_symbol_7, tint_symbol_6); + *(tint_symbol_4) = local_invocation_index_1_param; + compute_main_1(tint_symbol_4, tint_symbol_3); } kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { - threadgroup tint_array, 2>, 3> tint_symbol_8; - thread uint tint_symbol_9 = 0u; - compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_8), &(tint_symbol_9)); + threadgroup tint_array, 2>, 3> tint_symbol_5; + thread uint tint_symbol_6 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_5), &(tint_symbol_6)); return; } diff --git a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.spvasm index 71bb07eba0..2ebbb32e28 100644 --- a/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.spvasm +++ b/test/tint/builtins/atomicStore/array/aliased_arrays.spvasm.expected.spvasm @@ -96,10 +96,10 @@ %48 = OpLoad %uint %idx %49 = OpLoad %uint %idx %50 = OpLoad %uint %idx - %51 = OpFunctionCall %uint %tint_div %48 %uint_2 - %52 = OpFunctionCall %uint %tint_mod %49 %uint_2 - %53 = OpFunctionCall %uint %tint_mod %50 %uint_1 - %58 = OpAccessChain %_ptr_Workgroup_uint %wg %51 %52 %53 + %54 = OpFunctionCall %uint %tint_div %48 %uint_2 + %55 = OpFunctionCall %uint %tint_mod %49 %uint_2 + %56 = OpFunctionCall %uint %tint_mod %50 %uint_1 + %58 = OpAccessChain %_ptr_Workgroup_uint %wg %54 %55 %56 OpAtomicStore %58 %uint_2 %uint_0 %6 OpBranch %40 %40 = OpLabel diff --git a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.dxc.hlsl index 0c3cc70cf8..2704bfd198 100644 --- a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.dxc.hlsl +++ b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.dxc.hlsl @@ -20,11 +20,8 @@ void compute_main_inner(uint local_invocation_index_2) { const uint x_31 = idx; const uint x_33 = idx; const uint x_35 = idx; - const uint tint_symbol_2 = tint_div(x_31, 2u); - const uint tint_symbol_3 = tint_mod(x_33, 2u); - const uint tint_symbol_4 = tint_mod(x_35, 1u); uint atomic_result = 0u; - InterlockedExchange(wg[tint_symbol_2][tint_symbol_3][tint_symbol_4], 0u, atomic_result); + InterlockedExchange(wg[tint_div(x_31, 2u)][tint_mod(x_33, 2u)][tint_mod(x_35, 1u)], 0u, atomic_result); { const uint x_42 = idx; idx = (x_42 + 1u); diff --git a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.fxc.hlsl index 0c3cc70cf8..2704bfd198 100644 --- a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.fxc.hlsl +++ b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.fxc.hlsl @@ -20,11 +20,8 @@ void compute_main_inner(uint local_invocation_index_2) { const uint x_31 = idx; const uint x_33 = idx; const uint x_35 = idx; - const uint tint_symbol_2 = tint_div(x_31, 2u); - const uint tint_symbol_3 = tint_mod(x_33, 2u); - const uint tint_symbol_4 = tint_mod(x_35, 1u); uint atomic_result = 0u; - InterlockedExchange(wg[tint_symbol_2][tint_symbol_3][tint_symbol_4], 0u, atomic_result); + InterlockedExchange(wg[tint_div(x_31, 2u)][tint_mod(x_33, 2u)][tint_mod(x_35, 1u)], 0u, atomic_result); { const uint x_42 = idx; idx = (x_42 + 1u); diff --git a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.glsl b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.glsl index 800af68e1e..b6f4776847 100644 --- a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.glsl +++ b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.glsl @@ -21,10 +21,7 @@ void compute_main_inner(uint local_invocation_index_2) { uint x_31 = idx; uint x_33 = idx; uint x_35 = idx; - uint tint_symbol = tint_div(x_31, 2u); - uint tint_symbol_1 = tint_mod(x_33, 2u); - uint tint_symbol_2 = tint_mod(x_35, 1u); - atomicExchange(wg[tint_symbol][tint_symbol_1][tint_symbol_2], 0u); + atomicExchange(wg[tint_div(x_31, 2u)][tint_mod(x_33, 2u)][tint_mod(x_35, 1u)], 0u); { uint x_42 = idx; idx = (x_42 + 1u); diff --git a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.msl b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.msl index d17c9b4d04..e7a3bfedfa 100644 --- a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.msl +++ b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.msl @@ -22,7 +22,7 @@ uint tint_mod(uint lhs, uint rhs) { return (lhs % select(rhs, 1u, (rhs == 0u))); } -void compute_main_inner(uint local_invocation_index_2, threadgroup tint_array, 2>, 3>* const tint_symbol_3) { +void compute_main_inner(uint local_invocation_index_2, threadgroup tint_array, 2>, 3>* const tint_symbol) { uint idx = 0u; idx = local_invocation_index_2; while (true) { @@ -33,42 +33,39 @@ void compute_main_inner(uint local_invocation_index_2, threadgroup tint_array, 2>, 3>* const tint_symbol_5) { - uint const x_57 = *(tint_symbol_4); - compute_main_inner(x_57, tint_symbol_5); +void compute_main_1(thread uint* const tint_symbol_1, threadgroup tint_array, 2>, 3>* const tint_symbol_2) { + uint const x_57 = *(tint_symbol_1); + compute_main_inner(x_57, tint_symbol_2); return; } -void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup tint_array, 2>, 3>* const tint_symbol_6, thread uint* const tint_symbol_7) { +void compute_main_inner_1(uint local_invocation_index_1_param, threadgroup tint_array, 2>, 3>* const tint_symbol_3, thread uint* const tint_symbol_4) { for(uint idx_1 = local_invocation_index_1_param; (idx_1 < 6u); idx_1 = (idx_1 + 1u)) { uint const i = (idx_1 / 2u); uint const i_1 = (idx_1 % 2u); uint const i_2 = (idx_1 % 1u); - atomic_store_explicit(&((*(tint_symbol_6))[i][i_1][i_2]), 0u, memory_order_relaxed); + atomic_store_explicit(&((*(tint_symbol_3))[i][i_1][i_2]), 0u, memory_order_relaxed); } threadgroup_barrier(mem_flags::mem_threadgroup); - *(tint_symbol_7) = local_invocation_index_1_param; - compute_main_1(tint_symbol_7, tint_symbol_6); + *(tint_symbol_4) = local_invocation_index_1_param; + compute_main_1(tint_symbol_4, tint_symbol_3); } kernel void compute_main(uint local_invocation_index_1_param [[thread_index_in_threadgroup]]) { - threadgroup tint_array, 2>, 3> tint_symbol_8; - thread uint tint_symbol_9 = 0u; - compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_8), &(tint_symbol_9)); + threadgroup tint_array, 2>, 3> tint_symbol_5; + thread uint tint_symbol_6 = 0u; + compute_main_inner_1(local_invocation_index_1_param, &(tint_symbol_5), &(tint_symbol_6)); return; } diff --git a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.spvasm b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.spvasm index 71bb07eba0..2ebbb32e28 100644 --- a/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.spvasm +++ b/test/tint/builtins/atomicStore/array/arrays.spvasm.expected.spvasm @@ -96,10 +96,10 @@ %48 = OpLoad %uint %idx %49 = OpLoad %uint %idx %50 = OpLoad %uint %idx - %51 = OpFunctionCall %uint %tint_div %48 %uint_2 - %52 = OpFunctionCall %uint %tint_mod %49 %uint_2 - %53 = OpFunctionCall %uint %tint_mod %50 %uint_1 - %58 = OpAccessChain %_ptr_Workgroup_uint %wg %51 %52 %53 + %54 = OpFunctionCall %uint %tint_div %48 %uint_2 + %55 = OpFunctionCall %uint %tint_mod %49 %uint_2 + %56 = OpFunctionCall %uint %tint_mod %50 %uint_1 + %58 = OpAccessChain %_ptr_Workgroup_uint %wg %54 %55 %56 OpAtomicStore %58 %uint_2 %uint_0 %6 OpBranch %40 %40 = OpLabel diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl index fe0811a1f7..228a3a78c6 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl @@ -16,8 +16,8 @@ void atomicCompareExchangeWeak_e88938() { int atomic_compare_value = 1; InterlockedCompareExchange(arg_0, atomic_compare_value, 1, atomic_result.old_value); atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; - const atomic_compare_exchange_resulti32 tint_symbol_2 = atomic_result; - const int old_value_1 = tint_symbol_2.old_value; + const atomic_compare_exchange_resulti32 tint_symbol = atomic_result; + const int old_value_1 = tint_symbol.old_value; const int x_18 = old_value_1; const x__atomic_compare_exchange_resulti32 tint_symbol_3 = {x_18, (x_18 == 1)}; res = tint_symbol_3; @@ -38,7 +38,7 @@ void compute_main_1() { return; } -struct tint_symbol_1 { +struct tint_symbol_2 { uint local_invocation_index_1_param : SV_GroupIndex; }; @@ -53,7 +53,7 @@ void compute_main_inner_1(uint local_invocation_index_1_param) { } [numthreads(1, 1, 1)] -void compute_main(tint_symbol_1 tint_symbol) { - compute_main_inner_1(tint_symbol.local_invocation_index_1_param); +void compute_main(tint_symbol_2 tint_symbol_1) { + compute_main_inner_1(tint_symbol_1.local_invocation_index_1_param); return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl index fe0811a1f7..228a3a78c6 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl @@ -16,8 +16,8 @@ void atomicCompareExchangeWeak_e88938() { int atomic_compare_value = 1; InterlockedCompareExchange(arg_0, atomic_compare_value, 1, atomic_result.old_value); atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; - const atomic_compare_exchange_resulti32 tint_symbol_2 = atomic_result; - const int old_value_1 = tint_symbol_2.old_value; + const atomic_compare_exchange_resulti32 tint_symbol = atomic_result; + const int old_value_1 = tint_symbol.old_value; const int x_18 = old_value_1; const x__atomic_compare_exchange_resulti32 tint_symbol_3 = {x_18, (x_18 == 1)}; res = tint_symbol_3; @@ -38,7 +38,7 @@ void compute_main_1() { return; } -struct tint_symbol_1 { +struct tint_symbol_2 { uint local_invocation_index_1_param : SV_GroupIndex; }; @@ -53,7 +53,7 @@ void compute_main_inner_1(uint local_invocation_index_1_param) { } [numthreads(1, 1, 1)] -void compute_main(tint_symbol_1 tint_symbol) { - compute_main_inner_1(tint_symbol.local_invocation_index_1_param); +void compute_main(tint_symbol_2 tint_symbol_1) { + compute_main_inner_1(tint_symbol_1.local_invocation_index_1_param); return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl index 89f85cc2a2..3ba0e3f1c3 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl @@ -16,8 +16,8 @@ void atomicCompareExchangeWeak_83580d() { uint atomic_compare_value = 1u; InterlockedCompareExchange(arg_0, atomic_compare_value, 1u, atomic_result.old_value); atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; - const atomic_compare_exchange_resultu32 tint_symbol_2 = atomic_result; - const uint old_value_1 = tint_symbol_2.old_value; + const atomic_compare_exchange_resultu32 tint_symbol = atomic_result; + const uint old_value_1 = tint_symbol.old_value; const uint x_17 = old_value_1; const x__atomic_compare_exchange_resultu32 tint_symbol_3 = {x_17, (x_17 == 1u)}; res = tint_symbol_3; @@ -38,7 +38,7 @@ void compute_main_1() { return; } -struct tint_symbol_1 { +struct tint_symbol_2 { uint local_invocation_index_1_param : SV_GroupIndex; }; @@ -53,7 +53,7 @@ void compute_main_inner_1(uint local_invocation_index_1_param) { } [numthreads(1, 1, 1)] -void compute_main(tint_symbol_1 tint_symbol) { - compute_main_inner_1(tint_symbol.local_invocation_index_1_param); +void compute_main(tint_symbol_2 tint_symbol_1) { + compute_main_inner_1(tint_symbol_1.local_invocation_index_1_param); return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl index 89f85cc2a2..3ba0e3f1c3 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl @@ -16,8 +16,8 @@ void atomicCompareExchangeWeak_83580d() { uint atomic_compare_value = 1u; InterlockedCompareExchange(arg_0, atomic_compare_value, 1u, atomic_result.old_value); atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; - const atomic_compare_exchange_resultu32 tint_symbol_2 = atomic_result; - const uint old_value_1 = tint_symbol_2.old_value; + const atomic_compare_exchange_resultu32 tint_symbol = atomic_result; + const uint old_value_1 = tint_symbol.old_value; const uint x_17 = old_value_1; const x__atomic_compare_exchange_resultu32 tint_symbol_3 = {x_17, (x_17 == 1u)}; res = tint_symbol_3; @@ -38,7 +38,7 @@ void compute_main_1() { return; } -struct tint_symbol_1 { +struct tint_symbol_2 { uint local_invocation_index_1_param : SV_GroupIndex; }; @@ -53,7 +53,7 @@ void compute_main_inner_1(uint local_invocation_index_1_param) { } [numthreads(1, 1, 1)] -void compute_main(tint_symbol_1 tint_symbol) { - compute_main_inner_1(tint_symbol.local_invocation_index_1_param); +void compute_main(tint_symbol_2 tint_symbol_1) { + compute_main_inner_1(tint_symbol_1.local_invocation_index_1_param); return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl index f969d035d6..0f21d8d213 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.dxc.hlsl @@ -22,8 +22,8 @@ void atomicCompareExchangeWeak_e88938() { int atomic_compare_value = x_23; InterlockedCompareExchange(arg_0, atomic_compare_value, x_22, atomic_result.old_value); atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; - const atomic_compare_exchange_resulti32 tint_symbol_2 = atomic_result; - const int old_value_1 = tint_symbol_2.old_value; + const atomic_compare_exchange_resulti32 tint_symbol = atomic_result; + const int old_value_1 = tint_symbol.old_value; const int x_24 = old_value_1; const x__atomic_compare_exchange_resulti32 tint_symbol_3 = {x_24, (x_24 == x_22)}; res = tint_symbol_3; @@ -44,7 +44,7 @@ void compute_main_1() { return; } -struct tint_symbol_1 { +struct tint_symbol_2 { uint local_invocation_index_1_param : SV_GroupIndex; }; @@ -59,7 +59,7 @@ void compute_main_inner_1(uint local_invocation_index_1_param) { } [numthreads(1, 1, 1)] -void compute_main(tint_symbol_1 tint_symbol) { - compute_main_inner_1(tint_symbol.local_invocation_index_1_param); +void compute_main(tint_symbol_2 tint_symbol_1) { + compute_main_inner_1(tint_symbol_1.local_invocation_index_1_param); return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl index f969d035d6..0f21d8d213 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.fxc.hlsl @@ -22,8 +22,8 @@ void atomicCompareExchangeWeak_e88938() { int atomic_compare_value = x_23; InterlockedCompareExchange(arg_0, atomic_compare_value, x_22, atomic_result.old_value); atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; - const atomic_compare_exchange_resulti32 tint_symbol_2 = atomic_result; - const int old_value_1 = tint_symbol_2.old_value; + const atomic_compare_exchange_resulti32 tint_symbol = atomic_result; + const int old_value_1 = tint_symbol.old_value; const int x_24 = old_value_1; const x__atomic_compare_exchange_resulti32 tint_symbol_3 = {x_24, (x_24 == x_22)}; res = tint_symbol_3; @@ -44,7 +44,7 @@ void compute_main_1() { return; } -struct tint_symbol_1 { +struct tint_symbol_2 { uint local_invocation_index_1_param : SV_GroupIndex; }; @@ -59,7 +59,7 @@ void compute_main_inner_1(uint local_invocation_index_1_param) { } [numthreads(1, 1, 1)] -void compute_main(tint_symbol_1 tint_symbol) { - compute_main_inner_1(tint_symbol.local_invocation_index_1_param); +void compute_main(tint_symbol_2 tint_symbol_1) { + compute_main_inner_1(tint_symbol_1.local_invocation_index_1_param); return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl index 99e867f07e..46c7526d3c 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.dxc.hlsl @@ -22,8 +22,8 @@ void atomicCompareExchangeWeak_83580d() { uint atomic_compare_value = x_22; InterlockedCompareExchange(arg_0, atomic_compare_value, x_21, atomic_result.old_value); atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; - const atomic_compare_exchange_resultu32 tint_symbol_2 = atomic_result; - const uint old_value_1 = tint_symbol_2.old_value; + const atomic_compare_exchange_resultu32 tint_symbol = atomic_result; + const uint old_value_1 = tint_symbol.old_value; const uint x_23 = old_value_1; const x__atomic_compare_exchange_resultu32 tint_symbol_3 = {x_23, (x_23 == x_21)}; res = tint_symbol_3; @@ -44,7 +44,7 @@ void compute_main_1() { return; } -struct tint_symbol_1 { +struct tint_symbol_2 { uint local_invocation_index_1_param : SV_GroupIndex; }; @@ -59,7 +59,7 @@ void compute_main_inner_1(uint local_invocation_index_1_param) { } [numthreads(1, 1, 1)] -void compute_main(tint_symbol_1 tint_symbol) { - compute_main_inner_1(tint_symbol.local_invocation_index_1_param); +void compute_main(tint_symbol_2 tint_symbol_1) { + compute_main_inner_1(tint_symbol_1.local_invocation_index_1_param); return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl index 99e867f07e..46c7526d3c 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.fxc.hlsl @@ -22,8 +22,8 @@ void atomicCompareExchangeWeak_83580d() { uint atomic_compare_value = x_22; InterlockedCompareExchange(arg_0, atomic_compare_value, x_21, atomic_result.old_value); atomic_result.exchanged = atomic_result.old_value == atomic_compare_value; - const atomic_compare_exchange_resultu32 tint_symbol_2 = atomic_result; - const uint old_value_1 = tint_symbol_2.old_value; + const atomic_compare_exchange_resultu32 tint_symbol = atomic_result; + const uint old_value_1 = tint_symbol.old_value; const uint x_23 = old_value_1; const x__atomic_compare_exchange_resultu32 tint_symbol_3 = {x_23, (x_23 == x_21)}; res = tint_symbol_3; @@ -44,7 +44,7 @@ void compute_main_1() { return; } -struct tint_symbol_1 { +struct tint_symbol_2 { uint local_invocation_index_1_param : SV_GroupIndex; }; @@ -59,7 +59,7 @@ void compute_main_inner_1(uint local_invocation_index_1_param) { } [numthreads(1, 1, 1)] -void compute_main(tint_symbol_1 tint_symbol) { - compute_main_inner_1(tint_symbol.local_invocation_index_1_param); +void compute_main(tint_symbol_2 tint_symbol_1) { + compute_main_inner_1(tint_symbol_1.local_invocation_index_1_param); return; } diff --git a/test/tint/builtins/gen/literal/textureDimensions/cdc6c9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureDimensions/cdc6c9.wgsl.expected.glsl index f358a0993e..87471810b3 100644 --- a/test/tint/builtins/gen/literal/textureDimensions/cdc6c9.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/textureDimensions/cdc6c9.wgsl.expected.glsl @@ -14,16 +14,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -31,6 +37,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -72,16 +80,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -89,6 +103,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -124,16 +140,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -141,6 +163,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { diff --git a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl index a5f0e0a260..598afb2c01 100644 --- a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl @@ -14,16 +14,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -31,6 +37,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -63,7 +71,7 @@ vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uve uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureLoad_1bfdfb() { @@ -100,16 +108,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -117,6 +131,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -149,7 +165,7 @@ vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uve uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureLoad_1bfdfb() { @@ -180,16 +196,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -197,6 +219,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -229,7 +253,7 @@ vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uve uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureLoad_1bfdfb() { diff --git a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl index a2b7930815..5629e715fb 100644 --- a/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/textureLoad/8acf41.wgsl.expected.glsl @@ -14,16 +14,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -31,6 +37,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -63,7 +71,7 @@ vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ive uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureLoad_8acf41() { @@ -100,16 +108,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -117,6 +131,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -149,7 +165,7 @@ vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ive uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureLoad_8acf41() { @@ -180,16 +196,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -197,6 +219,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -229,7 +253,7 @@ vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ive uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureLoad_8acf41() { diff --git a/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl index b12b3d8502..4ff46dbdf5 100644 --- a/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl @@ -14,16 +14,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -31,6 +37,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 3, std140) uniform ext_tex_params_block_std140_ubo { @@ -72,7 +80,7 @@ uniform highp sampler2D ext_tex_plane_1_1; uniform highp sampler2D arg_0_arg_1; uniform highp sampler2D ext_tex_plane_1_arg_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureSampleBaseClampToEdge_7c04e6() { @@ -109,16 +117,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -126,6 +140,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 3, std140) uniform ext_tex_params_block_std140_ubo { @@ -167,7 +183,7 @@ uniform highp sampler2D ext_tex_plane_1_1; uniform highp sampler2D arg_0_arg_1; uniform highp sampler2D ext_tex_plane_1_arg_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureSampleBaseClampToEdge_7c04e6() { @@ -198,16 +214,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -215,6 +237,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 3, std140) uniform ext_tex_params_block_std140_ubo { @@ -256,7 +280,7 @@ uniform highp sampler2D ext_tex_plane_1_1; uniform highp sampler2D arg_0_arg_1; uniform highp sampler2D ext_tex_plane_1_arg_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureSampleBaseClampToEdge_7c04e6() { diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl index 26bb61fa89..9324574a4f 100644 --- a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl @@ -1,14 +1,14 @@ -groupshared uint arg_0; - -uint tint_workgroupUniformLoad_arg_0() { +uint tint_workgroupUniformLoad(inout uint p) { GroupMemoryBarrierWithGroupSync(); - const uint result = arg_0; + const uint result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared uint arg_0; + void workgroupUniformLoad_37307c() { - uint res = tint_workgroupUniformLoad_arg_0(); + uint res = tint_workgroupUniformLoad(arg_0); } struct tint_symbol_1 { diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl index 26bb61fa89..9324574a4f 100644 --- a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl @@ -1,14 +1,14 @@ -groupshared uint arg_0; - -uint tint_workgroupUniformLoad_arg_0() { +uint tint_workgroupUniformLoad(inout uint p) { GroupMemoryBarrierWithGroupSync(); - const uint result = arg_0; + const uint result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared uint arg_0; + void workgroupUniformLoad_37307c() { - uint res = tint_workgroupUniformLoad_arg_0(); + uint res = tint_workgroupUniformLoad(arg_0); } struct tint_symbol_1 { diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.glsl index 5b51b2ddc1..061ebab64d 100644 --- a/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/37307c.wgsl.expected.glsl @@ -1,15 +1,15 @@ #version 310 es -shared uint arg_0; -uint tint_workgroupUniformLoad_arg_0() { +uint tint_workgroupUniformLoad(inout uint p) { barrier(); - uint result = arg_0; + uint result = p; barrier(); return result; } +shared uint arg_0; void workgroupUniformLoad_37307c() { - uint res = tint_workgroupUniformLoad_arg_0(); + uint res = tint_workgroupUniformLoad(arg_0); } void compute_main(uint local_invocation_index) { diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl index fe6d27ef2b..0bd3512d63 100644 --- a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl @@ -1,14 +1,14 @@ -groupshared float arg_0; - -float tint_workgroupUniformLoad_arg_0() { +float tint_workgroupUniformLoad(inout float p) { GroupMemoryBarrierWithGroupSync(); - const float result = arg_0; + const float result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared float arg_0; + void workgroupUniformLoad_7a857c() { - float res = tint_workgroupUniformLoad_arg_0(); + float res = tint_workgroupUniformLoad(arg_0); } struct tint_symbol_1 { diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl index fe6d27ef2b..0bd3512d63 100644 --- a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl @@ -1,14 +1,14 @@ -groupshared float arg_0; - -float tint_workgroupUniformLoad_arg_0() { +float tint_workgroupUniformLoad(inout float p) { GroupMemoryBarrierWithGroupSync(); - const float result = arg_0; + const float result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared float arg_0; + void workgroupUniformLoad_7a857c() { - float res = tint_workgroupUniformLoad_arg_0(); + float res = tint_workgroupUniformLoad(arg_0); } struct tint_symbol_1 { diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.glsl index bfdeb8737d..dcde824d31 100644 --- a/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/7a857c.wgsl.expected.glsl @@ -1,15 +1,15 @@ #version 310 es -shared float arg_0; -float tint_workgroupUniformLoad_arg_0() { +float tint_workgroupUniformLoad(inout float p) { barrier(); - float result = arg_0; + float result = p; barrier(); return result; } +shared float arg_0; void workgroupUniformLoad_7a857c() { - float res = tint_workgroupUniformLoad_arg_0(); + float res = tint_workgroupUniformLoad(arg_0); } void compute_main(uint local_invocation_index) { diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl index 87cf14c363..5bce24ba29 100644 --- a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl @@ -1,14 +1,14 @@ -groupshared int arg_0; - -int tint_workgroupUniformLoad_arg_0() { +int tint_workgroupUniformLoad(inout int p) { GroupMemoryBarrierWithGroupSync(); - const int result = arg_0; + const int result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared int arg_0; + void workgroupUniformLoad_9d33de() { - int res = tint_workgroupUniformLoad_arg_0(); + int res = tint_workgroupUniformLoad(arg_0); } struct tint_symbol_1 { diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl index 87cf14c363..5bce24ba29 100644 --- a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl @@ -1,14 +1,14 @@ -groupshared int arg_0; - -int tint_workgroupUniformLoad_arg_0() { +int tint_workgroupUniformLoad(inout int p) { GroupMemoryBarrierWithGroupSync(); - const int result = arg_0; + const int result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared int arg_0; + void workgroupUniformLoad_9d33de() { - int res = tint_workgroupUniformLoad_arg_0(); + int res = tint_workgroupUniformLoad(arg_0); } struct tint_symbol_1 { diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.glsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.glsl index 31ae3f9c11..10874b5afe 100644 --- a/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/9d33de.wgsl.expected.glsl @@ -1,15 +1,15 @@ #version 310 es -shared int arg_0; -int tint_workgroupUniformLoad_arg_0() { +int tint_workgroupUniformLoad(inout int p) { barrier(); - int result = arg_0; + int result = p; barrier(); return result; } +shared int arg_0; void workgroupUniformLoad_9d33de() { - int res = tint_workgroupUniformLoad_arg_0(); + int res = tint_workgroupUniformLoad(arg_0); } void compute_main(uint local_invocation_index) { diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl index d34a7c4107..96fb735422 100644 --- a/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl @@ -1,14 +1,14 @@ -groupshared float16_t arg_0; - -float16_t tint_workgroupUniformLoad_arg_0() { +float16_t tint_workgroupUniformLoad(inout float16_t p) { GroupMemoryBarrierWithGroupSync(); - const float16_t result = arg_0; + const float16_t result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared float16_t arg_0; + void workgroupUniformLoad_e07d08() { - float16_t res = tint_workgroupUniformLoad_arg_0(); + float16_t res = tint_workgroupUniformLoad(arg_0); } struct tint_symbol_1 { diff --git a/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.glsl b/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.glsl index 0b882bde92..33a9a403c5 100644 --- a/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/workgroupUniformLoad/e07d08.wgsl.expected.glsl @@ -1,16 +1,16 @@ #version 310 es #extension GL_AMD_gpu_shader_half_float : require -shared float16_t arg_0; -float16_t tint_workgroupUniformLoad_arg_0() { +float16_t tint_workgroupUniformLoad(inout float16_t p) { barrier(); - float16_t result = arg_0; + float16_t result = p; barrier(); return result; } +shared float16_t arg_0; void workgroupUniformLoad_e07d08() { - float16_t res = tint_workgroupUniformLoad_arg_0(); + float16_t res = tint_workgroupUniformLoad(arg_0); } void compute_main(uint local_invocation_index) { diff --git a/test/tint/builtins/gen/var/textureDimensions/cdc6c9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cdc6c9.wgsl.expected.glsl index f358a0993e..87471810b3 100644 --- a/test/tint/builtins/gen/var/textureDimensions/cdc6c9.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/textureDimensions/cdc6c9.wgsl.expected.glsl @@ -14,16 +14,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -31,6 +37,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -72,16 +80,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -89,6 +103,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -124,16 +140,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -141,6 +163,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { diff --git a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl index 2cc4ccf8de..d38b45488f 100644 --- a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl @@ -14,16 +14,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -31,6 +37,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -63,7 +71,7 @@ vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uve uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureLoad_1bfdfb() { @@ -101,16 +109,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -118,6 +132,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -150,7 +166,7 @@ vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uve uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureLoad_1bfdfb() { @@ -182,16 +198,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -199,6 +221,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -231,7 +255,7 @@ vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uve uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureLoad_1bfdfb() { diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl index a24d4fe83c..fd0f0b4487 100644 --- a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl @@ -14,16 +14,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -31,6 +37,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -63,7 +71,7 @@ vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ive uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureLoad_8acf41() { @@ -101,16 +109,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -118,6 +132,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -150,7 +166,7 @@ vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ive uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureLoad_8acf41() { @@ -182,16 +198,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -199,6 +221,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -231,7 +255,7 @@ vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ive uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureLoad_8acf41() { diff --git a/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl index 9824423f94..764d338d19 100644 --- a/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/textureSampleBaseClampToEdge/7c04e6.wgsl.expected.glsl @@ -14,16 +14,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -31,6 +37,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 3, std140) uniform ext_tex_params_block_std140_ubo { @@ -72,7 +80,7 @@ uniform highp sampler2D ext_tex_plane_1_1; uniform highp sampler2D arg_0_arg_1; uniform highp sampler2D ext_tex_plane_1_arg_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureSampleBaseClampToEdge_7c04e6() { @@ -110,16 +118,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -127,6 +141,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 3, std140) uniform ext_tex_params_block_std140_ubo { @@ -168,7 +184,7 @@ uniform highp sampler2D ext_tex_plane_1_1; uniform highp sampler2D arg_0_arg_1; uniform highp sampler2D ext_tex_plane_1_arg_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureSampleBaseClampToEdge_7c04e6() { @@ -200,16 +216,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -217,6 +239,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 3, std140) uniform ext_tex_params_block_std140_ubo { @@ -258,7 +282,7 @@ uniform highp sampler2D ext_tex_plane_1_1; uniform highp sampler2D arg_0_arg_1; uniform highp sampler2D ext_tex_plane_1_arg_1; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void textureSampleBaseClampToEdge_7c04e6() { diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl index 26bb61fa89..9324574a4f 100644 --- a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.dxc.hlsl @@ -1,14 +1,14 @@ -groupshared uint arg_0; - -uint tint_workgroupUniformLoad_arg_0() { +uint tint_workgroupUniformLoad(inout uint p) { GroupMemoryBarrierWithGroupSync(); - const uint result = arg_0; + const uint result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared uint arg_0; + void workgroupUniformLoad_37307c() { - uint res = tint_workgroupUniformLoad_arg_0(); + uint res = tint_workgroupUniformLoad(arg_0); } struct tint_symbol_1 { diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl index 26bb61fa89..9324574a4f 100644 --- a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.fxc.hlsl @@ -1,14 +1,14 @@ -groupshared uint arg_0; - -uint tint_workgroupUniformLoad_arg_0() { +uint tint_workgroupUniformLoad(inout uint p) { GroupMemoryBarrierWithGroupSync(); - const uint result = arg_0; + const uint result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared uint arg_0; + void workgroupUniformLoad_37307c() { - uint res = tint_workgroupUniformLoad_arg_0(); + uint res = tint_workgroupUniformLoad(arg_0); } struct tint_symbol_1 { diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.glsl b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.glsl index 5b51b2ddc1..061ebab64d 100644 --- a/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/workgroupUniformLoad/37307c.wgsl.expected.glsl @@ -1,15 +1,15 @@ #version 310 es -shared uint arg_0; -uint tint_workgroupUniformLoad_arg_0() { +uint tint_workgroupUniformLoad(inout uint p) { barrier(); - uint result = arg_0; + uint result = p; barrier(); return result; } +shared uint arg_0; void workgroupUniformLoad_37307c() { - uint res = tint_workgroupUniformLoad_arg_0(); + uint res = tint_workgroupUniformLoad(arg_0); } void compute_main(uint local_invocation_index) { diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl index fe6d27ef2b..0bd3512d63 100644 --- a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.dxc.hlsl @@ -1,14 +1,14 @@ -groupshared float arg_0; - -float tint_workgroupUniformLoad_arg_0() { +float tint_workgroupUniformLoad(inout float p) { GroupMemoryBarrierWithGroupSync(); - const float result = arg_0; + const float result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared float arg_0; + void workgroupUniformLoad_7a857c() { - float res = tint_workgroupUniformLoad_arg_0(); + float res = tint_workgroupUniformLoad(arg_0); } struct tint_symbol_1 { diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl index fe6d27ef2b..0bd3512d63 100644 --- a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.fxc.hlsl @@ -1,14 +1,14 @@ -groupshared float arg_0; - -float tint_workgroupUniformLoad_arg_0() { +float tint_workgroupUniformLoad(inout float p) { GroupMemoryBarrierWithGroupSync(); - const float result = arg_0; + const float result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared float arg_0; + void workgroupUniformLoad_7a857c() { - float res = tint_workgroupUniformLoad_arg_0(); + float res = tint_workgroupUniformLoad(arg_0); } struct tint_symbol_1 { diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.glsl b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.glsl index bfdeb8737d..dcde824d31 100644 --- a/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/workgroupUniformLoad/7a857c.wgsl.expected.glsl @@ -1,15 +1,15 @@ #version 310 es -shared float arg_0; -float tint_workgroupUniformLoad_arg_0() { +float tint_workgroupUniformLoad(inout float p) { barrier(); - float result = arg_0; + float result = p; barrier(); return result; } +shared float arg_0; void workgroupUniformLoad_7a857c() { - float res = tint_workgroupUniformLoad_arg_0(); + float res = tint_workgroupUniformLoad(arg_0); } void compute_main(uint local_invocation_index) { diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl index 87cf14c363..5bce24ba29 100644 --- a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.dxc.hlsl @@ -1,14 +1,14 @@ -groupshared int arg_0; - -int tint_workgroupUniformLoad_arg_0() { +int tint_workgroupUniformLoad(inout int p) { GroupMemoryBarrierWithGroupSync(); - const int result = arg_0; + const int result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared int arg_0; + void workgroupUniformLoad_9d33de() { - int res = tint_workgroupUniformLoad_arg_0(); + int res = tint_workgroupUniformLoad(arg_0); } struct tint_symbol_1 { diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl index 87cf14c363..5bce24ba29 100644 --- a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.fxc.hlsl @@ -1,14 +1,14 @@ -groupshared int arg_0; - -int tint_workgroupUniformLoad_arg_0() { +int tint_workgroupUniformLoad(inout int p) { GroupMemoryBarrierWithGroupSync(); - const int result = arg_0; + const int result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared int arg_0; + void workgroupUniformLoad_9d33de() { - int res = tint_workgroupUniformLoad_arg_0(); + int res = tint_workgroupUniformLoad(arg_0); } struct tint_symbol_1 { diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.glsl b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.glsl index 31ae3f9c11..10874b5afe 100644 --- a/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/workgroupUniformLoad/9d33de.wgsl.expected.glsl @@ -1,15 +1,15 @@ #version 310 es -shared int arg_0; -int tint_workgroupUniformLoad_arg_0() { +int tint_workgroupUniformLoad(inout int p) { barrier(); - int result = arg_0; + int result = p; barrier(); return result; } +shared int arg_0; void workgroupUniformLoad_9d33de() { - int res = tint_workgroupUniformLoad_arg_0(); + int res = tint_workgroupUniformLoad(arg_0); } void compute_main(uint local_invocation_index) { diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl index d34a7c4107..96fb735422 100644 --- a/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.dxc.hlsl @@ -1,14 +1,14 @@ -groupshared float16_t arg_0; - -float16_t tint_workgroupUniformLoad_arg_0() { +float16_t tint_workgroupUniformLoad(inout float16_t p) { GroupMemoryBarrierWithGroupSync(); - const float16_t result = arg_0; + const float16_t result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared float16_t arg_0; + void workgroupUniformLoad_e07d08() { - float16_t res = tint_workgroupUniformLoad_arg_0(); + float16_t res = tint_workgroupUniformLoad(arg_0); } struct tint_symbol_1 { diff --git a/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.glsl b/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.glsl index 0b882bde92..33a9a403c5 100644 --- a/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/workgroupUniformLoad/e07d08.wgsl.expected.glsl @@ -1,16 +1,16 @@ #version 310 es #extension GL_AMD_gpu_shader_half_float : require -shared float16_t arg_0; -float16_t tint_workgroupUniformLoad_arg_0() { +float16_t tint_workgroupUniformLoad(inout float16_t p) { barrier(); - float16_t result = arg_0; + float16_t result = p; barrier(); return result; } +shared float16_t arg_0; void workgroupUniformLoad_e07d08() { - float16_t res = tint_workgroupUniformLoad_arg_0(); + float16_t res = tint_workgroupUniformLoad(arg_0); } void compute_main(uint local_invocation_index) { diff --git a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl index 6cbc9c0836..02da464d17 100644 --- a/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl +++ b/test/tint/builtins/textureLoad/texture_external_param.wgsl.expected.glsl @@ -14,16 +14,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -31,6 +37,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -67,7 +75,7 @@ vec4 textureLoad2d(highp sampler2D tint_symbol_1, highp sampler2D ext_tex_plane_ uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_2; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void doTextureLoad() { @@ -104,16 +112,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -121,6 +135,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -157,7 +173,7 @@ vec4 textureLoad2d(highp sampler2D tint_symbol_1, highp sampler2D ext_tex_plane_ uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_2; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void doTextureLoad() { @@ -188,16 +204,22 @@ struct GammaTransferParams { struct ExternalTextureParams { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; mat3 gamutConversionMatrix; mat3x2 coordTransformationMatrix; + uint pad_2; + uint pad_3; }; struct ExternalTextureParams_std140 { uint numPlanes; uint doYuvToRgbConversionOnly; + uint pad; + uint pad_1; mat3x4 yuvToRgbConversionMatrix; GammaTransferParams gammaDecodeParams; GammaTransferParams gammaEncodeParams; @@ -205,6 +227,8 @@ struct ExternalTextureParams_std140 { vec2 coordTransformationMatrix_0; vec2 coordTransformationMatrix_1; vec2 coordTransformationMatrix_2; + uint pad_2; + uint pad_3; }; layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo { @@ -241,7 +265,7 @@ vec4 textureLoad2d(highp sampler2D tint_symbol_1, highp sampler2D ext_tex_plane_ uniform highp sampler2D arg_0_1; uniform highp sampler2D ext_tex_plane_1_2; ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) { - return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2)); + return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3); } void doTextureLoad() { diff --git a/test/tint/builtins/workgroupUniformLoad/array.wgsl.expected.dxc.hlsl b/test/tint/builtins/workgroupUniformLoad/array.wgsl.expected.dxc.hlsl index a9b6ea5edd..d8a47b9ecd 100644 --- a/test/tint/builtins/workgroupUniformLoad/array.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/array.wgsl.expected.dxc.hlsl @@ -3,17 +3,17 @@ void unused_entry_point() { return; } -groupshared int v[4]; - -typedef int tint_workgroupUniformLoad_v_ret[4]; -tint_workgroupUniformLoad_v_ret tint_workgroupUniformLoad_v() { +typedef int tint_workgroupUniformLoad_ret[4]; +tint_workgroupUniformLoad_ret tint_workgroupUniformLoad(inout int p[4]) { GroupMemoryBarrierWithGroupSync(); - const int result[4] = v; + const int result[4] = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared int v[4]; + typedef int foo_ret[4]; foo_ret foo() { - return tint_workgroupUniformLoad_v(); + return tint_workgroupUniformLoad(v); } diff --git a/test/tint/builtins/workgroupUniformLoad/array.wgsl.expected.fxc.hlsl b/test/tint/builtins/workgroupUniformLoad/array.wgsl.expected.fxc.hlsl index a9b6ea5edd..d8a47b9ecd 100644 --- a/test/tint/builtins/workgroupUniformLoad/array.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/array.wgsl.expected.fxc.hlsl @@ -3,17 +3,17 @@ void unused_entry_point() { return; } -groupshared int v[4]; - -typedef int tint_workgroupUniformLoad_v_ret[4]; -tint_workgroupUniformLoad_v_ret tint_workgroupUniformLoad_v() { +typedef int tint_workgroupUniformLoad_ret[4]; +tint_workgroupUniformLoad_ret tint_workgroupUniformLoad(inout int p[4]) { GroupMemoryBarrierWithGroupSync(); - const int result[4] = v; + const int result[4] = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared int v[4]; + typedef int foo_ret[4]; foo_ret foo() { - return tint_workgroupUniformLoad_v(); + return tint_workgroupUniformLoad(v); } diff --git a/test/tint/builtins/workgroupUniformLoad/array.wgsl.expected.glsl b/test/tint/builtins/workgroupUniformLoad/array.wgsl.expected.glsl index cda9b79eea..661c13bd83 100644 --- a/test/tint/builtins/workgroupUniformLoad/array.wgsl.expected.glsl +++ b/test/tint/builtins/workgroupUniformLoad/array.wgsl.expected.glsl @@ -4,15 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -shared int v[4]; -int[4] tint_workgroupUniformLoad_v() { +int[4] tint_workgroupUniformLoad(inout int p[4]) { barrier(); - int result[4] = v; + int result[4] = p; barrier(); return result; } +shared int v[4]; int[4] foo() { - return tint_workgroupUniformLoad_v(); + return tint_workgroupUniformLoad(v); } diff --git a/test/tint/builtins/workgroupUniformLoad/array_overridable_count.wgsl.expected.dxc.hlsl b/test/tint/builtins/workgroupUniformLoad/array_overridable_count.wgsl.expected.dxc.hlsl index a42cbe5ada..1958f4a8e4 100644 --- a/test/tint/builtins/workgroupUniformLoad/array_overridable_count.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/array_overridable_count.wgsl.expected.dxc.hlsl @@ -3,17 +3,17 @@ void unused_entry_point() { return; } -groupshared int v[128]; - -typedef int tint_workgroupUniformLoad_v_ret[128]; -tint_workgroupUniformLoad_v_ret tint_workgroupUniformLoad_v() { +typedef int tint_workgroupUniformLoad_ret[128]; +tint_workgroupUniformLoad_ret tint_workgroupUniformLoad(inout int p[128]) { GroupMemoryBarrierWithGroupSync(); - const int result[128] = v; + const int result[128] = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared int v[128]; + int foo() { - const int tint_symbol[128] = tint_workgroupUniformLoad_v(); + const int tint_symbol[128] = tint_workgroupUniformLoad(v); return tint_symbol[0]; } diff --git a/test/tint/builtins/workgroupUniformLoad/array_overridable_count.wgsl.expected.fxc.hlsl b/test/tint/builtins/workgroupUniformLoad/array_overridable_count.wgsl.expected.fxc.hlsl index a42cbe5ada..1958f4a8e4 100644 --- a/test/tint/builtins/workgroupUniformLoad/array_overridable_count.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/array_overridable_count.wgsl.expected.fxc.hlsl @@ -3,17 +3,17 @@ void unused_entry_point() { return; } -groupshared int v[128]; - -typedef int tint_workgroupUniformLoad_v_ret[128]; -tint_workgroupUniformLoad_v_ret tint_workgroupUniformLoad_v() { +typedef int tint_workgroupUniformLoad_ret[128]; +tint_workgroupUniformLoad_ret tint_workgroupUniformLoad(inout int p[128]) { GroupMemoryBarrierWithGroupSync(); - const int result[128] = v; + const int result[128] = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared int v[128]; + int foo() { - const int tint_symbol[128] = tint_workgroupUniformLoad_v(); + const int tint_symbol[128] = tint_workgroupUniformLoad(v); return tint_symbol[0]; } diff --git a/test/tint/builtins/workgroupUniformLoad/array_overridable_count.wgsl.expected.glsl b/test/tint/builtins/workgroupUniformLoad/array_overridable_count.wgsl.expected.glsl index 6e551e8424..fa1338771a 100644 --- a/test/tint/builtins/workgroupUniformLoad/array_overridable_count.wgsl.expected.glsl +++ b/test/tint/builtins/workgroupUniformLoad/array_overridable_count.wgsl.expected.glsl @@ -4,16 +4,16 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -shared int v[128]; -int[128] tint_workgroupUniformLoad_v() { +int[128] tint_workgroupUniformLoad(inout int p[128]) { barrier(); - int result[128] = v; + int result[128] = p; barrier(); return result; } +shared int v[128]; int foo() { - int tint_symbol[128] = tint_workgroupUniformLoad_v(); + int tint_symbol[128] = tint_workgroupUniformLoad(v); return tint_symbol[0]; } diff --git a/test/tint/builtins/workgroupUniformLoad/array_overridable_count_aliased.wgsl.expected.dxc.hlsl b/test/tint/builtins/workgroupUniformLoad/array_overridable_count_aliased.wgsl.expected.dxc.hlsl index a42cbe5ada..1958f4a8e4 100644 --- a/test/tint/builtins/workgroupUniformLoad/array_overridable_count_aliased.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/array_overridable_count_aliased.wgsl.expected.dxc.hlsl @@ -3,17 +3,17 @@ void unused_entry_point() { return; } -groupshared int v[128]; - -typedef int tint_workgroupUniformLoad_v_ret[128]; -tint_workgroupUniformLoad_v_ret tint_workgroupUniformLoad_v() { +typedef int tint_workgroupUniformLoad_ret[128]; +tint_workgroupUniformLoad_ret tint_workgroupUniformLoad(inout int p[128]) { GroupMemoryBarrierWithGroupSync(); - const int result[128] = v; + const int result[128] = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared int v[128]; + int foo() { - const int tint_symbol[128] = tint_workgroupUniformLoad_v(); + const int tint_symbol[128] = tint_workgroupUniformLoad(v); return tint_symbol[0]; } diff --git a/test/tint/builtins/workgroupUniformLoad/array_overridable_count_aliased.wgsl.expected.fxc.hlsl b/test/tint/builtins/workgroupUniformLoad/array_overridable_count_aliased.wgsl.expected.fxc.hlsl index a42cbe5ada..1958f4a8e4 100644 --- a/test/tint/builtins/workgroupUniformLoad/array_overridable_count_aliased.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/array_overridable_count_aliased.wgsl.expected.fxc.hlsl @@ -3,17 +3,17 @@ void unused_entry_point() { return; } -groupshared int v[128]; - -typedef int tint_workgroupUniformLoad_v_ret[128]; -tint_workgroupUniformLoad_v_ret tint_workgroupUniformLoad_v() { +typedef int tint_workgroupUniformLoad_ret[128]; +tint_workgroupUniformLoad_ret tint_workgroupUniformLoad(inout int p[128]) { GroupMemoryBarrierWithGroupSync(); - const int result[128] = v; + const int result[128] = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared int v[128]; + int foo() { - const int tint_symbol[128] = tint_workgroupUniformLoad_v(); + const int tint_symbol[128] = tint_workgroupUniformLoad(v); return tint_symbol[0]; } diff --git a/test/tint/builtins/workgroupUniformLoad/array_overridable_count_aliased.wgsl.expected.glsl b/test/tint/builtins/workgroupUniformLoad/array_overridable_count_aliased.wgsl.expected.glsl index 6e551e8424..fa1338771a 100644 --- a/test/tint/builtins/workgroupUniformLoad/array_overridable_count_aliased.wgsl.expected.glsl +++ b/test/tint/builtins/workgroupUniformLoad/array_overridable_count_aliased.wgsl.expected.glsl @@ -4,16 +4,16 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -shared int v[128]; -int[128] tint_workgroupUniformLoad_v() { +int[128] tint_workgroupUniformLoad(inout int p[128]) { barrier(); - int result[128] = v; + int result[128] = p; barrier(); return result; } +shared int v[128]; int foo() { - int tint_symbol[128] = tint_workgroupUniformLoad_v(); + int tint_symbol[128] = tint_workgroupUniformLoad(v); return tint_symbol[0]; } diff --git a/test/tint/builtins/workgroupUniformLoad/bool.wgsl.expected.dxc.hlsl b/test/tint/builtins/workgroupUniformLoad/bool.wgsl.expected.dxc.hlsl index afb3e79e35..28f1e19ff3 100644 --- a/test/tint/builtins/workgroupUniformLoad/bool.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/bool.wgsl.expected.dxc.hlsl @@ -3,15 +3,15 @@ void unused_entry_point() { return; } -groupshared bool v; - -bool tint_workgroupUniformLoad_v() { +bool tint_workgroupUniformLoad(inout bool p) { GroupMemoryBarrierWithGroupSync(); - const bool result = v; + const bool result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared bool v; + bool foo() { - return tint_workgroupUniformLoad_v(); + return tint_workgroupUniformLoad(v); } diff --git a/test/tint/builtins/workgroupUniformLoad/bool.wgsl.expected.fxc.hlsl b/test/tint/builtins/workgroupUniformLoad/bool.wgsl.expected.fxc.hlsl index afb3e79e35..28f1e19ff3 100644 --- a/test/tint/builtins/workgroupUniformLoad/bool.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/bool.wgsl.expected.fxc.hlsl @@ -3,15 +3,15 @@ void unused_entry_point() { return; } -groupshared bool v; - -bool tint_workgroupUniformLoad_v() { +bool tint_workgroupUniformLoad(inout bool p) { GroupMemoryBarrierWithGroupSync(); - const bool result = v; + const bool result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared bool v; + bool foo() { - return tint_workgroupUniformLoad_v(); + return tint_workgroupUniformLoad(v); } diff --git a/test/tint/builtins/workgroupUniformLoad/bool.wgsl.expected.glsl b/test/tint/builtins/workgroupUniformLoad/bool.wgsl.expected.glsl index 4962454001..9793dba937 100644 --- a/test/tint/builtins/workgroupUniformLoad/bool.wgsl.expected.glsl +++ b/test/tint/builtins/workgroupUniformLoad/bool.wgsl.expected.glsl @@ -4,15 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -shared bool v; -bool tint_workgroupUniformLoad_v() { +bool tint_workgroupUniformLoad(inout bool p) { barrier(); - bool result = v; + bool result = p; barrier(); return result; } +shared bool v; bool foo() { - return tint_workgroupUniformLoad_v(); + return tint_workgroupUniformLoad(v); } diff --git a/test/tint/builtins/workgroupUniformLoad/for_loop.wgsl.expected.dxc.hlsl b/test/tint/builtins/workgroupUniformLoad/for_loop.wgsl.expected.dxc.hlsl index ec2335593c..98df2c2bb4 100644 --- a/test/tint/builtins/workgroupUniformLoad/for_loop.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/for_loop.wgsl.expected.dxc.hlsl @@ -3,30 +3,22 @@ void unused_entry_point() { return; } +int tint_workgroupUniformLoad(inout int p) { + GroupMemoryBarrierWithGroupSync(); + const int result = p; + GroupMemoryBarrierWithGroupSync(); + return result; +} + groupshared int a; - -int tint_workgroupUniformLoad_a() { - GroupMemoryBarrierWithGroupSync(); - const int result = a; - GroupMemoryBarrierWithGroupSync(); - return result; -} - groupshared int b; -int tint_workgroupUniformLoad_b() { - GroupMemoryBarrierWithGroupSync(); - const int result = b; - GroupMemoryBarrierWithGroupSync(); - return result; -} - void foo() { { int i = 0; while (true) { const int tint_symbol = i; - const int tint_symbol_1 = tint_workgroupUniformLoad_a(); + const int tint_symbol_1 = tint_workgroupUniformLoad(a); if (!((tint_symbol < tint_symbol_1))) { break; } @@ -34,7 +26,7 @@ void foo() { } { const int tint_symbol_2 = i; - const int tint_symbol_3 = tint_workgroupUniformLoad_b(); + const int tint_symbol_3 = tint_workgroupUniformLoad(b); i = (tint_symbol_2 + tint_symbol_3); } } diff --git a/test/tint/builtins/workgroupUniformLoad/for_loop.wgsl.expected.fxc.hlsl b/test/tint/builtins/workgroupUniformLoad/for_loop.wgsl.expected.fxc.hlsl index ec2335593c..98df2c2bb4 100644 --- a/test/tint/builtins/workgroupUniformLoad/for_loop.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/for_loop.wgsl.expected.fxc.hlsl @@ -3,30 +3,22 @@ void unused_entry_point() { return; } +int tint_workgroupUniformLoad(inout int p) { + GroupMemoryBarrierWithGroupSync(); + const int result = p; + GroupMemoryBarrierWithGroupSync(); + return result; +} + groupshared int a; - -int tint_workgroupUniformLoad_a() { - GroupMemoryBarrierWithGroupSync(); - const int result = a; - GroupMemoryBarrierWithGroupSync(); - return result; -} - groupshared int b; -int tint_workgroupUniformLoad_b() { - GroupMemoryBarrierWithGroupSync(); - const int result = b; - GroupMemoryBarrierWithGroupSync(); - return result; -} - void foo() { { int i = 0; while (true) { const int tint_symbol = i; - const int tint_symbol_1 = tint_workgroupUniformLoad_a(); + const int tint_symbol_1 = tint_workgroupUniformLoad(a); if (!((tint_symbol < tint_symbol_1))) { break; } @@ -34,7 +26,7 @@ void foo() { } { const int tint_symbol_2 = i; - const int tint_symbol_3 = tint_workgroupUniformLoad_b(); + const int tint_symbol_3 = tint_workgroupUniformLoad(b); i = (tint_symbol_2 + tint_symbol_3); } } diff --git a/test/tint/builtins/workgroupUniformLoad/for_loop.wgsl.expected.glsl b/test/tint/builtins/workgroupUniformLoad/for_loop.wgsl.expected.glsl index 09c4abe004..97926d0be0 100644 --- a/test/tint/builtins/workgroupUniformLoad/for_loop.wgsl.expected.glsl +++ b/test/tint/builtins/workgroupUniformLoad/for_loop.wgsl.expected.glsl @@ -4,28 +4,21 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } +int tint_workgroupUniformLoad(inout int p) { + barrier(); + int result = p; + barrier(); + return result; +} + shared int a; -int tint_workgroupUniformLoad_a() { - barrier(); - int result = a; - barrier(); - return result; -} - shared int b; -int tint_workgroupUniformLoad_b() { - barrier(); - int result = b; - barrier(); - return result; -} - void foo() { { int i = 0; while (true) { int tint_symbol = i; - int tint_symbol_1 = tint_workgroupUniformLoad_a(); + int tint_symbol_1 = tint_workgroupUniformLoad(a); if (!((tint_symbol < tint_symbol_1))) { break; } @@ -33,7 +26,7 @@ void foo() { } { int tint_symbol_2 = i; - int tint_symbol_3 = tint_workgroupUniformLoad_b(); + int tint_symbol_3 = tint_workgroupUniformLoad(b); i = (tint_symbol_2 + tint_symbol_3); } } diff --git a/test/tint/builtins/workgroupUniformLoad/if_condition.wgsl.expected.dxc.hlsl b/test/tint/builtins/workgroupUniformLoad/if_condition.wgsl.expected.dxc.hlsl index 48a589fa32..bfc2a25291 100644 --- a/test/tint/builtins/workgroupUniformLoad/if_condition.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/if_condition.wgsl.expected.dxc.hlsl @@ -3,17 +3,17 @@ void unused_entry_point() { return; } -groupshared bool v; - -bool tint_workgroupUniformLoad_v() { +bool tint_workgroupUniformLoad(inout bool p) { GroupMemoryBarrierWithGroupSync(); - const bool result = v; + const bool result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared bool v; + int foo() { - if (tint_workgroupUniformLoad_v()) { + if (tint_workgroupUniformLoad(v)) { return 42; } return 0; diff --git a/test/tint/builtins/workgroupUniformLoad/if_condition.wgsl.expected.fxc.hlsl b/test/tint/builtins/workgroupUniformLoad/if_condition.wgsl.expected.fxc.hlsl index 48a589fa32..bfc2a25291 100644 --- a/test/tint/builtins/workgroupUniformLoad/if_condition.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/if_condition.wgsl.expected.fxc.hlsl @@ -3,17 +3,17 @@ void unused_entry_point() { return; } -groupshared bool v; - -bool tint_workgroupUniformLoad_v() { +bool tint_workgroupUniformLoad(inout bool p) { GroupMemoryBarrierWithGroupSync(); - const bool result = v; + const bool result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared bool v; + int foo() { - if (tint_workgroupUniformLoad_v()) { + if (tint_workgroupUniformLoad(v)) { return 42; } return 0; diff --git a/test/tint/builtins/workgroupUniformLoad/if_condition.wgsl.expected.glsl b/test/tint/builtins/workgroupUniformLoad/if_condition.wgsl.expected.glsl index ad15d258d8..ef53245214 100644 --- a/test/tint/builtins/workgroupUniformLoad/if_condition.wgsl.expected.glsl +++ b/test/tint/builtins/workgroupUniformLoad/if_condition.wgsl.expected.glsl @@ -4,16 +4,16 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -shared bool v; -bool tint_workgroupUniformLoad_v() { +bool tint_workgroupUniformLoad(inout bool p) { barrier(); - bool result = v; + bool result = p; barrier(); return result; } +shared bool v; int foo() { - if (tint_workgroupUniformLoad_v()) { + if (tint_workgroupUniformLoad(v)) { return 42; } return 0; diff --git a/test/tint/builtins/workgroupUniformLoad/matrix.wgsl.expected.dxc.hlsl b/test/tint/builtins/workgroupUniformLoad/matrix.wgsl.expected.dxc.hlsl index 1b22b46bfb..053093e383 100644 --- a/test/tint/builtins/workgroupUniformLoad/matrix.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/matrix.wgsl.expected.dxc.hlsl @@ -3,15 +3,15 @@ void unused_entry_point() { return; } -groupshared float3x3 v; - -float3x3 tint_workgroupUniformLoad_v() { +float3x3 tint_workgroupUniformLoad(inout float3x3 p) { GroupMemoryBarrierWithGroupSync(); - const float3x3 result = v; + const float3x3 result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared float3x3 v; + float3x3 foo() { - return tint_workgroupUniformLoad_v(); + return tint_workgroupUniformLoad(v); } diff --git a/test/tint/builtins/workgroupUniformLoad/matrix.wgsl.expected.fxc.hlsl b/test/tint/builtins/workgroupUniformLoad/matrix.wgsl.expected.fxc.hlsl index 1b22b46bfb..053093e383 100644 --- a/test/tint/builtins/workgroupUniformLoad/matrix.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/matrix.wgsl.expected.fxc.hlsl @@ -3,15 +3,15 @@ void unused_entry_point() { return; } -groupshared float3x3 v; - -float3x3 tint_workgroupUniformLoad_v() { +float3x3 tint_workgroupUniformLoad(inout float3x3 p) { GroupMemoryBarrierWithGroupSync(); - const float3x3 result = v; + const float3x3 result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared float3x3 v; + float3x3 foo() { - return tint_workgroupUniformLoad_v(); + return tint_workgroupUniformLoad(v); } diff --git a/test/tint/builtins/workgroupUniformLoad/matrix.wgsl.expected.glsl b/test/tint/builtins/workgroupUniformLoad/matrix.wgsl.expected.glsl index ac70b34a82..86ea506210 100644 --- a/test/tint/builtins/workgroupUniformLoad/matrix.wgsl.expected.glsl +++ b/test/tint/builtins/workgroupUniformLoad/matrix.wgsl.expected.glsl @@ -4,15 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -shared mat3 v; -mat3 tint_workgroupUniformLoad_v() { +mat3 tint_workgroupUniformLoad(inout mat3 p) { barrier(); - mat3 result = v; + mat3 result = p; barrier(); return result; } +shared mat3 v; mat3 foo() { - return tint_workgroupUniformLoad_v(); + return tint_workgroupUniformLoad(v); } diff --git a/test/tint/builtins/workgroupUniformLoad/structures.wgsl.expected.dxc.hlsl b/test/tint/builtins/workgroupUniformLoad/structures.wgsl.expected.dxc.hlsl index eb3a52c98a..201beaca58 100644 --- a/test/tint/builtins/workgroupUniformLoad/structures.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/structures.wgsl.expected.dxc.hlsl @@ -12,15 +12,15 @@ struct Outer { Inner a[4]; }; -groupshared Outer v; - -Outer tint_workgroupUniformLoad_v() { +Outer tint_workgroupUniformLoad(inout Outer p) { GroupMemoryBarrierWithGroupSync(); - const Outer result = v; + const Outer result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared Outer v; + Outer foo() { - return tint_workgroupUniformLoad_v(); + return tint_workgroupUniformLoad(v); } diff --git a/test/tint/builtins/workgroupUniformLoad/structures.wgsl.expected.fxc.hlsl b/test/tint/builtins/workgroupUniformLoad/structures.wgsl.expected.fxc.hlsl index eb3a52c98a..201beaca58 100644 --- a/test/tint/builtins/workgroupUniformLoad/structures.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/structures.wgsl.expected.fxc.hlsl @@ -12,15 +12,15 @@ struct Outer { Inner a[4]; }; -groupshared Outer v; - -Outer tint_workgroupUniformLoad_v() { +Outer tint_workgroupUniformLoad(inout Outer p) { GroupMemoryBarrierWithGroupSync(); - const Outer result = v; + const Outer result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared Outer v; + Outer foo() { - return tint_workgroupUniformLoad_v(); + return tint_workgroupUniformLoad(v); } diff --git a/test/tint/builtins/workgroupUniformLoad/structures.wgsl.expected.glsl b/test/tint/builtins/workgroupUniformLoad/structures.wgsl.expected.glsl index 7f9766a584..203e90d897 100644 --- a/test/tint/builtins/workgroupUniformLoad/structures.wgsl.expected.glsl +++ b/test/tint/builtins/workgroupUniformLoad/structures.wgsl.expected.glsl @@ -14,15 +14,15 @@ struct Outer { Inner a[4]; }; -shared Outer v; -Outer tint_workgroupUniformLoad_v() { +Outer tint_workgroupUniformLoad(inout Outer p) { barrier(); - Outer result = v; + Outer result = p; barrier(); return result; } +shared Outer v; Outer foo() { - return tint_workgroupUniformLoad_v(); + return tint_workgroupUniformLoad(v); } diff --git a/test/tint/builtins/workgroupUniformLoad/vec.wgsl.expected.dxc.hlsl b/test/tint/builtins/workgroupUniformLoad/vec.wgsl.expected.dxc.hlsl index 80cd6df3bd..77473c2061 100644 --- a/test/tint/builtins/workgroupUniformLoad/vec.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/vec.wgsl.expected.dxc.hlsl @@ -3,15 +3,15 @@ void unused_entry_point() { return; } -groupshared float4 v; - -float4 tint_workgroupUniformLoad_v() { +float4 tint_workgroupUniformLoad(inout float4 p) { GroupMemoryBarrierWithGroupSync(); - const float4 result = v; + const float4 result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared float4 v; + float4 foo() { - return tint_workgroupUniformLoad_v(); + return tint_workgroupUniformLoad(v); } diff --git a/test/tint/builtins/workgroupUniformLoad/vec.wgsl.expected.fxc.hlsl b/test/tint/builtins/workgroupUniformLoad/vec.wgsl.expected.fxc.hlsl index 80cd6df3bd..77473c2061 100644 --- a/test/tint/builtins/workgroupUniformLoad/vec.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/vec.wgsl.expected.fxc.hlsl @@ -3,15 +3,15 @@ void unused_entry_point() { return; } -groupshared float4 v; - -float4 tint_workgroupUniformLoad_v() { +float4 tint_workgroupUniformLoad(inout float4 p) { GroupMemoryBarrierWithGroupSync(); - const float4 result = v; + const float4 result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared float4 v; + float4 foo() { - return tint_workgroupUniformLoad_v(); + return tint_workgroupUniformLoad(v); } diff --git a/test/tint/builtins/workgroupUniformLoad/vec.wgsl.expected.glsl b/test/tint/builtins/workgroupUniformLoad/vec.wgsl.expected.glsl index f4dc643d52..76e29ed5c6 100644 --- a/test/tint/builtins/workgroupUniformLoad/vec.wgsl.expected.glsl +++ b/test/tint/builtins/workgroupUniformLoad/vec.wgsl.expected.glsl @@ -4,15 +4,15 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -shared vec4 v; -vec4 tint_workgroupUniformLoad_v() { +vec4 tint_workgroupUniformLoad(inout vec4 p) { barrier(); - vec4 result = v; + vec4 result = p; barrier(); return result; } +shared vec4 v; vec4 foo() { - return tint_workgroupUniformLoad_v(); + return tint_workgroupUniformLoad(v); } diff --git a/test/tint/builtins/workgroupUniformLoad/via_param.wgsl.expected.dxc.hlsl b/test/tint/builtins/workgroupUniformLoad/via_param.wgsl.expected.dxc.hlsl index de20d9c6df..2d0fe18852 100644 --- a/test/tint/builtins/workgroupUniformLoad/via_param.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/via_param.wgsl.expected.dxc.hlsl @@ -3,21 +3,20 @@ void unused_entry_point() { return; } -groupshared int v[4]; - -int tint_workgroupUniformLoad_v_X(uint p[1]) { +int tint_workgroupUniformLoad(inout int p) { GroupMemoryBarrierWithGroupSync(); - const int result = v[p[0]]; + const int result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared int v[4]; + int foo_v_X(uint p[1]) { - const uint tint_symbol[1] = {p[0u]}; - return tint_workgroupUniformLoad_v_X(tint_symbol); + return tint_workgroupUniformLoad(v[p[0]]); } int bar() { - const uint tint_symbol_1[1] = (uint[1])0; - return foo_v_X(tint_symbol_1); + const uint tint_symbol[1] = (uint[1])0; + return foo_v_X(tint_symbol); } diff --git a/test/tint/builtins/workgroupUniformLoad/via_param.wgsl.expected.fxc.hlsl b/test/tint/builtins/workgroupUniformLoad/via_param.wgsl.expected.fxc.hlsl index de20d9c6df..2d0fe18852 100644 --- a/test/tint/builtins/workgroupUniformLoad/via_param.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/workgroupUniformLoad/via_param.wgsl.expected.fxc.hlsl @@ -3,21 +3,20 @@ void unused_entry_point() { return; } -groupshared int v[4]; - -int tint_workgroupUniformLoad_v_X(uint p[1]) { +int tint_workgroupUniformLoad(inout int p) { GroupMemoryBarrierWithGroupSync(); - const int result = v[p[0]]; + const int result = p; GroupMemoryBarrierWithGroupSync(); return result; } +groupshared int v[4]; + int foo_v_X(uint p[1]) { - const uint tint_symbol[1] = {p[0u]}; - return tint_workgroupUniformLoad_v_X(tint_symbol); + return tint_workgroupUniformLoad(v[p[0]]); } int bar() { - const uint tint_symbol_1[1] = (uint[1])0; - return foo_v_X(tint_symbol_1); + const uint tint_symbol[1] = (uint[1])0; + return foo_v_X(tint_symbol); } diff --git a/test/tint/builtins/workgroupUniformLoad/via_param.wgsl.expected.glsl b/test/tint/builtins/workgroupUniformLoad/via_param.wgsl.expected.glsl index 755546389a..aa2e549df4 100644 --- a/test/tint/builtins/workgroupUniformLoad/via_param.wgsl.expected.glsl +++ b/test/tint/builtins/workgroupUniformLoad/via_param.wgsl.expected.glsl @@ -4,21 +4,20 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -shared int v[4]; -int tint_workgroupUniformLoad_v_X(uint p[1]) { +int tint_workgroupUniformLoad(inout int p) { barrier(); - int result = v[p[0]]; + int result = p; barrier(); return result; } +shared int v[4]; int foo_v_X(uint p[1]) { - uint tint_symbol[1] = uint[1](p[0u]); - return tint_workgroupUniformLoad_v_X(tint_symbol); + return tint_workgroupUniformLoad(v[p[0]]); } int bar() { - uint tint_symbol_1[1] = uint[1](0u); - return foo_v_X(tint_symbol_1); + uint tint_symbol[1] = uint[1](0u); + return foo_v_X(tint_symbol); } diff --git a/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.spvasm index 89a507ffa9..4a87507e5e 100644 --- a/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod/scalar-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 46 +; Bound: 39 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,62 +10,49 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" %int = OpTypeInt 32 1 %1 = OpTypeFunction %int %int %int + %8 = OpConstantNull %int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %10 = OpConstantNull %bool -%_ptr_Function_int = OpTypePointer Function %int - %13 = OpConstantNull %int %int_n2147483648 = OpConstant %int -2147483648 %int_n1 = OpConstant %int -1 %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_2147483648 = OpConstant %uint 2147483648 - %29 = OpConstantNull %uint - %true = OpConstantTrue %bool + %24 = OpConstantNull %uint %void = OpTypeVoid - %40 = OpTypeFunction %void + %33 = OpTypeFunction %void %int_2 = OpConstant %int 2 %tint_mod = OpFunction %int None %1 %lhs = OpFunctionParameter %int %rhs = OpFunctionParameter %int %6 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %10 -%tint_return_value = OpVariable %_ptr_Function_int Function %13 - %15 = OpIEqual %bool %rhs %13 - %17 = OpIEqual %bool %lhs %int_n2147483648 - %19 = OpIEqual %bool %rhs %int_n1 - %20 = OpLogicalAnd %bool %17 %19 - %21 = OpLogicalOr %bool %15 %20 - %14 = OpSelect %int %21 %int_1 %rhs - %26 = OpBitwiseOr %int %lhs %14 - %24 = OpBitcast %uint %26 - %28 = OpBitwiseAnd %uint %24 %uint_2147483648 - %30 = OpINotEqual %bool %28 %29 - OpSelectionMerge %31 None - OpBranchConditional %30 %32 %33 - %32 = OpLabel - OpStore %tint_return_flag %true - %35 = OpSDiv %int %lhs %14 - %36 = OpIMul %int %35 %14 - %37 = OpISub %int %lhs %36 - OpStore %tint_return_value %37 - OpBranch %31 - %33 = OpLabel - OpStore %tint_return_flag %true - %38 = OpSRem %int %lhs %14 - OpStore %tint_return_value %38 - OpBranch %31 - %31 = OpLabel - %39 = OpLoad %int %tint_return_value - OpReturnValue %39 + %9 = OpIEqual %bool %rhs %8 + %12 = OpIEqual %bool %lhs %int_n2147483648 + %14 = OpIEqual %bool %rhs %int_n1 + %15 = OpLogicalAnd %bool %12 %14 + %16 = OpLogicalOr %bool %9 %15 + %7 = OpSelect %int %16 %int_1 %rhs + %21 = OpBitwiseOr %int %lhs %7 + %19 = OpBitcast %uint %21 + %23 = OpBitwiseAnd %uint %19 %uint_2147483648 + %25 = OpINotEqual %bool %23 %24 + OpSelectionMerge %26 None + OpBranchConditional %25 %27 %28 + %27 = OpLabel + %29 = OpSDiv %int %lhs %7 + %30 = OpIMul %int %29 %7 + %31 = OpISub %int %lhs %30 + OpReturnValue %31 + %28 = OpLabel + %32 = OpSRem %int %lhs %7 + OpReturnValue %32 + %26 = OpLabel + OpReturnValue %8 OpFunctionEnd - %f = OpFunction %void None %40 - %43 = OpLabel - %45 = OpFunctionCall %int %tint_mod %int_1 %int_2 + %f = OpFunction %void None %33 + %36 = OpLabel + %38 = OpFunctionCall %int %tint_mod %int_1 %int_2 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.spvasm index 749734c9a1..707d590394 100644 --- a/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod/scalar-vec3/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 57 +; Bound: 50 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,74 +10,61 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %1 = OpTypeFunction %v3int %int %v3int + %10 = OpConstantNull %v3int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %11 = OpConstantNull %bool -%_ptr_Function_v3int = OpTypePointer Function %v3int - %14 = OpConstantNull %v3int %v3bool = OpTypeVector %bool 3 %int_n2147483648 = OpConstant %int -2147483648 - %20 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 + %15 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n1 = OpConstant %int -1 - %23 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 + %18 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 %int_1 = OpConstant %int 1 - %28 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %23 = OpConstantComposite %v3int %int_1 %int_1 %int_1 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %uint_2147483648 = OpConstant %uint 2147483648 - %35 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 - %37 = OpConstantNull %v3uint - %true = OpConstantTrue %bool + %30 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 + %32 = OpConstantNull %v3uint %void = OpTypeVoid - %48 = OpTypeFunction %void + %41 = OpTypeFunction %void %int_4 = OpConstant %int 4 %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 - %55 = OpConstantComposite %v3int %int_1 %int_2 %int_3 + %48 = OpConstantComposite %v3int %int_1 %int_2 %int_3 %tint_mod = OpFunction %v3int None %1 %lhs = OpFunctionParameter %int %rhs = OpFunctionParameter %v3int %7 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %11 -%tint_return_value = OpVariable %_ptr_Function_v3int Function %14 - %15 = OpCompositeConstruct %v3int %lhs %lhs %lhs - %17 = OpIEqual %v3bool %rhs %14 - %21 = OpIEqual %v3bool %15 %20 - %24 = OpIEqual %v3bool %rhs %23 - %25 = OpLogicalAnd %v3bool %21 %24 - %26 = OpLogicalOr %v3bool %17 %25 - %16 = OpSelect %v3int %26 %28 %rhs - %33 = OpBitwiseOr %v3int %15 %16 - %30 = OpBitcast %v3uint %33 - %36 = OpBitwiseAnd %v3uint %30 %35 - %38 = OpINotEqual %v3bool %36 %37 - %29 = OpAny %bool %38 - OpSelectionMerge %39 None - OpBranchConditional %29 %40 %41 - %40 = OpLabel - OpStore %tint_return_flag %true - %43 = OpSDiv %v3int %15 %16 - %44 = OpIMul %v3int %43 %16 - %45 = OpISub %v3int %15 %44 - OpStore %tint_return_value %45 - OpBranch %39 - %41 = OpLabel - OpStore %tint_return_flag %true - %46 = OpSRem %v3int %15 %16 - OpStore %tint_return_value %46 - OpBranch %39 - %39 = OpLabel - %47 = OpLoad %v3int %tint_return_value - OpReturnValue %47 + %8 = OpCompositeConstruct %v3int %lhs %lhs %lhs + %11 = OpIEqual %v3bool %rhs %10 + %16 = OpIEqual %v3bool %8 %15 + %19 = OpIEqual %v3bool %rhs %18 + %20 = OpLogicalAnd %v3bool %16 %19 + %21 = OpLogicalOr %v3bool %11 %20 + %9 = OpSelect %v3int %21 %23 %rhs + %28 = OpBitwiseOr %v3int %8 %9 + %25 = OpBitcast %v3uint %28 + %31 = OpBitwiseAnd %v3uint %25 %30 + %33 = OpINotEqual %v3bool %31 %32 + %24 = OpAny %bool %33 + OpSelectionMerge %34 None + OpBranchConditional %24 %35 %36 + %35 = OpLabel + %37 = OpSDiv %v3int %8 %9 + %38 = OpIMul %v3int %37 %9 + %39 = OpISub %v3int %8 %38 + OpReturnValue %39 + %36 = OpLabel + %40 = OpSRem %v3int %8 %9 + OpReturnValue %40 + %34 = OpLabel + OpReturnValue %10 OpFunctionEnd - %f = OpFunction %void None %48 - %51 = OpLabel - %56 = OpFunctionCall %v3int %tint_mod %int_4 %55 + %f = OpFunction %void None %41 + %44 = OpLabel + %49 = OpFunctionCall %v3int %tint_mod %int_4 %48 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.spvasm index 52fbedbbeb..6b884aa710 100644 --- a/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod/vec3-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 57 +; Bound: 50 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,74 +10,61 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %1 = OpTypeFunction %v3int %v3int %int + %10 = OpConstantNull %v3int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %11 = OpConstantNull %bool -%_ptr_Function_v3int = OpTypePointer Function %v3int - %14 = OpConstantNull %v3int %v3bool = OpTypeVector %bool 3 %int_n2147483648 = OpConstant %int -2147483648 - %20 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 + %15 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n1 = OpConstant %int -1 - %23 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 + %18 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 %int_1 = OpConstant %int 1 - %28 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %23 = OpConstantComposite %v3int %int_1 %int_1 %int_1 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %uint_2147483648 = OpConstant %uint 2147483648 - %35 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 - %37 = OpConstantNull %v3uint - %true = OpConstantTrue %bool + %30 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 + %32 = OpConstantNull %v3uint %void = OpTypeVoid - %48 = OpTypeFunction %void + %41 = OpTypeFunction %void %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 - %54 = OpConstantComposite %v3int %int_1 %int_2 %int_3 + %47 = OpConstantComposite %v3int %int_1 %int_2 %int_3 %int_4 = OpConstant %int 4 %tint_mod = OpFunction %v3int None %1 %lhs = OpFunctionParameter %v3int %rhs = OpFunctionParameter %int %7 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %11 -%tint_return_value = OpVariable %_ptr_Function_v3int Function %14 - %15 = OpCompositeConstruct %v3int %rhs %rhs %rhs - %17 = OpIEqual %v3bool %15 %14 - %21 = OpIEqual %v3bool %lhs %20 - %24 = OpIEqual %v3bool %15 %23 - %25 = OpLogicalAnd %v3bool %21 %24 - %26 = OpLogicalOr %v3bool %17 %25 - %16 = OpSelect %v3int %26 %28 %15 - %33 = OpBitwiseOr %v3int %lhs %16 - %30 = OpBitcast %v3uint %33 - %36 = OpBitwiseAnd %v3uint %30 %35 - %38 = OpINotEqual %v3bool %36 %37 - %29 = OpAny %bool %38 - OpSelectionMerge %39 None - OpBranchConditional %29 %40 %41 - %40 = OpLabel - OpStore %tint_return_flag %true - %43 = OpSDiv %v3int %lhs %16 - %44 = OpIMul %v3int %43 %16 - %45 = OpISub %v3int %lhs %44 - OpStore %tint_return_value %45 - OpBranch %39 - %41 = OpLabel - OpStore %tint_return_flag %true - %46 = OpSRem %v3int %lhs %16 - OpStore %tint_return_value %46 - OpBranch %39 - %39 = OpLabel - %47 = OpLoad %v3int %tint_return_value - OpReturnValue %47 + %8 = OpCompositeConstruct %v3int %rhs %rhs %rhs + %11 = OpIEqual %v3bool %8 %10 + %16 = OpIEqual %v3bool %lhs %15 + %19 = OpIEqual %v3bool %8 %18 + %20 = OpLogicalAnd %v3bool %16 %19 + %21 = OpLogicalOr %v3bool %11 %20 + %9 = OpSelect %v3int %21 %23 %8 + %28 = OpBitwiseOr %v3int %lhs %9 + %25 = OpBitcast %v3uint %28 + %31 = OpBitwiseAnd %v3uint %25 %30 + %33 = OpINotEqual %v3bool %31 %32 + %24 = OpAny %bool %33 + OpSelectionMerge %34 None + OpBranchConditional %24 %35 %36 + %35 = OpLabel + %37 = OpSDiv %v3int %lhs %9 + %38 = OpIMul %v3int %37 %9 + %39 = OpISub %v3int %lhs %38 + OpReturnValue %39 + %36 = OpLabel + %40 = OpSRem %v3int %lhs %9 + OpReturnValue %40 + %34 = OpLabel + OpReturnValue %10 OpFunctionEnd - %f = OpFunction %void None %48 - %51 = OpLabel - %56 = OpFunctionCall %v3int %tint_mod %54 %int_4 + %f = OpFunction %void None %41 + %44 = OpLabel + %49 = OpFunctionCall %v3int %tint_mod %47 %int_4 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.spvasm index 92536c9cab..86a721be4f 100644 --- a/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod/vec3-vec3/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 59 +; Bound: 52 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,76 +10,63 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %1 = OpTypeFunction %v3int %v3int %v3int + %9 = OpConstantNull %v3int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %11 = OpConstantNull %bool -%_ptr_Function_v3int = OpTypePointer Function %v3int - %14 = OpConstantNull %v3int %v3bool = OpTypeVector %bool 3 %int_n2147483648 = OpConstant %int -2147483648 - %19 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 + %14 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n1 = OpConstant %int -1 - %22 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 + %17 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 %int_1 = OpConstant %int 1 - %27 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %22 = OpConstantComposite %v3int %int_1 %int_1 %int_1 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %uint_2147483648 = OpConstant %uint 2147483648 - %34 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 - %36 = OpConstantNull %v3uint - %true = OpConstantTrue %bool + %29 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 + %31 = OpConstantNull %v3uint %void = OpTypeVoid - %47 = OpTypeFunction %void + %40 = OpTypeFunction %void %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 - %53 = OpConstantComposite %v3int %int_1 %int_2 %int_3 + %46 = OpConstantComposite %v3int %int_1 %int_2 %int_3 %int_4 = OpConstant %int 4 %int_5 = OpConstant %int 5 %int_6 = OpConstant %int 6 - %57 = OpConstantComposite %v3int %int_4 %int_5 %int_6 + %50 = OpConstantComposite %v3int %int_4 %int_5 %int_6 %tint_mod = OpFunction %v3int None %1 %lhs = OpFunctionParameter %v3int %rhs = OpFunctionParameter %v3int %7 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %11 -%tint_return_value = OpVariable %_ptr_Function_v3int Function %14 - %16 = OpIEqual %v3bool %rhs %14 - %20 = OpIEqual %v3bool %lhs %19 - %23 = OpIEqual %v3bool %rhs %22 - %24 = OpLogicalAnd %v3bool %20 %23 - %25 = OpLogicalOr %v3bool %16 %24 - %15 = OpSelect %v3int %25 %27 %rhs - %32 = OpBitwiseOr %v3int %lhs %15 - %29 = OpBitcast %v3uint %32 - %35 = OpBitwiseAnd %v3uint %29 %34 - %37 = OpINotEqual %v3bool %35 %36 - %28 = OpAny %bool %37 - OpSelectionMerge %38 None - OpBranchConditional %28 %39 %40 - %39 = OpLabel - OpStore %tint_return_flag %true - %42 = OpSDiv %v3int %lhs %15 - %43 = OpIMul %v3int %42 %15 - %44 = OpISub %v3int %lhs %43 - OpStore %tint_return_value %44 - OpBranch %38 - %40 = OpLabel - OpStore %tint_return_flag %true - %45 = OpSRem %v3int %lhs %15 - OpStore %tint_return_value %45 - OpBranch %38 - %38 = OpLabel - %46 = OpLoad %v3int %tint_return_value - OpReturnValue %46 + %10 = OpIEqual %v3bool %rhs %9 + %15 = OpIEqual %v3bool %lhs %14 + %18 = OpIEqual %v3bool %rhs %17 + %19 = OpLogicalAnd %v3bool %15 %18 + %20 = OpLogicalOr %v3bool %10 %19 + %8 = OpSelect %v3int %20 %22 %rhs + %27 = OpBitwiseOr %v3int %lhs %8 + %24 = OpBitcast %v3uint %27 + %30 = OpBitwiseAnd %v3uint %24 %29 + %32 = OpINotEqual %v3bool %30 %31 + %23 = OpAny %bool %32 + OpSelectionMerge %33 None + OpBranchConditional %23 %34 %35 + %34 = OpLabel + %36 = OpSDiv %v3int %lhs %8 + %37 = OpIMul %v3int %36 %8 + %38 = OpISub %v3int %lhs %37 + OpReturnValue %38 + %35 = OpLabel + %39 = OpSRem %v3int %lhs %8 + OpReturnValue %39 + %33 = OpLabel + OpReturnValue %9 OpFunctionEnd - %f = OpFunction %void None %47 - %50 = OpLabel - %58 = OpFunctionCall %v3int %tint_mod %53 %57 + %f = OpFunction %void None %40 + %43 = OpLabel + %51 = OpFunctionCall %v3int %tint_mod %46 %50 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.spvasm index 5963a80b16..02476d0a68 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 45 +; Bound: 38 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,61 +10,48 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" %int = OpTypeInt 32 1 %1 = OpTypeFunction %int %int %int + %8 = OpConstantNull %int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %10 = OpConstantNull %bool -%_ptr_Function_int = OpTypePointer Function %int - %13 = OpConstantNull %int %int_n2147483648 = OpConstant %int -2147483648 %int_n1 = OpConstant %int -1 %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_2147483648 = OpConstant %uint 2147483648 - %29 = OpConstantNull %uint - %true = OpConstantTrue %bool + %24 = OpConstantNull %uint %void = OpTypeVoid - %40 = OpTypeFunction %void + %33 = OpTypeFunction %void %tint_mod = OpFunction %int None %1 %lhs = OpFunctionParameter %int %rhs = OpFunctionParameter %int %6 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %10 -%tint_return_value = OpVariable %_ptr_Function_int Function %13 - %15 = OpIEqual %bool %rhs %13 - %17 = OpIEqual %bool %lhs %int_n2147483648 - %19 = OpIEqual %bool %rhs %int_n1 - %20 = OpLogicalAnd %bool %17 %19 - %21 = OpLogicalOr %bool %15 %20 - %14 = OpSelect %int %21 %int_1 %rhs - %26 = OpBitwiseOr %int %lhs %14 - %24 = OpBitcast %uint %26 - %28 = OpBitwiseAnd %uint %24 %uint_2147483648 - %30 = OpINotEqual %bool %28 %29 - OpSelectionMerge %31 None - OpBranchConditional %30 %32 %33 - %32 = OpLabel - OpStore %tint_return_flag %true - %35 = OpSDiv %int %lhs %14 - %36 = OpIMul %int %35 %14 - %37 = OpISub %int %lhs %36 - OpStore %tint_return_value %37 - OpBranch %31 - %33 = OpLabel - OpStore %tint_return_flag %true - %38 = OpSRem %int %lhs %14 - OpStore %tint_return_value %38 - OpBranch %31 - %31 = OpLabel - %39 = OpLoad %int %tint_return_value - OpReturnValue %39 + %9 = OpIEqual %bool %rhs %8 + %12 = OpIEqual %bool %lhs %int_n2147483648 + %14 = OpIEqual %bool %rhs %int_n1 + %15 = OpLogicalAnd %bool %12 %14 + %16 = OpLogicalOr %bool %9 %15 + %7 = OpSelect %int %16 %int_1 %rhs + %21 = OpBitwiseOr %int %lhs %7 + %19 = OpBitcast %uint %21 + %23 = OpBitwiseAnd %uint %19 %uint_2147483648 + %25 = OpINotEqual %bool %23 %24 + OpSelectionMerge %26 None + OpBranchConditional %25 %27 %28 + %27 = OpLabel + %29 = OpSDiv %int %lhs %7 + %30 = OpIMul %int %29 %7 + %31 = OpISub %int %lhs %30 + OpReturnValue %31 + %28 = OpLabel + %32 = OpSRem %int %lhs %7 + OpReturnValue %32 + %26 = OpLabel + OpReturnValue %8 OpFunctionEnd - %f = OpFunction %void None %40 - %43 = OpLabel - %44 = OpFunctionCall %int %tint_mod %int_1 %13 + %f = OpFunction %void None %33 + %36 = OpLabel + %37 = OpFunctionCall %int %tint_mod %int_1 %8 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.spvasm index 11dd73e8cf..7f90f8162b 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/scalar-vec3/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 57 +; Bound: 50 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,74 +10,61 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %1 = OpTypeFunction %v3int %int %v3int + %10 = OpConstantNull %v3int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %11 = OpConstantNull %bool -%_ptr_Function_v3int = OpTypePointer Function %v3int - %14 = OpConstantNull %v3int %v3bool = OpTypeVector %bool 3 %int_n2147483648 = OpConstant %int -2147483648 - %20 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 + %15 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n1 = OpConstant %int -1 - %23 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 + %18 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 %int_1 = OpConstant %int 1 - %28 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %23 = OpConstantComposite %v3int %int_1 %int_1 %int_1 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %uint_2147483648 = OpConstant %uint 2147483648 - %35 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 - %37 = OpConstantNull %v3uint - %true = OpConstantTrue %bool + %30 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 + %32 = OpConstantNull %v3uint %void = OpTypeVoid - %48 = OpTypeFunction %void + %41 = OpTypeFunction %void %int_4 = OpConstant %int 4 - %53 = OpConstantNull %int + %46 = OpConstantNull %int %int_2 = OpConstant %int 2 - %55 = OpConstantComposite %v3int %53 %int_2 %53 + %48 = OpConstantComposite %v3int %46 %int_2 %46 %tint_mod = OpFunction %v3int None %1 %lhs = OpFunctionParameter %int %rhs = OpFunctionParameter %v3int %7 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %11 -%tint_return_value = OpVariable %_ptr_Function_v3int Function %14 - %15 = OpCompositeConstruct %v3int %lhs %lhs %lhs - %17 = OpIEqual %v3bool %rhs %14 - %21 = OpIEqual %v3bool %15 %20 - %24 = OpIEqual %v3bool %rhs %23 - %25 = OpLogicalAnd %v3bool %21 %24 - %26 = OpLogicalOr %v3bool %17 %25 - %16 = OpSelect %v3int %26 %28 %rhs - %33 = OpBitwiseOr %v3int %15 %16 - %30 = OpBitcast %v3uint %33 - %36 = OpBitwiseAnd %v3uint %30 %35 - %38 = OpINotEqual %v3bool %36 %37 - %29 = OpAny %bool %38 - OpSelectionMerge %39 None - OpBranchConditional %29 %40 %41 - %40 = OpLabel - OpStore %tint_return_flag %true - %43 = OpSDiv %v3int %15 %16 - %44 = OpIMul %v3int %43 %16 - %45 = OpISub %v3int %15 %44 - OpStore %tint_return_value %45 - OpBranch %39 - %41 = OpLabel - OpStore %tint_return_flag %true - %46 = OpSRem %v3int %15 %16 - OpStore %tint_return_value %46 - OpBranch %39 - %39 = OpLabel - %47 = OpLoad %v3int %tint_return_value - OpReturnValue %47 + %8 = OpCompositeConstruct %v3int %lhs %lhs %lhs + %11 = OpIEqual %v3bool %rhs %10 + %16 = OpIEqual %v3bool %8 %15 + %19 = OpIEqual %v3bool %rhs %18 + %20 = OpLogicalAnd %v3bool %16 %19 + %21 = OpLogicalOr %v3bool %11 %20 + %9 = OpSelect %v3int %21 %23 %rhs + %28 = OpBitwiseOr %v3int %8 %9 + %25 = OpBitcast %v3uint %28 + %31 = OpBitwiseAnd %v3uint %25 %30 + %33 = OpINotEqual %v3bool %31 %32 + %24 = OpAny %bool %33 + OpSelectionMerge %34 None + OpBranchConditional %24 %35 %36 + %35 = OpLabel + %37 = OpSDiv %v3int %8 %9 + %38 = OpIMul %v3int %37 %9 + %39 = OpISub %v3int %8 %38 + OpReturnValue %39 + %36 = OpLabel + %40 = OpSRem %v3int %8 %9 + OpReturnValue %40 + %34 = OpLabel + OpReturnValue %10 OpFunctionEnd - %f = OpFunction %void None %48 - %51 = OpLabel - %56 = OpFunctionCall %v3int %tint_mod %int_4 %55 + %f = OpFunction %void None %41 + %44 = OpLabel + %49 = OpFunctionCall %v3int %tint_mod %int_4 %48 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.spvasm index e88004d5e2..ce0bc864e3 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 57 +; Bound: 50 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,74 +10,61 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %1 = OpTypeFunction %v3int %v3int %int + %10 = OpConstantNull %v3int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %11 = OpConstantNull %bool -%_ptr_Function_v3int = OpTypePointer Function %v3int - %14 = OpConstantNull %v3int %v3bool = OpTypeVector %bool 3 %int_n2147483648 = OpConstant %int -2147483648 - %20 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 + %15 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n1 = OpConstant %int -1 - %23 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 + %18 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 %int_1 = OpConstant %int 1 - %28 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %23 = OpConstantComposite %v3int %int_1 %int_1 %int_1 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %uint_2147483648 = OpConstant %uint 2147483648 - %35 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 - %37 = OpConstantNull %v3uint - %true = OpConstantTrue %bool + %30 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 + %32 = OpConstantNull %v3uint %void = OpTypeVoid - %48 = OpTypeFunction %void + %41 = OpTypeFunction %void %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 - %54 = OpConstantComposite %v3int %int_1 %int_2 %int_3 - %55 = OpConstantNull %int + %47 = OpConstantComposite %v3int %int_1 %int_2 %int_3 + %48 = OpConstantNull %int %tint_mod = OpFunction %v3int None %1 %lhs = OpFunctionParameter %v3int %rhs = OpFunctionParameter %int %7 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %11 -%tint_return_value = OpVariable %_ptr_Function_v3int Function %14 - %15 = OpCompositeConstruct %v3int %rhs %rhs %rhs - %17 = OpIEqual %v3bool %15 %14 - %21 = OpIEqual %v3bool %lhs %20 - %24 = OpIEqual %v3bool %15 %23 - %25 = OpLogicalAnd %v3bool %21 %24 - %26 = OpLogicalOr %v3bool %17 %25 - %16 = OpSelect %v3int %26 %28 %15 - %33 = OpBitwiseOr %v3int %lhs %16 - %30 = OpBitcast %v3uint %33 - %36 = OpBitwiseAnd %v3uint %30 %35 - %38 = OpINotEqual %v3bool %36 %37 - %29 = OpAny %bool %38 - OpSelectionMerge %39 None - OpBranchConditional %29 %40 %41 - %40 = OpLabel - OpStore %tint_return_flag %true - %43 = OpSDiv %v3int %lhs %16 - %44 = OpIMul %v3int %43 %16 - %45 = OpISub %v3int %lhs %44 - OpStore %tint_return_value %45 - OpBranch %39 - %41 = OpLabel - OpStore %tint_return_flag %true - %46 = OpSRem %v3int %lhs %16 - OpStore %tint_return_value %46 - OpBranch %39 - %39 = OpLabel - %47 = OpLoad %v3int %tint_return_value - OpReturnValue %47 + %8 = OpCompositeConstruct %v3int %rhs %rhs %rhs + %11 = OpIEqual %v3bool %8 %10 + %16 = OpIEqual %v3bool %lhs %15 + %19 = OpIEqual %v3bool %8 %18 + %20 = OpLogicalAnd %v3bool %16 %19 + %21 = OpLogicalOr %v3bool %11 %20 + %9 = OpSelect %v3int %21 %23 %8 + %28 = OpBitwiseOr %v3int %lhs %9 + %25 = OpBitcast %v3uint %28 + %31 = OpBitwiseAnd %v3uint %25 %30 + %33 = OpINotEqual %v3bool %31 %32 + %24 = OpAny %bool %33 + OpSelectionMerge %34 None + OpBranchConditional %24 %35 %36 + %35 = OpLabel + %37 = OpSDiv %v3int %lhs %9 + %38 = OpIMul %v3int %37 %9 + %39 = OpISub %v3int %lhs %38 + OpReturnValue %39 + %36 = OpLabel + %40 = OpSRem %v3int %lhs %9 + OpReturnValue %40 + %34 = OpLabel + OpReturnValue %10 OpFunctionEnd - %f = OpFunction %void None %48 - %51 = OpLabel - %56 = OpFunctionCall %v3int %tint_mod %54 %55 + %f = OpFunction %void None %41 + %44 = OpLabel + %49 = OpFunctionCall %v3int %tint_mod %47 %48 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.spvasm index 30bd04a805..9265dc2210 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_constant/vec3-vec3/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 58 +; Bound: 51 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,75 +10,62 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %1 = OpTypeFunction %v3int %v3int %v3int + %9 = OpConstantNull %v3int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %11 = OpConstantNull %bool -%_ptr_Function_v3int = OpTypePointer Function %v3int - %14 = OpConstantNull %v3int %v3bool = OpTypeVector %bool 3 %int_n2147483648 = OpConstant %int -2147483648 - %19 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 + %14 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n1 = OpConstant %int -1 - %22 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 + %17 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 %int_1 = OpConstant %int 1 - %27 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %22 = OpConstantComposite %v3int %int_1 %int_1 %int_1 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %uint_2147483648 = OpConstant %uint 2147483648 - %34 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 - %36 = OpConstantNull %v3uint - %true = OpConstantTrue %bool + %29 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 + %31 = OpConstantNull %v3uint %void = OpTypeVoid - %47 = OpTypeFunction %void + %40 = OpTypeFunction %void %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 - %53 = OpConstantComposite %v3int %int_1 %int_2 %int_3 - %54 = OpConstantNull %int + %46 = OpConstantComposite %v3int %int_1 %int_2 %int_3 + %47 = OpConstantNull %int %int_5 = OpConstant %int 5 - %56 = OpConstantComposite %v3int %54 %int_5 %54 + %49 = OpConstantComposite %v3int %47 %int_5 %47 %tint_mod = OpFunction %v3int None %1 %lhs = OpFunctionParameter %v3int %rhs = OpFunctionParameter %v3int %7 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %11 -%tint_return_value = OpVariable %_ptr_Function_v3int Function %14 - %16 = OpIEqual %v3bool %rhs %14 - %20 = OpIEqual %v3bool %lhs %19 - %23 = OpIEqual %v3bool %rhs %22 - %24 = OpLogicalAnd %v3bool %20 %23 - %25 = OpLogicalOr %v3bool %16 %24 - %15 = OpSelect %v3int %25 %27 %rhs - %32 = OpBitwiseOr %v3int %lhs %15 - %29 = OpBitcast %v3uint %32 - %35 = OpBitwiseAnd %v3uint %29 %34 - %37 = OpINotEqual %v3bool %35 %36 - %28 = OpAny %bool %37 - OpSelectionMerge %38 None - OpBranchConditional %28 %39 %40 - %39 = OpLabel - OpStore %tint_return_flag %true - %42 = OpSDiv %v3int %lhs %15 - %43 = OpIMul %v3int %42 %15 - %44 = OpISub %v3int %lhs %43 - OpStore %tint_return_value %44 - OpBranch %38 - %40 = OpLabel - OpStore %tint_return_flag %true - %45 = OpSRem %v3int %lhs %15 - OpStore %tint_return_value %45 - OpBranch %38 - %38 = OpLabel - %46 = OpLoad %v3int %tint_return_value - OpReturnValue %46 + %10 = OpIEqual %v3bool %rhs %9 + %15 = OpIEqual %v3bool %lhs %14 + %18 = OpIEqual %v3bool %rhs %17 + %19 = OpLogicalAnd %v3bool %15 %18 + %20 = OpLogicalOr %v3bool %10 %19 + %8 = OpSelect %v3int %20 %22 %rhs + %27 = OpBitwiseOr %v3int %lhs %8 + %24 = OpBitcast %v3uint %27 + %30 = OpBitwiseAnd %v3uint %24 %29 + %32 = OpINotEqual %v3bool %30 %31 + %23 = OpAny %bool %32 + OpSelectionMerge %33 None + OpBranchConditional %23 %34 %35 + %34 = OpLabel + %36 = OpSDiv %v3int %lhs %8 + %37 = OpIMul %v3int %36 %8 + %38 = OpISub %v3int %lhs %37 + OpReturnValue %38 + %35 = OpLabel + %39 = OpSRem %v3int %lhs %8 + OpReturnValue %39 + %33 = OpLabel + OpReturnValue %9 OpFunctionEnd - %f = OpFunction %void None %47 - %50 = OpLabel - %57 = OpFunctionCall %v3int %tint_mod %53 %56 + %f = OpFunction %void None %40 + %43 = OpLabel + %50 = OpFunctionCall %v3int %tint_mod %46 %49 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.spvasm index e63496497f..815a18557b 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 51 +; Bound: 45 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,71 +10,59 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" OpName %a "a" OpName %b "b" %int = OpTypeInt 32 1 %1 = OpTypeFunction %int %int %int + %8 = OpConstantNull %int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %10 = OpConstantNull %bool -%_ptr_Function_int = OpTypePointer Function %int - %13 = OpConstantNull %int %int_n2147483648 = OpConstant %int -2147483648 %int_n1 = OpConstant %int -1 %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_2147483648 = OpConstant %uint 2147483648 - %29 = OpConstantNull %uint - %true = OpConstantTrue %bool + %24 = OpConstantNull %uint %void = OpTypeVoid - %40 = OpTypeFunction %void + %33 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int %tint_mod = OpFunction %int None %1 %lhs = OpFunctionParameter %int %rhs = OpFunctionParameter %int %6 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %10 -%tint_return_value = OpVariable %_ptr_Function_int Function %13 - %15 = OpIEqual %bool %rhs %13 - %17 = OpIEqual %bool %lhs %int_n2147483648 - %19 = OpIEqual %bool %rhs %int_n1 - %20 = OpLogicalAnd %bool %17 %19 - %21 = OpLogicalOr %bool %15 %20 - %14 = OpSelect %int %21 %int_1 %rhs - %26 = OpBitwiseOr %int %lhs %14 - %24 = OpBitcast %uint %26 - %28 = OpBitwiseAnd %uint %24 %uint_2147483648 - %30 = OpINotEqual %bool %28 %29 - OpSelectionMerge %31 None - OpBranchConditional %30 %32 %33 - %32 = OpLabel - OpStore %tint_return_flag %true - %35 = OpSDiv %int %lhs %14 - %36 = OpIMul %int %35 %14 - %37 = OpISub %int %lhs %36 - OpStore %tint_return_value %37 - OpBranch %31 - %33 = OpLabel - OpStore %tint_return_flag %true - %38 = OpSRem %int %lhs %14 - OpStore %tint_return_value %38 - OpBranch %31 - %31 = OpLabel - %39 = OpLoad %int %tint_return_value - OpReturnValue %39 + %9 = OpIEqual %bool %rhs %8 + %12 = OpIEqual %bool %lhs %int_n2147483648 + %14 = OpIEqual %bool %rhs %int_n1 + %15 = OpLogicalAnd %bool %12 %14 + %16 = OpLogicalOr %bool %9 %15 + %7 = OpSelect %int %16 %int_1 %rhs + %21 = OpBitwiseOr %int %lhs %7 + %19 = OpBitcast %uint %21 + %23 = OpBitwiseAnd %uint %19 %uint_2147483648 + %25 = OpINotEqual %bool %23 %24 + OpSelectionMerge %26 None + OpBranchConditional %25 %27 %28 + %27 = OpLabel + %29 = OpSDiv %int %lhs %7 + %30 = OpIMul %int %29 %7 + %31 = OpISub %int %lhs %30 + OpReturnValue %31 + %28 = OpLabel + %32 = OpSRem %int %lhs %7 + OpReturnValue %32 + %26 = OpLabel + OpReturnValue %8 OpFunctionEnd - %f = OpFunction %void None %40 - %43 = OpLabel - %a = OpVariable %_ptr_Function_int Function %13 - %b = OpVariable %_ptr_Function_int Function %13 + %f = OpFunction %void None %33 + %36 = OpLabel + %a = OpVariable %_ptr_Function_int Function %8 + %b = OpVariable %_ptr_Function_int Function %8 OpStore %a %int_1 - OpStore %b %13 - %47 = OpLoad %int %a - %48 = OpLoad %int %b - %49 = OpLoad %int %b - %50 = OpIAdd %int %48 %49 - %46 = OpFunctionCall %int %tint_mod %47 %50 + OpStore %b %8 + %41 = OpLoad %int %a + %42 = OpLoad %int %b + %43 = OpLoad %int %b + %44 = OpIAdd %int %42 %43 + %40 = OpFunctionCall %int %tint_mod %41 %44 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.spvasm index 18b6fdd61c..a79e7b3307 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/scalar-vec3/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 64 +; Bound: 58 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,85 +10,73 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" OpName %a "a" OpName %b "b" %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %1 = OpTypeFunction %v3int %int %v3int + %10 = OpConstantNull %v3int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %11 = OpConstantNull %bool -%_ptr_Function_v3int = OpTypePointer Function %v3int - %14 = OpConstantNull %v3int %v3bool = OpTypeVector %bool 3 %int_n2147483648 = OpConstant %int -2147483648 - %20 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 + %15 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n1 = OpConstant %int -1 - %23 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 + %18 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 %int_1 = OpConstant %int 1 - %28 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %23 = OpConstantComposite %v3int %int_1 %int_1 %int_1 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %uint_2147483648 = OpConstant %uint 2147483648 - %35 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 - %37 = OpConstantNull %v3uint - %true = OpConstantTrue %bool + %30 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 + %32 = OpConstantNull %v3uint %void = OpTypeVoid - %48 = OpTypeFunction %void + %41 = OpTypeFunction %void %int_4 = OpConstant %int 4 %_ptr_Function_int = OpTypePointer Function %int - %55 = OpConstantNull %int + %48 = OpConstantNull %int %int_2 = OpConstant %int 2 - %57 = OpConstantComposite %v3int %55 %int_2 %55 + %50 = OpConstantComposite %v3int %48 %int_2 %48 +%_ptr_Function_v3int = OpTypePointer Function %v3int %tint_mod = OpFunction %v3int None %1 %lhs = OpFunctionParameter %int %rhs = OpFunctionParameter %v3int %7 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %11 -%tint_return_value = OpVariable %_ptr_Function_v3int Function %14 - %15 = OpCompositeConstruct %v3int %lhs %lhs %lhs - %17 = OpIEqual %v3bool %rhs %14 - %21 = OpIEqual %v3bool %15 %20 - %24 = OpIEqual %v3bool %rhs %23 - %25 = OpLogicalAnd %v3bool %21 %24 - %26 = OpLogicalOr %v3bool %17 %25 - %16 = OpSelect %v3int %26 %28 %rhs - %33 = OpBitwiseOr %v3int %15 %16 - %30 = OpBitcast %v3uint %33 - %36 = OpBitwiseAnd %v3uint %30 %35 - %38 = OpINotEqual %v3bool %36 %37 - %29 = OpAny %bool %38 - OpSelectionMerge %39 None - OpBranchConditional %29 %40 %41 - %40 = OpLabel - OpStore %tint_return_flag %true - %43 = OpSDiv %v3int %15 %16 - %44 = OpIMul %v3int %43 %16 - %45 = OpISub %v3int %15 %44 - OpStore %tint_return_value %45 - OpBranch %39 - %41 = OpLabel - OpStore %tint_return_flag %true - %46 = OpSRem %v3int %15 %16 - OpStore %tint_return_value %46 - OpBranch %39 - %39 = OpLabel - %47 = OpLoad %v3int %tint_return_value - OpReturnValue %47 + %8 = OpCompositeConstruct %v3int %lhs %lhs %lhs + %11 = OpIEqual %v3bool %rhs %10 + %16 = OpIEqual %v3bool %8 %15 + %19 = OpIEqual %v3bool %rhs %18 + %20 = OpLogicalAnd %v3bool %16 %19 + %21 = OpLogicalOr %v3bool %11 %20 + %9 = OpSelect %v3int %21 %23 %rhs + %28 = OpBitwiseOr %v3int %8 %9 + %25 = OpBitcast %v3uint %28 + %31 = OpBitwiseAnd %v3uint %25 %30 + %33 = OpINotEqual %v3bool %31 %32 + %24 = OpAny %bool %33 + OpSelectionMerge %34 None + OpBranchConditional %24 %35 %36 + %35 = OpLabel + %37 = OpSDiv %v3int %8 %9 + %38 = OpIMul %v3int %37 %9 + %39 = OpISub %v3int %8 %38 + OpReturnValue %39 + %36 = OpLabel + %40 = OpSRem %v3int %8 %9 + OpReturnValue %40 + %34 = OpLabel + OpReturnValue %10 OpFunctionEnd - %f = OpFunction %void None %48 - %51 = OpLabel - %a = OpVariable %_ptr_Function_int Function %55 - %b = OpVariable %_ptr_Function_v3int Function %14 + %f = OpFunction %void None %41 + %44 = OpLabel + %a = OpVariable %_ptr_Function_int Function %48 + %b = OpVariable %_ptr_Function_v3int Function %10 OpStore %a %int_4 - OpStore %b %57 - %60 = OpLoad %int %a - %61 = OpLoad %v3int %b - %62 = OpLoad %v3int %b - %63 = OpIAdd %v3int %61 %62 - %59 = OpFunctionCall %v3int %tint_mod %60 %63 + OpStore %b %50 + %54 = OpLoad %int %a + %55 = OpLoad %v3int %b + %56 = OpLoad %v3int %b + %57 = OpIAdd %v3int %55 %56 + %53 = OpFunctionCall %v3int %tint_mod %54 %57 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.spvasm index 80e55aeb82..36731264c5 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 64 +; Bound: 58 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,85 +10,73 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" OpName %a "a" OpName %b "b" %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %1 = OpTypeFunction %v3int %v3int %int + %10 = OpConstantNull %v3int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %11 = OpConstantNull %bool -%_ptr_Function_v3int = OpTypePointer Function %v3int - %14 = OpConstantNull %v3int %v3bool = OpTypeVector %bool 3 %int_n2147483648 = OpConstant %int -2147483648 - %20 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 + %15 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n1 = OpConstant %int -1 - %23 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 + %18 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 %int_1 = OpConstant %int 1 - %28 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %23 = OpConstantComposite %v3int %int_1 %int_1 %int_1 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %uint_2147483648 = OpConstant %uint 2147483648 - %35 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 - %37 = OpConstantNull %v3uint - %true = OpConstantTrue %bool + %30 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 + %32 = OpConstantNull %v3uint %void = OpTypeVoid - %48 = OpTypeFunction %void + %41 = OpTypeFunction %void %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 - %54 = OpConstantComposite %v3int %int_1 %int_2 %int_3 - %56 = OpConstantNull %int + %47 = OpConstantComposite %v3int %int_1 %int_2 %int_3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %50 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %tint_mod = OpFunction %v3int None %1 %lhs = OpFunctionParameter %v3int %rhs = OpFunctionParameter %int %7 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %11 -%tint_return_value = OpVariable %_ptr_Function_v3int Function %14 - %15 = OpCompositeConstruct %v3int %rhs %rhs %rhs - %17 = OpIEqual %v3bool %15 %14 - %21 = OpIEqual %v3bool %lhs %20 - %24 = OpIEqual %v3bool %15 %23 - %25 = OpLogicalAnd %v3bool %21 %24 - %26 = OpLogicalOr %v3bool %17 %25 - %16 = OpSelect %v3int %26 %28 %15 - %33 = OpBitwiseOr %v3int %lhs %16 - %30 = OpBitcast %v3uint %33 - %36 = OpBitwiseAnd %v3uint %30 %35 - %38 = OpINotEqual %v3bool %36 %37 - %29 = OpAny %bool %38 - OpSelectionMerge %39 None - OpBranchConditional %29 %40 %41 - %40 = OpLabel - OpStore %tint_return_flag %true - %43 = OpSDiv %v3int %lhs %16 - %44 = OpIMul %v3int %43 %16 - %45 = OpISub %v3int %lhs %44 - OpStore %tint_return_value %45 - OpBranch %39 - %41 = OpLabel - OpStore %tint_return_flag %true - %46 = OpSRem %v3int %lhs %16 - OpStore %tint_return_value %46 - OpBranch %39 - %39 = OpLabel - %47 = OpLoad %v3int %tint_return_value - OpReturnValue %47 + %8 = OpCompositeConstruct %v3int %rhs %rhs %rhs + %11 = OpIEqual %v3bool %8 %10 + %16 = OpIEqual %v3bool %lhs %15 + %19 = OpIEqual %v3bool %8 %18 + %20 = OpLogicalAnd %v3bool %16 %19 + %21 = OpLogicalOr %v3bool %11 %20 + %9 = OpSelect %v3int %21 %23 %8 + %28 = OpBitwiseOr %v3int %lhs %9 + %25 = OpBitcast %v3uint %28 + %31 = OpBitwiseAnd %v3uint %25 %30 + %33 = OpINotEqual %v3bool %31 %32 + %24 = OpAny %bool %33 + OpSelectionMerge %34 None + OpBranchConditional %24 %35 %36 + %35 = OpLabel + %37 = OpSDiv %v3int %lhs %9 + %38 = OpIMul %v3int %37 %9 + %39 = OpISub %v3int %lhs %38 + OpReturnValue %39 + %36 = OpLabel + %40 = OpSRem %v3int %lhs %9 + OpReturnValue %40 + %34 = OpLabel + OpReturnValue %10 OpFunctionEnd - %f = OpFunction %void None %48 - %51 = OpLabel - %a = OpVariable %_ptr_Function_v3int Function %14 - %b = OpVariable %_ptr_Function_int Function %56 - OpStore %a %54 - OpStore %b %56 - %60 = OpLoad %v3int %a - %61 = OpLoad %int %b - %62 = OpLoad %int %b - %63 = OpIAdd %int %61 %62 - %59 = OpFunctionCall %v3int %tint_mod %60 %63 + %f = OpFunction %void None %41 + %44 = OpLabel + %a = OpVariable %_ptr_Function_v3int Function %10 + %b = OpVariable %_ptr_Function_int Function %50 + OpStore %a %47 + OpStore %b %50 + %54 = OpLoad %v3int %a + %55 = OpLoad %int %b + %56 = OpLoad %int %b + %57 = OpIAdd %int %55 %56 + %53 = OpFunctionCall %v3int %tint_mod %54 %57 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.spvasm index 1c69618b6b..b1590cf845 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_expression/vec3-vec3/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 64 +; Bound: 58 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,85 +10,73 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" OpName %a "a" OpName %b "b" %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %1 = OpTypeFunction %v3int %v3int %v3int + %9 = OpConstantNull %v3int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %11 = OpConstantNull %bool -%_ptr_Function_v3int = OpTypePointer Function %v3int - %14 = OpConstantNull %v3int %v3bool = OpTypeVector %bool 3 %int_n2147483648 = OpConstant %int -2147483648 - %19 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 + %14 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n1 = OpConstant %int -1 - %22 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 + %17 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 %int_1 = OpConstant %int 1 - %27 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %22 = OpConstantComposite %v3int %int_1 %int_1 %int_1 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %uint_2147483648 = OpConstant %uint 2147483648 - %34 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 - %36 = OpConstantNull %v3uint - %true = OpConstantTrue %bool + %29 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 + %31 = OpConstantNull %v3uint %void = OpTypeVoid - %47 = OpTypeFunction %void + %40 = OpTypeFunction %void %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 - %53 = OpConstantComposite %v3int %int_1 %int_2 %int_3 - %55 = OpConstantNull %int + %46 = OpConstantComposite %v3int %int_1 %int_2 %int_3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %49 = OpConstantNull %int %int_5 = OpConstant %int 5 - %57 = OpConstantComposite %v3int %55 %int_5 %55 + %51 = OpConstantComposite %v3int %49 %int_5 %49 %tint_mod = OpFunction %v3int None %1 %lhs = OpFunctionParameter %v3int %rhs = OpFunctionParameter %v3int %7 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %11 -%tint_return_value = OpVariable %_ptr_Function_v3int Function %14 - %16 = OpIEqual %v3bool %rhs %14 - %20 = OpIEqual %v3bool %lhs %19 - %23 = OpIEqual %v3bool %rhs %22 - %24 = OpLogicalAnd %v3bool %20 %23 - %25 = OpLogicalOr %v3bool %16 %24 - %15 = OpSelect %v3int %25 %27 %rhs - %32 = OpBitwiseOr %v3int %lhs %15 - %29 = OpBitcast %v3uint %32 - %35 = OpBitwiseAnd %v3uint %29 %34 - %37 = OpINotEqual %v3bool %35 %36 - %28 = OpAny %bool %37 - OpSelectionMerge %38 None - OpBranchConditional %28 %39 %40 - %39 = OpLabel - OpStore %tint_return_flag %true - %42 = OpSDiv %v3int %lhs %15 - %43 = OpIMul %v3int %42 %15 - %44 = OpISub %v3int %lhs %43 - OpStore %tint_return_value %44 - OpBranch %38 - %40 = OpLabel - OpStore %tint_return_flag %true - %45 = OpSRem %v3int %lhs %15 - OpStore %tint_return_value %45 - OpBranch %38 - %38 = OpLabel - %46 = OpLoad %v3int %tint_return_value - OpReturnValue %46 + %10 = OpIEqual %v3bool %rhs %9 + %15 = OpIEqual %v3bool %lhs %14 + %18 = OpIEqual %v3bool %rhs %17 + %19 = OpLogicalAnd %v3bool %15 %18 + %20 = OpLogicalOr %v3bool %10 %19 + %8 = OpSelect %v3int %20 %22 %rhs + %27 = OpBitwiseOr %v3int %lhs %8 + %24 = OpBitcast %v3uint %27 + %30 = OpBitwiseAnd %v3uint %24 %29 + %32 = OpINotEqual %v3bool %30 %31 + %23 = OpAny %bool %32 + OpSelectionMerge %33 None + OpBranchConditional %23 %34 %35 + %34 = OpLabel + %36 = OpSDiv %v3int %lhs %8 + %37 = OpIMul %v3int %36 %8 + %38 = OpISub %v3int %lhs %37 + OpReturnValue %38 + %35 = OpLabel + %39 = OpSRem %v3int %lhs %8 + OpReturnValue %39 + %33 = OpLabel + OpReturnValue %9 OpFunctionEnd - %f = OpFunction %void None %47 - %50 = OpLabel - %a = OpVariable %_ptr_Function_v3int Function %14 - %b = OpVariable %_ptr_Function_v3int Function %14 - OpStore %a %53 - OpStore %b %57 - %60 = OpLoad %v3int %a - %61 = OpLoad %v3int %b - %62 = OpLoad %v3int %b - %63 = OpIAdd %v3int %61 %62 - %59 = OpFunctionCall %v3int %tint_mod %60 %63 + %f = OpFunction %void None %40 + %43 = OpLabel + %a = OpVariable %_ptr_Function_v3int Function %9 + %b = OpVariable %_ptr_Function_v3int Function %9 + OpStore %a %46 + OpStore %b %51 + %54 = OpLoad %v3int %a + %55 = OpLoad %v3int %b + %56 = OpLoad %v3int %b + %57 = OpIAdd %v3int %55 %56 + %53 = OpFunctionCall %v3int %tint_mod %54 %57 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.spvasm index deb7e72b17..f5525439a6 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 49 +; Bound: 43 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,69 +10,57 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" OpName %a "a" OpName %b "b" %int = OpTypeInt 32 1 %1 = OpTypeFunction %int %int %int + %8 = OpConstantNull %int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %10 = OpConstantNull %bool -%_ptr_Function_int = OpTypePointer Function %int - %13 = OpConstantNull %int %int_n2147483648 = OpConstant %int -2147483648 %int_n1 = OpConstant %int -1 %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_2147483648 = OpConstant %uint 2147483648 - %29 = OpConstantNull %uint - %true = OpConstantTrue %bool + %24 = OpConstantNull %uint %void = OpTypeVoid - %40 = OpTypeFunction %void + %33 = OpTypeFunction %void +%_ptr_Function_int = OpTypePointer Function %int %tint_mod = OpFunction %int None %1 %lhs = OpFunctionParameter %int %rhs = OpFunctionParameter %int %6 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %10 -%tint_return_value = OpVariable %_ptr_Function_int Function %13 - %15 = OpIEqual %bool %rhs %13 - %17 = OpIEqual %bool %lhs %int_n2147483648 - %19 = OpIEqual %bool %rhs %int_n1 - %20 = OpLogicalAnd %bool %17 %19 - %21 = OpLogicalOr %bool %15 %20 - %14 = OpSelect %int %21 %int_1 %rhs - %26 = OpBitwiseOr %int %lhs %14 - %24 = OpBitcast %uint %26 - %28 = OpBitwiseAnd %uint %24 %uint_2147483648 - %30 = OpINotEqual %bool %28 %29 - OpSelectionMerge %31 None - OpBranchConditional %30 %32 %33 - %32 = OpLabel - OpStore %tint_return_flag %true - %35 = OpSDiv %int %lhs %14 - %36 = OpIMul %int %35 %14 - %37 = OpISub %int %lhs %36 - OpStore %tint_return_value %37 - OpBranch %31 - %33 = OpLabel - OpStore %tint_return_flag %true - %38 = OpSRem %int %lhs %14 - OpStore %tint_return_value %38 - OpBranch %31 - %31 = OpLabel - %39 = OpLoad %int %tint_return_value - OpReturnValue %39 + %9 = OpIEqual %bool %rhs %8 + %12 = OpIEqual %bool %lhs %int_n2147483648 + %14 = OpIEqual %bool %rhs %int_n1 + %15 = OpLogicalAnd %bool %12 %14 + %16 = OpLogicalOr %bool %9 %15 + %7 = OpSelect %int %16 %int_1 %rhs + %21 = OpBitwiseOr %int %lhs %7 + %19 = OpBitcast %uint %21 + %23 = OpBitwiseAnd %uint %19 %uint_2147483648 + %25 = OpINotEqual %bool %23 %24 + OpSelectionMerge %26 None + OpBranchConditional %25 %27 %28 + %27 = OpLabel + %29 = OpSDiv %int %lhs %7 + %30 = OpIMul %int %29 %7 + %31 = OpISub %int %lhs %30 + OpReturnValue %31 + %28 = OpLabel + %32 = OpSRem %int %lhs %7 + OpReturnValue %32 + %26 = OpLabel + OpReturnValue %8 OpFunctionEnd - %f = OpFunction %void None %40 - %43 = OpLabel - %a = OpVariable %_ptr_Function_int Function %13 - %b = OpVariable %_ptr_Function_int Function %13 + %f = OpFunction %void None %33 + %36 = OpLabel + %a = OpVariable %_ptr_Function_int Function %8 + %b = OpVariable %_ptr_Function_int Function %8 OpStore %a %int_1 - OpStore %b %13 - %47 = OpLoad %int %a - %48 = OpLoad %int %b - %46 = OpFunctionCall %int %tint_mod %47 %48 + OpStore %b %8 + %41 = OpLoad %int %a + %42 = OpLoad %int %b + %40 = OpFunctionCall %int %tint_mod %41 %42 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.spvasm index b386e2b989..4990c236f4 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/scalar-vec3/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 62 +; Bound: 56 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,83 +10,71 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" OpName %a "a" OpName %b "b" %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %1 = OpTypeFunction %v3int %int %v3int + %10 = OpConstantNull %v3int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %11 = OpConstantNull %bool -%_ptr_Function_v3int = OpTypePointer Function %v3int - %14 = OpConstantNull %v3int %v3bool = OpTypeVector %bool 3 %int_n2147483648 = OpConstant %int -2147483648 - %20 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 + %15 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n1 = OpConstant %int -1 - %23 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 + %18 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 %int_1 = OpConstant %int 1 - %28 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %23 = OpConstantComposite %v3int %int_1 %int_1 %int_1 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %uint_2147483648 = OpConstant %uint 2147483648 - %35 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 - %37 = OpConstantNull %v3uint - %true = OpConstantTrue %bool + %30 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 + %32 = OpConstantNull %v3uint %void = OpTypeVoid - %48 = OpTypeFunction %void + %41 = OpTypeFunction %void %int_4 = OpConstant %int 4 %_ptr_Function_int = OpTypePointer Function %int - %55 = OpConstantNull %int + %48 = OpConstantNull %int %int_2 = OpConstant %int 2 - %57 = OpConstantComposite %v3int %55 %int_2 %55 + %50 = OpConstantComposite %v3int %48 %int_2 %48 +%_ptr_Function_v3int = OpTypePointer Function %v3int %tint_mod = OpFunction %v3int None %1 %lhs = OpFunctionParameter %int %rhs = OpFunctionParameter %v3int %7 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %11 -%tint_return_value = OpVariable %_ptr_Function_v3int Function %14 - %15 = OpCompositeConstruct %v3int %lhs %lhs %lhs - %17 = OpIEqual %v3bool %rhs %14 - %21 = OpIEqual %v3bool %15 %20 - %24 = OpIEqual %v3bool %rhs %23 - %25 = OpLogicalAnd %v3bool %21 %24 - %26 = OpLogicalOr %v3bool %17 %25 - %16 = OpSelect %v3int %26 %28 %rhs - %33 = OpBitwiseOr %v3int %15 %16 - %30 = OpBitcast %v3uint %33 - %36 = OpBitwiseAnd %v3uint %30 %35 - %38 = OpINotEqual %v3bool %36 %37 - %29 = OpAny %bool %38 - OpSelectionMerge %39 None - OpBranchConditional %29 %40 %41 - %40 = OpLabel - OpStore %tint_return_flag %true - %43 = OpSDiv %v3int %15 %16 - %44 = OpIMul %v3int %43 %16 - %45 = OpISub %v3int %15 %44 - OpStore %tint_return_value %45 - OpBranch %39 - %41 = OpLabel - OpStore %tint_return_flag %true - %46 = OpSRem %v3int %15 %16 - OpStore %tint_return_value %46 - OpBranch %39 - %39 = OpLabel - %47 = OpLoad %v3int %tint_return_value - OpReturnValue %47 + %8 = OpCompositeConstruct %v3int %lhs %lhs %lhs + %11 = OpIEqual %v3bool %rhs %10 + %16 = OpIEqual %v3bool %8 %15 + %19 = OpIEqual %v3bool %rhs %18 + %20 = OpLogicalAnd %v3bool %16 %19 + %21 = OpLogicalOr %v3bool %11 %20 + %9 = OpSelect %v3int %21 %23 %rhs + %28 = OpBitwiseOr %v3int %8 %9 + %25 = OpBitcast %v3uint %28 + %31 = OpBitwiseAnd %v3uint %25 %30 + %33 = OpINotEqual %v3bool %31 %32 + %24 = OpAny %bool %33 + OpSelectionMerge %34 None + OpBranchConditional %24 %35 %36 + %35 = OpLabel + %37 = OpSDiv %v3int %8 %9 + %38 = OpIMul %v3int %37 %9 + %39 = OpISub %v3int %8 %38 + OpReturnValue %39 + %36 = OpLabel + %40 = OpSRem %v3int %8 %9 + OpReturnValue %40 + %34 = OpLabel + OpReturnValue %10 OpFunctionEnd - %f = OpFunction %void None %48 - %51 = OpLabel - %a = OpVariable %_ptr_Function_int Function %55 - %b = OpVariable %_ptr_Function_v3int Function %14 + %f = OpFunction %void None %41 + %44 = OpLabel + %a = OpVariable %_ptr_Function_int Function %48 + %b = OpVariable %_ptr_Function_v3int Function %10 OpStore %a %int_4 - OpStore %b %57 - %60 = OpLoad %int %a - %61 = OpLoad %v3int %b - %59 = OpFunctionCall %v3int %tint_mod %60 %61 + OpStore %b %50 + %54 = OpLoad %int %a + %55 = OpLoad %v3int %b + %53 = OpFunctionCall %v3int %tint_mod %54 %55 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.spvasm index 3e128f9068..9e99fc3374 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-scalar/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 62 +; Bound: 56 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,83 +10,71 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" OpName %a "a" OpName %b "b" %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %1 = OpTypeFunction %v3int %v3int %int + %10 = OpConstantNull %v3int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %11 = OpConstantNull %bool -%_ptr_Function_v3int = OpTypePointer Function %v3int - %14 = OpConstantNull %v3int %v3bool = OpTypeVector %bool 3 %int_n2147483648 = OpConstant %int -2147483648 - %20 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 + %15 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n1 = OpConstant %int -1 - %23 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 + %18 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 %int_1 = OpConstant %int 1 - %28 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %23 = OpConstantComposite %v3int %int_1 %int_1 %int_1 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %uint_2147483648 = OpConstant %uint 2147483648 - %35 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 - %37 = OpConstantNull %v3uint - %true = OpConstantTrue %bool + %30 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 + %32 = OpConstantNull %v3uint %void = OpTypeVoid - %48 = OpTypeFunction %void + %41 = OpTypeFunction %void %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 - %54 = OpConstantComposite %v3int %int_1 %int_2 %int_3 - %56 = OpConstantNull %int + %47 = OpConstantComposite %v3int %int_1 %int_2 %int_3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %50 = OpConstantNull %int %_ptr_Function_int = OpTypePointer Function %int %tint_mod = OpFunction %v3int None %1 %lhs = OpFunctionParameter %v3int %rhs = OpFunctionParameter %int %7 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %11 -%tint_return_value = OpVariable %_ptr_Function_v3int Function %14 - %15 = OpCompositeConstruct %v3int %rhs %rhs %rhs - %17 = OpIEqual %v3bool %15 %14 - %21 = OpIEqual %v3bool %lhs %20 - %24 = OpIEqual %v3bool %15 %23 - %25 = OpLogicalAnd %v3bool %21 %24 - %26 = OpLogicalOr %v3bool %17 %25 - %16 = OpSelect %v3int %26 %28 %15 - %33 = OpBitwiseOr %v3int %lhs %16 - %30 = OpBitcast %v3uint %33 - %36 = OpBitwiseAnd %v3uint %30 %35 - %38 = OpINotEqual %v3bool %36 %37 - %29 = OpAny %bool %38 - OpSelectionMerge %39 None - OpBranchConditional %29 %40 %41 - %40 = OpLabel - OpStore %tint_return_flag %true - %43 = OpSDiv %v3int %lhs %16 - %44 = OpIMul %v3int %43 %16 - %45 = OpISub %v3int %lhs %44 - OpStore %tint_return_value %45 - OpBranch %39 - %41 = OpLabel - OpStore %tint_return_flag %true - %46 = OpSRem %v3int %lhs %16 - OpStore %tint_return_value %46 - OpBranch %39 - %39 = OpLabel - %47 = OpLoad %v3int %tint_return_value - OpReturnValue %47 + %8 = OpCompositeConstruct %v3int %rhs %rhs %rhs + %11 = OpIEqual %v3bool %8 %10 + %16 = OpIEqual %v3bool %lhs %15 + %19 = OpIEqual %v3bool %8 %18 + %20 = OpLogicalAnd %v3bool %16 %19 + %21 = OpLogicalOr %v3bool %11 %20 + %9 = OpSelect %v3int %21 %23 %8 + %28 = OpBitwiseOr %v3int %lhs %9 + %25 = OpBitcast %v3uint %28 + %31 = OpBitwiseAnd %v3uint %25 %30 + %33 = OpINotEqual %v3bool %31 %32 + %24 = OpAny %bool %33 + OpSelectionMerge %34 None + OpBranchConditional %24 %35 %36 + %35 = OpLabel + %37 = OpSDiv %v3int %lhs %9 + %38 = OpIMul %v3int %37 %9 + %39 = OpISub %v3int %lhs %38 + OpReturnValue %39 + %36 = OpLabel + %40 = OpSRem %v3int %lhs %9 + OpReturnValue %40 + %34 = OpLabel + OpReturnValue %10 OpFunctionEnd - %f = OpFunction %void None %48 - %51 = OpLabel - %a = OpVariable %_ptr_Function_v3int Function %14 - %b = OpVariable %_ptr_Function_int Function %56 - OpStore %a %54 - OpStore %b %56 - %60 = OpLoad %v3int %a - %61 = OpLoad %int %b - %59 = OpFunctionCall %v3int %tint_mod %60 %61 + %f = OpFunction %void None %41 + %44 = OpLabel + %a = OpVariable %_ptr_Function_v3int Function %10 + %b = OpVariable %_ptr_Function_int Function %50 + OpStore %a %47 + OpStore %b %50 + %54 = OpLoad %v3int %a + %55 = OpLoad %int %b + %53 = OpFunctionCall %v3int %tint_mod %54 %55 OpReturn OpFunctionEnd diff --git a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.spvasm b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.spvasm index ebca6fa80b..7b469f1176 100644 --- a/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.spvasm +++ b/test/tint/expressions/binary/mod_by_zero/by_identifier/vec3-vec3/i32.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 62 +; Bound: 56 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -10,83 +10,71 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %f "f" OpName %a "a" OpName %b "b" %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %1 = OpTypeFunction %v3int %v3int %v3int + %9 = OpConstantNull %v3int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %11 = OpConstantNull %bool -%_ptr_Function_v3int = OpTypePointer Function %v3int - %14 = OpConstantNull %v3int %v3bool = OpTypeVector %bool 3 %int_n2147483648 = OpConstant %int -2147483648 - %19 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 + %14 = OpConstantComposite %v3int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n1 = OpConstant %int -1 - %22 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 + %17 = OpConstantComposite %v3int %int_n1 %int_n1 %int_n1 %int_1 = OpConstant %int 1 - %27 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %22 = OpConstantComposite %v3int %int_1 %int_1 %int_1 %uint = OpTypeInt 32 0 %v3uint = OpTypeVector %uint 3 %uint_2147483648 = OpConstant %uint 2147483648 - %34 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 - %36 = OpConstantNull %v3uint - %true = OpConstantTrue %bool + %29 = OpConstantComposite %v3uint %uint_2147483648 %uint_2147483648 %uint_2147483648 + %31 = OpConstantNull %v3uint %void = OpTypeVoid - %47 = OpTypeFunction %void + %40 = OpTypeFunction %void %int_2 = OpConstant %int 2 %int_3 = OpConstant %int 3 - %53 = OpConstantComposite %v3int %int_1 %int_2 %int_3 - %55 = OpConstantNull %int + %46 = OpConstantComposite %v3int %int_1 %int_2 %int_3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %49 = OpConstantNull %int %int_5 = OpConstant %int 5 - %57 = OpConstantComposite %v3int %55 %int_5 %55 + %51 = OpConstantComposite %v3int %49 %int_5 %49 %tint_mod = OpFunction %v3int None %1 %lhs = OpFunctionParameter %v3int %rhs = OpFunctionParameter %v3int %7 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %11 -%tint_return_value = OpVariable %_ptr_Function_v3int Function %14 - %16 = OpIEqual %v3bool %rhs %14 - %20 = OpIEqual %v3bool %lhs %19 - %23 = OpIEqual %v3bool %rhs %22 - %24 = OpLogicalAnd %v3bool %20 %23 - %25 = OpLogicalOr %v3bool %16 %24 - %15 = OpSelect %v3int %25 %27 %rhs - %32 = OpBitwiseOr %v3int %lhs %15 - %29 = OpBitcast %v3uint %32 - %35 = OpBitwiseAnd %v3uint %29 %34 - %37 = OpINotEqual %v3bool %35 %36 - %28 = OpAny %bool %37 - OpSelectionMerge %38 None - OpBranchConditional %28 %39 %40 - %39 = OpLabel - OpStore %tint_return_flag %true - %42 = OpSDiv %v3int %lhs %15 - %43 = OpIMul %v3int %42 %15 - %44 = OpISub %v3int %lhs %43 - OpStore %tint_return_value %44 - OpBranch %38 - %40 = OpLabel - OpStore %tint_return_flag %true - %45 = OpSRem %v3int %lhs %15 - OpStore %tint_return_value %45 - OpBranch %38 - %38 = OpLabel - %46 = OpLoad %v3int %tint_return_value - OpReturnValue %46 + %10 = OpIEqual %v3bool %rhs %9 + %15 = OpIEqual %v3bool %lhs %14 + %18 = OpIEqual %v3bool %rhs %17 + %19 = OpLogicalAnd %v3bool %15 %18 + %20 = OpLogicalOr %v3bool %10 %19 + %8 = OpSelect %v3int %20 %22 %rhs + %27 = OpBitwiseOr %v3int %lhs %8 + %24 = OpBitcast %v3uint %27 + %30 = OpBitwiseAnd %v3uint %24 %29 + %32 = OpINotEqual %v3bool %30 %31 + %23 = OpAny %bool %32 + OpSelectionMerge %33 None + OpBranchConditional %23 %34 %35 + %34 = OpLabel + %36 = OpSDiv %v3int %lhs %8 + %37 = OpIMul %v3int %36 %8 + %38 = OpISub %v3int %lhs %37 + OpReturnValue %38 + %35 = OpLabel + %39 = OpSRem %v3int %lhs %8 + OpReturnValue %39 + %33 = OpLabel + OpReturnValue %9 OpFunctionEnd - %f = OpFunction %void None %47 - %50 = OpLabel - %a = OpVariable %_ptr_Function_v3int Function %14 - %b = OpVariable %_ptr_Function_v3int Function %14 - OpStore %a %53 - OpStore %b %57 - %60 = OpLoad %v3int %a - %61 = OpLoad %v3int %b - %59 = OpFunctionCall %v3int %tint_mod %60 %61 + %f = OpFunction %void None %40 + %43 = OpLabel + %a = OpVariable %_ptr_Function_v3int Function %9 + %b = OpVariable %_ptr_Function_v3int Function %9 + OpStore %a %46 + OpStore %b %51 + %54 = OpLoad %v3int %a + %55 = OpLoad %v3int %b + %53 = OpFunctionCall %v3int %tint_mod %54 %55 OpReturn OpFunctionEnd diff --git a/test/tint/ptr_ref/load/param/workgroup/struct_in_array.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/load/param/workgroup/struct_in_array.wgsl.expected.dxc.hlsl index 38e8b07af1..1b5ca94809 100644 --- a/test/tint/ptr_ref/load/param/workgroup/struct_in_array.wgsl.expected.dxc.hlsl +++ b/test/tint/ptr_ref/load/param/workgroup/struct_in_array.wgsl.expected.dxc.hlsl @@ -16,13 +16,13 @@ void main_inner(uint local_invocation_index) { { for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) { const uint i_1 = idx; - const str tint_symbol_3 = (str)0; - S[i_1] = tint_symbol_3; + const str tint_symbol_2 = (str)0; + S[i_1] = tint_symbol_2; } } GroupMemoryBarrierWithGroupSync(); - const uint tint_symbol_2[1] = {2u}; - const str r = func_S_X(tint_symbol_2); + const uint tint_symbol_3[1] = {2u}; + const str r = func_S_X(tint_symbol_3); } [numthreads(1, 1, 1)] diff --git a/test/tint/ptr_ref/load/param/workgroup/struct_in_array.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/load/param/workgroup/struct_in_array.wgsl.expected.fxc.hlsl index 38e8b07af1..1b5ca94809 100644 --- a/test/tint/ptr_ref/load/param/workgroup/struct_in_array.wgsl.expected.fxc.hlsl +++ b/test/tint/ptr_ref/load/param/workgroup/struct_in_array.wgsl.expected.fxc.hlsl @@ -16,13 +16,13 @@ void main_inner(uint local_invocation_index) { { for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) { const uint i_1 = idx; - const str tint_symbol_3 = (str)0; - S[i_1] = tint_symbol_3; + const str tint_symbol_2 = (str)0; + S[i_1] = tint_symbol_2; } } GroupMemoryBarrierWithGroupSync(); - const uint tint_symbol_2[1] = {2u}; - const str r = func_S_X(tint_symbol_2); + const uint tint_symbol_3[1] = {2u}; + const str r = func_S_X(tint_symbol_3); } [numthreads(1, 1, 1)] diff --git a/test/tint/ptr_ref/store/param/workgroup/struct_in_array.wgsl.expected.dxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/struct_in_array.wgsl.expected.dxc.hlsl index 36be9e2df8..592ab89a58 100644 --- a/test/tint/ptr_ref/store/param/workgroup/struct_in_array.wgsl.expected.dxc.hlsl +++ b/test/tint/ptr_ref/store/param/workgroup/struct_in_array.wgsl.expected.dxc.hlsl @@ -5,8 +5,8 @@ struct str { groupshared str S[4]; void func_S_X(uint pointer[1]) { - const str tint_symbol_2 = (str)0; - S[pointer[0]] = tint_symbol_2; + const str tint_symbol_4 = (str)0; + S[pointer[0]] = tint_symbol_4; } struct tint_symbol_1 { @@ -17,8 +17,8 @@ void main_inner(uint local_invocation_index) { { for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) { const uint i_1 = idx; - const str tint_symbol_4 = (str)0; - S[i_1] = tint_symbol_4; + const str tint_symbol_2 = (str)0; + S[i_1] = tint_symbol_2; } } GroupMemoryBarrierWithGroupSync(); diff --git a/test/tint/ptr_ref/store/param/workgroup/struct_in_array.wgsl.expected.fxc.hlsl b/test/tint/ptr_ref/store/param/workgroup/struct_in_array.wgsl.expected.fxc.hlsl index 36be9e2df8..592ab89a58 100644 --- a/test/tint/ptr_ref/store/param/workgroup/struct_in_array.wgsl.expected.fxc.hlsl +++ b/test/tint/ptr_ref/store/param/workgroup/struct_in_array.wgsl.expected.fxc.hlsl @@ -5,8 +5,8 @@ struct str { groupshared str S[4]; void func_S_X(uint pointer[1]) { - const str tint_symbol_2 = (str)0; - S[pointer[0]] = tint_symbol_2; + const str tint_symbol_4 = (str)0; + S[pointer[0]] = tint_symbol_4; } struct tint_symbol_1 { @@ -17,8 +17,8 @@ void main_inner(uint local_invocation_index) { { for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) { const uint i_1 = idx; - const str tint_symbol_4 = (str)0; - S[i_1] = tint_symbol_4; + const str tint_symbol_2 = (str)0; + S[i_1] = tint_symbol_2; } } GroupMemoryBarrierWithGroupSync(); diff --git a/test/tint/ptr_ref/store/param/workgroup/struct_in_array.wgsl.expected.msl b/test/tint/ptr_ref/store/param/workgroup/struct_in_array.wgsl.expected.msl index 752003542d..bc419c04a7 100644 --- a/test/tint/ptr_ref/store/param/workgroup/struct_in_array.wgsl.expected.msl +++ b/test/tint/ptr_ref/store/param/workgroup/struct_in_array.wgsl.expected.msl @@ -19,15 +19,15 @@ struct str { }; void func(threadgroup str* const pointer) { - str const tint_symbol_1 = str{}; - *(pointer) = tint_symbol_1; + str const tint_symbol_2 = str{}; + *(pointer) = tint_symbol_2; } void tint_symbol_inner(uint local_invocation_index, threadgroup tint_array* const tint_symbol_3) { for(uint idx = local_invocation_index; (idx < 4u); idx = (idx + 1u)) { uint const i_1 = idx; - str const tint_symbol_2 = str{}; - (*(tint_symbol_3))[i_1] = tint_symbol_2; + str const tint_symbol_1 = str{}; + (*(tint_symbol_3))[i_1] = tint_symbol_1; } threadgroup_barrier(mem_flags::mem_threadgroup); func(&((*(tint_symbol_3))[2])); diff --git a/test/tint/shadowing/short_names/renamer/function.wgsl.expected.dxc.hlsl b/test/tint/shadowing/short_names/renamer/function.wgsl.expected.dxc.hlsl index b27695049b..b3bb46bd9a 100644 --- a/test/tint/shadowing/short_names/renamer/function.wgsl.expected.dxc.hlsl +++ b/test/tint/shadowing/short_names/renamer/function.wgsl.expected.dxc.hlsl @@ -10,25 +10,25 @@ bool vec2i(float f) { return bool(f); } -struct tint_symbol_1 { +struct tint_symbol_6 { uint VertexIndex : SV_VertexID; }; -struct tint_symbol_2 { +struct tint_symbol_7 { float4 value : SV_Position; }; float4 main_inner(uint VertexIndex) { - const float4 tint_symbol_3 = (0.0f).xxxx; - const float4 tint_symbol_4 = (1.0f).xxxx; - const int tint_symbol_5 = vec4f(); - const float tint_symbol_6 = vec2f(tint_symbol_5); - const bool tint_symbol_7 = vec2i(tint_symbol_6); - return (tint_symbol_7 ? tint_symbol_4 : tint_symbol_3); + const float4 tint_symbol = (0.0f).xxxx; + const float4 tint_symbol_1 = (1.0f).xxxx; + const int tint_symbol_2 = vec4f(); + const float tint_symbol_3 = vec2f(tint_symbol_2); + const bool tint_symbol_4 = vec2i(tint_symbol_3); + return (tint_symbol_4 ? tint_symbol_1 : tint_symbol); } -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const float4 inner_result = main_inner(tint_symbol.VertexIndex); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; +tint_symbol_7 main(tint_symbol_6 tint_symbol_5) { + const float4 inner_result = main_inner(tint_symbol_5.VertexIndex); + tint_symbol_7 wrapper_result = (tint_symbol_7)0; wrapper_result.value = inner_result; return wrapper_result; } diff --git a/test/tint/shadowing/short_names/renamer/function.wgsl.expected.fxc.hlsl b/test/tint/shadowing/short_names/renamer/function.wgsl.expected.fxc.hlsl index b27695049b..b3bb46bd9a 100644 --- a/test/tint/shadowing/short_names/renamer/function.wgsl.expected.fxc.hlsl +++ b/test/tint/shadowing/short_names/renamer/function.wgsl.expected.fxc.hlsl @@ -10,25 +10,25 @@ bool vec2i(float f) { return bool(f); } -struct tint_symbol_1 { +struct tint_symbol_6 { uint VertexIndex : SV_VertexID; }; -struct tint_symbol_2 { +struct tint_symbol_7 { float4 value : SV_Position; }; float4 main_inner(uint VertexIndex) { - const float4 tint_symbol_3 = (0.0f).xxxx; - const float4 tint_symbol_4 = (1.0f).xxxx; - const int tint_symbol_5 = vec4f(); - const float tint_symbol_6 = vec2f(tint_symbol_5); - const bool tint_symbol_7 = vec2i(tint_symbol_6); - return (tint_symbol_7 ? tint_symbol_4 : tint_symbol_3); + const float4 tint_symbol = (0.0f).xxxx; + const float4 tint_symbol_1 = (1.0f).xxxx; + const int tint_symbol_2 = vec4f(); + const float tint_symbol_3 = vec2f(tint_symbol_2); + const bool tint_symbol_4 = vec2i(tint_symbol_3); + return (tint_symbol_4 ? tint_symbol_1 : tint_symbol); } -tint_symbol_2 main(tint_symbol_1 tint_symbol) { - const float4 inner_result = main_inner(tint_symbol.VertexIndex); - tint_symbol_2 wrapper_result = (tint_symbol_2)0; +tint_symbol_7 main(tint_symbol_6 tint_symbol_5) { + const float4 inner_result = main_inner(tint_symbol_5.VertexIndex); + tint_symbol_7 wrapper_result = (tint_symbol_7)0; wrapper_result.value = inner_result; return wrapper_result; } diff --git a/test/tint/shadowing/short_names/renamer/function.wgsl.expected.msl b/test/tint/shadowing/short_names/renamer/function.wgsl.expected.msl index 69aef235f8..00ff172776 100644 --- a/test/tint/shadowing/short_names/renamer/function.wgsl.expected.msl +++ b/test/tint/shadowing/short_names/renamer/function.wgsl.expected.msl @@ -13,22 +13,22 @@ bool vec2i(float f) { return bool(f); } -struct tint_symbol_1 { +struct tint_symbol_6 { float4 value [[position]]; }; float4 tint_symbol_inner(uint VertexIndex) { - float4 const tint_symbol_2 = float4(0.0f); - float4 const tint_symbol_3 = float4(1.0f); - int const tint_symbol_4 = vec4f(); - float const tint_symbol_5 = vec2f(tint_symbol_4); - bool const tint_symbol_6 = vec2i(tint_symbol_5); - return select(tint_symbol_2, tint_symbol_3, tint_symbol_6); + float4 const tint_symbol_1 = float4(0.0f); + float4 const tint_symbol_2 = float4(1.0f); + int const tint_symbol_3 = vec4f(); + float const tint_symbol_4 = vec2f(tint_symbol_3); + bool const tint_symbol_5 = vec2i(tint_symbol_4); + return select(tint_symbol_1, tint_symbol_2, tint_symbol_5); } -vertex tint_symbol_1 tint_symbol(uint VertexIndex [[vertex_id]]) { +vertex tint_symbol_6 tint_symbol(uint VertexIndex [[vertex_id]]) { float4 const inner_result = tint_symbol_inner(VertexIndex); - tint_symbol_1 wrapper_result = {}; + tint_symbol_6 wrapper_result = {}; wrapper_result.value = inner_result; return wrapper_result; } diff --git a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.spvasm b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.spvasm index 6764152fa7..c7ab06bf06 100644 --- a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 83 +; Bound: 76 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,8 +16,6 @@ OpName %tint_mod "tint_mod" OpName %lhs_0 "lhs" OpName %rhs_0 "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %foo "foo" OpName %maybe_zero "maybe_zero" %int = OpTypeInt 32 1 @@ -35,14 +33,10 @@ %int_n2147483648 = OpConstant %int -2147483648 %int_n1 = OpConstant %int -1 %int_1 = OpConstant %int 1 -%_ptr_Function_bool = OpTypePointer Function %bool - %35 = OpConstantNull %bool -%_ptr_Function_int = OpTypePointer Function %int %uint = OpTypeInt 32 0 %uint_2147483648 = OpConstant %uint 2147483648 - %50 = OpConstantNull %uint - %true = OpConstantTrue %bool - %61 = OpTypeFunction %void %int + %45 = OpConstantNull %uint + %54 = OpTypeFunction %void %int %unused_entry_point = OpFunction %void None %9 %12 = OpLabel OpReturn @@ -64,64 +58,57 @@ %lhs_0 = OpFunctionParameter %int %rhs_0 = OpFunctionParameter %int %32 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %35 -%tint_return_value = OpVariable %_ptr_Function_int Function %4 - %39 = OpIEqual %bool %rhs_0 %4 - %40 = OpIEqual %bool %lhs_0 %int_n2147483648 - %41 = OpIEqual %bool %rhs_0 %int_n1 - %42 = OpLogicalAnd %bool %40 %41 - %43 = OpLogicalOr %bool %39 %42 - %38 = OpSelect %int %43 %int_1 %rhs_0 - %47 = OpBitwiseOr %int %lhs_0 %38 - %45 = OpBitcast %uint %47 - %49 = OpBitwiseAnd %uint %45 %uint_2147483648 - %51 = OpINotEqual %bool %49 %50 - OpSelectionMerge %52 None - OpBranchConditional %51 %53 %54 - %53 = OpLabel - OpStore %tint_return_flag %true - %56 = OpSDiv %int %lhs_0 %38 - %57 = OpIMul %int %56 %38 - %58 = OpISub %int %lhs_0 %57 - OpStore %tint_return_value %58 - OpBranch %52 - %54 = OpLabel - OpStore %tint_return_flag %true - %59 = OpSRem %int %lhs_0 %38 - OpStore %tint_return_value %59 - OpBranch %52 - %52 = OpLabel - %60 = OpLoad %int %tint_return_value - OpReturnValue %60 + %34 = OpIEqual %bool %rhs_0 %4 + %35 = OpIEqual %bool %lhs_0 %int_n2147483648 + %36 = OpIEqual %bool %rhs_0 %int_n1 + %37 = OpLogicalAnd %bool %35 %36 + %38 = OpLogicalOr %bool %34 %37 + %33 = OpSelect %int %38 %int_1 %rhs_0 + %42 = OpBitwiseOr %int %lhs_0 %33 + %40 = OpBitcast %uint %42 + %44 = OpBitwiseAnd %uint %40 %uint_2147483648 + %46 = OpINotEqual %bool %44 %45 + OpSelectionMerge %47 None + OpBranchConditional %46 %48 %49 + %48 = OpLabel + %50 = OpSDiv %int %lhs_0 %33 + %51 = OpIMul %int %50 %33 + %52 = OpISub %int %lhs_0 %51 + OpReturnValue %52 + %49 = OpLabel + %53 = OpSRem %int %lhs_0 %33 + OpReturnValue %53 + %47 = OpLabel + OpReturnValue %4 OpFunctionEnd - %foo = OpFunction %void None %61 + %foo = OpFunction %void None %54 %maybe_zero = OpFunctionParameter %int - %64 = OpLabel - %66 = OpLoad %int %a - %65 = OpFunctionCall %int %tint_div %66 %4 - OpStore %a %65 - %68 = OpLoad %int %a - %67 = OpFunctionCall %int %tint_mod %68 %4 - OpStore %a %67 - %70 = OpLoad %int %a - %69 = OpFunctionCall %int %tint_div %70 %maybe_zero - OpStore %a %69 - %72 = OpLoad %int %a - %71 = OpFunctionCall %int %tint_mod %72 %maybe_zero - OpStore %a %71 + %57 = OpLabel + %59 = OpLoad %int %a + %58 = OpFunctionCall %int %tint_div %59 %4 + OpStore %a %58 + %61 = OpLoad %int %a + %60 = OpFunctionCall %int %tint_mod %61 %4 + OpStore %a %60 + %63 = OpLoad %int %a + %62 = OpFunctionCall %int %tint_div %63 %maybe_zero + OpStore %a %62 + %65 = OpLoad %int %a + %64 = OpFunctionCall %int %tint_mod %65 %maybe_zero + OpStore %a %64 + %66 = OpLoad %float %b + %67 = OpFDiv %float %66 %8 + OpStore %b %67 + %68 = OpLoad %float %b + %69 = OpFRem %float %68 %8 + OpStore %b %69 + %70 = OpLoad %float %b + %71 = OpConvertSToF %float %maybe_zero + %72 = OpFDiv %float %70 %71 + OpStore %b %72 %73 = OpLoad %float %b - %74 = OpFDiv %float %73 %8 - OpStore %b %74 - %75 = OpLoad %float %b - %76 = OpFRem %float %75 %8 - OpStore %b %76 - %77 = OpLoad %float %b - %78 = OpConvertSToF %float %maybe_zero - %79 = OpFDiv %float %77 %78 - OpStore %b %79 - %80 = OpLoad %float %b - %81 = OpConvertSToF %float %maybe_zero - %82 = OpFRem %float %80 %81 - OpStore %b %82 + %74 = OpConvertSToF %float %maybe_zero + %75 = OpFRem %float %73 %74 + OpStore %b %75 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.dxc.hlsl index 961678047d..503f0e7809 100644 --- a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.dxc.hlsl +++ b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.dxc.hlsl @@ -10,6 +10,5 @@ int tint_div(int lhs, int rhs) { } void foo() { - const int tint_symbol = tint_div(asint(v.Load(0u)), 2); - v.Store(0u, asuint(tint_symbol)); + v.Store(0u, asuint(tint_div(asint(v.Load(0u)), 2))); } diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.fxc.hlsl index 961678047d..503f0e7809 100644 --- a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.fxc.hlsl +++ b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.fxc.hlsl @@ -10,6 +10,5 @@ int tint_div(int lhs, int rhs) { } void foo() { - const int tint_symbol = tint_div(asint(v.Load(0u)), 2); - v.Store(0u, asuint(tint_symbol)); + v.Store(0u, asuint(tint_div(asint(v.Load(0u)), 2))); } diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl index 822f89b0b9..81ef9d0fe9 100644 --- a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.glsl @@ -17,7 +17,6 @@ int tint_div(int lhs, int rhs) { } void foo() { - int tint_symbol = tint_div(v.inner.a, 2); - v.inner.a = tint_symbol; + v.inner.a = tint_div(v.inner.a, 2); } diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.msl b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.msl index c839ac0133..03a9f2cb64 100644 --- a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.msl +++ b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.msl @@ -9,8 +9,7 @@ int tint_div(int lhs, int rhs) { return (lhs / select(rhs, 1, bool((rhs == 0) | bool((lhs == (-2147483647 - 1)) & (rhs == -1))))); } -void foo(device S* const tint_symbol_1) { - int const tint_symbol = tint_div((*(tint_symbol_1)).a, 2); - (*(tint_symbol_1)).a = tint_symbol; +void foo(device S* const tint_symbol) { + (*(tint_symbol)).a = tint_div((*(tint_symbol)).a, 2); } diff --git a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.spvasm index e1c28b21ee..00b456a664 100644 --- a/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/scalar/divide.wgsl.expected.spvasm @@ -58,10 +58,10 @@ OpFunctionEnd %foo = OpFunction %void None %6 %28 = OpLabel - %33 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 - %34 = OpLoad %int %33 - %29 = OpFunctionCall %int %tint_div %34 %int_2 - %36 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 - OpStore %36 %29 + %32 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %34 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %35 = OpLoad %int %34 + %33 = OpFunctionCall %int %tint_div %35 %int_2 + OpStore %32 %33 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.dxc.hlsl index 40a04199e4..a51a03f568 100644 --- a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.dxc.hlsl +++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.dxc.hlsl @@ -15,6 +15,5 @@ int tint_mod(int lhs, int rhs) { } void foo() { - const int tint_symbol = tint_mod(asint(v.Load(0u)), 2); - v.Store(0u, asuint(tint_symbol)); + v.Store(0u, asuint(tint_mod(asint(v.Load(0u)), 2))); } diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.fxc.hlsl index 40a04199e4..a51a03f568 100644 --- a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.fxc.hlsl +++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.fxc.hlsl @@ -15,6 +15,5 @@ int tint_mod(int lhs, int rhs) { } void foo() { - const int tint_symbol = tint_mod(asint(v.Load(0u)), 2); - v.Store(0u, asuint(tint_symbol)); + v.Store(0u, asuint(tint_mod(asint(v.Load(0u)), 2))); } diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl index 1b27070db0..1ebe67ebf5 100644 --- a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.glsl @@ -22,7 +22,6 @@ int tint_mod(int lhs, int rhs) { } void foo() { - int tint_symbol = tint_mod(v.inner.a, 2); - v.inner.a = tint_symbol; + v.inner.a = tint_mod(v.inner.a, 2); } diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.msl b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.msl index 42772eec7a..1241632bea 100644 --- a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.msl +++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.msl @@ -14,8 +14,7 @@ int tint_mod(int lhs, int rhs) { } } -void foo(device S* const tint_symbol_1) { - int const tint_symbol = tint_mod((*(tint_symbol_1)).a, 2); - (*(tint_symbol_1)).a = tint_symbol; +void foo(device S* const tint_symbol) { + (*(tint_symbol)).a = tint_mod((*(tint_symbol)).a, 2); } diff --git a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.spvasm b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.spvasm index 5df8f971b8..3bbb8ba2d9 100644 --- a/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/scalar/modulo.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 57 +; Bound: 50 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,8 +16,6 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %foo "foo" OpDecorate %v_block Block OpMemberDecorate %v_block 0 Offset 0 @@ -32,18 +30,14 @@ %void = OpTypeVoid %6 = OpTypeFunction %void %10 = OpTypeFunction %int %int %int + %16 = OpConstantNull %int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %18 = OpConstantNull %bool -%_ptr_Function_int = OpTypePointer Function %int - %21 = OpConstantNull %int %int_n2147483648 = OpConstant %int -2147483648 %int_n1 = OpConstant %int -1 %int_1 = OpConstant %int 1 %uint = OpTypeInt 32 0 %uint_2147483648 = OpConstant %uint 2147483648 - %37 = OpConstantNull %uint - %true = OpConstantTrue %bool + %32 = OpConstantNull %uint %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int %int_2 = OpConstant %int 2 @@ -55,42 +49,35 @@ %lhs = OpFunctionParameter %int %rhs = OpFunctionParameter %int %14 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %18 -%tint_return_value = OpVariable %_ptr_Function_int Function %21 - %23 = OpIEqual %bool %rhs %21 - %25 = OpIEqual %bool %lhs %int_n2147483648 - %27 = OpIEqual %bool %rhs %int_n1 - %28 = OpLogicalAnd %bool %25 %27 - %29 = OpLogicalOr %bool %23 %28 - %22 = OpSelect %int %29 %int_1 %rhs - %34 = OpBitwiseOr %int %lhs %22 - %32 = OpBitcast %uint %34 - %36 = OpBitwiseAnd %uint %32 %uint_2147483648 - %38 = OpINotEqual %bool %36 %37 - OpSelectionMerge %39 None - OpBranchConditional %38 %40 %41 - %40 = OpLabel - OpStore %tint_return_flag %true - %43 = OpSDiv %int %lhs %22 - %44 = OpIMul %int %43 %22 - %45 = OpISub %int %lhs %44 - OpStore %tint_return_value %45 - OpBranch %39 - %41 = OpLabel - OpStore %tint_return_flag %true - %46 = OpSRem %int %lhs %22 - OpStore %tint_return_value %46 - OpBranch %39 - %39 = OpLabel - %47 = OpLoad %int %tint_return_value - OpReturnValue %47 + %17 = OpIEqual %bool %rhs %16 + %20 = OpIEqual %bool %lhs %int_n2147483648 + %22 = OpIEqual %bool %rhs %int_n1 + %23 = OpLogicalAnd %bool %20 %22 + %24 = OpLogicalOr %bool %17 %23 + %15 = OpSelect %int %24 %int_1 %rhs + %29 = OpBitwiseOr %int %lhs %15 + %27 = OpBitcast %uint %29 + %31 = OpBitwiseAnd %uint %27 %uint_2147483648 + %33 = OpINotEqual %bool %31 %32 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %36 + %35 = OpLabel + %37 = OpSDiv %int %lhs %15 + %38 = OpIMul %int %37 %15 + %39 = OpISub %int %lhs %38 + OpReturnValue %39 + %36 = OpLabel + %40 = OpSRem %int %lhs %15 + OpReturnValue %40 + %34 = OpLabel + OpReturnValue %16 OpFunctionEnd %foo = OpFunction %void None %6 - %49 = OpLabel - %53 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 - %54 = OpLoad %int %53 - %50 = OpFunctionCall %int %tint_mod %54 %int_2 - %56 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 - OpStore %56 %50 + %42 = OpLabel + %45 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %47 = OpAccessChain %_ptr_StorageBuffer_int %v %uint_0 %uint_0 + %48 = OpLoad %int %47 + %46 = OpFunctionCall %int %tint_mod %48 %int_2 + OpStore %45 %46 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.dxc.hlsl index c2ffedcfcd..1c1e04c60a 100644 --- a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.dxc.hlsl +++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.dxc.hlsl @@ -10,6 +10,5 @@ int4 tint_div(int4 lhs, int4 rhs) { } void foo() { - const int4 tint_symbol = tint_div(asint(v.Load4(0u)), (2).xxxx); - v.Store4(0u, asuint(tint_symbol)); + v.Store4(0u, asuint(tint_div(asint(v.Load4(0u)), (2).xxxx))); } diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.fxc.hlsl index c2ffedcfcd..1c1e04c60a 100644 --- a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.fxc.hlsl +++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.fxc.hlsl @@ -10,6 +10,5 @@ int4 tint_div(int4 lhs, int4 rhs) { } void foo() { - const int4 tint_symbol = tint_div(asint(v.Load4(0u)), (2).xxxx); - v.Store4(0u, asuint(tint_symbol)); + v.Store4(0u, asuint(tint_div(asint(v.Load4(0u)), (2).xxxx))); } diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl index daea9b2647..1c33d31dd4 100644 --- a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.glsl @@ -17,7 +17,6 @@ ivec4 tint_div(ivec4 lhs, ivec4 rhs) { } void foo() { - ivec4 tint_symbol = tint_div(v.inner.a, ivec4(2)); - v.inner.a = tint_symbol; + v.inner.a = tint_div(v.inner.a, ivec4(2)); } diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.msl index f0dd095353..db0e4ff168 100644 --- a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.msl +++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.msl @@ -9,8 +9,7 @@ int4 tint_div(int4 lhs, int4 rhs) { return (lhs / select(rhs, int4(1), ((rhs == int4(0)) | ((lhs == int4((-2147483647 - 1))) & (rhs == int4(-1)))))); } -void foo(device S* const tint_symbol_1) { - int4 const tint_symbol = tint_div((*(tint_symbol_1)).a, int4(2)); - (*(tint_symbol_1)).a = tint_symbol; +void foo(device S* const tint_symbol) { + (*(tint_symbol)).a = tint_div((*(tint_symbol)).a, int4(2)); } diff --git a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.spvasm index cfca72af03..f4ac117f93 100644 --- a/test/tint/statements/compound_assign/vector/divide.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/divide.wgsl.expected.spvasm @@ -44,7 +44,7 @@ %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %int_2 = OpConstant %int 2 - %41 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 + %42 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 %unused_entry_point = OpFunction %void None %7 %10 = OpLabel OpReturn @@ -64,10 +64,10 @@ OpFunctionEnd %foo = OpFunction %void None %7 %33 = OpLabel - %38 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 - %39 = OpLoad %v4int %38 - %34 = OpFunctionCall %v4int %tint_div %39 %41 - %42 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 - OpStore %42 %34 + %37 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %39 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %40 = OpLoad %v4int %39 + %38 = OpFunctionCall %v4int %tint_div %40 %42 + OpStore %37 %38 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.dxc.hlsl index ea807538e4..fd35f96c67 100644 --- a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.dxc.hlsl +++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.dxc.hlsl @@ -16,6 +16,5 @@ int4 tint_mod(int4 lhs, int rhs) { } void foo() { - const int4 tint_symbol = tint_mod(asint(v.Load4(0u)), 2); - v.Store4(0u, asuint(tint_symbol)); + v.Store4(0u, asuint(tint_mod(asint(v.Load4(0u)), 2))); } diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.fxc.hlsl index ea807538e4..fd35f96c67 100644 --- a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.fxc.hlsl +++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.fxc.hlsl @@ -16,6 +16,5 @@ int4 tint_mod(int4 lhs, int rhs) { } void foo() { - const int4 tint_symbol = tint_mod(asint(v.Load4(0u)), 2); - v.Store4(0u, asuint(tint_symbol)); + v.Store4(0u, asuint(tint_mod(asint(v.Load4(0u)), 2))); } diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl index b650cfb145..da6ab7210b 100644 --- a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.glsl @@ -23,7 +23,6 @@ ivec4 tint_mod(ivec4 lhs, int rhs) { } void foo() { - ivec4 tint_symbol = tint_mod(v.inner.a, 2); - v.inner.a = tint_symbol; + v.inner.a = tint_mod(v.inner.a, 2); } diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.msl index e0a82ebd81..afe37d627a 100644 --- a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.msl +++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.msl @@ -15,8 +15,7 @@ int4 tint_mod(int4 lhs, int rhs) { } } -void foo(device S* const tint_symbol_1) { - int4 const tint_symbol = tint_mod((*(tint_symbol_1)).a, 2); - (*(tint_symbol_1)).a = tint_symbol; +void foo(device S* const tint_symbol) { + (*(tint_symbol)).a = tint_mod((*(tint_symbol)).a, 2); } diff --git a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.spvasm index 52b59dde7b..c3a7acd84c 100644 --- a/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/modulo-scalar.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 65 +; Bound: 58 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,8 +16,6 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %foo "foo" OpDecorate %v_block Block OpMemberDecorate %v_block 0 Offset 0 @@ -33,24 +31,20 @@ %void = OpTypeVoid %7 = OpTypeFunction %void %11 = OpTypeFunction %v4int %v4int %int + %18 = OpConstantNull %v4int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %19 = OpConstantNull %bool -%_ptr_Function_v4int = OpTypePointer Function %v4int - %22 = OpConstantNull %v4int %v4bool = OpTypeVector %bool 4 %int_n2147483648 = OpConstant %int -2147483648 - %28 = OpConstantComposite %v4int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n2147483648 + %23 = OpConstantComposite %v4int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n1 = OpConstant %int -1 - %31 = OpConstantComposite %v4int %int_n1 %int_n1 %int_n1 %int_n1 + %26 = OpConstantComposite %v4int %int_n1 %int_n1 %int_n1 %int_n1 %int_1 = OpConstant %int 1 - %36 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 + %31 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 %uint = OpTypeInt 32 0 %v4uint = OpTypeVector %uint 4 %uint_2147483648 = OpConstant %uint 2147483648 - %43 = OpConstantComposite %v4uint %uint_2147483648 %uint_2147483648 %uint_2147483648 %uint_2147483648 - %45 = OpConstantNull %v4uint - %true = OpConstantTrue %bool + %38 = OpConstantComposite %v4uint %uint_2147483648 %uint_2147483648 %uint_2147483648 %uint_2147483648 + %40 = OpConstantNull %v4uint %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %int_2 = OpConstant %int 2 @@ -62,44 +56,37 @@ %lhs = OpFunctionParameter %v4int %rhs = OpFunctionParameter %int %15 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %19 -%tint_return_value = OpVariable %_ptr_Function_v4int Function %22 - %23 = OpCompositeConstruct %v4int %rhs %rhs %rhs %rhs - %25 = OpIEqual %v4bool %23 %22 - %29 = OpIEqual %v4bool %lhs %28 - %32 = OpIEqual %v4bool %23 %31 - %33 = OpLogicalAnd %v4bool %29 %32 - %34 = OpLogicalOr %v4bool %25 %33 - %24 = OpSelect %v4int %34 %36 %23 - %41 = OpBitwiseOr %v4int %lhs %24 - %38 = OpBitcast %v4uint %41 - %44 = OpBitwiseAnd %v4uint %38 %43 - %46 = OpINotEqual %v4bool %44 %45 - %37 = OpAny %bool %46 - OpSelectionMerge %47 None - OpBranchConditional %37 %48 %49 - %48 = OpLabel - OpStore %tint_return_flag %true - %51 = OpSDiv %v4int %lhs %24 - %52 = OpIMul %v4int %51 %24 - %53 = OpISub %v4int %lhs %52 - OpStore %tint_return_value %53 - OpBranch %47 - %49 = OpLabel - OpStore %tint_return_flag %true - %54 = OpSRem %v4int %lhs %24 - OpStore %tint_return_value %54 - OpBranch %47 - %47 = OpLabel - %55 = OpLoad %v4int %tint_return_value - OpReturnValue %55 + %16 = OpCompositeConstruct %v4int %rhs %rhs %rhs %rhs + %19 = OpIEqual %v4bool %16 %18 + %24 = OpIEqual %v4bool %lhs %23 + %27 = OpIEqual %v4bool %16 %26 + %28 = OpLogicalAnd %v4bool %24 %27 + %29 = OpLogicalOr %v4bool %19 %28 + %17 = OpSelect %v4int %29 %31 %16 + %36 = OpBitwiseOr %v4int %lhs %17 + %33 = OpBitcast %v4uint %36 + %39 = OpBitwiseAnd %v4uint %33 %38 + %41 = OpINotEqual %v4bool %39 %40 + %32 = OpAny %bool %41 + OpSelectionMerge %42 None + OpBranchConditional %32 %43 %44 + %43 = OpLabel + %45 = OpSDiv %v4int %lhs %17 + %46 = OpIMul %v4int %45 %17 + %47 = OpISub %v4int %lhs %46 + OpReturnValue %47 + %44 = OpLabel + %48 = OpSRem %v4int %lhs %17 + OpReturnValue %48 + %42 = OpLabel + OpReturnValue %18 OpFunctionEnd %foo = OpFunction %void None %7 - %57 = OpLabel - %61 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 - %62 = OpLoad %v4int %61 - %58 = OpFunctionCall %v4int %tint_mod %62 %int_2 - %64 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 - OpStore %64 %58 + %50 = OpLabel + %53 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %55 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %56 = OpLoad %v4int %55 + %54 = OpFunctionCall %v4int %tint_mod %56 %int_2 + OpStore %53 %54 OpReturn OpFunctionEnd diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.dxc.hlsl b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.dxc.hlsl index 051500d31f..4d6414d50c 100644 --- a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.dxc.hlsl +++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.dxc.hlsl @@ -15,6 +15,5 @@ int4 tint_mod(int4 lhs, int4 rhs) { } void foo() { - const int4 tint_symbol = tint_mod(asint(v.Load4(0u)), (2).xxxx); - v.Store4(0u, asuint(tint_symbol)); + v.Store4(0u, asuint(tint_mod(asint(v.Load4(0u)), (2).xxxx))); } diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.fxc.hlsl b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.fxc.hlsl index 051500d31f..4d6414d50c 100644 --- a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.fxc.hlsl +++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.fxc.hlsl @@ -15,6 +15,5 @@ int4 tint_mod(int4 lhs, int4 rhs) { } void foo() { - const int4 tint_symbol = tint_mod(asint(v.Load4(0u)), (2).xxxx); - v.Store4(0u, asuint(tint_symbol)); + v.Store4(0u, asuint(tint_mod(asint(v.Load4(0u)), (2).xxxx))); } diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl index b7ed4cce48..a4bd3e649e 100644 --- a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl +++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.glsl @@ -22,7 +22,6 @@ ivec4 tint_mod(ivec4 lhs, ivec4 rhs) { } void foo() { - ivec4 tint_symbol = tint_mod(v.inner.a, ivec4(2)); - v.inner.a = tint_symbol; + v.inner.a = tint_mod(v.inner.a, ivec4(2)); } diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.msl b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.msl index fc613339ac..16b69681ea 100644 --- a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.msl +++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.msl @@ -14,8 +14,7 @@ int4 tint_mod(int4 lhs, int4 rhs) { } } -void foo(device S* const tint_symbol_1) { - int4 const tint_symbol = tint_mod((*(tint_symbol_1)).a, int4(2)); - (*(tint_symbol_1)).a = tint_symbol; +void foo(device S* const tint_symbol) { + (*(tint_symbol)).a = tint_mod((*(tint_symbol)).a, int4(2)); } diff --git a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.spvasm b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.spvasm index 3ac6525e08..180eebd2b1 100644 --- a/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.spvasm +++ b/test/tint/statements/compound_assign/vector/modulo.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 65 +; Bound: 58 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -16,8 +16,6 @@ OpName %tint_mod "tint_mod" OpName %lhs "lhs" OpName %rhs "rhs" - OpName %tint_return_flag "tint_return_flag" - OpName %tint_return_value "tint_return_value" OpName %foo "foo" OpDecorate %v_block Block OpMemberDecorate %v_block 0 Offset 0 @@ -33,28 +31,24 @@ %void = OpTypeVoid %7 = OpTypeFunction %void %11 = OpTypeFunction %v4int %v4int %v4int + %17 = OpConstantNull %v4int %bool = OpTypeBool -%_ptr_Function_bool = OpTypePointer Function %bool - %19 = OpConstantNull %bool -%_ptr_Function_v4int = OpTypePointer Function %v4int - %22 = OpConstantNull %v4int %v4bool = OpTypeVector %bool 4 %int_n2147483648 = OpConstant %int -2147483648 - %27 = OpConstantComposite %v4int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n2147483648 + %22 = OpConstantComposite %v4int %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n2147483648 %int_n1 = OpConstant %int -1 - %30 = OpConstantComposite %v4int %int_n1 %int_n1 %int_n1 %int_n1 + %25 = OpConstantComposite %v4int %int_n1 %int_n1 %int_n1 %int_n1 %int_1 = OpConstant %int 1 - %35 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 + %30 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1 %uint = OpTypeInt 32 0 %v4uint = OpTypeVector %uint 4 %uint_2147483648 = OpConstant %uint 2147483648 - %42 = OpConstantComposite %v4uint %uint_2147483648 %uint_2147483648 %uint_2147483648 %uint_2147483648 - %44 = OpConstantNull %v4uint - %true = OpConstantTrue %bool + %37 = OpConstantComposite %v4uint %uint_2147483648 %uint_2147483648 %uint_2147483648 %uint_2147483648 + %39 = OpConstantNull %v4uint %uint_0 = OpConstant %uint 0 %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int %int_2 = OpConstant %int 2 - %63 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 + %57 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2 %unused_entry_point = OpFunction %void None %7 %10 = OpLabel OpReturn @@ -63,43 +57,36 @@ %lhs = OpFunctionParameter %v4int %rhs = OpFunctionParameter %v4int %15 = OpLabel -%tint_return_flag = OpVariable %_ptr_Function_bool Function %19 -%tint_return_value = OpVariable %_ptr_Function_v4int Function %22 - %24 = OpIEqual %v4bool %rhs %22 - %28 = OpIEqual %v4bool %lhs %27 - %31 = OpIEqual %v4bool %rhs %30 - %32 = OpLogicalAnd %v4bool %28 %31 - %33 = OpLogicalOr %v4bool %24 %32 - %23 = OpSelect %v4int %33 %35 %rhs - %40 = OpBitwiseOr %v4int %lhs %23 - %37 = OpBitcast %v4uint %40 - %43 = OpBitwiseAnd %v4uint %37 %42 - %45 = OpINotEqual %v4bool %43 %44 - %36 = OpAny %bool %45 - OpSelectionMerge %46 None - OpBranchConditional %36 %47 %48 - %47 = OpLabel - OpStore %tint_return_flag %true - %50 = OpSDiv %v4int %lhs %23 - %51 = OpIMul %v4int %50 %23 - %52 = OpISub %v4int %lhs %51 - OpStore %tint_return_value %52 - OpBranch %46 - %48 = OpLabel - OpStore %tint_return_flag %true - %53 = OpSRem %v4int %lhs %23 - OpStore %tint_return_value %53 - OpBranch %46 - %46 = OpLabel - %54 = OpLoad %v4int %tint_return_value - OpReturnValue %54 + %18 = OpIEqual %v4bool %rhs %17 + %23 = OpIEqual %v4bool %lhs %22 + %26 = OpIEqual %v4bool %rhs %25 + %27 = OpLogicalAnd %v4bool %23 %26 + %28 = OpLogicalOr %v4bool %18 %27 + %16 = OpSelect %v4int %28 %30 %rhs + %35 = OpBitwiseOr %v4int %lhs %16 + %32 = OpBitcast %v4uint %35 + %38 = OpBitwiseAnd %v4uint %32 %37 + %40 = OpINotEqual %v4bool %38 %39 + %31 = OpAny %bool %40 + OpSelectionMerge %41 None + OpBranchConditional %31 %42 %43 + %42 = OpLabel + %44 = OpSDiv %v4int %lhs %16 + %45 = OpIMul %v4int %44 %16 + %46 = OpISub %v4int %lhs %45 + OpReturnValue %46 + %43 = OpLabel + %47 = OpSRem %v4int %lhs %16 + OpReturnValue %47 + %41 = OpLabel + OpReturnValue %17 OpFunctionEnd %foo = OpFunction %void None %7 - %56 = OpLabel - %60 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 - %61 = OpLoad %v4int %60 - %57 = OpFunctionCall %v4int %tint_mod %61 %63 - %64 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 - OpStore %64 %57 + %49 = OpLabel + %52 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %54 = OpAccessChain %_ptr_StorageBuffer_v4int %v %uint_0 %uint_0 + %55 = OpLoad %v4int %54 + %53 = OpFunctionCall %v4int %tint_mod %55 %57 + OpStore %52 %53 OpReturn OpFunctionEnd diff --git a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.spvasm b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.spvasm index f2bb297013..b01d061b9d 100644 --- a/test/tint/var/initialization/workgroup/matrix.wgsl.expected.spvasm +++ b/test/tint/var/initialization/workgroup/matrix.wgsl.expected.spvasm @@ -1,42 +1,22 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 23 +; Bound: 10 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" %local_invocation_index_1 + OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %local_invocation_index_1 "local_invocation_index_1" OpName %v "v" - OpName %main_inner "main_inner" - OpName %local_invocation_index "local_invocation_index" OpName %main "main" - OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex - %uint = OpTypeInt 32 0 -%_ptr_Input_uint = OpTypePointer Input %uint -%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input %float = OpTypeFloat 32 %v3float = OpTypeVector %float 3 %mat2v3float = OpTypeMatrix %v3float 2 %_ptr_Workgroup_mat2v3float = OpTypePointer Workgroup %mat2v3float %v = OpVariable %_ptr_Workgroup_mat2v3float Workgroup %void = OpTypeVoid - %9 = OpTypeFunction %void %uint - %14 = OpConstantNull %mat2v3float - %uint_2 = OpConstant %uint 2 - %uint_264 = OpConstant %uint 264 - %18 = OpTypeFunction %void - %main_inner = OpFunction %void None %9 -%local_invocation_index = OpFunctionParameter %uint - %13 = OpLabel - OpStore %v %14 - OpControlBarrier %uint_2 %uint_2 %uint_264 - OpReturn - OpFunctionEnd - %main = OpFunction %void None %18 - %20 = OpLabel - %22 = OpLoad %uint %local_invocation_index_1 - %21 = OpFunctionCall %void %main_inner %22 + %6 = OpTypeFunction %void + %main = OpFunction %void None %6 + %9 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl b/test/tint/var/initialization/workgroup/scalar.wgsl index f99bf74f8c..cf9a851630 100644 --- a/test/tint/var/initialization/workgroup/scalar.wgsl +++ b/test/tint/var/initialization/workgroup/scalar.wgsl @@ -2,5 +2,5 @@ var v : i32; @compute @workgroup_size(1) fn main() { - _ = v; + let i = v; } diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.dxc.hlsl b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.dxc.hlsl index 43e8f607dc..d9bc4415b2 100644 --- a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.dxc.hlsl +++ b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.dxc.hlsl @@ -9,6 +9,7 @@ void main_inner(uint local_invocation_index) { v = 0; } GroupMemoryBarrierWithGroupSync(); + const int i = v; } [numthreads(1, 1, 1)] diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.fxc.hlsl b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.fxc.hlsl index 43e8f607dc..d9bc4415b2 100644 --- a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.fxc.hlsl +++ b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.fxc.hlsl @@ -9,6 +9,7 @@ void main_inner(uint local_invocation_index) { v = 0; } GroupMemoryBarrierWithGroupSync(); + const int i = v; } [numthreads(1, 1, 1)] diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.glsl b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.glsl index e455a2b321..33c7291ecb 100644 --- a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.glsl +++ b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.glsl @@ -6,6 +6,7 @@ void tint_symbol(uint local_invocation_index) { v = 0; } barrier(); + int i = v; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.msl b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.msl index 3829fc7306..ae61ccf730 100644 --- a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.msl +++ b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.msl @@ -6,6 +6,7 @@ void tint_symbol_inner(uint local_invocation_index, threadgroup int* const tint_ *(tint_symbol_1) = 0; } threadgroup_barrier(mem_flags::mem_threadgroup); + int const i = *(tint_symbol_1); } kernel void tint_symbol(uint local_invocation_index [[thread_index_in_threadgroup]]) { diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.spvasm b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.spvasm index 34298e87b6..dfb0ec0d9c 100644 --- a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.spvasm +++ b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 21 +; Bound: 22 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 @@ -24,17 +24,18 @@ %12 = OpConstantNull %int %uint_2 = OpConstant %uint 2 %uint_264 = OpConstant %uint 264 - %16 = OpTypeFunction %void + %17 = OpTypeFunction %void %main_inner = OpFunction %void None %7 %local_invocation_index = OpFunctionParameter %uint %11 = OpLabel OpStore %v %12 OpControlBarrier %uint_2 %uint_2 %uint_264 + %16 = OpLoad %int %v OpReturn OpFunctionEnd - %main = OpFunction %void None %16 - %18 = OpLabel - %20 = OpLoad %uint %local_invocation_index_1 - %19 = OpFunctionCall %void %main_inner %20 + %main = OpFunction %void None %17 + %19 = OpLabel + %21 = OpLoad %uint %local_invocation_index_1 + %20 = OpFunctionCall %void %main_inner %21 OpReturn OpFunctionEnd diff --git a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.wgsl b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.wgsl index 98978d068e..af228f1e20 100644 --- a/test/tint/var/initialization/workgroup/scalar.wgsl.expected.wgsl +++ b/test/tint/var/initialization/workgroup/scalar.wgsl.expected.wgsl @@ -2,5 +2,5 @@ var v : i32; @compute @workgroup_size(1) fn main() { - _ = v; + let i = v; } diff --git a/test/tint/var/initialization/workgroup/struct.wgsl.expected.spvasm b/test/tint/var/initialization/workgroup/struct.wgsl.expected.spvasm index 3c74230941..fd31974631 100644 --- a/test/tint/var/initialization/workgroup/struct.wgsl.expected.spvasm +++ b/test/tint/var/initialization/workgroup/struct.wgsl.expected.spvasm @@ -1,47 +1,27 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 23 +; Bound: 10 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" %local_invocation_index_1 + OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %local_invocation_index_1 "local_invocation_index_1" OpName %S "S" OpMemberName %S 0 "a" OpMemberName %S 1 "b" OpName %v "v" - OpName %main_inner "main_inner" - OpName %local_invocation_index "local_invocation_index" OpName %main "main" - OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex OpMemberDecorate %S 0 Offset 0 OpMemberDecorate %S 1 Offset 4 - %uint = OpTypeInt 32 0 -%_ptr_Input_uint = OpTypePointer Input %uint -%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input %int = OpTypeInt 32 1 %float = OpTypeFloat 32 %S = OpTypeStruct %int %float %_ptr_Workgroup_S = OpTypePointer Workgroup %S %v = OpVariable %_ptr_Workgroup_S Workgroup %void = OpTypeVoid - %9 = OpTypeFunction %void %uint - %14 = OpConstantNull %S - %uint_2 = OpConstant %uint 2 - %uint_264 = OpConstant %uint 264 - %18 = OpTypeFunction %void - %main_inner = OpFunction %void None %9 -%local_invocation_index = OpFunctionParameter %uint - %13 = OpLabel - OpStore %v %14 - OpControlBarrier %uint_2 %uint_2 %uint_264 - OpReturn - OpFunctionEnd - %main = OpFunction %void None %18 - %20 = OpLabel - %22 = OpLoad %uint %local_invocation_index_1 - %21 = OpFunctionCall %void %main_inner %22 + %6 = OpTypeFunction %void + %main = OpFunction %void None %6 + %9 = OpLabel OpReturn OpFunctionEnd diff --git a/test/tint/var/initialization/workgroup/vector.wgsl.expected.spvasm b/test/tint/var/initialization/workgroup/vector.wgsl.expected.spvasm index 4ac8187386..7eb221a903 100644 --- a/test/tint/var/initialization/workgroup/vector.wgsl.expected.spvasm +++ b/test/tint/var/initialization/workgroup/vector.wgsl.expected.spvasm @@ -1,41 +1,21 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 22 +; Bound: 9 ; Schema: 0 OpCapability Shader OpMemoryModel Logical GLSL450 - OpEntryPoint GLCompute %main "main" %local_invocation_index_1 + OpEntryPoint GLCompute %main "main" OpExecutionMode %main LocalSize 1 1 1 - OpName %local_invocation_index_1 "local_invocation_index_1" OpName %v "v" - OpName %main_inner "main_inner" - OpName %local_invocation_index "local_invocation_index" OpName %main "main" - OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex - %uint = OpTypeInt 32 0 -%_ptr_Input_uint = OpTypePointer Input %uint -%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input %int = OpTypeInt 32 1 %v3int = OpTypeVector %int 3 %_ptr_Workgroup_v3int = OpTypePointer Workgroup %v3int %v = OpVariable %_ptr_Workgroup_v3int Workgroup %void = OpTypeVoid - %8 = OpTypeFunction %void %uint - %13 = OpConstantNull %v3int - %uint_2 = OpConstant %uint 2 - %uint_264 = OpConstant %uint 264 - %17 = OpTypeFunction %void - %main_inner = OpFunction %void None %8 -%local_invocation_index = OpFunctionParameter %uint - %12 = OpLabel - OpStore %v %13 - OpControlBarrier %uint_2 %uint_2 %uint_264 - OpReturn - OpFunctionEnd - %main = OpFunction %void None %17 - %19 = OpLabel - %21 = OpLoad %uint %local_invocation_index_1 - %20 = OpFunctionCall %void %main_inner %21 + %5 = OpTypeFunction %void + %main = OpFunction %void None %5 + %8 = OpLabel OpReturn OpFunctionEnd