1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.1 Module
3 * -------------------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief Shared structures for ES 3.1 negative API tests
22 *//*--------------------------------------------------------------------*/
24 #include "es31fNegativeTestShared.hpp"
26 #include "tcuResultCollector.hpp"
28 #include "gluContextInfo.hpp"
29 #include "gluRenderContext.hpp"
30 #include "glwFunctions.hpp"
38 namespace NegativeTestShared
45 ErrorCase::ErrorCase (Context& ctx, const char* name, const char* desc)
46 : TestCase(ctx, name, desc)
50 NegativeTestContext::NegativeTestContext (ErrorCase& host,
51 glu::RenderContext& renderCtx,
52 const glu::ContextInfo& ctxInfo,
54 tcu::ResultCollector& results,
56 : glu::CallLogWrapper (renderCtx.getFunctions(), log)
58 , m_renderCtx (renderCtx)
63 enableLogging(enableLogging_);
66 NegativeTestContext::~NegativeTestContext ()
68 while (m_openSections--)
69 getLog() << TestLog::EndSection;
72 void NegativeTestContext::fail (const string& msg)
74 m_results.addResult(QP_TEST_RESULT_FAIL, msg);
77 int NegativeTestContext::getInteger (GLenum pname) const
80 m_renderCtx.getFunctions().getIntegerv(pname, &retval);
84 void NegativeTestContext::beginSection (const string& desc)
86 if (isLoggingEnabled())
88 getLog() << TestLog::Section("callstream", desc);
93 void NegativeTestContext::endSection (void)
95 if (isLoggingEnabled())
97 DE_ASSERT (m_openSections > 0);
98 getLog() << TestLog::EndSection;
103 void NegativeTestContext::expectError (GLenum error)
105 m_host.expectError(error, error);
108 void NegativeTestContext::expectError (GLenum error0, GLenum error1)
110 m_host.expectError(error0, error1);
113 bool NegativeTestContext::isShaderSupported (glu::ShaderType shaderType)
115 if (contextSupports(getRenderContext().getType(), glu::ApiType::es(3, 2)))
120 case glu::SHADERTYPE_GEOMETRY:
121 return getContextInfo().isExtensionSupported("GL_EXT_geometry_shader");
122 case glu::SHADERTYPE_TESSELLATION_CONTROL:
123 case glu::SHADERTYPE_TESSELLATION_EVALUATION:
124 return getContextInfo().isExtensionSupported("GL_EXT_tessellation_shader");
130 bool NegativeTestContext::isExtensionSupported (std::string extension)
132 return getContextInfo().isExtensionSupported(extension.c_str());
135 } // NegativeTestShared