GLSL: implement interpolation qualifiers.

Bug: tint:1399 tint:451
Change-Id: Idf02a98d2c51ab4d93847fc24a9d5a447ce3aaa3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78222
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
diff --git a/src/writer/glsl/generator_impl.cc b/src/writer/glsl/generator_impl.cc
index 1444a69..fa5e06b 100644
--- a/src/writer/glsl/generator_impl.cc
+++ b/src/writer/glsl/generator_impl.cc
@@ -1840,33 +1840,30 @@
   }
 }
 
-std::string GeneratorImpl::interpolation_to_modifiers(
-    ast::InterpolationType type,
-    ast::InterpolationSampling sampling) const {
-  std::string modifiers;
-  switch (type) {
-    case ast::InterpolationType::kPerspective:
-      modifiers += "linear ";
-      break;
-    case ast::InterpolationType::kLinear:
-      modifiers += "noperspective ";
-      break;
-    case ast::InterpolationType::kFlat:
-      modifiers += "nointerpolation ";
-      break;
+void GeneratorImpl::EmitInterpolationQualifiers(
+    std::ostream& out,
+    const ast::DecorationList& decorations) {
+  for (auto* deco : decorations) {
+    if (auto* interpolate = deco->As<ast::InterpolateDecoration>()) {
+      switch (interpolate->type) {
+        case ast::InterpolationType::kPerspective:
+        case ast::InterpolationType::kLinear:
+          break;
+        case ast::InterpolationType::kFlat:
+          out << "flat ";
+          break;
+      }
+      switch (interpolate->sampling) {
+        case ast::InterpolationSampling::kCentroid:
+          out << "centroid ";
+          break;
+        case ast::InterpolationSampling::kSample:
+        case ast::InterpolationSampling::kCenter:
+        case ast::InterpolationSampling::kNone:
+          break;
+      }
+    }
   }
-  switch (sampling) {
-    case ast::InterpolationSampling::kCentroid:
-      modifiers += "centroid ";
-      break;
-    case ast::InterpolationSampling::kSample:
-      modifiers += "sample ";
-      break;
-    case ast::InterpolationSampling::kCenter:
-    case ast::InterpolationSampling::kNone:
-      break;
-  }
-  return modifiers;
 }
 
 bool GeneratorImpl::EmitDecorations(std::ostream& out,
@@ -1980,6 +1977,10 @@
       if (!EmitDecorations(out, decorations)) {
         return false;
       }
+      // GLSL does not support interpolation qualifiers on vertex inputs
+      if (func->PipelineStage() != ast::PipelineStage::kVertex) {
+        EmitInterpolationQualifiers(out, decorations);
+      }
       if (!EmitTypeAndName(
               out, member->Type(), ast::StorageClass::kInput,
               ast::Access::kReadWrite,
@@ -2001,6 +2002,10 @@
       if (!EmitDecorations(out, decorations)) {
         return false;
       }
+      // GLSL does not support interpolation qualifiers on fragment outputs
+      if (func->PipelineStage() != ast::PipelineStage::kFragment) {
+        EmitInterpolationQualifiers(out, decorations);
+      }
       if (!EmitTypeAndName(
               out, member->Type(), ast::StorageClass::kOutput,
               ast::Access::kReadWrite,
@@ -2614,28 +2619,11 @@
 
     auto out = line(b);
 
-    std::string pre, post;
-
-    if (auto* decl = mem->Declaration()) {
-      for (auto* deco : decl->decorations) {
-        if (auto* interpolate = deco->As<ast::InterpolateDecoration>()) {
-          auto mod = interpolation_to_modifiers(interpolate->type,
-                                                interpolate->sampling);
-          if (mod.empty()) {
-            diagnostics_.add_error(diag::System::Writer,
-                                   "unsupported interpolation");
-            return false;
-          }
-        }
-      }
-    }
-
-    out << pre;
     if (!EmitTypeAndName(out, ty, ast::StorageClass::kNone,
                          ast::Access::kReadWrite, name)) {
       return false;
     }
-    out << post << ";";
+    out << ";";
   }
   return true;
 }
diff --git a/src/writer/glsl/generator_impl.h b/src/writer/glsl/generator_impl.h
index e53fd22..ce6a4bb 100644
--- a/src/writer/glsl/generator_impl.h
+++ b/src/writer/glsl/generator_impl.h
@@ -292,6 +292,11 @@
   /// @returns true on success
   bool EmitWorkgroupVariable(const sem::Variable* var);
 
+  /// Handles emitting interpolation qualifiers
+  /// @param out the output of the expression stream
+  /// @param decos the decorations
+  void EmitInterpolationQualifiers(std::ostream& out,
+                                   const ast::DecorationList& decos);
   /// Handles emitting decorations
   /// @param out the output of the expression stream
   /// @param decos the decorations
@@ -410,14 +415,6 @@
   /// @returns the appropriate semantic type or null on error.
   sem::Type* builtin_type(ast::Builtin builtin);
 
-  /// Converts interpolation attributes to a GLSL modifiers
-  /// @param type the interpolation type
-  /// @param sampling the interpolation sampling
-  /// @returns the string name of the attribute or blank on error
-  std::string interpolation_to_modifiers(
-      ast::InterpolationType type,
-      ast::InterpolationSampling sampling) const;
-
  private:
   enum class VarType { kIn, kOut };
 
diff --git a/test/bug/tint/1081.wgsl.expected.glsl b/test/bug/tint/1081.wgsl.expected.glsl
index 3637e84..a0b53fa 100644
--- a/test/bug/tint/1081.wgsl.expected.glsl
+++ b/test/bug/tint/1081.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #version 310 es
 precision mediump float;
 
@@ -34,7 +32,7 @@
   wrapper_result.value = inner_result;
   return wrapper_result;
 }
-layout(location = 1) in ivec3 x;
+layout(location = 1) flat in ivec3 x;
 layout(location = 2) out int value;
 void main() {
   tint_symbol_2 inputs;
@@ -45,10 +43,3 @@
 }
 
 
-Error parsing GLSL shader:
-ERROR: 0:35: 'int' : must be qualified as flat in
-ERROR: 0:35: '' : compilation terminated 
-ERROR: 2 compilation errors.  No code generated.
-
-
-
diff --git a/test/shader_io/fragment_input_locations.wgsl.expected.glsl b/test/shader_io/fragment_input_locations.wgsl.expected.glsl
index 66c175d..8f91796 100644
--- a/test/shader_io/fragment_input_locations.wgsl.expected.glsl
+++ b/test/shader_io/fragment_input_locations.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #version 310 es
 precision mediump float;
 
@@ -21,8 +19,8 @@
   tint_symbol_inner(tint_symbol_1.loc0, tint_symbol_1.loc1, tint_symbol_1.loc2, tint_symbol_1.loc3);
   return;
 }
-layout(location = 0) in int loc0;
-layout(location = 1) in uint loc1;
+layout(location = 0) flat in int loc0;
+layout(location = 1) flat in uint loc1;
 layout(location = 2) in float loc2;
 layout(location = 3) in vec4 loc3;
 void main() {
@@ -35,10 +33,3 @@
 }
 
 
-Error parsing GLSL shader:
-ERROR: 0:22: 'int' : must be qualified as flat in
-ERROR: 0:22: '' : compilation terminated 
-ERROR: 2 compilation errors.  No code generated.
-
-
-
diff --git a/test/shader_io/fragment_input_locations_struct.wgsl.expected.glsl b/test/shader_io/fragment_input_locations_struct.wgsl.expected.glsl
index 54cf564..a187ac5 100644
--- a/test/shader_io/fragment_input_locations_struct.wgsl.expected.glsl
+++ b/test/shader_io/fragment_input_locations_struct.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #version 310 es
 precision mediump float;
 
@@ -28,8 +26,8 @@
   tint_symbol_inner(tint_symbol_3);
   return;
 }
-layout(location = 0) in int loc0;
-layout(location = 1) in uint loc1;
+layout(location = 0) flat in int loc0;
+layout(location = 1) flat in uint loc1;
 layout(location = 2) in float loc2;
 layout(location = 3) in vec4 loc3;
 void main() {
@@ -42,10 +40,3 @@
 }
 
 
-Error parsing GLSL shader:
-ERROR: 0:29: 'int' : must be qualified as flat in
-ERROR: 0:29: '' : compilation terminated 
-ERROR: 2 compilation errors.  No code generated.
-
-
-
diff --git a/test/shader_io/fragment_input_mixed.wgsl.expected.glsl b/test/shader_io/fragment_input_mixed.wgsl.expected.glsl
index 3304037..a846915 100644
--- a/test/shader_io/fragment_input_mixed.wgsl.expected.glsl
+++ b/test/shader_io/fragment_input_mixed.wgsl.expected.glsl
@@ -39,8 +39,8 @@
   tint_symbol_inner(tint_symbol_3, tint_symbol_1.front_facing, tint_symbol_1.loc1, tint_symbol_1.sample_index, tint_symbol_4, tint_symbol_1.loc2);
   return;
 }
-layout(location = 0) in int loc0;
-layout(location = 1) in uint loc1;
+layout(location = 0) flat in int loc0;
+layout(location = 1) flat in uint loc1;
 layout(location = 2) in float loc2;
 layout(location = 3) in vec4 loc3;
 void main() {
@@ -58,8 +58,8 @@
 
 
 Error parsing GLSL shader:
-ERROR: 0:40: 'int' : must be qualified as flat in
-ERROR: 0:40: '' : compilation terminated 
+ERROR: 0:52: 'gl_SampleID' : required extension not requested: GL_OES_sample_variables
+ERROR: 0:52: '' : compilation terminated 
 ERROR: 2 compilation errors.  No code generated.
 
 
diff --git a/test/shader_io/interpolate_input_parameters.wgsl.expected.glsl b/test/shader_io/interpolate_input_parameters.wgsl.expected.glsl
index 73269ca..b02bb34 100644
--- a/test/shader_io/interpolate_input_parameters.wgsl.expected.glsl
+++ b/test/shader_io/interpolate_input_parameters.wgsl.expected.glsl
@@ -20,12 +20,12 @@
   return;
 }
 layout(location = 0) in float none;
-layout(location = 1) in float tint_symbol_1;
+layout(location = 1) flat in float tint_symbol_1;
 layout(location = 2) in float perspective_center;
-layout(location = 3) in float perspective_centroid;
+layout(location = 3) centroid in float perspective_centroid;
 layout(location = 4) in float perspective_sample;
 layout(location = 5) in float linear_center;
-layout(location = 6) in float linear_centroid;
+layout(location = 6) centroid in float linear_centroid;
 layout(location = 7) in float linear_sample;
 void main() {
   tint_symbol_3 inputs;
diff --git a/test/shader_io/interpolate_input_struct.wgsl.expected.glsl b/test/shader_io/interpolate_input_struct.wgsl.expected.glsl
index b5aa84c..b4ebc59 100644
--- a/test/shader_io/interpolate_input_struct.wgsl.expected.glsl
+++ b/test/shader_io/interpolate_input_struct.wgsl.expected.glsl
@@ -31,12 +31,12 @@
   return;
 }
 layout(location = 0) in float none;
-layout(location = 1) in float tint_symbol;
+layout(location = 1) flat in float tint_symbol;
 layout(location = 2) in float perspective_center;
-layout(location = 3) in float perspective_centroid;
+layout(location = 3) centroid in float perspective_centroid;
 layout(location = 4) in float perspective_sample;
 layout(location = 5) in float linear_center;
-layout(location = 6) in float linear_centroid;
+layout(location = 6) centroid in float linear_centroid;
 layout(location = 7) in float linear_sample;
 void main() {
   tint_symbol_4 inputs;
diff --git a/test/shader_io/interpolate_integers.wgsl.expected.glsl b/test/shader_io/interpolate_integers.wgsl.expected.glsl
index 721460e..736525a 100644
--- a/test/shader_io/interpolate_integers.wgsl.expected.glsl
+++ b/test/shader_io/interpolate_integers.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
 #version 310 es
 precision mediump float;
 
@@ -44,10 +42,10 @@
   wrapper_result.pos = inner_result.pos;
   return wrapper_result;
 }
-layout(location = 0) out int i;
-layout(location = 1) out uint u;
-layout(location = 2) out ivec4 vi;
-layout(location = 3) out uvec4 vu;
+layout(location = 0) flat out int i;
+layout(location = 1) flat out uint u;
+layout(location = 2) flat out ivec4 vi;
+layout(location = 3) flat out uvec4 vu;
 void main() {
   tint_symbol outputs;
   outputs = vert_main();
@@ -99,10 +97,10 @@
   wrapper_result_1.value = inner_result_1;
   return wrapper_result_1;
 }
-layout(location = 0) in int i;
-layout(location = 1) in uint u;
-layout(location = 2) in ivec4 vi;
-layout(location = 3) in uvec4 vu;
+layout(location = 0) flat in int i;
+layout(location = 1) flat in uint u;
+layout(location = 2) flat in ivec4 vi;
+layout(location = 3) flat in uvec4 vu;
 layout(location = 0) out int value;
 void main() {
   tint_symbol_2 inputs;
@@ -117,10 +115,3 @@
 }
 
 
-Error parsing GLSL shader:
-ERROR: 0:40: 'int' : must be qualified as flat in
-ERROR: 0:40: '' : compilation terminated 
-ERROR: 2 compilation errors.  No code generated.
-
-
-
diff --git a/test/shader_io/interpolate_return_struct.wgsl.expected.glsl b/test/shader_io/interpolate_return_struct.wgsl.expected.glsl
index f4ed345..c9ee276 100644
--- a/test/shader_io/interpolate_return_struct.wgsl.expected.glsl
+++ b/test/shader_io/interpolate_return_struct.wgsl.expected.glsl
@@ -44,12 +44,12 @@
   return wrapper_result;
 }
 layout(location = 0) out float none;
-layout(location = 1) out float tint_symbol;
+layout(location = 1) flat out float tint_symbol;
 layout(location = 2) out float perspective_center;
-layout(location = 3) out float perspective_centroid;
+layout(location = 3) centroid out float perspective_centroid;
 layout(location = 4) out float perspective_sample;
 layout(location = 5) out float linear_center;
-layout(location = 6) out float linear_centroid;
+layout(location = 6) centroid out float linear_centroid;
 layout(location = 7) out float linear_sample;
 void main() {
   tint_symbol_2 outputs;
diff --git a/test/shader_io/shared_struct_helper_function.wgsl.expected.glsl b/test/shader_io/shared_struct_helper_function.wgsl.expected.glsl
index c94bcbd..875731b 100644
--- a/test/shader_io/shared_struct_helper_function.wgsl.expected.glsl
+++ b/test/shader_io/shared_struct_helper_function.wgsl.expected.glsl
@@ -32,7 +32,7 @@
   wrapper_result.loc0 = inner_result.loc0;
   return wrapper_result;
 }
-layout(location = 0) out int loc0;
+layout(location = 0) flat out int loc0;
 void main() {
   tint_symbol outputs;
   outputs = vert_main1();
@@ -75,7 +75,7 @@
   wrapper_result_1.loc0 = inner_result_1.loc0;
   return wrapper_result_1;
 }
-layout(location = 0) out int loc0;
+layout(location = 0) flat out int loc0;
 void main() {
   tint_symbol_1 outputs;
   outputs = vert_main2();
diff --git a/test/shader_io/shared_struct_storage_buffer.wgsl.expected.glsl b/test/shader_io/shared_struct_storage_buffer.wgsl.expected.glsl
index 06aedda..b8b01eb 100644
--- a/test/shader_io/shared_struct_storage_buffer.wgsl.expected.glsl
+++ b/test/shader_io/shared_struct_storage_buffer.wgsl.expected.glsl
@@ -34,7 +34,7 @@
   return;
 }
 layout(location = 0) in float f;
-layout(location = 1) in uint u;
+layout(location = 1) flat in uint u;
 void main() {
   tint_symbol_3 inputs;
   inputs.f = f;
diff --git a/test/shader_io/vertex_output_locations_struct.wgsl.expected.glsl b/test/shader_io/vertex_output_locations_struct.wgsl.expected.glsl
index 0a758bc..90910ba 100644
--- a/test/shader_io/vertex_output_locations_struct.wgsl.expected.glsl
+++ b/test/shader_io/vertex_output_locations_struct.wgsl.expected.glsl
@@ -31,8 +31,8 @@
   wrapper_result.position = inner_result.position;
   return wrapper_result;
 }
-layout(location = 0) out int loc0;
-layout(location = 1) out uint loc1;
+layout(location = 0) flat out int loc0;
+layout(location = 1) flat out uint loc1;
 layout(location = 2) out float loc2;
 layout(location = 3) out vec4 loc3;
 void main() {
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.glsl
deleted file mode 100644
index d4c764d..0000000
--- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.glsl
+++ /dev/null
@@ -1,64 +0,0 @@
-SKIP: FAILED
-
-#version 310 es
-precision mediump float;
-
-uint x_1 = 0u;
-uint x_2 = 0u;
-uint x_3 = 0u;
-uint x_4 = 0u;
-
-void main_1() {
-  return;
-}
-
-struct main_out {
-  uint x_2_1;
-  uint x_4_1;
-};
-struct tint_symbol_2 {
-  uint x_1_param;
-  uint x_3_param;
-};
-struct tint_symbol_3 {
-  uint x_2_1;
-  uint x_4_1;
-};
-
-main_out tint_symbol_inner(uint x_1_param, uint x_3_param) {
-  x_1 = x_1_param;
-  x_3 = x_3_param;
-  main_1();
-  main_out tint_symbol_4 = main_out(x_2, x_4);
-  return tint_symbol_4;
-}
-
-tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1) {
-  main_out inner_result = tint_symbol_inner(tint_symbol_1.x_1_param, tint_symbol_1.x_3_param);
-  tint_symbol_3 wrapper_result = tint_symbol_3(0u, 0u);
-  wrapper_result.x_2_1 = inner_result.x_2_1;
-  wrapper_result.x_4_1 = inner_result.x_4_1;
-  return wrapper_result;
-}
-layout(location = 0) in uint x_1_param;
-layout(location = 30) in uint x_3_param;
-layout(location = 0) out uint x_2_1;
-layout(location = 6) out uint x_4_1;
-void main() {
-  tint_symbol_2 inputs;
-  inputs.x_1_param = x_1_param;
-  inputs.x_3_param = x_3_param;
-  tint_symbol_3 outputs;
-  outputs = tint_symbol(inputs);
-  x_2_1 = outputs.x_2_1;
-  x_4_1 = outputs.x_4_1;
-}
-
-
-Error parsing GLSL shader:
-ERROR: 0:41: 'uint' : must be qualified as flat in
-ERROR: 0:41: '' : compilation terminated 
-ERROR: 2 compilation errors.  No code generated.
-
-
-
diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.glsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.glsl
deleted file mode 100644
index f8c14c2..0000000
--- a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.spvasm.expected.glsl
+++ /dev/null
@@ -1,65 +0,0 @@
-SKIP: FAILED
-
-#version 310 es
-precision mediump float;
-
-vec4 x_2 = vec4(0.0f, 0.0f, 0.0f, 0.0f);
-int x_3 = 0;
-int x_4 = 0;
-layout(r32i) uniform highp writeonly iimage2D x_5_1;
-
-void main_1() {
-  x_4 = 1;
-  vec4 x_23 = x_2;
-  int x_27 = int(x_23.x);
-  int x_28 = int(x_23.y);
-  if (((((x_27 & 1) + (x_28 & 1)) + x_3) == int(x_23.z))) {
-  }
-  imageStore(x_5_1, ivec2(x_27, x_28), ivec4(x_27, 0, 0, 0));
-  return;
-}
-
-struct main_out {
-  int x_4_1;
-};
-struct tint_symbol_2 {
-  int x_3_param;
-  vec4 x_2_param;
-};
-struct tint_symbol_3 {
-  int x_4_1;
-};
-
-main_out tint_symbol_inner(vec4 x_2_param, int x_3_param) {
-  x_2 = x_2_param;
-  x_3 = x_3_param;
-  main_1();
-  main_out tint_symbol_4 = main_out(x_4);
-  return tint_symbol_4;
-}
-
-tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1) {
-  main_out inner_result = tint_symbol_inner(tint_symbol_1.x_2_param, tint_symbol_1.x_3_param);
-  tint_symbol_3 wrapper_result = tint_symbol_3(0);
-  wrapper_result.x_4_1 = inner_result.x_4_1;
-  return wrapper_result;
-}
-layout(location = 0) in int x_3_param;
-layout(location = 0) out int x_4_1;
-void main() {
-  tint_symbol_2 inputs;
-  inputs.x_3_param = x_3_param;
-  inputs.x_2_param = gl_FragCoord;
-  tint_symbol_3 outputs;
-  outputs = tint_symbol(inputs);
-  x_4_1 = outputs.x_4_1;
-}
-
-
-Error parsing GLSL shader:
-ERROR: 0:45: 'int' : must be qualified as flat in
-ERROR: 0:45: '' : compilation terminated 
-ERROR: 2 compilation errors.  No code generated.
-
-
-
diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.glsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.glsl
deleted file mode 100644
index f8c14c2..0000000
--- a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_image_store/1.wgsl.expected.glsl
+++ /dev/null
@@ -1,65 +0,0 @@
-SKIP: FAILED
-
-#version 310 es
-precision mediump float;
-
-vec4 x_2 = vec4(0.0f, 0.0f, 0.0f, 0.0f);
-int x_3 = 0;
-int x_4 = 0;
-layout(r32i) uniform highp writeonly iimage2D x_5_1;
-
-void main_1() {
-  x_4 = 1;
-  vec4 x_23 = x_2;
-  int x_27 = int(x_23.x);
-  int x_28 = int(x_23.y);
-  if (((((x_27 & 1) + (x_28 & 1)) + x_3) == int(x_23.z))) {
-  }
-  imageStore(x_5_1, ivec2(x_27, x_28), ivec4(x_27, 0, 0, 0));
-  return;
-}
-
-struct main_out {
-  int x_4_1;
-};
-struct tint_symbol_2 {
-  int x_3_param;
-  vec4 x_2_param;
-};
-struct tint_symbol_3 {
-  int x_4_1;
-};
-
-main_out tint_symbol_inner(vec4 x_2_param, int x_3_param) {
-  x_2 = x_2_param;
-  x_3 = x_3_param;
-  main_1();
-  main_out tint_symbol_4 = main_out(x_4);
-  return tint_symbol_4;
-}
-
-tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1) {
-  main_out inner_result = tint_symbol_inner(tint_symbol_1.x_2_param, tint_symbol_1.x_3_param);
-  tint_symbol_3 wrapper_result = tint_symbol_3(0);
-  wrapper_result.x_4_1 = inner_result.x_4_1;
-  return wrapper_result;
-}
-layout(location = 0) in int x_3_param;
-layout(location = 0) out int x_4_1;
-void main() {
-  tint_symbol_2 inputs;
-  inputs.x_3_param = x_3_param;
-  inputs.x_2_param = gl_FragCoord;
-  tint_symbol_3 outputs;
-  outputs = tint_symbol(inputs);
-  x_4_1 = outputs.x_4_1;
-}
-
-
-Error parsing GLSL shader:
-ERROR: 0:45: 'int' : must be qualified as flat in
-ERROR: 0:45: '' : compilation terminated 
-ERROR: 2 compilation errors.  No code generated.
-
-
-
diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.glsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.glsl
deleted file mode 100644
index 3eb1c86..0000000
--- a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.spvasm.expected.glsl
+++ /dev/null
@@ -1,61 +0,0 @@
-SKIP: FAILED
-
-#version 310 es
-precision mediump float;
-
-vec4 x_2 = vec4(0.0f, 0.0f, 0.0f, 0.0f);
-int x_3 = 0;
-int x_4 = 0;
-
-void main_1() {
-  vec4 x_16 = x_2;
-  if (((((int(x_16.x) & 1) + (int(x_16.y) & 1)) + x_3) == int(x_16.z))) {
-  }
-  x_4 = 1;
-  return;
-}
-
-struct main_out {
-  int x_4_1;
-};
-struct tint_symbol_2 {
-  int x_3_param;
-  vec4 x_2_param;
-};
-struct tint_symbol_3 {
-  int x_4_1;
-};
-
-main_out tint_symbol_inner(vec4 x_2_param, int x_3_param) {
-  x_2 = x_2_param;
-  x_3 = x_3_param;
-  main_1();
-  main_out tint_symbol_4 = main_out(x_4);
-  return tint_symbol_4;
-}
-
-tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1) {
-  main_out inner_result = tint_symbol_inner(tint_symbol_1.x_2_param, tint_symbol_1.x_3_param);
-  tint_symbol_3 wrapper_result = tint_symbol_3(0);
-  wrapper_result.x_4_1 = inner_result.x_4_1;
-  return wrapper_result;
-}
-layout(location = 0) in int x_3_param;
-layout(location = 0) out int x_4_1;
-void main() {
-  tint_symbol_2 inputs;
-  inputs.x_3_param = x_3_param;
-  inputs.x_2_param = gl_FragCoord;
-  tint_symbol_3 outputs;
-  outputs = tint_symbol(inputs);
-  x_4_1 = outputs.x_4_1;
-}
-
-
-Error parsing GLSL shader:
-ERROR: 0:41: 'int' : must be qualified as flat in
-ERROR: 0:41: '' : compilation terminated 
-ERROR: 2 compilation errors.  No code generated.
-
-
-
diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.glsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.glsl
deleted file mode 100644
index 3eb1c86..0000000
--- a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write/1.wgsl.expected.glsl
+++ /dev/null
@@ -1,61 +0,0 @@
-SKIP: FAILED
-
-#version 310 es
-precision mediump float;
-
-vec4 x_2 = vec4(0.0f, 0.0f, 0.0f, 0.0f);
-int x_3 = 0;
-int x_4 = 0;
-
-void main_1() {
-  vec4 x_16 = x_2;
-  if (((((int(x_16.x) & 1) + (int(x_16.y) & 1)) + x_3) == int(x_16.z))) {
-  }
-  x_4 = 1;
-  return;
-}
-
-struct main_out {
-  int x_4_1;
-};
-struct tint_symbol_2 {
-  int x_3_param;
-  vec4 x_2_param;
-};
-struct tint_symbol_3 {
-  int x_4_1;
-};
-
-main_out tint_symbol_inner(vec4 x_2_param, int x_3_param) {
-  x_2 = x_2_param;
-  x_3 = x_3_param;
-  main_1();
-  main_out tint_symbol_4 = main_out(x_4);
-  return tint_symbol_4;
-}
-
-tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1) {
-  main_out inner_result = tint_symbol_inner(tint_symbol_1.x_2_param, tint_symbol_1.x_3_param);
-  tint_symbol_3 wrapper_result = tint_symbol_3(0);
-  wrapper_result.x_4_1 = inner_result.x_4_1;
-  return wrapper_result;
-}
-layout(location = 0) in int x_3_param;
-layout(location = 0) out int x_4_1;
-void main() {
-  tint_symbol_2 inputs;
-  inputs.x_3_param = x_3_param;
-  inputs.x_2_param = gl_FragCoord;
-  tint_symbol_3 outputs;
-  outputs = tint_symbol(inputs);
-  x_4_1 = outputs.x_4_1;
-}
-
-
-Error parsing GLSL shader:
-ERROR: 0:41: 'int' : must be qualified as flat in
-ERROR: 0:41: '' : compilation terminated 
-ERROR: 2 compilation errors.  No code generated.
-
-
-
diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.glsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.glsl
deleted file mode 100644
index c882569..0000000
--- a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.spvasm.expected.glsl
+++ /dev/null
@@ -1,62 +0,0 @@
-SKIP: FAILED
-
-#version 310 es
-precision mediump float;
-
-vec4 x_2 = vec4(0.0f, 0.0f, 0.0f, 0.0f);
-int x_3 = 0;
-int x_4 = 0;
-
-void main_1() {
-  vec4 x_16 = x_2;
-  int x_26 = x_3;
-  x_4 = 1;
-  if (((((int(x_16.x) & 1) + (int(x_16.y) & 1)) + x_26) == int(x_16.z))) {
-  }
-  return;
-}
-
-struct main_out {
-  int x_4_1;
-};
-struct tint_symbol_2 {
-  int x_3_param;
-  vec4 x_2_param;
-};
-struct tint_symbol_3 {
-  int x_4_1;
-};
-
-main_out tint_symbol_inner(vec4 x_2_param, int x_3_param) {
-  x_2 = x_2_param;
-  x_3 = x_3_param;
-  main_1();
-  main_out tint_symbol_4 = main_out(x_4);
-  return tint_symbol_4;
-}
-
-tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1) {
-  main_out inner_result = tint_symbol_inner(tint_symbol_1.x_2_param, tint_symbol_1.x_3_param);
-  tint_symbol_3 wrapper_result = tint_symbol_3(0);
-  wrapper_result.x_4_1 = inner_result.x_4_1;
-  return wrapper_result;
-}
-layout(location = 0) in int x_3_param;
-layout(location = 0) out int x_4_1;
-void main() {
-  tint_symbol_2 inputs;
-  inputs.x_3_param = x_3_param;
-  inputs.x_2_param = gl_FragCoord;
-  tint_symbol_3 outputs;
-  outputs = tint_symbol(inputs);
-  x_4_1 = outputs.x_4_1;
-}
-
-
-Error parsing GLSL shader:
-ERROR: 0:42: 'int' : must be qualified as flat in
-ERROR: 0:42: '' : compilation terminated 
-ERROR: 2 compilation errors.  No code generated.
-
-
-
diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.glsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.glsl
deleted file mode 100644
index c882569..0000000
--- a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_output_write_before_terminate/1.wgsl.expected.glsl
+++ /dev/null
@@ -1,62 +0,0 @@
-SKIP: FAILED
-
-#version 310 es
-precision mediump float;
-
-vec4 x_2 = vec4(0.0f, 0.0f, 0.0f, 0.0f);
-int x_3 = 0;
-int x_4 = 0;
-
-void main_1() {
-  vec4 x_16 = x_2;
-  int x_26 = x_3;
-  x_4 = 1;
-  if (((((int(x_16.x) & 1) + (int(x_16.y) & 1)) + x_26) == int(x_16.z))) {
-  }
-  return;
-}
-
-struct main_out {
-  int x_4_1;
-};
-struct tint_symbol_2 {
-  int x_3_param;
-  vec4 x_2_param;
-};
-struct tint_symbol_3 {
-  int x_4_1;
-};
-
-main_out tint_symbol_inner(vec4 x_2_param, int x_3_param) {
-  x_2 = x_2_param;
-  x_3 = x_3_param;
-  main_1();
-  main_out tint_symbol_4 = main_out(x_4);
-  return tint_symbol_4;
-}
-
-tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1) {
-  main_out inner_result = tint_symbol_inner(tint_symbol_1.x_2_param, tint_symbol_1.x_3_param);
-  tint_symbol_3 wrapper_result = tint_symbol_3(0);
-  wrapper_result.x_4_1 = inner_result.x_4_1;
-  return wrapper_result;
-}
-layout(location = 0) in int x_3_param;
-layout(location = 0) out int x_4_1;
-void main() {
-  tint_symbol_2 inputs;
-  inputs.x_3_param = x_3_param;
-  inputs.x_2_param = gl_FragCoord;
-  tint_symbol_3 outputs;
-  outputs = tint_symbol(inputs);
-  x_4_1 = outputs.x_4_1;
-}
-
-
-Error parsing GLSL shader:
-ERROR: 0:42: 'int' : must be qualified as flat in
-ERROR: 0:42: '' : compilation terminated 
-ERROR: 2 compilation errors.  No code generated.
-
-
-
diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.glsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.glsl
index e7a0333..c06c744 100644
--- a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.glsl
+++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.spvasm.expected.glsl
@@ -50,7 +50,7 @@
   wrapper_result.x_4_1 = inner_result.x_4_1;
   return wrapper_result;
 }
-layout(location = 0) in int x_3_param;
+layout(location = 0) flat in int x_3_param;
 layout(location = 0) out int x_4_1;
 void main() {
   tint_symbol_2 inputs;
diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.glsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.glsl
index ef745b9..cf3ecc7 100644
--- a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.glsl
+++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/no_ssbo_store/1.wgsl.expected.glsl
@@ -54,7 +54,7 @@
   wrapper_result.x_4_1 = inner_result.x_4_1;
   return wrapper_result;
 }
-layout(location = 0) in int x_3_param;
+layout(location = 0) flat in int x_3_param;
 layout(location = 0) out int x_4_1;
 void main() {
   tint_symbol_2 inputs;
diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.glsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.glsl
index 50f2abd..18cb20e 100644
--- a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.glsl
+++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.spvasm.expected.glsl
@@ -51,7 +51,7 @@
   wrapper_result.x_4_1 = inner_result.x_4_1;
   return wrapper_result;
 }
-layout(location = 0) in int x_3_param;
+layout(location = 0) flat in int x_3_param;
 layout(location = 0) out int x_4_1;
 void main() {
   tint_symbol_2 inputs;
diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.glsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.glsl
index 5a47c56..133921c 100644
--- a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.glsl
+++ b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/ssbo_store_before_terminate/1.wgsl.expected.glsl
@@ -55,7 +55,7 @@
   wrapper_result.x_4_1 = inner_result.x_4_1;
   return wrapper_result;
 }
-layout(location = 0) in int x_3_param;
+layout(location = 0) flat in int x_3_param;
 layout(location = 0) out int x_4_1;
 void main() {
   tint_symbol_2 inputs;
diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.glsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.glsl
deleted file mode 100644
index 89108cf..0000000
--- a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.spvasm.expected.glsl
+++ /dev/null
@@ -1,76 +0,0 @@
-SKIP: FAILED
-
-#version 310 es
-precision mediump float;
-
-vec4 x_2 = vec4(0.0f, 0.0f, 0.0f, 0.0f);
-int x_3 = 0;
-int x_4 = 0;
-
-void main_1() {
-  int x_33_phi = 0;
-  vec4 x_18 = x_2;
-  int x_28 = x_3;
-  x_33_phi = 0;
-  if (((((int(x_18.x) & 1) + (int(x_18.y) & 1)) + x_28) == int(x_18.z))) {
-    while (true) {
-      int x_34 = 0;
-      int x_33 = x_33_phi;
-      if ((uint(x_33) < uint(10))) {
-      } else {
-        break;
-      }
-      {
-        x_34 = (x_33 + 1);
-        x_33_phi = x_34;
-      }
-    }
-  }
-  x_4 = 1;
-  return;
-}
-
-struct main_out {
-  int x_4_1;
-};
-struct tint_symbol_2 {
-  int x_3_param;
-  vec4 x_2_param;
-};
-struct tint_symbol_3 {
-  int x_4_1;
-};
-
-main_out tint_symbol_inner(vec4 x_2_param, int x_3_param) {
-  x_2 = x_2_param;
-  x_3 = x_3_param;
-  main_1();
-  main_out tint_symbol_4 = main_out(x_4);
-  return tint_symbol_4;
-}
-
-tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1) {
-  main_out inner_result = tint_symbol_inner(tint_symbol_1.x_2_param, tint_symbol_1.x_3_param);
-  tint_symbol_3 wrapper_result = tint_symbol_3(0);
-  wrapper_result.x_4_1 = inner_result.x_4_1;
-  return wrapper_result;
-}
-layout(location = 0) in int x_3_param;
-layout(location = 0) out int x_4_1;
-void main() {
-  tint_symbol_2 inputs;
-  inputs.x_3_param = x_3_param;
-  inputs.x_2_param = gl_FragCoord;
-  tint_symbol_3 outputs;
-  outputs = tint_symbol(inputs);
-  x_4_1 = outputs.x_4_1;
-}
-
-
-Error parsing GLSL shader:
-ERROR: 0:56: 'int' : must be qualified as flat in
-ERROR: 0:56: '' : compilation terminated 
-ERROR: 2 compilation errors.  No code generated.
-
-
-
diff --git a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.glsl b/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.glsl
deleted file mode 100644
index 89108cf..0000000
--- a/test/vk-gl-cts/spirv_assembly/instruction/terminate_invocation/terminate_loop/1.wgsl.expected.glsl
+++ /dev/null
@@ -1,76 +0,0 @@
-SKIP: FAILED
-
-#version 310 es
-precision mediump float;
-
-vec4 x_2 = vec4(0.0f, 0.0f, 0.0f, 0.0f);
-int x_3 = 0;
-int x_4 = 0;
-
-void main_1() {
-  int x_33_phi = 0;
-  vec4 x_18 = x_2;
-  int x_28 = x_3;
-  x_33_phi = 0;
-  if (((((int(x_18.x) & 1) + (int(x_18.y) & 1)) + x_28) == int(x_18.z))) {
-    while (true) {
-      int x_34 = 0;
-      int x_33 = x_33_phi;
-      if ((uint(x_33) < uint(10))) {
-      } else {
-        break;
-      }
-      {
-        x_34 = (x_33 + 1);
-        x_33_phi = x_34;
-      }
-    }
-  }
-  x_4 = 1;
-  return;
-}
-
-struct main_out {
-  int x_4_1;
-};
-struct tint_symbol_2 {
-  int x_3_param;
-  vec4 x_2_param;
-};
-struct tint_symbol_3 {
-  int x_4_1;
-};
-
-main_out tint_symbol_inner(vec4 x_2_param, int x_3_param) {
-  x_2 = x_2_param;
-  x_3 = x_3_param;
-  main_1();
-  main_out tint_symbol_4 = main_out(x_4);
-  return tint_symbol_4;
-}
-
-tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1) {
-  main_out inner_result = tint_symbol_inner(tint_symbol_1.x_2_param, tint_symbol_1.x_3_param);
-  tint_symbol_3 wrapper_result = tint_symbol_3(0);
-  wrapper_result.x_4_1 = inner_result.x_4_1;
-  return wrapper_result;
-}
-layout(location = 0) in int x_3_param;
-layout(location = 0) out int x_4_1;
-void main() {
-  tint_symbol_2 inputs;
-  inputs.x_3_param = x_3_param;
-  inputs.x_2_param = gl_FragCoord;
-  tint_symbol_3 outputs;
-  outputs = tint_symbol(inputs);
-  x_4_1 = outputs.x_4_1;
-}
-
-
-Error parsing GLSL shader:
-ERROR: 0:56: 'int' : must be qualified as flat in
-ERROR: 0:56: '' : compilation terminated 
-ERROR: 2 compilation errors.  No code generated.
-
-
-