// // Copyright 2018 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. // // BlendFuncExtendedTest // Test EXT_blend_func_extended #include "test_utils/ANGLETest.h" #include "test_utils/gl_raii.h" #include "util/shader_utils.h" #include <algorithm> #include <cmath> #include <fstream> usingnamespaceangle; namespace { // Partial implementation of weight function for GLES 2 blend equation that // is dual-source aware. template <int factor, int index> float Weight(const float /*dst*/[4], const float src[4], const float src1[4]) { … } GLubyte ScaleChannel(float weight) { … } // Implementation of GLES 2 blend equation that is dual-source aware. template <int RGBs, int RGBd, int As, int Ad> void BlendEquationFuncAdd(const float dst[4], const float src[4], const float src1[4], angle::GLColor *result) { … } void CheckPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLint tolerance, const angle::GLColor &color) { … } const GLuint kWidth = …; const GLuint kHeight = …; class EXTBlendFuncExtendedTest : public ANGLETest<> { … }; class EXTBlendFuncExtendedTestES3 : public ANGLETest<> { … }; class EXTBlendFuncExtendedDrawTest : public ANGLETest<> { … }; class EXTBlendFuncExtendedDrawTestES3 : public EXTBlendFuncExtendedDrawTest { … }; class EXTBlendFuncExtendedDrawTestES31 : public EXTBlendFuncExtendedDrawTestES3 { … }; } // namespace // Test EXT_blend_func_extended related gets. TEST_P(EXTBlendFuncExtendedTest, TestMaxDualSourceDrawBuffers) { … } // Test that SRC1 factors limit the number of allowed draw buffers. TEST_P(EXTBlendFuncExtendedTest, MaxDualSourceDrawBuffersError) { … } // Test a shader with EXT_blend_func_extended and gl_SecondaryFragColorEXT. // Outputs to primary color buffer using primary and secondary colors. TEST_P(EXTBlendFuncExtendedDrawTest, FragColor) { … } // Test a shader with EXT_blend_func_extended and EXT_draw_buffers enabled at the same time. TEST_P(EXTBlendFuncExtendedDrawTest, FragColorBroadcast) { … } // Test a shader with EXT_blend_func_extended and gl_FragData. // Outputs to a color buffer using primary and secondary frag data. TEST_P(EXTBlendFuncExtendedDrawTest, FragData) { … } // Test that min/max blending works correctly with SRC1 factors. TEST_P(EXTBlendFuncExtendedDrawTest, MinMax) { … } // Test an ESSL 3.00 shader that uses two fragment outputs with locations specified in the shader. TEST_P(EXTBlendFuncExtendedDrawTestES3, FragmentOutputLocationsInShader) { … } // Test an ESSL 3.00 shader that uses two fragment outputs with locations specified through the API. TEST_P(EXTBlendFuncExtendedDrawTestES3, FragmentOutputLocationsAPI) { … } // Test an ESSL 3.00 shader that uses two fragment outputs, with location for one specified through // the API and location for another being set automatically. TEST_P(EXTBlendFuncExtendedDrawTestES3, FragmentOutputLocationsAPIAndAutomatic) { … } // Test an ESSL 3.00 shader that uses two array fragment outputs with locations // specified in the shader. TEST_P(EXTBlendFuncExtendedDrawTestES3, FragmentArrayOutputLocationsInShader) { … } // Test an ESSL 3.00 shader that uses two array fragment outputs with locations specified through // the API. TEST_P(EXTBlendFuncExtendedDrawTestES3, FragmentArrayOutputLocationsAPI) { … } // Ported from TranslatorVariants/EXTBlendFuncExtendedES3DrawTest // Test that tests glBindFragDataLocationEXT, glBindFragDataLocationIndexedEXT, // glGetFragDataLocation, glGetFragDataIndexEXT work correctly with // GLSL array output variables. The output variable can be bound by // referring to the variable name with or without the first element array // accessor. The getters can query location of the individual elements in // the array. The test does not actually use the base test drawing, // since the drivers at the time of writing do not support multiple // buffers and dual source blending. TEST_P(EXTBlendFuncExtendedDrawTestES3, ES3GettersArray) { … } // Ported from TranslatorVariants/EXTBlendFuncExtendedES3DrawTest TEST_P(EXTBlendFuncExtendedDrawTestES3, ESSL3BindSimpleVarAsArrayNoBind) { … } // Test an ESSL 3.00 program with a link-time fragment output location conflict. TEST_P(EXTBlendFuncExtendedTestES3, FragmentOutputLocationConflict) { … } // Test an ESSL 3.00 program with some bindings set for nonexistent variables. These should not // create link-time conflicts. TEST_P(EXTBlendFuncExtendedTestES3, FragmentOutputLocationForNonexistentOutput) { … } // Test mixing shader-assigned and automatic output locations. TEST_P(EXTBlendFuncExtendedTestES3, FragmentOutputLocationsPartiallyAutomatic) { … } // Test a fragment output array that doesn't fit because contiguous locations are not available. TEST_P(EXTBlendFuncExtendedTestES3, FragmentOutputArrayDoesntFit) { … } // Test that a secondary blending source limits the number of primary outputs. TEST_P(EXTBlendFuncExtendedTestES3, TooManyFragmentOutputsForDualSourceBlending) { … } // Test that fragment outputs bound to the same location must have the same type. TEST_P(EXTBlendFuncExtendedTestES3, InconsistentTypesForLocationAPI) { … } // Test that rendering to multiple fragment outputs bound via API works. TEST_P(EXTBlendFuncExtendedDrawTestES3, MultipleDrawBuffersAPI) { … } // Use a program pipeline with EXT_blend_func_extended TEST_P(EXTBlendFuncExtendedDrawTestES31, UseProgramPipeline) { … } // Use program pipeline where the fragment program is changed TEST_P(EXTBlendFuncExtendedDrawTestES31, UseTwoProgramStages) { … } ANGLE_INSTANTIATE_TEST_ES2(…); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(…); ANGLE_INSTANTIATE_TEST_ES3_AND_ES31(…); ANGLE_INSTANTIATE_TEST_ES2(…); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(…); ANGLE_INSTANTIATE_TEST_ES3_AND_ES31(…); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(…); ANGLE_INSTANTIATE_TEST_ES31(…);