xref: /aosp_15_r20/external/deqp/modules/gles31/functional/es31fNegativeTestShared.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1*35238bceSAndroid Build Coastguard Worker #ifndef _ES31FNEGATIVETESTSHARED_HPP
2*35238bceSAndroid Build Coastguard Worker #define _ES31FNEGATIVETESTSHARED_HPP
3*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
4*35238bceSAndroid Build Coastguard Worker  * drawElements Quality Program OpenGL ES 3.1 Module
5*35238bceSAndroid Build Coastguard Worker  * -------------------------------------------------
6*35238bceSAndroid Build Coastguard Worker  *
7*35238bceSAndroid Build Coastguard Worker  * Copyright 2014 The Android Open Source Project
8*35238bceSAndroid Build Coastguard Worker  *
9*35238bceSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
10*35238bceSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
11*35238bceSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
12*35238bceSAndroid Build Coastguard Worker  *
13*35238bceSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
14*35238bceSAndroid Build Coastguard Worker  *
15*35238bceSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
16*35238bceSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
17*35238bceSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18*35238bceSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
19*35238bceSAndroid Build Coastguard Worker  * limitations under the License.
20*35238bceSAndroid Build Coastguard Worker  *
21*35238bceSAndroid Build Coastguard Worker  *//*!
22*35238bceSAndroid Build Coastguard Worker  * \file
23*35238bceSAndroid Build Coastguard Worker  * \brief Shared structures for ES 3.1 negative API tests
24*35238bceSAndroid Build Coastguard Worker  *//*--------------------------------------------------------------------*/
25*35238bceSAndroid Build Coastguard Worker 
26*35238bceSAndroid Build Coastguard Worker #include "tcuDefs.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "glwDefs.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "gluCallLogWrapper.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "gluShaderUtil.hpp"
30*35238bceSAndroid Build Coastguard Worker #include "tes31TestCase.hpp"
31*35238bceSAndroid Build Coastguard Worker 
32*35238bceSAndroid Build Coastguard Worker namespace tcu
33*35238bceSAndroid Build Coastguard Worker {
34*35238bceSAndroid Build Coastguard Worker 
35*35238bceSAndroid Build Coastguard Worker class ResultCollector;
36*35238bceSAndroid Build Coastguard Worker 
37*35238bceSAndroid Build Coastguard Worker } // namespace tcu
38*35238bceSAndroid Build Coastguard Worker 
39*35238bceSAndroid Build Coastguard Worker namespace deqp
40*35238bceSAndroid Build Coastguard Worker {
41*35238bceSAndroid Build Coastguard Worker namespace gles31
42*35238bceSAndroid Build Coastguard Worker {
43*35238bceSAndroid Build Coastguard Worker namespace Functional
44*35238bceSAndroid Build Coastguard Worker {
45*35238bceSAndroid Build Coastguard Worker namespace NegativeTestShared
46*35238bceSAndroid Build Coastguard Worker {
47*35238bceSAndroid Build Coastguard Worker 
48*35238bceSAndroid Build Coastguard Worker class ErrorCase : public TestCase
49*35238bceSAndroid Build Coastguard Worker {
50*35238bceSAndroid Build Coastguard Worker public:
51*35238bceSAndroid Build Coastguard Worker     ErrorCase(Context &ctx, const char *name, const char *desc);
~ErrorCase(void)52*35238bceSAndroid Build Coastguard Worker     virtual ~ErrorCase(void)
53*35238bceSAndroid Build Coastguard Worker     {
54*35238bceSAndroid Build Coastguard Worker     }
55*35238bceSAndroid Build Coastguard Worker 
56*35238bceSAndroid Build Coastguard Worker     virtual void expectError(glw::GLenum error0, glw::GLenum error1) = 0;
57*35238bceSAndroid Build Coastguard Worker };
58*35238bceSAndroid Build Coastguard Worker 
59*35238bceSAndroid Build Coastguard Worker class NegativeTestContext : public glu::CallLogWrapper
60*35238bceSAndroid Build Coastguard Worker {
61*35238bceSAndroid Build Coastguard Worker public:
62*35238bceSAndroid Build Coastguard Worker     NegativeTestContext(ErrorCase &host, glu::RenderContext &renderCtx, const glu::ContextInfo &ctxInfo,
63*35238bceSAndroid Build Coastguard Worker                         tcu::TestLog &log, tcu::ResultCollector &results, bool enableLog);
64*35238bceSAndroid Build Coastguard Worker     ~NegativeTestContext();
65*35238bceSAndroid Build Coastguard Worker 
66*35238bceSAndroid Build Coastguard Worker     const tcu::ResultCollector &getResults(void) const;
67*35238bceSAndroid Build Coastguard Worker 
68*35238bceSAndroid Build Coastguard Worker     void fail(const std::string &msg);
69*35238bceSAndroid Build Coastguard Worker     int getInteger(glw::GLenum pname) const;
getRenderContext(void) const70*35238bceSAndroid Build Coastguard Worker     const glu::RenderContext &getRenderContext(void) const
71*35238bceSAndroid Build Coastguard Worker     {
72*35238bceSAndroid Build Coastguard Worker         return m_renderCtx;
73*35238bceSAndroid Build Coastguard Worker     }
getContextInfo(void) const74*35238bceSAndroid Build Coastguard Worker     const glu::ContextInfo &getContextInfo(void) const
75*35238bceSAndroid Build Coastguard Worker     {
76*35238bceSAndroid Build Coastguard Worker         return m_ctxInfo;
77*35238bceSAndroid Build Coastguard Worker     }
78*35238bceSAndroid Build Coastguard Worker     void beginSection(const std::string &desc);
79*35238bceSAndroid Build Coastguard Worker     void endSection(void);
80*35238bceSAndroid Build Coastguard Worker 
81*35238bceSAndroid Build Coastguard Worker     void expectError(glw::GLenum error);
82*35238bceSAndroid Build Coastguard Worker     void expectError(glw::GLenum error0, glw::GLenum error1);
83*35238bceSAndroid Build Coastguard Worker     bool isShaderSupported(glu::ShaderType shaderType);
84*35238bceSAndroid Build Coastguard Worker     bool isExtensionSupported(std::string extension);
85*35238bceSAndroid Build Coastguard Worker 
86*35238bceSAndroid Build Coastguard Worker protected:
87*35238bceSAndroid Build Coastguard Worker     ErrorCase &m_host;
88*35238bceSAndroid Build Coastguard Worker 
89*35238bceSAndroid Build Coastguard Worker private:
90*35238bceSAndroid Build Coastguard Worker     glu::RenderContext &m_renderCtx;
91*35238bceSAndroid Build Coastguard Worker     const glu::ContextInfo &m_ctxInfo;
92*35238bceSAndroid Build Coastguard Worker     tcu::ResultCollector &m_results;
93*35238bceSAndroid Build Coastguard Worker     int m_openSections;
94*35238bceSAndroid Build Coastguard Worker };
95*35238bceSAndroid Build Coastguard Worker 
96*35238bceSAndroid Build Coastguard Worker typedef void (*TestFunc)(NegativeTestContext &ctx);
97*35238bceSAndroid Build Coastguard Worker 
98*35238bceSAndroid Build Coastguard Worker struct FunctionContainer
99*35238bceSAndroid Build Coastguard Worker {
100*35238bceSAndroid Build Coastguard Worker     TestFunc function;
101*35238bceSAndroid Build Coastguard Worker     const char *name;
102*35238bceSAndroid Build Coastguard Worker     const char *desc;
103*35238bceSAndroid Build Coastguard Worker };
104*35238bceSAndroid Build Coastguard Worker 
105*35238bceSAndroid Build Coastguard Worker } // namespace NegativeTestShared
106*35238bceSAndroid Build Coastguard Worker } // namespace Functional
107*35238bceSAndroid Build Coastguard Worker } // namespace gles31
108*35238bceSAndroid Build Coastguard Worker } // namespace deqp
109*35238bceSAndroid Build Coastguard Worker 
110*35238bceSAndroid Build Coastguard Worker #endif // _ES31FNEGATIVETESTSHARED_HPP
111