a76aa2c553eae6be833240caad7c8d3cf52f1b82
[platform/upstream/VK-GL-CTS.git] / framework / opengl / gluDummyRenderContext.hpp
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 dummy render context with a glw::Functions
45  * containing just null pointers.
46  *//*--------------------------------------------------------------------*/
47 class DummyRenderContext : public RenderContext
48 {
49 public:
50         explicit                                                        DummyRenderContext      (ContextType ctxType = ContextType()) : m_ctxType(ctxType) {}
51
52         virtual ContextType                                     getType                         (void) const { return m_ctxType;                                }
53         virtual const glw::Functions&           getFunctions            (void) const { return m_functions;                              }
54         virtual const tcu::RenderTarget&        getRenderTarget         (void) const { return m_renderTarget;                   }
55         virtual void                                            postIterate                     (void) {}
56
57 private:
58         const ContextType                                       m_ctxType;
59         tcu::RenderTarget                                       m_renderTarget;
60         glw::Functions                                          m_functions;
61 };
62
63 } // glu
64
65 #endif // _GLUDUMMYRENDERCONTEXT_HPP