Remove Renamer in glsl ast_printer
Remove Renamer in glsl ast_printer as it is now also run in
ShaderModuleGL which aligns with other backends.
Bug: tint:2114
Change-Id: Ide00633eda41c51d3b0b4da86fbe3ae69b18344f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/164823
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc b/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
index fbc7d34..ca5fa0c 100644
--- a/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
@@ -151,9 +151,6 @@
manager.Add<ast::transform::SingleEntryPoint>();
data.Add<ast::transform::SingleEntryPoint::Config>(entry_point);
}
- manager.Add<ast::transform::Renamer>();
- data.Add<ast::transform::Renamer::Config>(ast::transform::Renamer::Target::kGlslKeywords,
- /* preserve_unicode */ false);
manager.Add<ast::transform::PreservePadding>(); // Must come before DirectVariableAccess
diff --git a/src/tint/lang/glsl/writer/ast_printer/helper_test.h b/src/tint/lang/glsl/writer/ast_printer/helper_test.h
index eb9cbdf..f7ccd9c 100644
--- a/src/tint/lang/glsl/writer/ast_printer/helper_test.h
+++ b/src/tint/lang/glsl/writer/ast_printer/helper_test.h
@@ -37,6 +37,7 @@
#include "src/tint/lang/glsl/writer/common/version.h"
#include "src/tint/lang/glsl/writer/writer.h"
#include "src/tint/lang/wgsl/ast/transform/manager.h"
+#include "src/tint/lang/wgsl/ast/transform/renamer.h"
#include "src/tint/lang/wgsl/resolver/resolve.h"
namespace tint::glsl::writer {
@@ -96,6 +97,20 @@
ADD_FAILURE() << program->Diagnostics();
}
+ // Run the glsl keyword renamer before all other transforms.
+ ast::transform::Manager transform_manager;
+ ast::transform::DataMap transform_data;
+ ast::transform::DataMap outputs;
+ transform_data.Add<ast::transform::Renamer::Config>(
+ ast::transform::Renamer::Target::kGlslKeywords,
+ /* preserve_unicode */ false);
+ transform_manager.Add<tint::ast::transform::Renamer>();
+ auto result = transform_manager.Run(*program, transform_data, outputs);
+ if (!result.IsValid()) {
+ ADD_FAILURE() << result.Diagnostics();
+ }
+ *program = std::move(result);
+
auto sanitized_result = Sanitize(*program, options, /* entry_point */ "");
if (!sanitized_result.program.IsValid()) {
ADD_FAILURE() << sanitized_result.program.Diagnostics();
diff --git a/test/tint/bug/chromium/1434271.wgsl.expected.glsl b/test/tint/bug/chromium/1434271.wgsl.expected.glsl
index 373ccd4..c0928e0 100644
--- a/test/tint/bug/chromium/1434271.wgsl.expected.glsl
+++ b/test/tint/bug/chromium/1434271.wgsl.expected.glsl
@@ -231,8 +231,8 @@
void main() {
gl_PointSize = 1.0;
- VertexInput tint_symbol_2 = VertexInput(position_1, color_1, quad_pos_1);
- VertexOutput inner_result = vs_main(tint_symbol_2);
+ VertexInput tint_symbol_3 = VertexInput(position_1, color_1, quad_pos_1);
+ VertexOutput inner_result = vs_main(tint_symbol_3);
gl_Position = inner_result.position;
color_2 = inner_result.color;
quad_pos_2 = inner_result.quad_pos;
@@ -306,8 +306,8 @@
rand_seed = ((sim_params.inner.seed.xy * vec2(GlobalInvocationID.xy)) * sim_params.inner.seed.zw);
uint idx = GlobalInvocationID.x;
Particle particle = data.particles[idx];
- uint tint_symbol[1] = uint[1](idx);
- assign_and_preserve_padding_data_particles_X(tint_symbol, particle);
+ uint tint_symbol_3[1] = uint[1](idx);
+ assign_and_preserve_padding_data_particles_X(tint_symbol_3, particle);
}
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.glsl b/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.glsl
index 6382dc1..c79b3c9 100644
--- a/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.glsl
+++ b/test/tint/builtins/textureNumSamples/depth_ms.spvasm.expected.glsl
@@ -47,17 +47,17 @@
#version 310 es
precision highp float;
-struct tint_symbol {
+struct tint_symbol_3 {
uint texture_builtin_value_0;
};
-layout(binding = 0, std140) uniform tint_symbol_1_block_ubo {
- tint_symbol inner;
-} tint_symbol_1;
+layout(binding = 0, std140) uniform tint_symbol_4_block_ubo {
+ tint_symbol_3 inner;
+} tint_symbol_4;
void textureNumSamples_a3c8a0() {
int res = 0;
- res = int(tint_symbol_1.inner.texture_builtin_value_0);
+ res = int(tint_symbol_4.inner.texture_builtin_value_0);
return;
}
@@ -80,17 +80,17 @@
}
#version 310 es
-struct tint_symbol {
+struct tint_symbol_3 {
uint texture_builtin_value_0;
};
-layout(binding = 0, std140) uniform tint_symbol_1_block_ubo {
- tint_symbol inner;
-} tint_symbol_1;
+layout(binding = 0, std140) uniform tint_symbol_4_block_ubo {
+ tint_symbol_3 inner;
+} tint_symbol_4;
void textureNumSamples_a3c8a0() {
int res = 0;
- res = int(tint_symbol_1.inner.texture_builtin_value_0);
+ res = int(tint_symbol_4.inner.texture_builtin_value_0);
return;
}