// // 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. // // APPLE_clip_distance_test.cpp: // Test for APPLE_clip_distance // #include "tests/test_utils/ShaderExtensionTest.h" namespace { const char EXTPragma[] = …; // Shader using gl_ClipDistance const char ESSL100_APPLEClipDistanceShader1[] = …; // Shader redeclares gl_ClipDistance const char ESSL100_APPLEClipDistanceShader2[] = …; // ESSL 3.00 Shader using gl_ClipDistance const char ESSL300_APPLEClipDistanceShader1[] = …; // ESSL 3.00 Shader redeclares gl_ClipDistance const char ESSL300_APPLEClipDistanceShader2[] = …; class APPLEClipDistanceTest : public sh::ShaderExtensionTest { … }; // Extension flag is required to compile properly. Expect failure when it is // not present. TEST_P(APPLEClipDistanceTest, CompileFailsWithoutExtension) { … } // Extension directive is required to compile properly. Expect failure when // it is not present. TEST_P(APPLEClipDistanceTest, CompileFailsWithExtensionWithoutPragma) { … } // With extension flag and extension directive, compiling succeeds. // Also test that the extension directive state is reset correctly. TEST_P(APPLEClipDistanceTest, CompileSucceedsWithExtensionAndPragma) { … } #if defined(ANGLE_ENABLE_VULKAN) // With extension flag and extension directive, compiling using TranslatorVulkan succeeds. TEST_P(APPLEClipDistanceTest, CompileSucceedsVulkan) { … } // Test that the SPIR-V gen path can compile a shader when this extension is not supported. TEST_P(APPLEClipDistanceTest, CompileSucceedsWithoutExtSupportVulkan) { … } #endif #if defined(ANGLE_ENABLE_METAL) // With extension flag and extension directive, compiling using TranslatorMSL succeeds. TEST_P(APPLEClipDistanceTest, CompileSucceedsMetal) { mResources.APPLE_clip_distance = 1; mResources.MaxClipDistances = 8; InitializeCompiler(SH_MSL_METAL_OUTPUT); EXPECT_TRUE(TestShaderCompile(EXTPragma)); } #endif // 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(…); } // anonymous namespace