xref: /aosp_15_r20/external/deqp/framework/opengl/gluDummyRenderContext.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 #ifndef _GLUDUMMYRENDERCONTEXT_HPP
2 #define _GLUDUMMYRENDERCONTEXT_HPP
3 /*-------------------------------------------------------------------------
4  * drawElements Quality Program OpenGL ES Utilities
5  * ------------------------------------------------
6  *
7  * Copyright 2014 The Android Open Source Project
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  *//*!
22  * \file
23  * \brief A RenderContext representing absence of a real render context.
24  *
25  * \todo Remove this when the need for a render context in test case
26  *         constructors no longer exists.
27  *//*--------------------------------------------------------------------*/
28 
29 #include "tcuDefs.hpp"
30 #include "gluRenderContext.hpp"
31 #include "tcuRenderTarget.hpp"
32 #include "glwFunctions.hpp"
33 
34 namespace glu
35 {
36 
37 /*--------------------------------------------------------------------*//*!
38  * \brief RenderContext that can be used when no render context is present.
39  *
40  * Some patterns (e.g. a test class inheriting from glu::CallLogWrapper)
41  * currently depend on having access to the glw::Functions already in test
42  * case constructor; in such situations there may not be a proper render
43  * context available (like in test case list dumping mode). This is a
44  * simple workaround for that: a empty render context with a glw::Functions
45  * containing just null pointers.
46  *//*--------------------------------------------------------------------*/
47 class EmptyRenderContext : public RenderContext
48 {
49 public:
EmptyRenderContext(ContextType ctxType=ContextType ())50     explicit EmptyRenderContext(ContextType ctxType = ContextType()) : m_ctxType(ctxType)
51     {
52     }
53 
getType(void) const54     virtual ContextType getType(void) const
55     {
56         return m_ctxType;
57     }
getFunctions(void) const58     virtual const glw::Functions &getFunctions(void) const
59     {
60         return m_functions;
61     }
getRenderTarget(void) const62     virtual const tcu::RenderTarget &getRenderTarget(void) const
63     {
64         return m_renderTarget;
65     }
postIterate(void)66     virtual void postIterate(void)
67     {
68     }
69 
70 private:
71     const ContextType m_ctxType;
72     tcu::RenderTarget m_renderTarget;
73     glw::Functions m_functions;
74 };
75 
76 } // namespace glu
77 
78 #endif // _GLUDUMMYRENDERCONTEXT_HPP
79