diff --git a/src/transform/canonicalize_entry_point_io.cc b/src/transform/canonicalize_entry_point_io.cc index e00c1a0fa6..f62ce674e6 100644 --- a/src/transform/canonicalize_entry_point_io.cc +++ b/src/transform/canonicalize_entry_point_io.cc @@ -184,24 +184,23 @@ struct CanonicalizeEntryPointIO::State { // corresponding gl_ builtin name auto* builtin = ast::GetAttribute(attributes); if (cfg.shader_style == ShaderStyle::kGlsl && builtin) { - name = GLSLBuiltinToString(builtin->builtin, func_ast->PipelineStage()); + name = GLSLBuiltinToString(builtin->builtin, func_ast->PipelineStage(), + ast::StorageClass::kInput); } auto symbol = ctx.dst->Symbols().New(name); // Create the global variable and use its value for the shader input. const ast::Expression* value = ctx.dst->Expr(symbol); - if (HasSampleMask(attributes)) { - // Vulkan requires the type of a SampleMask builtin to be an array. - // Declare it as array and then load the first element. - ast_type = ctx.dst->ty.array(ast_type, 1); - value = ctx.dst->IndexAccessor(value, 0); - } - // In GLSL, if the type doesn't match the type of the builtin, - // insert a bitcast - if (cfg.shader_style == ShaderStyle::kGlsl && builtin && - GLSLBuiltinNeedsBitcast(builtin->builtin)) { - value = ctx.dst->Bitcast(CreateASTTypeFor(ctx, type), value); + if (builtin) { + if (cfg.shader_style == ShaderStyle::kGlsl) { + value = FromGLSLBuiltin(builtin->builtin, value, ast_type); + } else if (builtin->builtin == ast::Builtin::kSampleMask) { + // Vulkan requires the type of a SampleMask builtin to be an array. + // Declare it as array and then load the first element. + ast_type = ctx.dst->ty.array(ast_type, 1); + value = ctx.dst->IndexAccessor(value, 0); + } } ctx.dst->Global(symbol, ast_type, ast::StorageClass::kInput, std::move(attributes)); @@ -251,9 +250,12 @@ struct CanonicalizeEntryPointIO::State { // In GLSL, if it's a builtin, override the name with the // corresponding gl_ builtin name - auto* builtin = ast::GetAttribute(attributes); - if (cfg.shader_style == ShaderStyle::kGlsl && builtin) { - name = GLSLBuiltinToString(builtin->builtin, func_ast->PipelineStage()); + if (cfg.shader_style == ShaderStyle::kGlsl) { + if (auto* b = ast::GetAttribute(attributes)) { + name = GLSLBuiltinToString(b->builtin, func_ast->PipelineStage(), + ast::StorageClass::kOutput); + value = ToGLSLBuiltin(b->builtin, value, type); + } } OutputValue output; @@ -626,9 +628,11 @@ struct CanonicalizeEntryPointIO::State { /// Retrieve the gl_ string corresponding to a builtin. /// @param builtin the builtin /// @param stage the current pipeline stage + /// @param storage_class the storage class (input or output) /// @returns the gl_ string corresponding to that builtin const char* GLSLBuiltinToString(ast::Builtin builtin, - ast::PipelineStage stage) { + ast::PipelineStage stage, + ast::StorageClass storage_class) { switch (builtin) { case ast::Builtin::kPosition: switch (stage) { @@ -660,26 +664,67 @@ struct CanonicalizeEntryPointIO::State { case ast::Builtin::kSampleIndex: return "gl_SampleID"; case ast::Builtin::kSampleMask: - return "gl_SampleMask"; + if (storage_class == ast::StorageClass::kInput) { + return "gl_SampleMaskIn"; + } else { + return "gl_SampleMask"; + } default: return ""; } } - /// Check if the GLSL version if a builtin doesn't match the WGSL type - /// @param builtin the WGSL builtin to check - /// @returns true if the GLSL builtin needs to be cast to the WGSL type - bool GLSLBuiltinNeedsBitcast(ast::Builtin builtin) { + /// Convert a given GLSL builtin value to the corresponding WGSL value. + /// @param builtin the builtin variable + /// @param value the value to convert + /// @param ast_type (inout) the incoming WGSL and outgoing GLSL types + /// @returns an expression representing the GLSL builtin converted to what + /// WGSL expects + const ast::Expression* FromGLSLBuiltin(ast::Builtin builtin, + const ast::Expression* value, + const ast::Type*& ast_type) { + switch (builtin) { + case ast::Builtin::kVertexIndex: + case ast::Builtin::kInstanceIndex: + case ast::Builtin::kSampleIndex: + // GLSL uses i32 for these, so bitcast to u32. + value = ctx.dst->Bitcast(ast_type, value); + ast_type = ctx.dst->ty.i32(); + break; + case ast::Builtin::kSampleMask: + // gl_SampleMask is an array of i32. Retrieve the first element and + // bitcast it to u32. + value = ctx.dst->IndexAccessor(value, 0); + value = ctx.dst->Bitcast(ast_type, value); + ast_type = ctx.dst->ty.array(ctx.dst->ty.i32(), 1); + break; + default: + break; + } + return value; + } + + /// Convert a given WGSL value to the type expected when assigning to a + /// GLSL builtin. + /// @param builtin the builtin variable + /// @param value the value to convert + /// @param type (out) the type to which the value was converted + /// @returns the converted value which can be assigned to the GLSL builtin + const ast::Expression* ToGLSLBuiltin(ast::Builtin builtin, + const ast::Expression* value, + const sem::Type*& type) { switch (builtin) { case ast::Builtin::kVertexIndex: case ast::Builtin::kInstanceIndex: case ast::Builtin::kSampleIndex: case ast::Builtin::kSampleMask: - // In GLSL, these are i32, not u32. - return true; + type = ctx.dst->create(); + value = ctx.dst->Bitcast(CreateASTTypeFor(ctx, type), value); + break; default: - return false; + break; } + return value; } }; diff --git a/src/transform/canonicalize_entry_point_io_test.cc b/src/transform/canonicalize_entry_point_io_test.cc index 38bd91d463..23030cbf1e 100644 --- a/src/transform/canonicalize_entry_point_io_test.cc +++ b/src/transform/canonicalize_entry_point_io_test.cc @@ -2321,6 +2321,80 @@ fn main() { EXPECT_EQ(expect, str(got)); } +TEST_F(CanonicalizeEntryPointIOTest, GLSLSampleMaskBuiltins) { + auto* src = R"( +@stage(fragment) +fn fragment_main(@builtin(sample_index) sample_index : u32, + @builtin(sample_mask) mask_in : u32 + ) -> @builtin(sample_mask) u32 { + return mask_in; +} +)"; + + auto* expect = R"( +@builtin(sample_index) @internal(disable_validation__ignore_storage_class) var gl_SampleID : i32; + +@builtin(sample_mask) @internal(disable_validation__ignore_storage_class) var gl_SampleMaskIn : array; + +@builtin(sample_mask) @internal(disable_validation__ignore_storage_class) var gl_SampleMask : array; + +fn fragment_main(sample_index : u32, mask_in : u32) -> u32 { + return mask_in; +} + +@stage(fragment) +fn main() { + let inner_result = fragment_main(bitcast(gl_SampleID), bitcast(gl_SampleMaskIn[0])); + gl_SampleMask[0] = bitcast(inner_result); +} +)"; + + DataMap data; + data.Add( + CanonicalizeEntryPointIO::ShaderStyle::kGlsl); + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + +TEST_F(CanonicalizeEntryPointIOTest, GLSLVertexInstanceIndexBuiltins) { + auto* src = R"( +@stage(vertex) +fn vertex_main(@builtin(vertex_index) vertexID : u32, + @builtin(instance_index) instanceID : u32 + ) -> @builtin(position) vec4 { + return vec4(f32(vertexID) + f32(instanceID)); +} +)"; + + auto* expect = R"( +@builtin(vertex_index) @internal(disable_validation__ignore_storage_class) var gl_VertexID : i32; + +@builtin(instance_index) @internal(disable_validation__ignore_storage_class) var gl_InstanceID : i32; + +@builtin(position) @internal(disable_validation__ignore_storage_class) var gl_Position : vec4; + +fn vertex_main(vertexID : u32, instanceID : u32) -> vec4 { + return vec4((f32(vertexID) + f32(instanceID))); +} + +@stage(vertex) +fn main() { + let inner_result = vertex_main(bitcast(gl_VertexID), bitcast(gl_InstanceID)); + gl_Position = inner_result; + gl_Position.y = -(gl_Position.y); + gl_Position.z = ((2.0 * gl_Position.z) - gl_Position.w); +} +)"; + + DataMap data; + data.Add( + CanonicalizeEntryPointIO::ShaderStyle::kGlsl); + auto got = Run(src, data); + + EXPECT_EQ(expect, str(got)); +} + } // namespace } // namespace transform } // namespace tint diff --git a/src/writer/glsl/generator_impl.cc b/src/writer/glsl/generator_impl.cc index a5e8941e76..8857f8ad12 100644 --- a/src/writer/glsl/generator_impl.cc +++ b/src/writer/glsl/generator_impl.cc @@ -63,6 +63,16 @@ bool IsRelational(tint::ast::BinaryOp op) { op == tint::ast::BinaryOp::kGreaterThanEqual; } +bool RequiresOESSampleVariables(tint::ast::Builtin builtin) { + switch (builtin) { + case tint::ast::Builtin::kSampleIndex: + case tint::ast::Builtin::kSampleMask: + return true; + default: + return false; + } +} + } // namespace namespace tint { @@ -125,7 +135,6 @@ GeneratorImpl::~GeneratorImpl() = default; bool GeneratorImpl::Generate() { line() << "#version 310 es"; - line() << "precision mediump float;"; auto helpers_insertion_point = current_buffer_->lines.size(); @@ -171,9 +180,26 @@ bool GeneratorImpl::Generate() { } } + TextBuffer extensions; + + if (requires_oes_sample_variables) { + extensions.Append("#extension GL_OES_sample_variables : require"); + } + + auto indent = current_buffer_->current_indent; + + if (!extensions.lines.empty()) { + current_buffer_->Insert(extensions, helpers_insertion_point, indent); + helpers_insertion_point += extensions.lines.size(); + } + + current_buffer_->Insert("precision mediump float;", helpers_insertion_point++, + indent); + if (!helpers_.lines.empty()) { - current_buffer_->Insert("", helpers_insertion_point++, 0); - current_buffer_->Insert(helpers_, helpers_insertion_point++, 0); + current_buffer_->Insert("", helpers_insertion_point++, indent); + current_buffer_->Insert(helpers_, helpers_insertion_point, indent); + helpers_insertion_point += helpers_.lines.size(); } return true; @@ -197,8 +223,8 @@ bool GeneratorImpl::EmitIndexAccessor( bool GeneratorImpl::EmitBitcast(std::ostream& out, const ast::BitcastExpression* expr) { - auto* src_type = TypeOf(expr->expr); - auto* dst_type = TypeOf(expr); + auto* src_type = TypeOf(expr->expr)->UnwrapRef(); + auto* dst_type = TypeOf(expr)->UnwrapRef(); if (!dst_type->is_integer_scalar_or_vector() && !dst_type->is_float_scalar_or_vector()) { @@ -1807,8 +1833,12 @@ bool GeneratorImpl::EmitWorkgroupVariable(const sem::Variable* var) { bool GeneratorImpl::EmitIOVariable(const sem::Variable* var) { auto* decl = var->Declaration(); - // Do not emit builtin (gl_) variables. - if (ast::HasAttribute(decl->attributes)) { + if (auto* b = ast::GetAttribute(decl->attributes)) { + // Use of gl_SampleID requires the GL_OES_sample_variables extension + if (RequiresOESSampleVariables(b->builtin)) { + requires_oes_sample_variables = true; + } + // Do not emit builtin (gl_) variables. return true; } diff --git a/src/writer/glsl/generator_impl.h b/src/writer/glsl/generator_impl.h index 9bdba66669..92667d166a 100644 --- a/src/writer/glsl/generator_impl.h +++ b/src/writer/glsl/generator_impl.h @@ -471,6 +471,7 @@ class GeneratorImpl : public TextGenerator { std::unordered_map structure_builders_; std::unordered_map dynamic_vector_write_; std::unordered_map int_dot_funcs_; + bool requires_oes_sample_variables = false; }; } // namespace glsl diff --git a/test/bug/tint/1076.wgsl.expected.glsl b/test/bug/tint/1076.wgsl.expected.glsl index 1b1ec51ee5..7e392e55f2 100644 --- a/test/bug/tint/1076.wgsl.expected.glsl +++ b/test/bug/tint/1076.wgsl.expected.glsl @@ -1,6 +1,5 @@ -SKIP: FAILED - #version 310 es +#extension GL_OES_sample_variables : require precision mediump float; layout(location = 0) in float a_1; @@ -20,16 +19,9 @@ FragIn tint_symbol(FragIn tint_symbol_1, float b) { } void main() { - FragIn tint_symbol_3 = FragIn(a_1, uint(gl_SampleMask[0])); + FragIn tint_symbol_3 = FragIn(a_1, uint(gl_SampleMaskIn[0])); FragIn inner_result = tint_symbol(tint_symbol_3, b_1); a_2 = inner_result.a; - gl_SampleMask_1[0] = inner_result.mask; + gl_SampleMask[0] = int(inner_result.mask); return; } -Error parsing GLSL shader: -ERROR: 0:21: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:21: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/shader_io/fragment_input_builtins.wgsl.expected.glsl b/test/shader_io/fragment_input_builtins.wgsl.expected.glsl index fa8c48e723..22ad777e4a 100644 --- a/test/shader_io/fragment_input_builtins.wgsl.expected.glsl +++ b/test/shader_io/fragment_input_builtins.wgsl.expected.glsl @@ -1,6 +1,5 @@ -SKIP: FAILED - #version 310 es +#extension GL_OES_sample_variables : require precision mediump float; void tint_symbol(vec4 position, bool front_facing, uint sample_index, uint sample_mask) { @@ -11,13 +10,6 @@ void tint_symbol(vec4 position, bool front_facing, uint sample_index, uint sampl } void main() { - tint_symbol(gl_FragCoord, gl_FrontFacing, uint(gl_SampleID), uint(gl_SampleMask[0])); + tint_symbol(gl_FragCoord, gl_FrontFacing, uint(gl_SampleID), uint(gl_SampleMaskIn[0])); return; } -Error parsing GLSL shader: -ERROR: 0:12: 'gl_SampleID' : required extension not requested: GL_OES_sample_variables -ERROR: 0:12: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/shader_io/fragment_input_builtins_struct.wgsl.expected.glsl b/test/shader_io/fragment_input_builtins_struct.wgsl.expected.glsl index 9ac60b919d..2f0052e6a5 100644 --- a/test/shader_io/fragment_input_builtins_struct.wgsl.expected.glsl +++ b/test/shader_io/fragment_input_builtins_struct.wgsl.expected.glsl @@ -1,6 +1,5 @@ -SKIP: FAILED - #version 310 es +#extension GL_OES_sample_variables : require precision mediump float; struct FragmentInputs { @@ -18,14 +17,7 @@ void tint_symbol(FragmentInputs inputs) { } void main() { - FragmentInputs tint_symbol_1 = FragmentInputs(gl_FragCoord, gl_FrontFacing, uint(gl_SampleID), uint(gl_SampleMask[0])); + FragmentInputs tint_symbol_1 = FragmentInputs(gl_FragCoord, gl_FrontFacing, uint(gl_SampleID), uint(gl_SampleMaskIn[0])); tint_symbol(tint_symbol_1); return; } -Error parsing GLSL shader: -ERROR: 0:19: 'gl_SampleID' : required extension not requested: GL_OES_sample_variables -ERROR: 0:19: '' : 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 7c742041d7..9054ebbc59 100644 --- a/test/shader_io/fragment_input_mixed.wgsl.expected.glsl +++ b/test/shader_io/fragment_input_mixed.wgsl.expected.glsl @@ -1,6 +1,5 @@ -SKIP: FAILED - #version 310 es +#extension GL_OES_sample_variables : require precision mediump float; layout(location = 0) flat in int loc0_1; @@ -30,14 +29,7 @@ void tint_symbol(FragmentInputs0 inputs0, bool front_facing, uint loc1, uint sam void main() { FragmentInputs0 tint_symbol_1 = FragmentInputs0(gl_FragCoord, loc0_1); - FragmentInputs1 tint_symbol_2 = FragmentInputs1(loc3_1, uint(gl_SampleMask[0])); + FragmentInputs1 tint_symbol_2 = FragmentInputs1(loc3_1, uint(gl_SampleMaskIn[0])); tint_symbol(tint_symbol_1, gl_FrontFacing, loc1_1, uint(gl_SampleID), tint_symbol_2, loc2_1); return; } -Error parsing GLSL shader: -ERROR: 0:31: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:31: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/shader_io/fragment_output_builtins.wgsl.expected.glsl b/test/shader_io/fragment_output_builtins.wgsl.expected.glsl index 1d587241d3..e3faacbb3b 100644 --- a/test/shader_io/fragment_output_builtins.wgsl.expected.glsl +++ b/test/shader_io/fragment_output_builtins.wgsl.expected.glsl @@ -1,5 +1,3 @@ -SKIP: FAILED - #version 310 es precision mediump float; @@ -13,6 +11,7 @@ void main() { return; } #version 310 es +#extension GL_OES_sample_variables : require precision mediump float; uint main2() { @@ -21,13 +20,6 @@ uint main2() { void main() { uint inner_result = main2(); - gl_SampleMask[0] = inner_result; + gl_SampleMask[0] = int(inner_result); return; } -Error parsing GLSL shader: -ERROR: 0:10: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:10: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/shader_io/fragment_output_builtins_struct.wgsl.expected.glsl b/test/shader_io/fragment_output_builtins_struct.wgsl.expected.glsl index 0dce88a69f..877fb38860 100644 --- a/test/shader_io/fragment_output_builtins_struct.wgsl.expected.glsl +++ b/test/shader_io/fragment_output_builtins_struct.wgsl.expected.glsl @@ -1,6 +1,5 @@ -SKIP: FAILED - #version 310 es +#extension GL_OES_sample_variables : require precision mediump float; struct FragmentOutputs { @@ -16,13 +15,6 @@ FragmentOutputs tint_symbol() { void main() { FragmentOutputs inner_result = tint_symbol(); gl_FragDepth = inner_result.frag_depth; - gl_SampleMask[0] = inner_result.sample_mask; + gl_SampleMask[0] = int(inner_result.sample_mask); return; } -Error parsing GLSL shader: -ERROR: 0:17: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:17: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/shader_io/fragment_output_mixed.wgsl.expected.glsl b/test/shader_io/fragment_output_mixed.wgsl.expected.glsl index 2344346b3d..df40f8fad4 100644 --- a/test/shader_io/fragment_output_mixed.wgsl.expected.glsl +++ b/test/shader_io/fragment_output_mixed.wgsl.expected.glsl @@ -1,6 +1,5 @@ -SKIP: FAILED - #version 310 es +#extension GL_OES_sample_variables : require precision mediump float; layout(location = 0) out int loc0_1; @@ -27,14 +26,7 @@ void main() { gl_FragDepth = inner_result.frag_depth; loc1_1 = inner_result.loc1; loc2_1 = inner_result.loc2; - gl_SampleMask[0] = inner_result.sample_mask; + gl_SampleMask[0] = int(inner_result.sample_mask); loc3_1 = inner_result.loc3; return; } -Error parsing GLSL shader: -ERROR: 0:28: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:28: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.glsl deleted file mode 100644 index 2b992911d0..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.glsl +++ /dev/null @@ -1,26 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -int x_1[1] = int[1](0); -void main_1() { - return; -} - -void tint_symbol(uint x_1_param) { - x_1[0] = int(x_1_param); - main_1(); -} - -void main() { - tint_symbol(uint(gl_SampleMask[0])); - return; -} -Error parsing GLSL shader: -ERROR: 0:15: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:15: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.glsl deleted file mode 100644 index 44302f45b8..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.glsl +++ /dev/null @@ -1,26 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uint x_1[1] = uint[1](0u); -void main_1() { - return; -} - -void tint_symbol(uint x_1_param) { - x_1[0] = x_1_param; - main_1(); -} - -void main() { - tint_symbol(uint(gl_SampleMask[0])); - return; -} -Error parsing GLSL shader: -ERROR: 0:15: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:15: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.glsl deleted file mode 100644 index b6cf43f26d..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.glsl +++ /dev/null @@ -1,32 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -int x_1[1] = int[1](0); -void main_1() { - return; -} - -struct main_out { - uint x_1_1; -}; - -main_out tint_symbol() { - main_1(); - main_out tint_symbol_1 = main_out(uint(x_1[0])); - return tint_symbol_1; -} - -void main() { - main_out inner_result = tint_symbol(); - gl_SampleMask[0] = inner_result.x_1_1; - return; -} -Error parsing GLSL shader: -ERROR: 0:21: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:21: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.glsl deleted file mode 100644 index 48269aaf5e..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.glsl +++ /dev/null @@ -1,32 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uint x_1[1] = uint[1](0u); -void main_1() { - return; -} - -struct main_out { - uint x_1_1; -}; - -main_out tint_symbol() { - main_1(); - main_out tint_symbol_1 = main_out(x_1[0]); - return tint_symbol_1; -} - -void main() { - main_out inner_result = tint_symbol(); - gl_SampleMask[0] = inner_result.x_1_1; - return; -} -Error parsing GLSL shader: -ERROR: 0:21: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:21: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.glsl deleted file mode 100644 index b0827e8127..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.glsl +++ /dev/null @@ -1,27 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -int x_1 = 0; -void main_1() { - int x_2 = x_1; - return; -} - -void tint_symbol(uint x_1_param) { - x_1 = int(x_1_param); - main_1(); -} - -void main() { - tint_symbol(uint(gl_SampleID)); - return; -} -Error parsing GLSL shader: -ERROR: 0:16: 'gl_SampleID' : required extension not requested: GL_OES_sample_variables -ERROR: 0:16: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.glsl deleted file mode 100644 index b0827e8127..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.glsl +++ /dev/null @@ -1,27 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -int x_1 = 0; -void main_1() { - int x_2 = x_1; - return; -} - -void tint_symbol(uint x_1_param) { - x_1 = int(x_1_param); - main_1(); -} - -void main() { - tint_symbol(uint(gl_SampleID)); - return; -} -Error parsing GLSL shader: -ERROR: 0:16: 'gl_SampleID' : required extension not requested: GL_OES_sample_variables -ERROR: 0:16: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.glsl deleted file mode 100644 index b0827e8127..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.glsl +++ /dev/null @@ -1,27 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -int x_1 = 0; -void main_1() { - int x_2 = x_1; - return; -} - -void tint_symbol(uint x_1_param) { - x_1 = int(x_1_param); - main_1(); -} - -void main() { - tint_symbol(uint(gl_SampleID)); - return; -} -Error parsing GLSL shader: -ERROR: 0:16: 'gl_SampleID' : required extension not requested: GL_OES_sample_variables -ERROR: 0:16: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.glsl deleted file mode 100644 index 9a1398c567..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.glsl +++ /dev/null @@ -1,27 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uint x_1 = 0u; -void main_1() { - uint x_2 = x_1; - return; -} - -void tint_symbol(uint x_1_param) { - x_1 = x_1_param; - main_1(); -} - -void main() { - tint_symbol(uint(gl_SampleID)); - return; -} -Error parsing GLSL shader: -ERROR: 0:16: 'gl_SampleID' : required extension not requested: GL_OES_sample_variables -ERROR: 0:16: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.glsl deleted file mode 100644 index 9a1398c567..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.glsl +++ /dev/null @@ -1,27 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uint x_1 = 0u; -void main_1() { - uint x_2 = x_1; - return; -} - -void tint_symbol(uint x_1_param) { - x_1 = x_1_param; - main_1(); -} - -void main() { - tint_symbol(uint(gl_SampleID)); - return; -} -Error parsing GLSL shader: -ERROR: 0:16: 'gl_SampleID' : required extension not requested: GL_OES_sample_variables -ERROR: 0:16: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.glsl deleted file mode 100644 index 9a1398c567..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.glsl +++ /dev/null @@ -1,27 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uint x_1 = 0u; -void main_1() { - uint x_2 = x_1; - return; -} - -void tint_symbol(uint x_1_param) { - x_1 = x_1_param; - main_1(); -} - -void main() { - tint_symbol(uint(gl_SampleID)); - return; -} -Error parsing GLSL shader: -ERROR: 0:16: 'gl_SampleID' : required extension not requested: GL_OES_sample_variables -ERROR: 0:16: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.glsl deleted file mode 100644 index 5377a90a71..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.glsl +++ /dev/null @@ -1,27 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -int x_1[1] = int[1](0); -void main_1() { - int x_4 = x_1[0]; - return; -} - -void tint_symbol(uint x_1_param) { - x_1[0] = int(x_1_param); - main_1(); -} - -void main() { - tint_symbol(uint(gl_SampleMask[0])); - return; -} -Error parsing GLSL shader: -ERROR: 0:16: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:16: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.glsl deleted file mode 100644 index 5377a90a71..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.glsl +++ /dev/null @@ -1,27 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -int x_1[1] = int[1](0); -void main_1() { - int x_4 = x_1[0]; - return; -} - -void tint_symbol(uint x_1_param) { - x_1[0] = int(x_1_param); - main_1(); -} - -void main() { - tint_symbol(uint(gl_SampleMask[0])); - return; -} -Error parsing GLSL shader: -ERROR: 0:16: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:16: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.glsl deleted file mode 100644 index 883f06b984..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.glsl +++ /dev/null @@ -1,27 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -int x_1[1] = int[1](0); -void main_1() { - int x_3 = x_1[0]; - return; -} - -void tint_symbol(uint x_1_param) { - x_1[0] = int(x_1_param); - main_1(); -} - -void main() { - tint_symbol(uint(gl_SampleMask[0])); - return; -} -Error parsing GLSL shader: -ERROR: 0:16: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:16: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.glsl deleted file mode 100644 index efc266d3d4..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.glsl +++ /dev/null @@ -1,27 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uint x_1[1] = uint[1](0u); -void main_1() { - uint x_4 = x_1[0]; - return; -} - -void tint_symbol(uint x_1_param) { - x_1[0] = x_1_param; - main_1(); -} - -void main() { - tint_symbol(uint(gl_SampleMask[0])); - return; -} -Error parsing GLSL shader: -ERROR: 0:16: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:16: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.glsl deleted file mode 100644 index efc266d3d4..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.glsl +++ /dev/null @@ -1,27 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uint x_1[1] = uint[1](0u); -void main_1() { - uint x_4 = x_1[0]; - return; -} - -void tint_symbol(uint x_1_param) { - x_1[0] = x_1_param; - main_1(); -} - -void main() { - tint_symbol(uint(gl_SampleMask[0])); - return; -} -Error parsing GLSL shader: -ERROR: 0:16: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:16: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.glsl deleted file mode 100644 index 760f16f82e..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.glsl +++ /dev/null @@ -1,27 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uint x_1[1] = uint[1](0u); -void main_1() { - uint x_3 = x_1[0]; - return; -} - -void tint_symbol(uint x_1_param) { - x_1[0] = x_1_param; - main_1(); -} - -void main() { - tint_symbol(uint(gl_SampleMask[0])); - return; -} -Error parsing GLSL shader: -ERROR: 0:16: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:16: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.glsl deleted file mode 100644 index 760f16f82e..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.glsl +++ /dev/null @@ -1,27 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uint x_1[1] = uint[1](0u); -void main_1() { - uint x_3 = x_1[0]; - return; -} - -void tint_symbol(uint x_1_param) { - x_1[0] = x_1_param; - main_1(); -} - -void main() { - tint_symbol(uint(gl_SampleMask[0])); - return; -} -Error parsing GLSL shader: -ERROR: 0:16: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:16: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.glsl deleted file mode 100644 index 3bb9956aa0..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.glsl +++ /dev/null @@ -1,33 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -int x_1[1] = int[1](0); -void main_1() { - x_1[0] = 12; - return; -} - -struct main_out { - uint x_1_1; -}; - -main_out tint_symbol() { - main_1(); - main_out tint_symbol_1 = main_out(uint(x_1[0])); - return tint_symbol_1; -} - -void main() { - main_out inner_result = tint_symbol(); - gl_SampleMask[0] = inner_result.x_1_1; - return; -} -Error parsing GLSL shader: -ERROR: 0:22: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:22: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.glsl deleted file mode 100644 index 3bb9956aa0..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.glsl +++ /dev/null @@ -1,33 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -int x_1[1] = int[1](0); -void main_1() { - x_1[0] = 12; - return; -} - -struct main_out { - uint x_1_1; -}; - -main_out tint_symbol() { - main_1(); - main_out tint_symbol_1 = main_out(uint(x_1[0])); - return tint_symbol_1; -} - -void main() { - main_out inner_result = tint_symbol(); - gl_SampleMask[0] = inner_result.x_1_1; - return; -} -Error parsing GLSL shader: -ERROR: 0:22: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:22: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.glsl deleted file mode 100644 index 3bb9956aa0..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.glsl +++ /dev/null @@ -1,33 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -int x_1[1] = int[1](0); -void main_1() { - x_1[0] = 12; - return; -} - -struct main_out { - uint x_1_1; -}; - -main_out tint_symbol() { - main_1(); - main_out tint_symbol_1 = main_out(uint(x_1[0])); - return tint_symbol_1; -} - -void main() { - main_out inner_result = tint_symbol(); - gl_SampleMask[0] = inner_result.x_1_1; - return; -} -Error parsing GLSL shader: -ERROR: 0:22: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:22: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.glsl deleted file mode 100644 index 673165fa68..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.glsl +++ /dev/null @@ -1,33 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uint x_1[1] = uint[1](0u); -void main_1() { - x_1[0] = 0u; - return; -} - -struct main_out { - uint x_1_1; -}; - -main_out tint_symbol() { - main_1(); - main_out tint_symbol_1 = main_out(x_1[0]); - return tint_symbol_1; -} - -void main() { - main_out inner_result = tint_symbol(); - gl_SampleMask[0] = inner_result.x_1_1; - return; -} -Error parsing GLSL shader: -ERROR: 0:22: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:22: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.glsl deleted file mode 100644 index 673165fa68..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.glsl +++ /dev/null @@ -1,33 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uint x_1[1] = uint[1](0u); -void main_1() { - x_1[0] = 0u; - return; -} - -struct main_out { - uint x_1_1; -}; - -main_out tint_symbol() { - main_1(); - main_out tint_symbol_1 = main_out(x_1[0]); - return tint_symbol_1; -} - -void main() { - main_out inner_result = tint_symbol(); - gl_SampleMask[0] = inner_result.x_1_1; - return; -} -Error parsing GLSL shader: -ERROR: 0:22: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:22: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.glsl deleted file mode 100644 index 673165fa68..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.glsl +++ /dev/null @@ -1,33 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uint x_1[1] = uint[1](0u); -void main_1() { - x_1[0] = 0u; - return; -} - -struct main_out { - uint x_1_1; -}; - -main_out tint_symbol() { - main_1(); - main_out tint_symbol_1 = main_out(x_1[0]); - return tint_symbol_1; -} - -void main() { - main_out inner_result = tint_symbol(); - gl_SampleMask[0] = inner_result.x_1_1; - return; -} -Error parsing GLSL shader: -ERROR: 0:22: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:22: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.glsl deleted file mode 100644 index 673165fa68..0000000000 --- a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.glsl +++ /dev/null @@ -1,33 +0,0 @@ -SKIP: FAILED - -#version 310 es -precision mediump float; - -uint x_1[1] = uint[1](0u); -void main_1() { - x_1[0] = 0u; - return; -} - -struct main_out { - uint x_1_1; -}; - -main_out tint_symbol() { - main_1(); - main_out tint_symbol_1 = main_out(x_1[0]); - return tint_symbol_1; -} - -void main() { - main_out inner_result = tint_symbol(); - gl_SampleMask[0] = inner_result.x_1_1; - return; -} -Error parsing GLSL shader: -ERROR: 0:22: 'gl_SampleMask' : required extension not requested: GL_OES_sample_variables -ERROR: 0:22: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - -