// // Copyright 2015 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // ShaderValidation_test.cpp: // Tests that malformed shaders fail compilation, and that correct shaders pass compilation. // #include "GLSLANG/ShaderLang.h" #include "angle_gl.h" #include "gtest/gtest.h" #include "tests/test_utils/ShaderCompileTreeTest.h" usingnamespacesh; // Tests that don't target a specific version of the API spec (sometimes there are minor // differences). They choose the shader spec version with version directives. class FragmentShaderValidationTest : public ShaderCompileTreeTest { … }; // Tests that don't target a specific version of the API spec (sometimes there are minor // differences). They choose the shader spec version with version directives. class VertexShaderValidationTest : public ShaderCompileTreeTest { … }; class WebGL2FragmentShaderValidationTest : public ShaderCompileTreeTest { … }; class WebGL1FragmentShaderValidationTest : public ShaderCompileTreeTest { … }; class ComputeShaderValidationTest : public ShaderCompileTreeTest { … }; class ComputeShaderEnforcePackingValidationTest : public ComputeShaderValidationTest { … }; class GeometryShaderValidationTest : public ShaderCompileTreeTest { … }; class FragmentShaderEXTGeometryShaderValidationTest : public FragmentShaderValidationTest { … }; // This is a test for a bug that used to exist in ANGLE: // Calling a function with all parameters missing should not succeed. TEST_F(FragmentShaderValidationTest, FunctionParameterMismatch) { … } // Functions can't be redeclared as variables in the same scope (ESSL 1.00 section 4.2.7) TEST_F(FragmentShaderValidationTest, RedeclaringFunctionAsVariable) { … } // Functions can't be redeclared as structs in the same scope (ESSL 1.00 section 4.2.7) TEST_F(FragmentShaderValidationTest, RedeclaringFunctionAsStruct) { … } // Functions can't be redeclared with different qualifiers (ESSL 1.00 section 6.1.0) TEST_F(FragmentShaderValidationTest, RedeclaringFunctionWithDifferentQualifiers) { … } // Assignment and equality are undefined for structures containing arrays (ESSL 1.00 section 5.7) TEST_F(FragmentShaderValidationTest, CompareStructsContainingArrays) { … } // Assignment and equality are undefined for structures containing arrays (ESSL 1.00 section 5.7) TEST_F(FragmentShaderValidationTest, AssignStructsContainingArrays) { … } // Assignment and equality are undefined for structures containing samplers (ESSL 1.00 sections 5.7 // and 5.9) TEST_F(FragmentShaderValidationTest, CompareStructsContainingSamplers) { … } // Samplers are not allowed as l-values (ESSL 3.00 section 4.1.7), our interpretation is that this // extends to structs containing samplers. ESSL 1.00 spec is clearer about this. TEST_F(FragmentShaderValidationTest, AssignStructsContainingSamplers) { … } // This is a regression test for a particular bug that was in ANGLE. // It also verifies that ESSL3 functionality doesn't leak to ESSL1. TEST_F(FragmentShaderValidationTest, ArrayWithNoSizeInInitializerList) { … } // Const variables need an initializer. TEST_F(FragmentShaderValidationTest, ConstVarNotInitialized) { … } // Const variables need an initializer. In ESSL1 const structs containing // arrays are not allowed at all since it's impossible to initialize them. // Even though this test is for ESSL3 the only thing that's critical for // ESSL1 is the non-initialization check that's used for both language versions. // Whether ESSL1 compilation generates the most helpful error messages is a // secondary concern. TEST_F(FragmentShaderValidationTest, ConstStructNotInitialized) { … } // Const variables need an initializer. In ESSL1 const arrays are not allowed // at all since it's impossible to initialize them. // Even though this test is for ESSL3 the only thing that's critical for // ESSL1 is the non-initialization check that's used for both language versions. // Whether ESSL1 compilation generates the most helpful error messages is a // secondary concern. TEST_F(FragmentShaderValidationTest, ConstArrayNotInitialized) { … } // Block layout qualifiers can't be used on non-block uniforms (ESSL 3.00 section 4.3.8.3) TEST_F(FragmentShaderValidationTest, BlockLayoutQualifierOnRegularUniform) { … } // Block layout qualifiers can't be used on non-block uniforms (ESSL 3.00 section 4.3.8.3) TEST_F(FragmentShaderValidationTest, BlockLayoutQualifierOnUniformWithEmptyDecl) { … } // Arrays of arrays are not allowed (ESSL 3.00 section 4.1.9) TEST_F(FragmentShaderValidationTest, ArraysOfArrays1) { … } // Arrays of arrays are not allowed (ESSL 3.00 section 4.1.9) TEST_F(FragmentShaderValidationTest, ArraysOfArrays2) { … } // Arrays of arrays are not allowed (ESSL 3.00 section 4.1.9). Test this in a struct. TEST_F(FragmentShaderValidationTest, ArraysOfArraysInStruct) { … } // Test invalid dimensionality of implicitly sized array constructor arguments. TEST_F(FragmentShaderValidationTest, TooHighDimensionalityOfImplicitlySizedArrayOfArraysConstructorArguments) { … } // Test invalid dimensionality of implicitly sized array constructor arguments. TEST_F(FragmentShaderValidationTest, TooLowDimensionalityOfImplicitlySizedArrayOfArraysConstructorArguments) { … } // Implicitly sized arrays need to be initialized (ESSL 3.00 section 4.1.9) TEST_F(FragmentShaderValidationTest, UninitializedImplicitArraySize) { … } // An operator can only form a constant expression if all the operands are constant expressions // - even operands of ternary operator that are never evaluated. (ESSL 3.00 section 4.3.3) TEST_F(FragmentShaderValidationTest, TernaryOperatorNotConstantExpression) { … } // Ternary operator can operate on arrays (ESSL 3.00 section 5.7) TEST_F(FragmentShaderValidationTest, TernaryOperatorOnArrays) { … } // Ternary operator can operate on structs (ESSL 3.00 section 5.7) TEST_F(FragmentShaderValidationTest, TernaryOperatorOnStructs) { … } // Array length() returns a constant signed integral expression (ESSL 3.00 section 4.1.9) // Assigning it to unsigned should result in an error. TEST_F(FragmentShaderValidationTest, AssignArrayLengthToUnsigned) { … } // Global variable initializers need to be constant expressions (ESSL 1.00 section 4.3) // Initializing with a varying should be an error. TEST_F(FragmentShaderValidationTest, AssignVaryingToGlobal) { … } // Global variable initializers need to be constant expressions (ESSL 3.00 section 4.3) // Initializing with an uniform should be an error. TEST_F(FragmentShaderValidationTest, AssignUniformToGlobalESSL3) { … } // Global variable initializers need to be constant expressions (ESSL 1.00 section 4.3) // Initializing with an uniform used to generate a warning on ESSL 1.00 because of legacy // compatibility, but that causes dEQP to fail (which expects an error) TEST_F(FragmentShaderValidationTest, AssignUniformToGlobalESSL1) { … } // Global variable initializers need to be constant expressions (ESSL 1.00 section 4.3) // Initializing with an user-defined function call should be an error. TEST_F(FragmentShaderValidationTest, AssignFunctionCallToGlobal) { … } // Global variable initializers need to be constant expressions (ESSL 1.00 section 4.3) // Initializing with an assignment to another global should be an error. TEST_F(FragmentShaderValidationTest, AssignAssignmentToGlobal) { … } // Global variable initializers need to be constant expressions (ESSL 1.00 section 4.3) // Initializing with incrementing another global should be an error. TEST_F(FragmentShaderValidationTest, AssignIncrementToGlobal) { … } // Global variable initializers need to be constant expressions (ESSL 1.00 section 4.3) // Initializing with a texture lookup function call should be an error. TEST_F(FragmentShaderValidationTest, AssignTexture2DToGlobal) { … } // Global variable initializers need to be constant expressions (ESSL 3.00 section 4.3) // Initializing with a non-constant global should be an error. TEST_F(FragmentShaderValidationTest, AssignNonConstGlobalToGlobal) { … } // Global variable initializers need to be constant expressions (ESSL 3.00 section 4.3) // Initializing with a constant global should be fine. TEST_F(FragmentShaderValidationTest, AssignConstGlobalToGlobal) { … } // Statically assigning to both gl_FragData and gl_FragColor is forbidden (ESSL 1.00 section 7.2) TEST_F(FragmentShaderValidationTest, WriteBothFragDataAndFragColor) { … } // Version directive must be on the first line (ESSL 3.00 section 3.3) TEST_F(FragmentShaderValidationTest, VersionOnSecondLine) { … } // Layout qualifier can only appear in global scope (ESSL 3.00 section 4.3.8) TEST_F(FragmentShaderValidationTest, LayoutQualifierInCondition) { … } // Layout qualifier can only appear where specified (ESSL 3.00 section 4.3.8) TEST_F(FragmentShaderValidationTest, LayoutQualifierInFunctionReturnType) { … } // If there is more than one output, the location must be specified for all outputs. // (ESSL 3.00.04 section 4.3.8.2) TEST_F(FragmentShaderValidationTest, TwoOutputsNoLayoutQualifiers) { … } // (ESSL 3.00.04 section 4.3.8.2) TEST_F(FragmentShaderValidationTest, TwoOutputsFirstLayoutQualifier) { … } // (ESSL 3.00.04 section 4.3.8.2) TEST_F(FragmentShaderValidationTest, TwoOutputsSecondLayoutQualifier) { … } // Uniforms can be arrays (ESSL 3.00 section 4.3.5) TEST_F(FragmentShaderValidationTest, UniformArray) { … } // Fragment shader input variables cannot be arrays of structs (ESSL 3.00 section 4.3.4) TEST_F(FragmentShaderValidationTest, FragmentInputArrayOfStructs) { … } // Vertex shader inputs can't be arrays (ESSL 3.00 section 4.3.4) // This test is testing the case where the array brackets are after the variable name, so // the arrayness isn't known when the type and qualifiers are initially parsed. TEST_F(VertexShaderValidationTest, VertexShaderInputArray) { … } // Vertex shader inputs can't be arrays (ESSL 3.00 section 4.3.4) // This test is testing the case where the array brackets are after the type. TEST_F(VertexShaderValidationTest, VertexShaderInputArrayType) { … } // Fragment shader inputs can't contain booleans (ESSL 3.00 section 4.3.4) TEST_F(FragmentShaderValidationTest, FragmentShaderInputStructWithBool) { … } // Fragment shader inputs without a flat qualifier can't contain integers (ESSL 3.00 section 4.3.4) TEST_F(FragmentShaderValidationTest, FragmentShaderInputStructWithInt) { … } // Selecting a field of a vector that's the result of dynamic indexing a constant array should work. TEST_F(FragmentShaderValidationTest, ShaderSelectingFieldOfVectorIndexedFromArray) { … } // Passing an array into a function and then passing a value from that array into another function // should work. This is a regression test for a bug where the mangled name of a TType was not // properly updated when determining the type resulting from array indexing. TEST_F(FragmentShaderValidationTest, ArrayValueFromFunctionParameterAsParameter) { … } // Test that out-of-range integer literal generates an error in ESSL 3.00. TEST_F(FragmentShaderValidationTest, OutOfRangeIntegerLiteral) { … } // Test that vector field selection from a value taken from an array constructor is accepted as a // constant expression. TEST_F(FragmentShaderValidationTest, FieldSelectionFromVectorArrayConstructorIsConst) { … } // Test that structure field selection from a value taken from an array constructor is accepted as a // constant expression. TEST_F(FragmentShaderValidationTest, FieldSelectionFromStructArrayConstructorIsConst) { … } // Test that a reference to a const array is accepted as a constant expression. TEST_F(FragmentShaderValidationTest, ArraySymbolIsConst) { … } // Test that using an array constructor in a parameter to a built-in function is accepted as a // constant expression. TEST_F(FragmentShaderValidationTest, BuiltInFunctionAppliedToArrayConstructorIsConst) { … } // Test that using an array constructor in a parameter to a built-in function is accepted as a // constant expression. TEST_F(FragmentShaderValidationTest, BuiltInFunctionWithMultipleParametersAppliedToArrayConstructorIsConst) { … } // Test that using an array constructor in a parameter to a constructor is accepted as a constant // expression. TEST_F(FragmentShaderValidationTest, ConstructorWithMultipleParametersAppliedToArrayConstructorIsConst) { … } // Test that using an array constructor in an operand of the ternary selection operator is accepted // as a constant expression. TEST_F(FragmentShaderValidationTest, TernaryOperatorAppliedToArrayConstructorIsConst) { … } // Test that a ternary operator with one unevaluated non-constant operand is not a constant // expression. TEST_F(FragmentShaderValidationTest, TernaryOperatorNonConstantOperand) { … } // Test that a sampler can't be used in constructor argument list TEST_F(FragmentShaderValidationTest, SamplerInConstructorArguments) { … } // Test that void can't be used in constructor argument list TEST_F(FragmentShaderValidationTest, VoidInConstructorArguments) { … } // Test that a shader passing a struct into a constructor of array of structs with 1 element works. TEST_F(FragmentShaderValidationTest, SingleStructArrayConstructor) { … } // Test that a shader with empty constructor parameter list is not accepted. TEST_F(FragmentShaderValidationTest, EmptyArrayConstructor) { … } // Test that indexing fragment outputs with a non-constant expression is forbidden, even if ANGLE // is able to constant fold the index expression. ESSL 3.00 section 4.3.6. TEST_F(FragmentShaderValidationTest, DynamicallyIndexedFragmentOutput) { … } // Test that indexing a uniform buffer array with a non-constant expression is forbidden, even if // ANGLE is able to constant fold the index expression. ESSL 3.00 section 4.3.7. TEST_F(FragmentShaderValidationTest, DynamicallyIndexedUniformBuffer) { … } // Test that indexing a storage buffer array with a non-constant expression is forbidden, even if // ANGLE is able to constant fold the index expression. ESSL 3.10 section 4.3.9. TEST_F(FragmentShaderValidationTest, DynamicallyIndexedStorageBuffer) { … } // Test that indexing a sampler array with a non-constant expression is forbidden, even if ANGLE is // able to constant fold the index expression. ESSL 3.00 section 4.1.7.1. TEST_F(FragmentShaderValidationTest, DynamicallyIndexedSampler) { … } // Test that indexing an image array with a non-constant expression is forbidden, even if ANGLE is // able to constant fold the index expression. ESSL 3.10 section 4.1.7.2. TEST_F(FragmentShaderValidationTest, DynamicallyIndexedImage) { … } // Test that a shader that uses a struct definition in place of a struct constructor does not // compile. See GLSL ES 1.00 section 5.4.3. TEST_F(FragmentShaderValidationTest, StructConstructorWithStructDefinition) { … } // Test that indexing gl_FragData with a non-constant expression is forbidden in WebGL 2.0, even // when ANGLE is able to constant fold the index. // WebGL 2.0 spec section 'GLSL ES 1.00 Fragment Shader Output' TEST_F(WebGL2FragmentShaderValidationTest, IndexFragDataWithNonConstant) { … } // Global variable initializers need to be constant expressions (ESSL 1.00 section 4.3) // Initializing with an uniform should generate a warning // (we don't generate an error on ESSL 1.00 because of WebGL compatibility) TEST_F(WebGL2FragmentShaderValidationTest, AssignUniformToGlobalESSL1) { … } // Test that deferring global variable init works with an empty main(). TEST_F(WebGL2FragmentShaderValidationTest, DeferGlobalVariableInitWithEmptyMain) { … } // Test that a non-constant texture offset is not accepted for textureOffset. // ESSL 3.00 section 8.8 TEST_F(FragmentShaderValidationTest, TextureOffsetNonConst) { … } // Test that a non-constant texture offset is not accepted for textureProjOffset with bias. // ESSL 3.00 section 8.8 TEST_F(FragmentShaderValidationTest, TextureProjOffsetNonConst) { … } // Test that an out-of-range texture offset is not accepted. // GLES 3.0.4 section 3.8.10 specifies that out-of-range offset has undefined behavior. TEST_F(FragmentShaderValidationTest, TextureLodOffsetOutOfRange) { … } // Test that default precision qualifier for uint is not accepted. // ESSL 3.00.4 section 4.5.4: Only allowed for float, int and sampler types. TEST_F(FragmentShaderValidationTest, DefaultPrecisionUint) { … } // Test that sampler3D needs to be precision qualified. // ESSL 3.00.4 section 4.5.4: New ESSL 3.00 sampler types don't have predefined precision. TEST_F(FragmentShaderValidationTest, NoPrecisionSampler3D) { … } // Test that using a non-constant expression in a for loop initializer is forbidden in WebGL 1.0, // even when ANGLE is able to constant fold the initializer. // ESSL 1.00 Appendix A. TEST_F(WebGL1FragmentShaderValidationTest, NonConstantLoopIndex) { … } // Global variable initializers need to be constant expressions (ESSL 1.00 section 4.3) // Initializing with an uniform should generate a warning // (we don't generate an error on ESSL 1.00 because of WebGL compatibility) TEST_F(WebGL1FragmentShaderValidationTest, AssignUniformToGlobalESSL1) { … } // Test that deferring global variable init works with an empty main(). TEST_F(WebGL1FragmentShaderValidationTest, DeferGlobalVariableInitWithEmptyMain) { … } // Check that indices that are not integers are rejected. // The check should be done even if ESSL 1.00 Appendix A limitations are not applied. TEST_F(FragmentShaderValidationTest, NonIntegerIndex) { … } // ESSL1 shaders with a duplicate function prototype should be rejected. // ESSL 1.00.17 section 4.2.7. TEST_F(FragmentShaderValidationTest, DuplicatePrototypeESSL1) { … } // ESSL3 shaders with a duplicate function prototype should be allowed. // ESSL 3.00.4 section 4.2.3. TEST_F(FragmentShaderValidationTest, DuplicatePrototypeESSL3) { … } // Shaders with a local function prototype should be rejected. // ESSL 3.00.4 section 4.2.4. TEST_F(FragmentShaderValidationTest, LocalFunctionPrototype) { … } // ESSL 3.00 fragment shaders can not use #pragma STDGL invariant(all). // ESSL 3.00.4 section 4.6.1. Does not apply to other versions of ESSL. TEST_F(FragmentShaderValidationTest, ESSL300FragmentInvariantAll) { … } // Built-in functions can be overloaded in ESSL 1.00. TEST_F(FragmentShaderValidationTest, ESSL100BuiltInFunctionOverload) { … } // Built-in functions can not be overloaded in ESSL 3.00. TEST_F(FragmentShaderValidationTest, ESSL300BuiltInFunctionOverload) { … } // Multiplying a 4x2 matrix with a 4x2 matrix should not work. TEST_F(FragmentShaderValidationTest, CompoundMultiplyMatrixIdenticalNonSquareDimensions) { … } // Multiplying a matrix with 2 columns and 4 rows with a 2x2 matrix should work. TEST_F(FragmentShaderValidationTest, CompoundMultiplyMatrixValidNonSquareDimensions) { … } // Covers a bug where we would set the incorrect result size on an out-of-bounds vector swizzle. TEST_F(FragmentShaderValidationTest, OutOfBoundsVectorSwizzle) { … } // Covers a bug where strange preprocessor defines could trigger asserts. TEST_F(FragmentShaderValidationTest, DefineWithSemicolon) { … } // Covers a bug in our parsing of malformed shift preprocessor expressions. TEST_F(FragmentShaderValidationTest, LineDirectiveUndefinedShift) { … } // Covers a bug in our parsing of malformed shift preprocessor expressions. TEST_F(FragmentShaderValidationTest, LineDirectiveNegativeShift) { … } // gl_MaxImageUnits is only available in ES 3.1 shaders. TEST_F(FragmentShaderValidationTest, MaxImageUnitsInES3Shader) { … } // struct += struct is an invalid operation. TEST_F(FragmentShaderValidationTest, StructCompoundAssignStruct) { … } // struct == different struct is an invalid operation. TEST_F(FragmentShaderValidationTest, StructEqDifferentStruct) { … } // Compute shaders are not supported in versions lower than 310. TEST_F(ComputeShaderValidationTest, Version100) { … } // Compute shaders are not supported in versions lower than 310. TEST_F(ComputeShaderValidationTest, Version300) { … } // Compute shaders should have work group size specified. However, it is not a compile time error // to not have the size specified, but rather a link time one. // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, NoWorkGroupSizeSpecified) { … } // Test that workgroup size declaration doesn't accept variable declaration. TEST_F(ComputeShaderValidationTest, NoVariableDeclrationAfterWorkGroupSize) { … } // Work group size is less than 1. It should be at least 1. // GLSL ES 3.10 Revision 4, 7.1.3 Compute Shader Special Variables // The spec is not clear whether having a local size qualifier equal zero // is correct. // TODO (mradev): Ask people from Khronos to clarify the spec. TEST_F(ComputeShaderValidationTest, WorkGroupSizeTooSmallXdimension) { … } // Work group size is correct for the x and y dimensions, but not for the z dimension. // GLSL ES 3.10 Revision 4, 7.1.3 Compute Shader Special Variables TEST_F(ComputeShaderValidationTest, WorkGroupSizeTooSmallZDimension) { … } // Work group size is bigger than the minimum in the x dimension. // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, WorkGroupSizeTooBigXDimension) { … } // Work group size is bigger than the minimum in the y dimension. // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, WorkGroupSizeTooBigYDimension) { … } // Work group size is definitely bigger than the minimum in the z dimension. // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, WorkGroupSizeTooBigZDimension) { … } // Work group size specified through macro expansion. TEST_F(ComputeShaderValidationTest, WorkGroupSizeMacro) { … } // Work group size specified as an unsigned integer. TEST_F(ComputeShaderValidationTest, WorkGroupSizeUnsignedInteger) { … } // Work group size specified in hexadecimal. TEST_F(ComputeShaderValidationTest, WorkGroupSizeHexadecimal) { … } // local_size_x is -1 in hexadecimal format. // -1 is used as unspecified value in the TLayoutQualifier structure. TEST_F(ComputeShaderValidationTest, WorkGroupSizeMinusOneHexadecimal) { … } // Work group size specified in octal. TEST_F(ComputeShaderValidationTest, WorkGroupSizeOctal) { … } // Work group size is negative. It is specified in hexadecimal. TEST_F(ComputeShaderValidationTest, WorkGroupSizeNegativeHexadecimal) { … } // Multiple work group layout qualifiers with differing values. // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, DifferingLayoutQualifiers) { … } // Multiple work group input variables with differing local size values. // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, MultipleInputVariablesDifferingLocalSize) { … } // Multiple work group input variables with differing local size values. // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, MultipleInputVariablesDifferingLocalSize2) { … } // Multiple work group input variables with the same local size values. It should compile. // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, MultipleInputVariablesSameLocalSize) { … } // Multiple work group input variables with the same local size values. It should compile. // Since the default value is 1, it should compile. // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, MultipleInputVariablesSameLocalSize2) { … } // Multiple work group input variables with the same local size values. It should compile. // Since the default value is 1, it should compile. // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, MultipleInputVariablesSameLocalSize3) { … } // Specifying row_major qualifier in a work group size layout. // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, RowMajorInComputeInputLayout) { … } // local size layout can be used only with compute input variables // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, UniformComputeInputLayout) { … } // local size layout can be used only with compute input variables // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, UniformBufferComputeInputLayout) { … } // local size layout can be used only with compute input variables // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, StructComputeInputLayout) { … } // local size layout can be used only with compute input variables // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, StructBodyComputeInputLayout) { … } // local size layout can be used only with compute input variables // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, TypeComputeInputLayout) { … } // Invalid use of the out storage qualifier in a compute shader. // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, InvalidOutStorageQualifier) { … } // Invalid use of the out storage qualifier in a compute shader. // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, InvalidOutStorageQualifier2) { … } // Invalid use of the in storage qualifier. Can be only used to describe the local block size. // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, InvalidInStorageQualifier) { … } // Invalid use of the in storage qualifier. Can be only used to describe the local block size. // The test checks a different part of the GLSL grammar than what InvalidInStorageQualifier checks. // GLSL ES 3.10 Revision 4, 4.4.1.1 Compute Shader Inputs TEST_F(ComputeShaderValidationTest, InvalidInStorageQualifier2) { … } // The local_size layout qualifier is only available in compute shaders. TEST_F(VertexShaderValidationTest, InvalidUseOfLocalSizeX) { … } // The local_size layout qualifier is only available in compute shaders. TEST_F(FragmentShaderValidationTest, InvalidUseOfLocalSizeX) { … } // The local_size layout qualifier is only available in compute shaders. TEST_F(GeometryShaderValidationTest, InvalidUseOfLocalSizeX) { … } // It is a compile time error to use the gl_WorkGroupSize constant if // the local size has not been declared yet. // GLSL ES 3.10 Revision 4, 7.1.3 Compute Shader Special Variables TEST_F(ComputeShaderValidationTest, InvalidUsageOfWorkGroupSize) { … } // The test covers the compute shader built-in variables and constants. TEST_F(ComputeShaderValidationTest, CorrectUsageOfComputeBuiltins) { … } // It is illegal to write to a special variable. TEST_F(ComputeShaderValidationTest, SpecialVariableNumWorkGroups) { … } // It is illegal to write to a special variable. TEST_F(ComputeShaderValidationTest, SpecialVariableWorkGroupID) { … } // It is illegal to write to a special variable. TEST_F(ComputeShaderValidationTest, SpecialVariableLocalInvocationID) { … } // It is illegal to write to a special variable. TEST_F(ComputeShaderValidationTest, SpecialVariableGlobalInvocationID) { … } // It is illegal to write to a special variable. TEST_F(ComputeShaderValidationTest, SpecialVariableLocalInvocationIndex) { … } // It is illegal to write to a special variable. TEST_F(ComputeShaderValidationTest, SpecialVariableWorkGroupSize) { … } // It is illegal to apply an unary operator to a sampler. TEST_F(FragmentShaderValidationTest, SamplerUnaryOperator) { … } // Invariant cannot be used with a work group size declaration. TEST_F(ComputeShaderValidationTest, InvariantBlockSize) { … } // Invariant cannot be used with a non-output variable in ESSL3. TEST_F(FragmentShaderValidationTest, InvariantNonOuput) { … } // Invariant cannot be used with a non-output variable in ESSL3. // ESSL 3.00.6 section 4.8: This applies even if the declaration is empty. TEST_F(FragmentShaderValidationTest, InvariantNonOuputEmptyDeclaration) { … } // Invariant declaration should follow the following format "invariant <out variable name>". // Test having an incorrect qualifier in the invariant declaration. TEST_F(FragmentShaderValidationTest, InvariantDeclarationWithStorageQualifier) { … } // Invariant declaration should follow the following format "invariant <out variable name>". // Test having an incorrect precision qualifier in the invariant declaration. TEST_F(FragmentShaderValidationTest, InvariantDeclarationWithPrecisionQualifier) { … } // Invariant declaration should follow the following format "invariant <out variable name>". // Test having an incorrect layout qualifier in the invariant declaration. TEST_F(FragmentShaderValidationTest, InvariantDeclarationWithLayoutQualifier) { … } // Variable declaration with both invariant and layout qualifiers is not valid in the formal grammar // provided in the ESSL 3.00 spec. ESSL 3.10 starts allowing this combination, but ESSL 3.00 should // still disallow it. TEST_F(FragmentShaderValidationTest, VariableDeclarationWithInvariantAndLayoutQualifierESSL300) { … } // Bit shift with a rhs value > 31 has an undefined result in the GLSL spec. Detecting an undefined // result at compile time should not generate an error either way. // ESSL 3.00.6 section 5.9. TEST_F(FragmentShaderValidationTest, ShiftBy32) { … } // Bit shift with a rhs value < 0 has an undefined result in the GLSL spec. Detecting an undefined // result at compile time should not generate an error either way. // ESSL 3.00.6 section 5.9. TEST_F(FragmentShaderValidationTest, ShiftByNegative) { … } // Test that pruning empty declarations from loop init expression works. TEST_F(FragmentShaderValidationTest, EmptyDeclarationAsLoopInit) { … } // r32f, r32i, r32ui do not require either the writeonly or readonly memory qualifiers. // GLSL ES 3.10, Revision 4, 4.9 Memory Access Qualifiers TEST_F(FragmentShaderValidationTest, ImageR32FNoMemoryQualifier) { … } // Images which do not have r32f, r32i or r32ui as internal format, must have readonly or writeonly // specified. // GLSL ES 3.10, Revision 4, 4.9 Memory Access Qualifiers TEST_F(FragmentShaderValidationTest, ImageRGBA32FWithIncorrectMemoryQualifier) { … } // It is a compile-time error to call imageStore when the image is qualified as readonly. // GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers TEST_F(FragmentShaderValidationTest, StoreInReadOnlyImage) { … } // It is a compile-time error to call imageLoad when the image is qualified as writeonly. // GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers TEST_F(FragmentShaderValidationTest, LoadFromWriteOnlyImage) { … } // It is a compile-time error to call imageStore when the image is qualified as readonly. // Test to make sure this is validated correctly for images in arrays. // GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers TEST_F(FragmentShaderValidationTest, StoreInReadOnlyImageArray) { … } // It is a compile-time error to call imageStore when the image is qualified as readonly. // Test to make sure that checking this doesn't crash when validating an image in a struct. // Image in a struct in itself isn't accepted by the parser, but error recovery still results in // an image in the struct. // GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers TEST_F(FragmentShaderValidationTest, StoreInReadOnlyImageInStruct) { … } // A valid declaration and usage of an image3D. TEST_F(FragmentShaderValidationTest, ValidImage3D) { … } // A valid declaration and usage of an imageCube. TEST_F(FragmentShaderValidationTest, ValidImageCube) { … } // A valid declaration and usage of an image2DArray. TEST_F(FragmentShaderValidationTest, ValidImage2DArray) { … } // Images cannot be l-values. // GLSL ES 3.10 Revision 4, 4.1.7 Opaque Types TEST_F(FragmentShaderValidationTest, ImageLValueFunctionDefinitionInOut) { … } // Cannot assign to images. // GLSL ES 3.10 Revision 4, 4.1.7 Opaque Types TEST_F(FragmentShaderValidationTest, ImageAssignment) { … } // Passing an image qualifier to a function should not be able to discard the readonly qualifier. // GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers TEST_F(FragmentShaderValidationTest, ReadOnlyQualifierMissingInFunctionArgument) { … } // Passing an image qualifier to a function should not be able to discard the readonly qualifier. // Test with an image from an array. // GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers TEST_F(FragmentShaderValidationTest, ReadOnlyQualifierMissingInFunctionArgumentArray) { … } // Passing an image qualifier to a function should not be able to discard the readonly qualifier. // Test that validation doesn't crash on this for an image in a struct. // Image in a struct in itself isn't accepted by the parser, but error recovery still results in // an image in the struct. // GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers TEST_F(FragmentShaderValidationTest, ReadOnlyQualifierMissingInFunctionArgumentStruct) { … } // Passing an image qualifier to a function should not be able to discard the writeonly qualifier. // GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers TEST_F(FragmentShaderValidationTest, WriteOnlyQualifierMissingInFunctionArgument) { … } // Passing an image parameter as an argument to another function should not be able to discard the // writeonly qualifier. // GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers TEST_F(FragmentShaderValidationTest, DiscardWriteonlyInFunctionBody) { … } // The memory qualifiers for the image declaration and function argument match and the test should // pass. TEST_F(FragmentShaderValidationTest, CorrectImageMemoryQualifierSpecified) { … } // The test adds additional qualifiers to the argument in the function header. // This is correct since no memory qualifiers are discarded upon the function call. // GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers TEST_F(FragmentShaderValidationTest, CorrectImageMemoryQualifierSpecified2) { … } // Images are not allowed in structs. // GLSL ES 3.10 Revision 4, 4.1.8 Structures TEST_F(FragmentShaderValidationTest, ImageInStruct) { … } // Images are not allowed in interface blocks. // GLSL ES 3.10 Revision 4, 4.3.9 Interface Blocks TEST_F(FragmentShaderValidationTest, ImageInInterfaceBlock) { … } // Readonly used with an interface block. TEST_F(FragmentShaderValidationTest, ReadonlyWithInterfaceBlock) { … } // Readonly used with an invariant. TEST_F(FragmentShaderValidationTest, ReadonlyWithInvariant) { … } // Readonly used with a member of a structure. TEST_F(FragmentShaderValidationTest, ReadonlyWithStructMember) { … } // It should not be possible to use an internal format layout qualifier with an interface block. TEST_F(FragmentShaderValidationTest, ImageInternalFormatWithInterfaceBlock) { … } // It should not be possible to use an internal format layout qualifier with a uniform without a // type. TEST_F(FragmentShaderValidationTest, ImageInternalFormatInGlobalLayoutQualifier) { … } // ESSL 1.00 section 4.1.7. // Samplers are not allowed as operands for most operations. Test this for ternary operator. TEST_F(FragmentShaderValidationTest, SamplerAsTernaryOperand) { … } // ESSL 1.00.17 section 4.5.2. // ESSL 3.00.6 section 4.5.3. // Precision must be specified for floats. Test this with a declaration with no qualifiers. TEST_F(FragmentShaderValidationTest, FloatDeclarationNoQualifiersNoPrecision) { … } // Precision must be specified for floats. Test this with a function argument no qualifiers. TEST_F(FragmentShaderValidationTest, FloatDeclarationNoQualifiersNoPrecisionFunctionArg) { … } // Check compiler doesn't crash on incorrect unsized array declarations. TEST_F(FragmentShaderValidationTest, IncorrectUnsizedArray) { … } // Check compiler doesn't crash when a bvec is on the right hand side of a logical operator. // ESSL 3.00.6 section 5.9. TEST_F(FragmentShaderValidationTest, LogicalOpRHSIsBVec) { … } // Check compiler doesn't crash when there's an unsized array constructor with no parameters. // ESSL 3.00.6 section 4.1.9: Array size must be greater than zero. TEST_F(FragmentShaderValidationTest, UnsizedArrayConstructorNoParameters) { … } // Passing an image parameter as an argument to another function should not be able to discard the // coherent qualifier. TEST_F(FragmentShaderValidationTest, CoherentQualifierMissingInFunctionArgument) { … } // Passing an image parameter as an argument to another function should not be able to discard the // volatile qualifier. TEST_F(FragmentShaderValidationTest, VolatileQualifierMissingInFunctionArgument) { … } // The restrict qualifier can be discarded from a function argument. // GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers TEST_F(FragmentShaderValidationTest, RestrictQualifierDiscardedInFunctionArgument) { … } // Function image arguments can be overqualified. // GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers TEST_F(FragmentShaderValidationTest, OverqualifyingImageParameter) { … } // Test that work group size can be used to size arrays. // GLSL ES 3.10.4 section 7.1.3 Compute Shader Special Variables TEST_F(ComputeShaderValidationTest, WorkGroupSizeAsArraySize) { … } // Shared memory variables cannot be used inside a vertex shader. // GLSL ES 3.10 Revision 4, 4.3.8 Shared Variables TEST_F(VertexShaderValidationTest, VertexShaderSharedMemory) { … } // Shared memory variables cannot be used inside a fragment shader. // GLSL ES 3.10 Revision 4, 4.3.8 Shared Variables TEST_F(FragmentShaderValidationTest, FragmentShaderSharedMemory) { … } // Shared memory cannot be combined with any other storage qualifier. TEST_F(ComputeShaderValidationTest, UniformSharedMemory) { … } // Correct usage of shared memory variables. TEST_F(ComputeShaderValidationTest, CorrectUsageOfSharedMemory) { … } // Shared memory variables cannot be initialized. // GLSL ES 3.10 Revision 4, 4.3.8 Shared Variables TEST_F(ComputeShaderValidationTest, SharedVariableInitialization) { … } // Local variables cannot be qualified as shared. // GLSL ES 3.10 Revision 4, 4.3 Storage Qualifiers TEST_F(ComputeShaderValidationTest, SharedMemoryInFunctionBody) { … } // Struct members cannot be qualified as shared. TEST_F(ComputeShaderValidationTest, SharedMemoryInStruct) { … } // Interface block members cannot be qualified as shared. TEST_F(ComputeShaderValidationTest, SharedMemoryInInterfaceBlock) { … } // The shared qualifier cannot be used with any other qualifier. TEST_F(ComputeShaderValidationTest, SharedWithInvariant) { … } // The shared qualifier cannot be used with any other qualifier. TEST_F(ComputeShaderValidationTest, SharedWithMemoryQualifier) { … } // The shared qualifier cannot be used with any other qualifier. TEST_F(ComputeShaderValidationTest, SharedGlobalLayoutDeclaration) { … } // Declaring a function with the same name as a built-in from a higher ESSL version should not cause // a redeclaration error. TEST_F(FragmentShaderValidationTest, BuiltinESSL31FunctionDeclaredInESSL30Shader) { … } // Attempting to declare num_views without enabling OVR_multiview. TEST_F(VertexShaderValidationTest, InvalidNumViews) { … } // memoryBarrierShared is only available in a compute shader. // GLSL ES 3.10 Revision 4, 8.15 Shader Memory Control Functions TEST_F(FragmentShaderValidationTest, InvalidUseOfMemoryBarrierShared) { … } // groupMemoryBarrier is only available in a compute shader. // GLSL ES 3.10 Revision 4, 8.15 Shader Memory Control Functions TEST_F(FragmentShaderValidationTest, InvalidUseOfGroupMemoryBarrier) { … } // barrier can be used in a compute shader. // GLSL ES 3.10 Revision 4, 8.14 Shader Invocation Control Functions TEST_F(ComputeShaderValidationTest, ValidUseOfBarrier) { … } // memoryBarrierImage() can be used in all GLSL ES 3.10 shaders. // GLSL ES 3.10 Revision 4, 8.15 Shader Memory Control Functions TEST_F(FragmentShaderValidationTest, ValidUseOfMemoryBarrierImageInFragmentShader) { … } // checks that gsampler2DMS is not supported in version lower than 310 TEST_F(FragmentShaderValidationTest, Sampler2DMSInESSL300Shader) { … } // Declare main() with incorrect parameters. // ESSL 3.00.6 section 6.1 Function Definitions. TEST_F(FragmentShaderValidationTest, InvalidMainPrototypeParameters) { … } // Regression test for a crash in the empty constructor of unsized array // of a structure with non-basic fields fields. Test with "void". TEST_F(FragmentShaderValidationTest, VoidFieldStructUnsizedArrayEmptyConstructor) { … } // Regression test for a crash in the empty constructor of unsized array // of a structure with non-basic fields fields. Test with something other than "void". TEST_F(FragmentShaderValidationTest, SamplerFieldStructUnsizedArrayEmptyConstructor) { … } // Checks that odd array initialization syntax is an error, and does not produce // an ASSERT failure. TEST_F(VertexShaderValidationTest, InvalidArrayConstruction) { … } // Correct usage of image binding layout qualifier. TEST_F(ComputeShaderValidationTest, CorrectImageBindingLayoutQualifier) { … } // Incorrect use of "binding" on a global layout qualifier. TEST_F(ComputeShaderValidationTest, IncorrectGlobalBindingLayoutQualifier) { … } // Incorrect use of "binding" on a struct field layout qualifier. TEST_F(ComputeShaderValidationTest, IncorrectStructFieldBindingLayoutQualifier) { … } // Variable binding layout qualifier is set to a negative value. 0xffffffff wraps around to -1 // according to the integer parsing rules. TEST_F(FragmentShaderValidationTest, ImageBindingUnitNegative) { … } // Image binding layout qualifier value is greater than the maximum image binding. TEST_F(FragmentShaderValidationTest, ImageBindingUnitTooBig) { … } // Uniform variable binding is set on a non-opaque type. TEST_F(FragmentShaderValidationTest, NonOpaqueUniformBinding) { … } // Uniform variable binding is set on a sampler type. // ESSL 3.10 section 4.4.5 Opaque Uniform Layout Qualifiers. TEST_F(FragmentShaderValidationTest, SamplerUniformBinding) { … } // Uniform variable binding is set on a sampler type in an ESSL 3.00 shader. // The binding layout qualifier was added in ESSL 3.10, so this is incorrect. TEST_F(FragmentShaderValidationTest, SamplerUniformBindingESSL300) { … } // Attempting to construct a struct containing a void array should fail without asserting. TEST_F(FragmentShaderValidationTest, ConstructStructContainingVoidArray) { … } // Uniforms can't have location in ESSL 3.00. // Test this with an empty declaration (ESSL 3.00.6 section 4.8: The combinations of qualifiers that // cause compile-time or link-time errors are the same whether or not the declaration is empty). TEST_F(FragmentShaderValidationTest, UniformLocationEmptyDeclaration) { … } // Test function parameters of opaque type can't be l-value too. TEST_F(FragmentShaderValidationTest, OpaqueParameterCanNotBeLValue) { … } // Test samplers must not be operands in expressions, except for array indexing, structure field // selection and parentheses(ESSL 3.00 Secion 4.1.7). TEST_F(FragmentShaderValidationTest, InvalidExpressionForSamplerOperands) { … } // Test interface blocks as invalid operands to a binary expression. TEST_F(FragmentShaderValidationTest, InvalidInterfaceBlockBinaryExpression) { … } // Test interface block as an invalid operand to an unary expression. TEST_F(FragmentShaderValidationTest, InvalidInterfaceBlockUnaryExpression) { … } // Test interface block as an invalid operand to a ternary expression. // Note that the spec is not very explicit on this, but it makes sense to forbid this. TEST_F(FragmentShaderValidationTest, InvalidInterfaceBlockTernaryExpression) { … } // Test that "buffer" and "shared" are valid identifiers in version lower than GLSL ES 3.10. TEST_F(FragmentShaderValidationTest, BufferAndSharedAsIdentifierOnES3) { … } // Test that a struct can not be used as a constructor argument for a scalar. TEST_F(FragmentShaderValidationTest, StructAsBoolConstructorArgument) { … } // Test that a compute shader can be compiled with MAX_COMPUTE_UNIFORM_COMPONENTS uniform // components. TEST_F(ComputeShaderEnforcePackingValidationTest, MaxComputeUniformComponents) { … } // Test that a function can't be declared with a name starting with "gl_". Note that it's important // that the function is not being called. TEST_F(FragmentShaderValidationTest, FunctionDeclaredWithReservedName) { … } // Test that a function can't be defined with a name starting with "gl_". Note that it's important // that the function is not being called. TEST_F(FragmentShaderValidationTest, FunctionDefinedWithReservedName) { … } // Test that ops with mismatching operand types are disallowed and don't result in an assert. // This makes sure that constant folding doesn't fetch invalid union values in case operand types // mismatch. TEST_F(FragmentShaderValidationTest, InvalidOpsWithConstantOperandsDontAssert) { … } // Test that case labels with invalid types don't assert TEST_F(FragmentShaderValidationTest, CaseLabelsWithInvalidTypesDontAssert) { … } // Test that using an array as an index is not allowed. TEST_F(FragmentShaderValidationTest, ArrayAsIndex) { … } // Test that using an array as an array size is not allowed. TEST_F(FragmentShaderValidationTest, ArrayAsArraySize) { … } // The input primitive layout qualifier is only available in geometry shaders. TEST_F(VertexShaderValidationTest, InvalidUseOfInputPrimitives) { … } // The input primitive layout qualifier is only available in geometry shaders. TEST_F(FragmentShaderValidationTest, InvalidUseOfInputPrimitives) { … } // The input primitive layout qualifier is only available in geometry shaders. TEST_F(ComputeShaderValidationTest, InvalidUseOfInputPrimitives) { … } // The output primitive layout qualifier is only available in geometry shaders. TEST_F(VertexShaderValidationTest, InvalidUseOfOutputPrimitives) { … } // The output primitive layout qualifier is only available in geometry shaders. TEST_F(FragmentShaderValidationTest, InvalidUseOfOutputPrimitives) { … } // The 'invocations' layout qualifier is only available in geometry shaders. TEST_F(VertexShaderValidationTest, InvalidUseOfInvocations) { … } // The 'invocations' layout qualifier is only available in geometry shaders. TEST_F(FragmentShaderValidationTest, InvalidUseOfInvocations) { … } // The 'invocations' layout qualifier is only available in geometry shaders. TEST_F(ComputeShaderValidationTest, InvalidUseOfInvocations) { … } // The 'max_vertices' layout qualifier is only available in geometry shaders. TEST_F(VertexShaderValidationTest, InvalidUseOfMaxVertices) { … } // The 'max_vertices' layout qualifier is only available in geometry shaders. TEST_F(FragmentShaderValidationTest, InvalidUseOfMaxVertices) { … } // Test that using the same variable name twice in function parameters fails without crashing. TEST_F(FragmentShaderValidationTest, RedefinedParamInFunctionHeader) { … } // Test that using gl_ViewportIndex is not allowed in an ESSL 3.10 shader. TEST_F(VertexShaderValidationTest, ViewportIndexInESSL310) { … } // Test that gl_PrimitiveID is valid in fragment shader with 'GL_EXT_geometry_shader' declared. TEST_F(FragmentShaderEXTGeometryShaderValidationTest, PrimitiveIDWithExtension) { … } // Test that gl_PrimitiveID is invalid in fragment shader without 'GL_EXT_geometry_shader' declared. TEST_F(FragmentShaderEXTGeometryShaderValidationTest, PrimitiveIDWithoutExtension) { … } // Test that gl_PrimitiveID cannot be l-value in fragment shader. TEST_F(FragmentShaderEXTGeometryShaderValidationTest, AssignValueToPrimitiveID) { … } // Test that gl_Layer is valid in fragment shader with 'GL_EXT_geometry_shader' declared. TEST_F(FragmentShaderEXTGeometryShaderValidationTest, LayerWithExtension) { … } // Test that gl_Layer is invalid in fragment shader without 'GL_EXT_geometry_shader' declared. TEST_F(FragmentShaderEXTGeometryShaderValidationTest, LayerWithoutExtension) { … } // Test that gl_Layer cannot be l-value in fragment shader. TEST_F(FragmentShaderEXTGeometryShaderValidationTest, AssignValueToLayer) { … } // Test that all built-in constants defined in GL_EXT_geometry_shader can be used in fragment shader // with 'GL_EXT_geometry_shader' declared. TEST_F(FragmentShaderEXTGeometryShaderValidationTest, GeometryShaderBuiltInConstants) { … } // Test that any built-in constants defined in GL_EXT_geometry_shader cannot be used in fragment // shader without 'GL_EXT_geometry_shader' declared. TEST_F(FragmentShaderEXTGeometryShaderValidationTest, GeometryShaderBuiltInConstantsWithoutExtension) { … } // Test that declaring and using an interface block with 'const' qualifier is not allowed. TEST_F(VertexShaderValidationTest, InterfaceBlockUsingConstQualifier) { … } // Test that using shader io blocks without declaration of GL_EXT_shader_io_block is not allowed. TEST_F(VertexShaderValidationTest, IOBlockWithoutExtension) { … } // Test that using shader io blocks without declaration of GL_EXT_shader_io_block is not allowed. TEST_F(FragmentShaderValidationTest, IOBlockWithoutExtension) { … } // Test that a shader input with 'flat' qualifier cannot be used as l-value. TEST_F(FragmentShaderValidationTest, AssignValueToFlatIn) { … } // Test that a shader input with 'smooth' qualifier cannot be used as l-value. TEST_F(FragmentShaderValidationTest, AssignValueToSmoothIn) { … } // Test that a shader input with 'centroid' qualifier cannot be used as l-value. TEST_F(FragmentShaderValidationTest, AssignValueToCentroidIn) { … } // Test that shader compilation fails if the component argument is dynamic. TEST_F(FragmentShaderValidationTest, DynamicComponentTextureGather) { … } // Test that shader compilation fails if the component argument to textureGather has a negative // value. TEST_F(FragmentShaderValidationTest, TextureGatherNegativeComponent) { … } // Test that shader compilation fails if the component argument to textureGather has a value greater // than 3. TEST_F(FragmentShaderValidationTest, TextureGatherTooGreatComponent) { … } // Test that shader compilation fails if the offset is less than the minimum value. TEST_F(FragmentShaderValidationTest, TextureGatherTooGreatOffset) { … } // Test that it isn't allowed to use 'location' layout qualifier on GLSL ES 3.0 vertex shader // outputs. TEST_F(VertexShaderValidationTest, UseLocationOnVertexOutES30) { … } // Test that using 'location' layout qualifier on vertex shader outputs is legal in GLSL ES 3.1 // shaders. TEST_F(VertexShaderValidationTest, UseLocationOnVertexOutES31) { … } // Test that it isn't allowed to use 'location' layout qualifier on GLSL ES 3.0 fragment shader // inputs. TEST_F(FragmentShaderValidationTest, UseLocationOnFragmentInES30) { … } // Test that using 'location' layout qualifier on fragment shader inputs is legal in GLSL ES 3.1 // shaders. TEST_F(FragmentShaderValidationTest, UseLocationOnFragmentInES31) { … } // Test that declaring outputs of a vertex shader with same location causes a compile error. TEST_F(VertexShaderValidationTest, DeclareSameLocationOnVertexOut) { … } // Test that declaring inputs of a fragment shader with same location causes a compile error. TEST_F(FragmentShaderValidationTest, DeclareSameLocationOnFragmentIn) { … } // Test that the location of an element of an array conflicting with other output varyings in a // vertex shader causes a compile error. TEST_F(VertexShaderValidationTest, LocationConflictsnOnArrayElement) { … } // Test that the location of an element of a matrix conflicting with other output varyings in a // vertex shader causes a compile error. TEST_F(VertexShaderValidationTest, LocationConflictsOnMatrixElement) { … } // Test that the location of an element of a struct conflicting with other output varyings in a // vertex shader causes a compile error. TEST_F(VertexShaderValidationTest, LocationConflictsOnStructElement) { … } // Test that declaring inputs of a vertex shader with a location larger than GL_MAX_VERTEX_ATTRIBS // causes a compile error. TEST_F(VertexShaderValidationTest, AttributeLocationOutOfRange) { … } // Test that a block can follow the final case in a switch statement. // GLSL ES 3.00.5 section 6 and the grammar suggest that an empty block is a statement. TEST_F(FragmentShaderValidationTest, SwitchFinalCaseHasEmptyBlock) { … } // Test that an empty declaration can follow the final case in a switch statement. TEST_F(FragmentShaderValidationTest, SwitchFinalCaseHasEmptyDeclaration) { … } // The final case in a switch statement can't be empty in ESSL 3.10 either. This is the intent of // the spec though public spec in early 2018 didn't reflect this yet. TEST_F(FragmentShaderValidationTest, SwitchFinalCaseEmptyESSL310) { … } // Test that fragment shader cannot declare unsized inputs. TEST_F(FragmentShaderValidationTest, UnsizedInputs) { … } // Test that unsized struct members are not allowed. TEST_F(FragmentShaderValidationTest, UnsizedStructMember) { … } // Test that unsized parameters without a name are not allowed. // GLSL ES 3.10 section 6.1 Function Definitions. TEST_F(FragmentShaderValidationTest, UnsizedNamelessParameter) { … } // Test that partially unsized array of arrays constructor sizes are validated. TEST_F(FragmentShaderValidationTest, PartiallyUnsizedArrayOfArraysConstructor) { … } // Test that duplicate field names in a struct declarator list are validated. TEST_F(FragmentShaderValidationTest, DuplicateFieldNamesInStructDeclaratorList) { … } // Test that an empty statement is not allowed in switch before the first case. TEST_F(FragmentShaderValidationTest, EmptyStatementInSwitchBeforeFirstCase) { … } // Test that a nameless struct definition is not allowed as a function parameter type. // ESSL 3.00.6 section 12.10. ESSL 3.10 January 2016 section 13.10. TEST_F(FragmentShaderValidationTest, NamelessStructDefinitionAsParameterType) { … } // Test that a named struct definition is not allowed as a function parameter type. // ESSL 3.00.6 section 12.10. ESSL 3.10 January 2016 section 13.10. TEST_F(FragmentShaderValidationTest, NamedStructDefinitionAsParameterType) { … } // Test that a named struct definition is not allowed as a function parameter type. // ESSL 3.00.6 section 12.10. ESSL 3.10 January 2016 section 13.10. TEST_F(FragmentShaderValidationTest, StructDefinitionAsTypeOfParameterWithoutName) { … } // Test that an unsized const array doesn't assert. TEST_F(FragmentShaderValidationTest, UnsizedConstArray) { … } // Test that the value passed to the mem argument of an atomic memory function can be a shared // variable. TEST_F(ComputeShaderValidationTest, AtomicAddWithSharedVariable) { … } // Test that it is acceptable to pass an element of an array to the mem argument of an atomic memory // function, as long as the underlying array is a buffer or shared variable. TEST_F(ComputeShaderValidationTest, AtomicAddWithSharedVariableArray) { … } // Test that it is acceptable to pass a single component of a vector to the mem argument of an // atomic memory function, as long as the underlying vector is a buffer or shared variable. TEST_F(ComputeShaderValidationTest, AtomicAddWithSharedVariableVector) { … } // Test that the value passed to the mem argument of an atomic memory function can be a buffer // variable. TEST_F(FragmentShaderValidationTest, AtomicAddWithBufferVariable) { … } // Test that it is acceptable to pass an element of an array to the mem argument of an atomic memory // function, as long as the underlying array is a buffer or shared variable. TEST_F(FragmentShaderValidationTest, AtomicAddWithBufferVariableArrayElement) { … } // Test that it is acceptable to pass a member of a shader storage block instance to the mem // argument of an atomic memory function. TEST_F(FragmentShaderValidationTest, AtomicAddWithBufferVariableInBlockInstance) { … } // Test that it is acceptable to pass a member of a shader storage block instance array to the mem // argument of an atomic memory function. TEST_F(FragmentShaderValidationTest, AtomicAddWithBufferVariableInBlockInstanceArray) { … } // Test that it is acceptable to pass an element of an array of a shader storage block instance to // the mem argument of an atomic memory function. TEST_F(FragmentShaderValidationTest, AtomicAddWithElementOfArrayInBlockInstance) { … } // Test that it is not allowed to pass an atomic counter variable to the mem argument of an atomic // memory function. TEST_F(FragmentShaderValidationTest, AtomicAddWithAtomicCounter) { … } // Test that it is not allowed to pass an element of an atomic counter array to the mem argument of // an atomic memory function. TEST_F(FragmentShaderValidationTest, AtomicAddWithAtomicCounterArray) { … } // Test that it is not allowed to pass a local uint value to the mem argument of an atomic memory // function. TEST_F(FragmentShaderValidationTest, AtomicAddWithNonStorageVariable) { … } // Test that it is acceptable to pass a swizzle of a member of a shader storage block to the mem // argument of an atomic memory function. TEST_F(FragmentShaderValidationTest, AtomicAddWithSwizzle) { … } // Test that it is not allowed to pass an expression that does not constitute of indexing, field // selection or swizzle to the mem argument of an atomic memory function. TEST_F(FragmentShaderValidationTest, AtomicAddWithNonIndexNonSwizzleExpression) { … } // Test that negative indexing of a matrix doesn't result in an assert. TEST_F(FragmentShaderValidationTest, MatrixNegativeIndex) { … } // Global variable initializers need to be constant expressions. Test with assigning a ternary // expression that ANGLE can fold. TEST_F(FragmentShaderValidationTest, AssignConstantFoldedFromNonConstantTernaryToGlobal) { … } // Global variable initializers need to be constant expressions. Test with assigning a ternary // expression that ANGLE can fold. TEST_F(FragmentShaderValidationTest, AssignConstantArrayVariableFoldedFromNonConstantTernaryToGlobal) { … } // Test going past the struct nesting limit while simultaneously using invalid nested struct // definitions. This makes sure that the code generating an error message about going past the // struct nesting limit does not access the name of a nameless struct definition. TEST_F(WebGL1FragmentShaderValidationTest, StructNestingLimitWithNestedStructDefinitions) { … } // Test that the result of a sequence operator is not a constant-expression. // ESSL 3.00 section 12.43. TEST_F(FragmentShaderValidationTest, CommaReturnsNonConstant) { … } // Test that the result of indexing into an array constructor with some non-constant arguments is // not a constant expression. TEST_F(FragmentShaderValidationTest, IndexingIntoArrayConstructorWithNonConstantArgumentsIsNotConstantExpression) { … } // Test that the type of an initializer of a constant variable needs to match. TEST_F(FragmentShaderValidationTest, ConstantInitializerTypeMismatch) { … } // Test that redeclaring a built-in is an error in ESSL 1.00. ESSL 1.00.17 section 4.2.6 disallows // "redefinition" of built-ins - it's not very explicit about redeclaring them, but we treat this as // an error. The redeclaration cannot serve any purpose since it can't be accompanied by a // definition. TEST_F(FragmentShaderValidationTest, RedeclaringBuiltIn) { … } // Redefining a built-in that is not available in the current shader stage is assumed to be not an // error. Test with redefining groupMemoryBarrier() in fragment shader. The built-in // groupMemoryBarrier() is only available in compute shaders. TEST_F(FragmentShaderValidationTest, RedeclaringBuiltInFromAnotherShaderStage) { … } // Test that standard derivative functions that are in core ESSL 3.00 compile successfully. TEST_F(FragmentShaderValidationTest, ESSL300StandardDerivatives) { … } // Test that vertex shader built-in gl_Position is not accessible in fragment shader. TEST_F(FragmentShaderValidationTest, GlPosition) { … } // Test that compute shader built-in gl_LocalInvocationID is not accessible in fragment shader. TEST_F(FragmentShaderValidationTest, GlLocalInvocationID) { … } // Test that fragment shader built-in gl_FragCoord is not accessible in vertex shader. TEST_F(VertexShaderValidationTest, GlFragCoord) { … } // Test that a long sequence of repeated swizzling on an l-value does not cause a stack overflow. TEST_F(VertexShaderValidationTest, LValueRepeatedSwizzle) { … } // Test that swizzling that contains duplicate components can't form an l-value, even if it is // swizzled again so that the final result does not contain duplicate components. TEST_F(VertexShaderValidationTest, LValueSwizzleDuplicateComponents) { … } // Test that a fragment shader with nested if statements without braces compiles successfully. TEST_F(FragmentShaderValidationTest, HandleIfInnerIfStatementAlwaysTriviallyPruned) { … } // Test that a fragment shader with an if statement nested in a loop without braces compiles // successfully. TEST_F(FragmentShaderValidationTest, HandleLoopInnerIfStatementAlwaysTriviallyPruned) { … } // Test that declaring both gl_FragColor and gl_FragData invariant is not an error. The GLSL ES 1.00 // spec only disallows writing to both of them. ANGLE extends this validation to also cover reads, // but it makes sense not to treat declaring them both invariant as an error. TEST_F(FragmentShaderValidationTest, DeclareBothBuiltInFragmentOutputsInvariant) { … } // Test that a case cannot be placed inside a block nested inside a switch statement. GLSL ES 3.10 // section 6.2. TEST_F(FragmentShaderValidationTest, CaseInsideBlock) { … } // Test using a value from a constant array as a case label. TEST_F(FragmentShaderValidationTest, ValueFromConstantArrayAsCaseLabel) { … } // Test using a value from a constant array as a fragment output index. TEST_F(FragmentShaderValidationTest, ValueFromConstantArrayAsFragmentOutputIndex) { … } // Test using a value from a constant array as an array size. TEST_F(FragmentShaderValidationTest, ValueFromConstantArrayAsArraySize) { … } // Test that an invalid struct with void fields doesn't crash or assert when used in a comma // operator. This is a regression test. TEST_F(FragmentShaderValidationTest, InvalidStructWithVoidFieldsInComma) { … } // Test that layout(early_fragment_tests) in; is valid in fragment shader TEST_F(FragmentShaderValidationTest, ValidEarlyFragmentTests) { … } // Test that layout(early_fragment_tests=x) in; is invalid TEST_F(FragmentShaderValidationTest, InvalidValueForEarlyFragmentTests) { … } // Test that layout(early_fragment_tests) in varying; is invalid TEST_F(FragmentShaderValidationTest, InvalidEarlyFragmentTestsOnVariableDecl) { … } // Test that layout(early_fragment_tests) in; is invalid in vertex shader TEST_F(VertexShaderValidationTest, InvalidEarlyFragmentTests) { … } // Test that layout(early_fragment_tests) in; is invalid in compute shader TEST_F(ComputeShaderValidationTest, InvalidEarlyFragmentTests) { … } // Test that layout(x) in; only accepts x=early_fragment_tests. TEST_F(FragmentShaderValidationTest, NothingButEarlyFragmentTestsWithInWithoutVariableDecl) { … }