From 0c7a99f894dfea64a0fa1fd03132a7a36ac93683 Mon Sep 17 00:00:00 2001 From: Stephen White Date: Fri, 26 May 2023 04:53:17 +0000 Subject: [PATCH] Tint/GLSL: rename identifiers containing double-underscores. This is prohibited by the GLSL ES spec: "In addition, all identifiers containing two consecutive underscores (__) are reserved for use by underlying software layers. Defining such a name in a shader does not itself result in an error, but may result in unintended behaviors that stem from having multiple definitions of the same name." (https://registry.khronos.org/OpenGL/specs/es/3.1/GLSL_ES_Specification_3.10.withchanges.pdf, section 3.7). However, while glslang validation will not give an error on this, NVidia ES drivers will. So I've added a Dawn end2end test instead of a WGSL test. Bug: tint:1944 Change-Id: I4b965af00039ca7a232bc11be884483f8e02ccf6 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134140 Reviewed-by: Ben Clayton Commit-Queue: Stephen White Kokoro: Kokoro --- src/dawn/tests/end2end/ShaderTests.cpp | 42 +++++++++++++++++++ src/tint/ast/transform/renamer.cc | 2 +- .../storage_i32.spvasm.expected.glsl | 24 +++++------ .../storage_u32.spvasm.expected.glsl | 24 +++++------ .../workgroup_i32.spvasm.expected.glsl | 12 +++--- .../workgroup_u32.spvasm.expected.glsl | 12 +++--- .../storage_i32.spvasm.expected.glsl | 24 +++++------ .../storage_u32.spvasm.expected.glsl | 24 +++++------ .../workgroup_i32.spvasm.expected.glsl | 12 +++--- .../workgroup_u32.spvasm.expected.glsl | 12 +++--- .../underscore/double/fn.wgsl.expected.glsl | 6 +-- .../underscore/double/let.wgsl.expected.glsl | 4 +- .../double/parameter.wgsl.expected.glsl | 4 +- .../double/struct.wgsl.expected.glsl | 8 ++-- .../underscore/double/var.wgsl.expected.glsl | 4 +- 15 files changed, 128 insertions(+), 86 deletions(-) diff --git a/src/dawn/tests/end2end/ShaderTests.cpp b/src/dawn/tests/end2end/ShaderTests.cpp index fc94c481a6..683e36184a 100644 --- a/src/dawn/tests/end2end/ShaderTests.cpp +++ b/src/dawn/tests/end2end/ShaderTests.cpp @@ -1462,6 +1462,48 @@ fn main(@location(0) value : f32) -> @location(0) vec4f { EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(255, 255, 255, 255), renderPass.color, 0, 0); } +// Test that identifiers containing double underscores are renamed in the GLSL backend. +TEST_P(ShaderTests, DoubleUnderscore) { + wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"( +@vertex +fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4f { + const pos = array( + vec2( 1.0, -1.0), + vec2(-1.0, -1.0), + vec2( 0.0, 1.0), + ); + return vec4(pos[VertexIndex], 0.0, 1.0); +})"); + + wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"( +diagnostic(off, derivative_uniformity); + +@fragment +fn main() -> @location(0) vec4f { + let re__sult = vec4f(1.0); + return re__sult; +})"); + + utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1); + + utils::ComboRenderPipelineDescriptor descriptor; + descriptor.vertex.module = vsModule; + descriptor.cFragment.module = fsModule; + descriptor.primitive.topology = wgpu::PrimitiveTopology::TriangleList; + descriptor.cTargets[0].format = renderPass.colorFormat; + wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); + + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); + pass.SetPipeline(pipeline); + pass.Draw(3); + pass.End(); + wgpu::CommandBuffer commands = encoder.Finish(); + queue.Submit(1, &commands); + + EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(255, 255, 255, 255), renderPass.color, 0, 0); +} + DAWN_INSTANTIATE_TEST(ShaderTests, D3D11Backend(), D3D12Backend(), diff --git a/src/tint/ast/transform/renamer.cc b/src/tint/ast/transform/renamer.cc index b7c03a10c8..ff669f757c 100644 --- a/src/tint/ast/transform/renamer.cc +++ b/src/tint/ast/transform/renamer.cc @@ -1350,7 +1350,7 @@ Transform::ApplyResult Renamer::Apply(const Program* src, kReservedKeywordsGLSL + sizeof(kReservedKeywordsGLSL) / sizeof(const char*), name) || - name.compare(0, 3, "gl_") == 0; + name.compare(0, 3, "gl_") == 0 || name.find("__") != std::string::npos; case Target::kHlslKeywords: return std::binary_search( kReservedKeywordsHLSL, diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl index 9e34babfbc..873c74647b 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl @@ -15,7 +15,7 @@ struct SB_RW { int arg_0; }; -struct x__atomic_compare_exchange_resulti32 { +struct tint_symbol { int old_value; bool exchanged; }; @@ -25,15 +25,15 @@ layout(binding = 0, std430) buffer sb_rw_block_ssbo { } sb_rw; void atomicCompareExchangeWeak_1bd40a() { - x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32(0, false); + tint_symbol res = tint_symbol(0, false); atomic_compare_exchange_result_i32 atomic_compare_result; atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, 1, 1); atomic_compare_result.exchanged = atomic_compare_result.old_value == 1; - atomic_compare_exchange_result_i32 tint_symbol = atomic_compare_result; - int old_value_1 = tint_symbol.old_value; + atomic_compare_exchange_result_i32 tint_symbol_1 = atomic_compare_result; + int old_value_1 = tint_symbol_1.old_value; int x_19 = old_value_1; - x__atomic_compare_exchange_resulti32 tint_symbol_1 = x__atomic_compare_exchange_resulti32(x_19, (x_19 == 1)); - res = tint_symbol_1; + tint_symbol tint_symbol_2 = tint_symbol(x_19, (x_19 == 1)); + res = tint_symbol_2; return; } @@ -66,7 +66,7 @@ struct SB_RW { int arg_0; }; -struct x__atomic_compare_exchange_resulti32 { +struct tint_symbol { int old_value; bool exchanged; }; @@ -76,15 +76,15 @@ layout(binding = 0, std430) buffer sb_rw_block_ssbo { } sb_rw; void atomicCompareExchangeWeak_1bd40a() { - x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32(0, false); + tint_symbol res = tint_symbol(0, false); atomic_compare_exchange_result_i32 atomic_compare_result; atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, 1, 1); atomic_compare_result.exchanged = atomic_compare_result.old_value == 1; - atomic_compare_exchange_result_i32 tint_symbol = atomic_compare_result; - int old_value_1 = tint_symbol.old_value; + atomic_compare_exchange_result_i32 tint_symbol_1 = atomic_compare_result; + int old_value_1 = tint_symbol_1.old_value; int x_19 = old_value_1; - x__atomic_compare_exchange_resulti32 tint_symbol_1 = x__atomic_compare_exchange_resulti32(x_19, (x_19 == 1)); - res = tint_symbol_1; + tint_symbol tint_symbol_2 = tint_symbol(x_19, (x_19 == 1)); + res = tint_symbol_2; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl index cb7126a472..36812c3189 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl @@ -15,7 +15,7 @@ struct SB_RW { uint arg_0; }; -struct x__atomic_compare_exchange_resultu32 { +struct tint_symbol { uint old_value; bool exchanged; }; @@ -25,15 +25,15 @@ layout(binding = 0, std430) buffer sb_rw_block_ssbo { } sb_rw; void atomicCompareExchangeWeak_63d8e6() { - x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32(0u, false); + tint_symbol res = tint_symbol(0u, false); atomic_compare_exchange_result_u32 atomic_compare_result; atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, 1u, 1u); atomic_compare_result.exchanged = atomic_compare_result.old_value == 1u; - atomic_compare_exchange_result_u32 tint_symbol = atomic_compare_result; - uint old_value_1 = tint_symbol.old_value; + atomic_compare_exchange_result_u32 tint_symbol_1 = atomic_compare_result; + uint old_value_1 = tint_symbol_1.old_value; uint x_17 = old_value_1; - x__atomic_compare_exchange_resultu32 tint_symbol_1 = x__atomic_compare_exchange_resultu32(x_17, (x_17 == 1u)); - res = tint_symbol_1; + tint_symbol tint_symbol_2 = tint_symbol(x_17, (x_17 == 1u)); + res = tint_symbol_2; return; } @@ -66,7 +66,7 @@ struct SB_RW { uint arg_0; }; -struct x__atomic_compare_exchange_resultu32 { +struct tint_symbol { uint old_value; bool exchanged; }; @@ -76,15 +76,15 @@ layout(binding = 0, std430) buffer sb_rw_block_ssbo { } sb_rw; void atomicCompareExchangeWeak_63d8e6() { - x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32(0u, false); + tint_symbol res = tint_symbol(0u, false); atomic_compare_exchange_result_u32 atomic_compare_result; atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, 1u, 1u); atomic_compare_result.exchanged = atomic_compare_result.old_value == 1u; - atomic_compare_exchange_result_u32 tint_symbol = atomic_compare_result; - uint old_value_1 = tint_symbol.old_value; + atomic_compare_exchange_result_u32 tint_symbol_1 = atomic_compare_result; + uint old_value_1 = tint_symbol_1.old_value; uint x_17 = old_value_1; - x__atomic_compare_exchange_resultu32 tint_symbol_1 = x__atomic_compare_exchange_resultu32(x_17, (x_17 == 1u)); - res = tint_symbol_1; + tint_symbol tint_symbol_2 = tint_symbol(x_17, (x_17 == 1u)); + res = tint_symbol_2; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl index e84462ab0f..6e8440d6cc 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl @@ -6,7 +6,7 @@ struct atomic_compare_exchange_result_i32 { }; -struct x__atomic_compare_exchange_resulti32 { +struct tint_symbol { int old_value; bool exchanged; }; @@ -14,15 +14,15 @@ struct x__atomic_compare_exchange_resulti32 { uint local_invocation_index_1 = 0u; shared int arg_0; void atomicCompareExchangeWeak_e88938() { - x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32(0, false); + tint_symbol res = tint_symbol(0, false); atomic_compare_exchange_result_i32 atomic_compare_result; atomic_compare_result.old_value = atomicCompSwap(arg_0, 1, 1); atomic_compare_result.exchanged = atomic_compare_result.old_value == 1; - atomic_compare_exchange_result_i32 tint_symbol = atomic_compare_result; - int old_value_1 = tint_symbol.old_value; + atomic_compare_exchange_result_i32 tint_symbol_1 = atomic_compare_result; + int old_value_1 = tint_symbol_1.old_value; int x_18 = old_value_1; - x__atomic_compare_exchange_resulti32 tint_symbol_1 = x__atomic_compare_exchange_resulti32(x_18, (x_18 == 1)); - res = tint_symbol_1; + tint_symbol tint_symbol_2 = tint_symbol(x_18, (x_18 == 1)); + res = tint_symbol_2; return; } diff --git a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl index b8db0ed5ed..b127c4a5c6 100644 --- a/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/literal/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl @@ -6,7 +6,7 @@ struct atomic_compare_exchange_result_u32 { }; -struct x__atomic_compare_exchange_resultu32 { +struct tint_symbol { uint old_value; bool exchanged; }; @@ -14,15 +14,15 @@ struct x__atomic_compare_exchange_resultu32 { uint local_invocation_index_1 = 0u; shared uint arg_0; void atomicCompareExchangeWeak_83580d() { - x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32(0u, false); + tint_symbol res = tint_symbol(0u, false); atomic_compare_exchange_result_u32 atomic_compare_result; atomic_compare_result.old_value = atomicCompSwap(arg_0, 1u, 1u); atomic_compare_result.exchanged = atomic_compare_result.old_value == 1u; - atomic_compare_exchange_result_u32 tint_symbol = atomic_compare_result; - uint old_value_1 = tint_symbol.old_value; + atomic_compare_exchange_result_u32 tint_symbol_1 = atomic_compare_result; + uint old_value_1 = tint_symbol_1.old_value; uint x_17 = old_value_1; - x__atomic_compare_exchange_resultu32 tint_symbol_1 = x__atomic_compare_exchange_resultu32(x_17, (x_17 == 1u)); - res = tint_symbol_1; + tint_symbol tint_symbol_2 = tint_symbol(x_17, (x_17 == 1u)); + res = tint_symbol_2; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl index dffc4024d4..0ae1686547 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_i32.spvasm.expected.glsl @@ -15,7 +15,7 @@ struct SB_RW { int arg_0; }; -struct x__atomic_compare_exchange_resulti32 { +struct tint_symbol { int old_value; bool exchanged; }; @@ -27,7 +27,7 @@ layout(binding = 0, std430) buffer sb_rw_block_ssbo { void atomicCompareExchangeWeak_1bd40a() { int arg_1 = 0; int arg_2 = 0; - x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32(0, false); + tint_symbol res = tint_symbol(0, false); arg_1 = 1; arg_2 = 1; int x_23 = arg_2; @@ -35,11 +35,11 @@ void atomicCompareExchangeWeak_1bd40a() { atomic_compare_exchange_result_i32 atomic_compare_result; atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, x_24, x_23); atomic_compare_result.exchanged = atomic_compare_result.old_value == x_24; - atomic_compare_exchange_result_i32 tint_symbol = atomic_compare_result; - int old_value_1 = tint_symbol.old_value; + atomic_compare_exchange_result_i32 tint_symbol_1 = atomic_compare_result; + int old_value_1 = tint_symbol_1.old_value; int x_25 = old_value_1; - x__atomic_compare_exchange_resulti32 tint_symbol_1 = x__atomic_compare_exchange_resulti32(x_25, (x_25 == x_23)); - res = tint_symbol_1; + tint_symbol tint_symbol_2 = tint_symbol(x_25, (x_25 == x_23)); + res = tint_symbol_2; return; } @@ -72,7 +72,7 @@ struct SB_RW { int arg_0; }; -struct x__atomic_compare_exchange_resulti32 { +struct tint_symbol { int old_value; bool exchanged; }; @@ -84,7 +84,7 @@ layout(binding = 0, std430) buffer sb_rw_block_ssbo { void atomicCompareExchangeWeak_1bd40a() { int arg_1 = 0; int arg_2 = 0; - x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32(0, false); + tint_symbol res = tint_symbol(0, false); arg_1 = 1; arg_2 = 1; int x_23 = arg_2; @@ -92,11 +92,11 @@ void atomicCompareExchangeWeak_1bd40a() { atomic_compare_exchange_result_i32 atomic_compare_result; atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, x_24, x_23); atomic_compare_result.exchanged = atomic_compare_result.old_value == x_24; - atomic_compare_exchange_result_i32 tint_symbol = atomic_compare_result; - int old_value_1 = tint_symbol.old_value; + atomic_compare_exchange_result_i32 tint_symbol_1 = atomic_compare_result; + int old_value_1 = tint_symbol_1.old_value; int x_25 = old_value_1; - x__atomic_compare_exchange_resulti32 tint_symbol_1 = x__atomic_compare_exchange_resulti32(x_25, (x_25 == x_23)); - res = tint_symbol_1; + tint_symbol tint_symbol_2 = tint_symbol(x_25, (x_25 == x_23)); + res = tint_symbol_2; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl index 7c0b63fc94..a52bb8e700 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/storage_u32.spvasm.expected.glsl @@ -15,7 +15,7 @@ struct SB_RW { uint arg_0; }; -struct x__atomic_compare_exchange_resultu32 { +struct tint_symbol { uint old_value; bool exchanged; }; @@ -27,7 +27,7 @@ layout(binding = 0, std430) buffer sb_rw_block_ssbo { void atomicCompareExchangeWeak_63d8e6() { uint arg_1 = 0u; uint arg_2 = 0u; - x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32(0u, false); + tint_symbol res = tint_symbol(0u, false); arg_1 = 1u; arg_2 = 1u; uint x_21 = arg_2; @@ -35,11 +35,11 @@ void atomicCompareExchangeWeak_63d8e6() { atomic_compare_exchange_result_u32 atomic_compare_result; atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, x_22, x_21); atomic_compare_result.exchanged = atomic_compare_result.old_value == x_22; - atomic_compare_exchange_result_u32 tint_symbol = atomic_compare_result; - uint old_value_1 = tint_symbol.old_value; + atomic_compare_exchange_result_u32 tint_symbol_1 = atomic_compare_result; + uint old_value_1 = tint_symbol_1.old_value; uint x_23 = old_value_1; - x__atomic_compare_exchange_resultu32 tint_symbol_1 = x__atomic_compare_exchange_resultu32(x_23, (x_23 == x_21)); - res = tint_symbol_1; + tint_symbol tint_symbol_2 = tint_symbol(x_23, (x_23 == x_21)); + res = tint_symbol_2; return; } @@ -72,7 +72,7 @@ struct SB_RW { uint arg_0; }; -struct x__atomic_compare_exchange_resultu32 { +struct tint_symbol { uint old_value; bool exchanged; }; @@ -84,7 +84,7 @@ layout(binding = 0, std430) buffer sb_rw_block_ssbo { void atomicCompareExchangeWeak_63d8e6() { uint arg_1 = 0u; uint arg_2 = 0u; - x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32(0u, false); + tint_symbol res = tint_symbol(0u, false); arg_1 = 1u; arg_2 = 1u; uint x_21 = arg_2; @@ -92,11 +92,11 @@ void atomicCompareExchangeWeak_63d8e6() { atomic_compare_exchange_result_u32 atomic_compare_result; atomic_compare_result.old_value = atomicCompSwap(sb_rw.inner.arg_0, x_22, x_21); atomic_compare_result.exchanged = atomic_compare_result.old_value == x_22; - atomic_compare_exchange_result_u32 tint_symbol = atomic_compare_result; - uint old_value_1 = tint_symbol.old_value; + atomic_compare_exchange_result_u32 tint_symbol_1 = atomic_compare_result; + uint old_value_1 = tint_symbol_1.old_value; uint x_23 = old_value_1; - x__atomic_compare_exchange_resultu32 tint_symbol_1 = x__atomic_compare_exchange_resultu32(x_23, (x_23 == x_21)); - res = tint_symbol_1; + tint_symbol tint_symbol_2 = tint_symbol(x_23, (x_23 == x_21)); + res = tint_symbol_2; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl index c93cea245d..18b479ffd0 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_i32.spvasm.expected.glsl @@ -6,7 +6,7 @@ struct atomic_compare_exchange_result_i32 { }; -struct x__atomic_compare_exchange_resulti32 { +struct tint_symbol { int old_value; bool exchanged; }; @@ -16,7 +16,7 @@ shared int arg_0; void atomicCompareExchangeWeak_e88938() { int arg_1 = 0; int arg_2 = 0; - x__atomic_compare_exchange_resulti32 res = x__atomic_compare_exchange_resulti32(0, false); + tint_symbol res = tint_symbol(0, false); arg_1 = 1; arg_2 = 1; int x_22 = arg_2; @@ -24,11 +24,11 @@ void atomicCompareExchangeWeak_e88938() { atomic_compare_exchange_result_i32 atomic_compare_result; atomic_compare_result.old_value = atomicCompSwap(arg_0, x_23, x_22); atomic_compare_result.exchanged = atomic_compare_result.old_value == x_23; - atomic_compare_exchange_result_i32 tint_symbol = atomic_compare_result; - int old_value_1 = tint_symbol.old_value; + atomic_compare_exchange_result_i32 tint_symbol_1 = atomic_compare_result; + int old_value_1 = tint_symbol_1.old_value; int x_24 = old_value_1; - x__atomic_compare_exchange_resulti32 tint_symbol_1 = x__atomic_compare_exchange_resulti32(x_24, (x_24 == x_22)); - res = tint_symbol_1; + tint_symbol tint_symbol_2 = tint_symbol(x_24, (x_24 == x_22)); + res = tint_symbol_2; return; } diff --git a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl index 920a16edf0..51e6c91e59 100644 --- a/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl +++ b/test/tint/builtins/atomics/from_gen/var/atomicCompareExchangeWeak/workgroup_u32.spvasm.expected.glsl @@ -6,7 +6,7 @@ struct atomic_compare_exchange_result_u32 { }; -struct x__atomic_compare_exchange_resultu32 { +struct tint_symbol { uint old_value; bool exchanged; }; @@ -16,7 +16,7 @@ shared uint arg_0; void atomicCompareExchangeWeak_83580d() { uint arg_1 = 0u; uint arg_2 = 0u; - x__atomic_compare_exchange_resultu32 res = x__atomic_compare_exchange_resultu32(0u, false); + tint_symbol res = tint_symbol(0u, false); arg_1 = 1u; arg_2 = 1u; uint x_21 = arg_2; @@ -24,11 +24,11 @@ void atomicCompareExchangeWeak_83580d() { atomic_compare_exchange_result_u32 atomic_compare_result; atomic_compare_result.old_value = atomicCompSwap(arg_0, x_22, x_21); atomic_compare_result.exchanged = atomic_compare_result.old_value == x_22; - atomic_compare_exchange_result_u32 tint_symbol = atomic_compare_result; - uint old_value_1 = tint_symbol.old_value; + atomic_compare_exchange_result_u32 tint_symbol_1 = atomic_compare_result; + uint old_value_1 = tint_symbol_1.old_value; uint x_23 = old_value_1; - x__atomic_compare_exchange_resultu32 tint_symbol_1 = x__atomic_compare_exchange_resultu32(x_23, (x_23 == x_21)); - res = tint_symbol_1; + tint_symbol tint_symbol_2 = tint_symbol(x_23, (x_23 == x_21)); + res = tint_symbol_2; return; } diff --git a/test/tint/identifiers/underscore/double/fn.wgsl.expected.glsl b/test/tint/identifiers/underscore/double/fn.wgsl.expected.glsl index 8e59b08f36..03def7287b 100644 --- a/test/tint/identifiers/underscore/double/fn.wgsl.expected.glsl +++ b/test/tint/identifiers/underscore/double/fn.wgsl.expected.glsl @@ -7,14 +7,14 @@ void unused_entry_point() { void a() { } -void a__() { +void tint_symbol() { } void b() { a(); } -void b__() { - a__(); +void tint_symbol_1() { + tint_symbol(); } diff --git a/test/tint/identifiers/underscore/double/let.wgsl.expected.glsl b/test/tint/identifiers/underscore/double/let.wgsl.expected.glsl index f274d04ea9..638acd9c18 100644 --- a/test/tint/identifiers/underscore/double/let.wgsl.expected.glsl +++ b/test/tint/identifiers/underscore/double/let.wgsl.expected.glsl @@ -6,8 +6,8 @@ void unused_entry_point() { } void f() { int a = 1; - int a__ = a; + int tint_symbol = a; int b = a; - int b__ = a__; + int tint_symbol_1 = tint_symbol; } diff --git a/test/tint/identifiers/underscore/double/parameter.wgsl.expected.glsl b/test/tint/identifiers/underscore/double/parameter.wgsl.expected.glsl index 1c7262a456..8e829352e2 100644 --- a/test/tint/identifiers/underscore/double/parameter.wgsl.expected.glsl +++ b/test/tint/identifiers/underscore/double/parameter.wgsl.expected.glsl @@ -4,7 +4,7 @@ layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; void unused_entry_point() { return; } -void f(int a__) { - int b = a__; +void f(int tint_symbol) { + int b = tint_symbol; } diff --git a/test/tint/identifiers/underscore/double/struct.wgsl.expected.glsl b/test/tint/identifiers/underscore/double/struct.wgsl.expected.glsl index 9eb009e147..a6ac4ffe97 100644 --- a/test/tint/identifiers/underscore/double/struct.wgsl.expected.glsl +++ b/test/tint/identifiers/underscore/double/struct.wgsl.expected.glsl @@ -8,12 +8,12 @@ struct a { int b; }; -struct a__ { - int b__; +struct tint_symbol { + int tint_symbol_1; }; void f() { - a__ c = a__(0); - int d = c.b__; + tint_symbol c = tint_symbol(0); + int d = c.tint_symbol_1; } diff --git a/test/tint/identifiers/underscore/double/var.wgsl.expected.glsl b/test/tint/identifiers/underscore/double/var.wgsl.expected.glsl index f61376ad0d..9addc2921b 100644 --- a/test/tint/identifiers/underscore/double/var.wgsl.expected.glsl +++ b/test/tint/identifiers/underscore/double/var.wgsl.expected.glsl @@ -5,9 +5,9 @@ void unused_entry_point() { return; } int a = 1; -int a__ = 2; +int tint_symbol = 2; void f() { int b = a; - int b__ = a__; + int tint_symbol_1 = tint_symbol; }