Path: blob/main_old/src/tests/compiler_tests/EXT_frag_depth_test.cpp
1693 views
//1// Copyright 2018 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//5// EXT_frag_depth_test.cpp:6// Test for EXT_frag_depth7//89#include "tests/test_utils/ShaderExtensionTest.h"1011using EXTFragDepthTest = sh::ShaderExtensionTest;1213namespace14{15const char EXTPragma[] = "#extension GL_EXT_frag_depth : require\n";1617// Shader setting gl_FragDepthEXT18const char ESSL100_FragDepthShader[] =1920R"(21precision mediump float;2223void main()24{25gl_FragDepthEXT = 1.0;26})";2728// Extension flag is required to compile properly. Expect failure when it is29// not present.30TEST_P(EXTFragDepthTest, CompileFailsWithoutExtension)31{32mResources.EXT_frag_depth = 0;33InitializeCompiler();34EXPECT_FALSE(TestShaderCompile(EXTPragma));35}3637// Extension directive is required to compile properly. Expect failure when38// it is not present.39TEST_P(EXTFragDepthTest, CompileFailsWithExtensionWithoutPragma)40{41mResources.EXT_frag_depth = 1;42InitializeCompiler();43EXPECT_FALSE(TestShaderCompile(""));44}4546// With extension flag and extension directive, compiling succeeds.47// Also test that the extension directive state is reset correctly.48TEST_P(EXTFragDepthTest, CompileSucceedsWithExtensionAndPragma)49{50mResources.EXT_frag_depth = 1;51InitializeCompiler();52EXPECT_TRUE(TestShaderCompile(EXTPragma));53// Test reset functionality.54EXPECT_FALSE(TestShaderCompile(""));55EXPECT_TRUE(TestShaderCompile(EXTPragma));56}5758// The SL #version 100 shaders that are correct work similarly59// in both GL2 and GL3, with and without the version string.60INSTANTIATE_TEST_SUITE_P(CorrectESSL100Shaders,61EXTFragDepthTest,62Combine(Values(SH_GLES2_SPEC),63Values(sh::ESSLVersion100),64Values(ESSL100_FragDepthShader)));6566} // anonymous namespace676869