// // 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. // // EXT_blend_func_extended.cpp: // Test for EXT_blend_func_extended_test // #include "tests/test_utils/ShaderExtensionTest.h" namespace { const char EXTBFEPragma[] = …; const char ESSL100_SimpleShader1[] = …; // Shader that tests only the access to gl_MaxDualSourceDrawBuffersEXT. const char ESSL100_MaxDualSourceAccessShader[] = …; // Shader that writes to SecondaryFragData. const char ESSL100_FragDataShader[] = …; // Shader that writes to SecondaryFragColor and SecondaryFragData does not compile. const char ESSL100_ColorAndDataWriteFailureShader1[] = …; // Shader that writes to FragColor and SecondaryFragData does not compile. const char ESSL100_ColorAndDataWriteFailureShader2[] = …; // Shader that writes to FragData and SecondaryFragColor. const char ESSL100_ColorAndDataWriteFailureShader3[] = …; // Dynamic indexing of SecondaryFragData is not allowed in WebGL 2.0. const char ESSL100_IndexSecondaryFragDataWithNonConstantShader[] = …; // In GLSL version 300 es, the gl_MaxDualSourceDrawBuffersEXT is available. const char ESSL300_MaxDualSourceAccessShader[] = …; // In ES 3.0, the locations can be assigned through the API with glBindFragDataLocationIndexedEXT. // It's fine to have a mix of specified and unspecified locations. const char ESSL300_LocationAndUnspecifiedOutputShader[] = …; // It's also fine to leave locations completely unspecified. const char ESSL300_TwoUnspecifiedLocationOutputsShader[] = …; // Shader that is specifies two outputs with the same location but different indexes is valid. const char ESSL300_LocationIndexShader[] = …; // Shader that specifies index layout qualifier but not location fails to compile. const char ESSL300_LocationIndexFailureShader[] = …; // Shader that specifies index layout qualifier multiple times fails to compile. const char ESSL300_DoubleIndexFailureShader[] = …; // Shader that specifies an output with out-of-bounds location // for index 0 when another output uses index 1 is invalid. const char ESSL300_Index0OutOfBoundsFailureShader[] = …; // Shader that specifies an output with out-of-bounds location for index 1 is invalid. const char ESSL300_Index1OutOfBoundsFailureShader[] = …; // Shader that specifies two outputs with the same location // but different indices and different base types is invalid. const char ESSL300_IndexTypeMismatchFailureShader[] = …; // Global index layout qualifier fails. const char ESSL300_GlobalIndexFailureShader[] = …; // Index layout qualifier on a non-output variable fails. const char ESSL300_IndexOnUniformVariableFailureShader[] = …; // Index layout qualifier on a struct fails. const char ESSL300_IndexOnStructFailureShader[] = …; // Index layout qualifier on a struct member fails. const char ESSL300_IndexOnStructFieldFailureShader[] = …; class EXTBlendFuncExtendedTest : public sh::ShaderExtensionTest { … }; // Extension flag is required to compile properly. Expect failure when it is // not present. TEST_P(EXTBlendFuncExtendedTest, CompileFailsWithoutExtension) { … } // Extension directive is required to compile properly. Expect failure when // it is not present. TEST_P(EXTBlendFuncExtendedTest, CompileFailsWithExtensionWithoutPragma) { … } // With extension flag and extension directive, compiling succeeds. // Also test that the extension directive state is reset correctly. TEST_P(EXTBlendFuncExtendedTest, CompileSucceedsWithExtensionAndPragma) { … } // The SL #version 100 shaders that are correct work similarly // in both GL2 and GL3, with and without the version string. INSTANTIATE_TEST_SUITE_P(…); INSTANTIATE_TEST_SUITE_P(…); class EXTBlendFuncExtendedCompileFailureTest : public EXTBlendFuncExtendedTest { … }; TEST_P(EXTBlendFuncExtendedCompileFailureTest, CompileFails) { … } // Incorrect #version 100 shaders fail. INSTANTIATE_TEST_SUITE_P(…); // Correct #version 100 shaders that are incorrect in WebGL 2.0. INSTANTIATE_TEST_SUITE_P(…); // Correct #version 300 es shaders fail in GLES2 context, regardless of version string. INSTANTIATE_TEST_SUITE_P(…); // Correct #version 100 shaders fail when used with #version 300 es. INSTANTIATE_TEST_SUITE_P(…); // Incorrect #version 300 es shaders always fail. INSTANTIATE_TEST_SUITE_P(…); } // namespace