Test if GL_FRAGMENT_PRECISION_HIGH is exposed
authorPiotr Byszewski <piotr.byszewski@mobica.com>
Thu, 14 Sep 2017 09:34:18 +0000 (11:34 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 13 Oct 2017 15:00:37 +0000 (11:00 -0400)
GL_FRAGMENT_PRECISION_HIGH macro should be exposed in all ES shaders
from version 300 es onwards, as well as in version 100.

Components: OpenGL

VK-GL-CTS issue: 11

Affects:
KHR-GLES3.core.shader_macros.*
KHR-GLES31.core.shader_macros.*
KHR-GLES32.core.shader_macros.*

Change-Id: I8612a5ebe2c565405ae27319d821a0d6cae4fa52

external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles3-khr-master.txt
external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles31-khr-master.txt
external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles32-khr-master.txt
external/openglcts/modules/common/CMakeLists.txt
external/openglcts/modules/common/glcShaderMacroTests.cpp [new file with mode: 0644]
external/openglcts/modules/common/glcShaderMacroTests.hpp [new file with mode: 0644]
external/openglcts/modules/gles3/es3cTestPackage.cpp
external/openglcts/modules/gles31/es31cTestPackage.cpp
external/openglcts/modules/gles32/es32cTestPackage.cpp

index 0e2e637..c1af7e4 100644 (file)
@@ -3217,6 +3217,8 @@ KHR-GLES3.core.constant_expressions.array_normalize_vec3_vertex
 KHR-GLES3.core.constant_expressions.array_normalize_vec3_fragment
 KHR-GLES3.core.constant_expressions.array_normalize_vec4_vertex
 KHR-GLES3.core.constant_expressions.array_normalize_vec4_fragment
+KHR-GLES3.core.shader_macros.fragment_precision_high_vertex
+KHR-GLES3.core.shader_macros.fragment_precision_high_fragment
 KHR-GLES3.parallel_shader_compile.simple_queries
 KHR-GLES3.parallel_shader_compile.max_shader_compile_threads
 KHR-GLES3.parallel_shader_compile.compilation_completion_non_parallel
index 064f582..d2e2c87 100644 (file)
@@ -1831,6 +1831,11 @@ KHR-GLES31.core.vertex_attrib_binding.negative-bindVertexBuffer
 KHR-GLES31.core.vertex_attrib_binding.negative-vertexAttribFormat
 KHR-GLES31.core.vertex_attrib_binding.negative-vertexAttribBinding
 KHR-GLES31.core.vertex_attrib_binding.negative-vertexAttribDivisor
+KHR-GLES31.core.shader_macros.fragment_precision_high_vertex
+KHR-GLES31.core.shader_macros.fragment_precision_high_fragment
+KHR-GLES31.core.shader_macros.fragment_precision_high_geometry
+KHR-GLES31.core.shader_macros.fragment_precision_high_tess_control
+KHR-GLES31.core.shader_macros.fragment_precision_high_tess_eval
 KHR-GLES31.core.shader_storage_buffer_object.basic-basic-vs
 KHR-GLES31.core.shader_storage_buffer_object.basic-basic-cs
 KHR-GLES31.core.shader_storage_buffer_object.basic-max
index faaabc9..155ff27 100644 (file)
@@ -1007,6 +1007,11 @@ KHR-GLES32.core.constant_expressions.array_normalize_vec3_tess_eval
 KHR-GLES32.core.constant_expressions.array_normalize_vec4_geometry
 KHR-GLES32.core.constant_expressions.array_normalize_vec4_tess_control
 KHR-GLES32.core.constant_expressions.array_normalize_vec4_tess_eval
+KHR-GLES32.core.shader_macros.fragment_precision_high_vertex
+KHR-GLES32.core.shader_macros.fragment_precision_high_fragment
+KHR-GLES32.core.shader_macros.fragment_precision_high_geometry
+KHR-GLES32.core.shader_macros.fragment_precision_high_tess_control
+KHR-GLES32.core.shader_macros.fragment_precision_high_tess_eval
 KHR-GLES32.core.separable_programs_tf.tessellation_active
 KHR-GLES32.core.separable_programs_tf.geometry_active
 KHR-GLES32.robust.robust_buffer_access_behavior.vertex_buffer_objects
index 6267960..089dc69 100644 (file)
@@ -62,6 +62,8 @@ set(GLCTS_COMMON_SRCS
        glcShaderLoopTests.hpp
        glcShaderNegativeTests.hpp
        glcShaderNegativeTests.cpp
+       glcShaderMacroTests.cpp
+       glcShaderMacroTests.hpp
        glcShaderMultisampleInterpolationTests.cpp
        glcShaderMultisampleInterpolationTests.hpp
        glcShaderRenderCase.cpp
diff --git a/external/openglcts/modules/common/glcShaderMacroTests.cpp b/external/openglcts/modules/common/glcShaderMacroTests.cpp
new file mode 100644 (file)
index 0000000..30b1cce
--- /dev/null
@@ -0,0 +1,153 @@
+/*-------------------------------------------------------------------------
+ * OpenGL Conformance Test Suite
+ * -----------------------------
+ *
+ * Copyright (c) 2017 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */ /*!
+ * \file
+ * \brief
+ */ /*-------------------------------------------------------------------*/
+
+#include "glcShaderMacroTests.hpp"
+#include "deSharedPtr.hpp"
+#include "glsShaderExecUtil.hpp"
+#include "gluContextInfo.hpp"
+#include "tcuTestLog.hpp"
+
+namespace glcts
+{
+
+using tcu::TestLog;
+using namespace deqp::gls::ShaderExecUtil;
+
+class ExecutorTestCase : public deqp::TestCase
+{
+public:
+       ExecutorTestCase(deqp::Context& context, const char* name, glu::ShaderType shaderType, const ShaderSpec& shaderSpec,
+                                        int expectedOutput);
+       virtual ~ExecutorTestCase(void);
+       virtual tcu::TestNode::IterateResult iterate(void);
+
+protected:
+       glu::ShaderType m_shaderType;
+       ShaderSpec              m_shaderSpec;
+       int                             m_expectedOutput;
+};
+
+ExecutorTestCase::ExecutorTestCase(deqp::Context& context, const char* name, glu::ShaderType shaderType,
+                                                                  const ShaderSpec& shaderSpec, int expectedOutput)
+       : deqp::TestCase(context, name, "")
+       , m_shaderType(shaderType)
+       , m_shaderSpec(shaderSpec)
+       , m_expectedOutput(expectedOutput)
+{
+}
+
+ExecutorTestCase::~ExecutorTestCase(void)
+{
+}
+
+tcu::TestNode::IterateResult ExecutorTestCase::iterate(void)
+{
+       de::SharedPtr<ShaderExecutor> executor(createExecutor(m_context.getRenderContext(), m_shaderType, m_shaderSpec));
+
+       DE_ASSERT(executor.get());
+
+       executor->log(m_context.getTestContext().getLog());
+
+       if (!executor->isOk())
+               TCU_FAIL("Compilation failed");
+
+       executor->useProgram();
+
+       int                     result  = 0;
+       void* const outputs = &result;
+       executor->execute(1, DE_NULL, &outputs);
+
+       if (m_expectedOutput == result)
+       {
+               m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+               return tcu::TestNode::STOP;
+       }
+
+       m_context.getTestContext().getLog() << tcu::TestLog::Message << "Expected: " << m_expectedOutput
+                                                                               << " but test returned: " << result << tcu::TestLog::EndMessage;
+       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
+
+       return tcu::TestNode::STOP;
+}
+
+ShaderMacroTests::ShaderMacroTests(deqp::Context& context)
+       : TestCaseGroup(context, "shader_macros", "Shader Macro tests")
+{
+}
+
+ShaderMacroTests::~ShaderMacroTests()
+{
+}
+
+void ShaderMacroTests::init(void)
+{
+       const char* fragmentPrecisionShaderTemplate = "out0 = 0;\n"
+                                                                                                 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
+                                                                                                 "out0 = 1;\n"
+                                                                                                 "#endif\n";
+
+       glu::ContextType contextType = m_context.getRenderContext().getType();
+
+       ShaderSpec shaderSpec;
+       shaderSpec.version = glu::getContextTypeGLSLVersion(contextType);
+       shaderSpec.source  = fragmentPrecisionShaderTemplate;
+       shaderSpec.outputs.push_back(Symbol("out0", glu::VarType(glu::TYPE_INT, glu::PRECISION_HIGHP)));
+
+       std::vector<glu::ShaderType> shaderTypes;
+       shaderTypes.push_back(glu::SHADERTYPE_VERTEX);
+       shaderTypes.push_back(glu::SHADERTYPE_FRAGMENT);
+
+       if (glu::contextSupports(contextType, glu::ApiType::es(3, 2)))
+       {
+               shaderSpec.version = glu::GLSL_VERSION_320_ES;
+               shaderTypes.push_back(glu::SHADERTYPE_GEOMETRY);
+               shaderTypes.push_back(glu::SHADERTYPE_TESSELLATION_CONTROL);
+               shaderTypes.push_back(glu::SHADERTYPE_TESSELLATION_EVALUATION);
+       }
+       else if (glu::contextSupports(contextType, glu::ApiType::es(3, 1)))
+       {
+               shaderSpec.version = glu::GLSL_VERSION_310_ES;
+               if (m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader") ||
+                       m_context.getContextInfo().isExtensionSupported("GL_OES_geometry_shader"))
+               {
+                       shaderTypes.push_back(glu::SHADERTYPE_GEOMETRY);
+               }
+
+               if (m_context.getContextInfo().isExtensionSupported("GL_EXT_tessellation_shader") ||
+                       m_context.getContextInfo().isExtensionSupported("GL_OES_tessellation_shader"))
+               {
+                       shaderTypes.push_back(glu::SHADERTYPE_TESSELLATION_CONTROL);
+                       shaderTypes.push_back(glu::SHADERTYPE_TESSELLATION_EVALUATION);
+               }
+       }
+
+       for (std::size_t typeIndex = 0; typeIndex < shaderTypes.size(); ++typeIndex)
+       {
+               glu::ShaderType shaderType = shaderTypes[typeIndex];
+               std::string             caseName("fragment_precision_high_");
+               caseName += getShaderTypeName(shaderType);
+               addChild(new ExecutorTestCase(m_context, caseName.c_str(), shaderType, shaderSpec, 1));
+       }
+}
+
+} // namespace glcts
diff --git a/external/openglcts/modules/common/glcShaderMacroTests.hpp b/external/openglcts/modules/common/glcShaderMacroTests.hpp
new file mode 100644 (file)
index 0000000..891b2df
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef _GLCSHADERMACROTESTS_HPP
+#define _GLCSHADERMACROTESTS_HPP
+/*-------------------------------------------------------------------------
+ * OpenGL Conformance Test Suite
+ * -----------------------------
+ *
+ * Copyright (c) 2017 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */ /*!
+ * \file
+ * \brief
+ */ /*-------------------------------------------------------------------*/
+
+#include "glcTestCase.hpp"
+#include "gluShaderUtil.hpp"
+#include "tcuDefs.hpp"
+
+namespace glcts
+{
+
+class ShaderMacroTests : public TestCaseGroup
+{
+public:
+       ShaderMacroTests(deqp::Context& context);
+       ~ShaderMacroTests();
+
+       void init(void);
+};
+
+} // namespace glcts
+
+#endif // _GLCSHADERMACROTESTS_HPP
index b14d428..4a0dd51 100644 (file)
@@ -32,6 +32,7 @@
 #include "glcShaderIntegerMixTests.hpp"
 #include "glcShaderLibrary.hpp"
 #include "glcShaderLoopTests.hpp"
+#include "glcShaderMacroTests.hpp"
 #include "glcShaderNegativeTests.hpp"
 #include "glcShaderStructTests.hpp"
 #include "glcShaderSwitchTests.hpp"
@@ -165,6 +166,7 @@ void ES30TestPackage::init(void)
                addChild(new glcts::ExposedExtensionsTests(getContext()));
                tcu::TestCaseGroup* coreGroup = new tcu::TestCaseGroup(getTestContext(), "core", "core tests");
                coreGroup->addChild(new glcts::ShaderConstExprTests(getContext()));
+               coreGroup->addChild(new glcts::ShaderMacroTests(getContext()));
                addChild(coreGroup);
                addChild(new glcts::ParallelShaderCompileTests(getContext()));
        }
index 24325a1..9ac46f3 100644 (file)
@@ -49,6 +49,7 @@
 #include "glcShaderConstExprTests.hpp"
 #include "glcShaderGroupVoteTests.hpp"
 #include "glcShaderIntegerMixTests.hpp"
+#include "glcShaderMacroTests.hpp"
 #include "glcShaderMultisampleInterpolationTests.hpp"
 #include "glcShaderNegativeTests.hpp"
 
@@ -182,6 +183,7 @@ void ES31TestPackage::init(void)
                coreGroup->addChild(new glcts::ShaderConstExprTests(getContext()));
                coreGroup->addChild(new glcts::BlendEquationAdvancedTests(getContext(), glu::GLSL_VERSION_310_ES));
                coreGroup->addChild(new glcts::VertexAttribBindingTests(getContext()));
+               coreGroup->addChild(new glcts::ShaderMacroTests(getContext()));
                coreGroup->addChild(new glcts::ShaderStorageBufferObjectTests(getContext()));
                coreGroup->addChild(new glcts::ComputeShaderTests(getContext()));
                coreGroup->addChild(new glcts::ShaderImageLoadStoreTests(getContext()));
index 2a9a5a9..95bcf97 100644 (file)
@@ -33,6 +33,7 @@
 #include "glcShaderIntegerMixTests.hpp"
 #include "glcShaderLibrary.hpp"
 #include "glcShaderLoopTests.hpp"
+#include "glcShaderMacroTests.hpp"
 #include "glcShaderNegativeTests.hpp"
 #include "glcShaderStructTests.hpp"
 #include "glcShaderSwitchTests.hpp"
@@ -157,6 +158,7 @@ void ES32TestPackage::init(void)
                coreGroup->addChild(new glcts::TextureBufferTests(getContext(), extParams));
                coreGroup->addChild(new glcts::DrawBuffersIndexedTests(getContext(), extParams));
                coreGroup->addChild(new glcts::ShaderConstExprTests(getContext()));
+               coreGroup->addChild(new glcts::ShaderMacroTests(getContext()));
                coreGroup->addChild(new glcts::SeparableProgramsTransformFeedbackTests(getContext()));
                addChild(coreGroup);
                tcu::TestCaseGroup* robustGroup = new tcu::TestCaseGroup(getTestContext(), "robust", "");