// // Copyright 2017 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. // // BufferVariables_test.cpp: // Tests for buffer variables in GLSL ES 3.10 section 4.3.7. // #include "gtest/gtest.h" #include "GLSLANG/ShaderLang.h" #include "angle_gl.h" #include "gtest/gtest.h" #include "tests/test_utils/ShaderCompileTreeTest.h" #include "tests/test_utils/compiler_test.h" usingnamespacesh; class BufferVariablesTest : public ShaderCompileTreeTest { … }; class BufferVariablesMatchTest : public MatchOutputCodeTest { … }; // Test that the buffer qualifier described in GLSL ES 3.10 section 4.3.7 can be successfully // compiled. TEST_F(BufferVariablesTest, BasicShaderStorageBlockDeclaration) { … } // Test that shader storage block layout qualifiers can be declared for global scope. TEST_F(BufferVariablesTest, LayoutQualifiersDeclaredInGlobal) { … } // Test that shader storage block can be used with one or more memory qualifiers. TEST_F(BufferVariablesTest, ShaderStorageBlockWithMemoryQualifier) { … } // Test that buffer variables can be used with one or more memory qualifiers. TEST_F(BufferVariablesTest, BufferVariablesWithMemoryQualifier) { … } // Test that it is a compile-time error to declare buffer variables at global scope (outside a // block). TEST_F(BufferVariablesTest, DeclareBufferVariableAtGlobal) { … } // Test that the buffer variable can't be opaque type. TEST_F(BufferVariablesTest, BufferVariableWithOpaqueType) { … } // Test that the uniform variable can't be in shader storage block. TEST_F(BufferVariablesTest, UniformVariableInShaderStorageBlock) { … } // Test that buffer qualifier is not supported in verson lower than GLSL ES 3.10. TEST_F(BufferVariablesTest, BufferQualifierInESSL3) { … } // Test that can't assign to a readonly buffer variable. TEST_F(BufferVariablesTest, AssignToReadonlyBufferVariable) { … } // Test that can't assign to a buffer variable declared within shader storage block with readonly. TEST_F(BufferVariablesTest, AssignToBufferVariableWithinReadonlyBlock) { … } // Test that can't assign to a readonly buffer variable through an instance name. TEST_F(BufferVariablesTest, AssignToReadonlyBufferVariableByInstanceName) { … } // Test that can't assign to a readonly struct buffer variable. TEST_F(BufferVariablesTest, AssignToReadonlyStructBufferVariable) { … } // Test that can't assign to a readonly struct buffer variable through an instance name. TEST_F(BufferVariablesTest, AssignToReadonlyStructBufferVariableByInstanceName) { … } // Test that a readonly and writeonly buffer variable should neither read or write. TEST_F(BufferVariablesTest, AccessReadonlyWriteonlyBufferVariable) { … } // Test that accessing a writeonly buffer variable should be error. TEST_F(BufferVariablesTest, AccessWriteonlyBufferVariable) { … } // Test that accessing a buffer variable through an instance name is ok. TEST_F(BufferVariablesTest, AccessReadonlyBufferVariableByInstanceName) { … } // Test that accessing a buffer variable through an instance name inherits the writeonly qualifier // and generates errors. TEST_F(BufferVariablesTest, AccessWriteonlyBufferVariableByInstanceName) { … } // Test that writeonly buffer variable as the argument of a unary operator should be error. TEST_F(BufferVariablesTest, UnaryOperatorWithWriteonlyBufferVariable) { … } // Test that writeonly buffer variable on the left-hand side of compound assignment should be error. TEST_F(BufferVariablesTest, CompoundAssignmentToWriteonlyBufferVariable) { … } // Test that writeonly buffer variable as ternary op argument should be error. TEST_F(BufferVariablesTest, TernarySelectionWithWriteonlyBufferVariable) { … } // Test that writeonly buffer variable as array constructor argument should be error. TEST_F(BufferVariablesTest, ArrayConstructorWithWriteonlyBufferVariable) { … } // Test that writeonly buffer variable as structure constructor argument should be error. TEST_F(BufferVariablesTest, StructureConstructorWithWriteonlyBufferVariable) { … } // Test that writeonly buffer variable as built-in function argument should be error. TEST_F(BufferVariablesTest, BuildInFunctionWithWriteonlyBufferVariable) { … } // Test that readonly buffer variable as user-defined function in argument should be ok. TEST_F(BufferVariablesTest, UserDefinedFunctionWithReadonlyBufferVariableInArgument) { … } // Test that writeonly buffer variable as user-defined function in argument should be error. TEST_F(BufferVariablesTest, UserDefinedFunctionWithWriteonlyBufferVariableInArgument) { … } // Test that writeonly buffer variable as user-defined function out argument should be ok. TEST_F(BufferVariablesTest, UserDefinedFunctionWithWriteonlyBufferVariableOutArgument) { … } // Test that readonly buffer variable as user-defined function out argument should be error. TEST_F(BufferVariablesTest, UserDefinedFunctionWithReadonlyBufferVariableOutArgument) { … } // Test that buffer qualifier can't modify a function parameter. TEST_F(BufferVariablesTest, BufferQualifierOnFunctionParameter) { … } // Test that std430 qualifier is supported for shader storage blocks. TEST_F(BufferVariablesTest, ShaderStorageBlockWithStd430) { … } // Test that using std430 qualifier on a uniform block will fail to compile. TEST_F(BufferVariablesTest, UniformBlockWithStd430) { … } // Test that indexing a runtime-sized array with a positive index compiles. TEST_F(BufferVariablesTest, IndexRuntimeSizedArray) { … } // Test that indexing a runtime-sized array with a negative constant index does not compile. TEST_F(BufferVariablesTest, IndexRuntimeSizedArrayWithNegativeIndex) { … } // Test that only the last member of a buffer can be runtime-sized. TEST_F(BufferVariablesTest, RuntimeSizedVariableInNotLastInBuffer) { … } // Test that memory qualifiers are output. TEST_F(BufferVariablesMatchTest, MemoryQualifiers) { … }