Hash :
2ba626dc
Author :
Date :
2019-11-20T17:13:02
Work around dEQP KHR-GLES31 bug with tess/geom support. dEQP was inadvertendly requiring the presence of these extensions to even run the tests. There's a WIP fix to the dEQP tests and this CL implements that fix as a temporary workaround until we can update dEQP. Fixes several tests in KHR-GLES31.core.constant_expressions and KHR-GLES31.core.shader_macros. They now correctly return unsupported. Bug: angleproject:4143 Change-Id: I110beb2f18fd29f8f02b2ab166cfcfcfae80c2c1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1924620 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
/*-------------------------------------------------------------------------
* 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 "deSharedPtr.hpp"
#include "glcShaderMacroTests.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;
shaderTypes.push_back(glu::SHADERTYPE_GEOMETRY);
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