[glsl][ir] Create header section before preamble.
When emitting GLSL the `precision` modifiers and extensions need to be
emitted before the `struct`s. This means we need a header section to go
before the preamble section.
Bug: 42251044
Change-Id: I6c702955481f5665b1110eeb36ea1ecd1eb65411
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/205574
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
diff --git a/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.ir.glsl
index 187700a..4ae1f06 100644
--- a/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/log/3da25a.wgsl.expected.ir.glsl
@@ -2,7 +2,6 @@
precision highp float;
precision highp int;
-
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
vec4 tint_symbol;
@@ -30,6 +29,7 @@
}
#version 310 es
+
struct VertexOutput {
vec4 pos;
vec4 prevent_dce;
diff --git a/test/tint/builtins/gen/literal/log/655989.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/log/655989.wgsl.expected.ir.glsl
index 559ec95..b2f1638 100644
--- a/test/tint/builtins/gen/literal/log/655989.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/log/655989.wgsl.expected.ir.glsl
@@ -2,7 +2,6 @@
precision highp float;
precision highp int;
-
void log_655989() {
float res = 0.0f;
}
@@ -20,6 +19,7 @@
}
#version 310 es
+
struct VertexOutput {
vec4 pos;
};
diff --git a/test/tint/builtins/gen/literal/log/697e1d.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/log/697e1d.wgsl.expected.ir.glsl
index b8ad471..c96c5db 100644
--- a/test/tint/builtins/gen/literal/log/697e1d.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/log/697e1d.wgsl.expected.ir.glsl
@@ -2,7 +2,6 @@
precision highp float;
precision highp int;
-
void log_697e1d() {
vec4 res = vec4(0.0f);
}
@@ -20,6 +19,7 @@
}
#version 310 es
+
struct VertexOutput {
vec4 pos;
};
diff --git a/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.ir.glsl
index 2ca1b80..c2d927c 100644
--- a/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/log/6ff86f.wgsl.expected.ir.glsl
@@ -3,7 +3,6 @@
precision highp float;
precision highp int;
-
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
f16vec3 tint_symbol;
@@ -33,6 +32,7 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float: require
+
struct VertexOutput {
vec4 pos;
f16vec3 prevent_dce;
diff --git a/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.ir.glsl
index 6ce93d1..f11e9a0 100644
--- a/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/log/7114a6.wgsl.expected.ir.glsl
@@ -2,7 +2,6 @@
precision highp float;
precision highp int;
-
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
float tint_symbol;
@@ -30,6 +29,7 @@
}
#version 310 es
+
struct VertexOutput {
vec4 pos;
float prevent_dce;
diff --git a/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.ir.glsl
index b33fe43..d0f1d8a 100644
--- a/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/log/8f0e32.wgsl.expected.ir.glsl
@@ -3,7 +3,6 @@
precision highp float;
precision highp int;
-
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
f16vec2 tint_symbol;
@@ -33,6 +32,7 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float: require
+
struct VertexOutput {
vec4 pos;
f16vec2 prevent_dce;
diff --git a/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.ir.glsl
index 9cd637d..36d1226 100644
--- a/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/log/b2ce28.wgsl.expected.ir.glsl
@@ -2,7 +2,6 @@
precision highp float;
precision highp int;
-
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
vec2 tint_symbol;
@@ -30,6 +29,7 @@
}
#version 310 es
+
struct VertexOutput {
vec4 pos;
vec2 prevent_dce;
diff --git a/test/tint/builtins/gen/literal/log/b8088d.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/log/b8088d.wgsl.expected.ir.glsl
index d577c2c..827c094 100644
--- a/test/tint/builtins/gen/literal/log/b8088d.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/log/b8088d.wgsl.expected.ir.glsl
@@ -2,7 +2,6 @@
precision highp float;
precision highp int;
-
void log_b8088d() {
vec3 res = vec3(0.0f);
}
@@ -20,6 +19,7 @@
}
#version 310 es
+
struct VertexOutput {
vec4 pos;
};
diff --git a/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.ir.glsl
index 485fbb9..f5954d3 100644
--- a/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/log/c9f489.wgsl.expected.ir.glsl
@@ -3,7 +3,6 @@
precision highp float;
precision highp int;
-
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
float16_t tint_symbol;
@@ -33,6 +32,7 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float: require
+
struct VertexOutput {
vec4 pos;
float16_t prevent_dce;
diff --git a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.ir.glsl
index 067a326..a64ddd5 100644
--- a/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/log/cdbdc1.wgsl.expected.ir.glsl
@@ -3,7 +3,6 @@
precision highp float;
precision highp int;
-
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
f16vec4 tint_symbol;
@@ -33,6 +32,7 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float: require
+
struct VertexOutput {
vec4 pos;
f16vec4 prevent_dce;
diff --git a/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.ir.glsl
index 353329f..97369f9 100644
--- a/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/log/f4c570.wgsl.expected.ir.glsl
@@ -2,7 +2,6 @@
precision highp float;
precision highp int;
-
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
vec3 tint_symbol;
@@ -30,6 +29,7 @@
}
#version 310 es
+
struct VertexOutput {
vec4 pos;
vec3 prevent_dce;
diff --git a/test/tint/builtins/gen/literal/log/f60cc7.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/log/f60cc7.wgsl.expected.ir.glsl
index 1cd5963..c2212fa 100644
--- a/test/tint/builtins/gen/literal/log/f60cc7.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/log/f60cc7.wgsl.expected.ir.glsl
@@ -2,7 +2,6 @@
precision highp float;
precision highp int;
-
void log_f60cc7() {
vec2 res = vec2(0.0f);
}
@@ -20,6 +19,7 @@
}
#version 310 es
+
struct VertexOutput {
vec4 pos;
};