// // Copyright 2020 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. // // ClipDistanceTest.cpp: Test cases for // GL_APPLE_clip_distance / GL_EXT_clip_cull_distance / GL_ANGLE_clip_cull_distance extensions. // #include "test_utils/ANGLETest.h" #include "test_utils/gl_raii.h" #include "util/EGLWindow.h" #include "util/test_utils.h" usingnamespaceangle; class ClipDistanceAPPLETest : public ANGLETest<> { … }; // Query max clip distances and enable, disable states of clip distances TEST_P(ClipDistanceAPPLETest, StateQuery) { … } // Check that gl_ClipDistance is not defined for fragment shaders TEST_P(ClipDistanceAPPLETest, FragmentShader) { … } // Check that gl_ClipDistance cannot be redeclared as a global TEST_P(ClipDistanceAPPLETest, NotVarying) { … } // Check that gl_ClipDistance size cannot be undefined TEST_P(ClipDistanceAPPLETest, UndefinedArraySize) { … } // Check that gl_ClipDistance size cannot be more than maximum TEST_P(ClipDistanceAPPLETest, OutOfRangeArraySize) { … } // Write to one gl_ClipDistance element TEST_P(ClipDistanceAPPLETest, OneClipDistance) { … } // Write to each gl_ClipDistance element TEST_P(ClipDistanceAPPLETest, EachClipDistance) { … } // Use 8 clip distances to draw an octagon TEST_P(ClipDistanceAPPLETest, Octagon) { … } // Write to 3 clip distances TEST_P(ClipDistanceAPPLETest, ThreeClipDistances) { … } // Redeclare gl_ClipDistance in shader with explicit size, also use it in a global function // outside main() TEST_P(ClipDistanceAPPLETest, ThreeClipDistancesRedeclared) { … } ClipCullDistanceTestParams; std::string PrintToStringParamName(const ::testing::TestParamInfo<ClipCullDistanceTestParams> &info) { … } class ClipCullDistanceTest : public ANGLETest<ClipCullDistanceTestParams> { … }; // Query max clip distances and enable, disable states of clip distances TEST_P(ClipCullDistanceTest, StateQuery) { … } // Check that gl_ClipDistance and gl_CullDistance sizes cannot be undefined TEST_P(ClipCullDistanceTest, UndefinedArraySize) { … } // Check that shaders with invalid or missing storage qualifiers are rejected TEST_P(ClipCullDistanceTest, StorageQualifiers) { … } // Check that array sizes cannot be more than maximum TEST_P(ClipCullDistanceTest, OutOfRangeArraySize) { … } // Check that shader validation enforces matching array sizes between shader stages TEST_P(ClipCullDistanceTest, SizeCheck) { … } // Check that the sum of clip and cull distance array sizes is valid TEST_P(ClipCullDistanceTest, SizeCheckCombined) { … } // Test that declared but unused built-ins do not cause frontend failures. The internal uniform, // which is used for passing GL state on some platforms, could be removed when built-ins are not // accessed. TEST_P(ClipCullDistanceTest, Unused) { … } // Test that unused gl_ClipDistance does not cause a translator crash TEST_P(ClipCullDistanceTest, UnusedVertexVaryingNoCrash) { … } // Test that unused gl_ClipDistance does not cause a translator crash TEST_P(ClipCullDistanceTest, UnusedFragmentVaryingNoCrash) { … } // Test that length() does not compile for unsized arrays TEST_P(ClipCullDistanceTest, UnsizedArrayLength) { … } // Test that length() returns correct values for sized arrays TEST_P(ClipCullDistanceTest, SizedArrayLength) { … } // Test that pruning clip/cull distance variables does not cause a translator crash TEST_P(ClipCullDistanceTest, Pruned) { … } // Write to one gl_ClipDistance element TEST_P(ClipCullDistanceTest, OneClipDistance) { … } // Write to each gl_ClipDistance element TEST_P(ClipCullDistanceTest, EachClipDistance) { … } // Use 8 clip distances to draw an octagon TEST_P(ClipCullDistanceTest, Octagon) { … } // Write to 3 clip distances TEST_P(ClipCullDistanceTest, ThreeClipDistances) { … } // Redeclare gl_ClipDistance in shader with explicit size, also use it in a global function // outside main() TEST_P(ClipCullDistanceTest, ThreeClipDistancesRedeclared) { … } // Read clip distance varyings in fragment shaders TEST_P(ClipCullDistanceTest, ClipInterpolation) { … } // Write to one gl_CullDistance element TEST_P(ClipCullDistanceTest, OneCullDistance) { … } // Read cull distance varyings in fragment shaders TEST_P(ClipCullDistanceTest, CullInterpolation) { … } // Read both clip and cull distance varyings in fragment shaders TEST_P(ClipCullDistanceTest, ClipCullInterpolation) { … } // Write to 4 clip distances TEST_P(ClipCullDistanceTest, FourClipDistances) { … } // Write to 4 cull distances TEST_P(ClipCullDistanceTest, FourCullDistances) { … } // Verify that EXT_clip_cull_distance works with EXT_geometry_shader TEST_P(ClipCullDistanceTest, ClipDistanceInteractWithGeometryShader) { … } // Verify that EXT_clip_cull_distance works with EXT_geometry_shader TEST_P(ClipCullDistanceTest, CullDistanceInteractWithGeometryShader) { … } ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(…); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(…); ANGLE_INSTANTIATE_TEST_COMBINE_1(…);