Add multiple contexts tests
[platform/upstream/VK-GL-CTS.git] / external / openglcts / modules / common / glcContext.hpp
1 #ifndef _GLCCONTEXT_HPP
2 #define _GLCCONTEXT_HPP
3 /*-------------------------------------------------------------------------
4  * OpenGL Conformance Test Suite
5  * -----------------------------
6  *
7  * Copyright (c) 2016 Google Inc.
8  * Copyright (c) 2016 The Khronos Group Inc.
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  *      http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */ /*!
23  * \file
24  * \brief OpenGL context.
25  */ /*-------------------------------------------------------------------*/
26
27 #include "gluRenderConfig.hpp"
28 #include "gluRenderContext.hpp"
29 #include "tcuDefs.hpp"
30 #include "tcuTestContext.hpp"
31
32 namespace glu
33 {
34 class RenderContext;
35 class ContextInfo;
36 }
37
38 namespace tcu
39 {
40 class RenderTarget;
41 }
42
43 namespace deqp
44 {
45
46 class Context
47 {
48 public:
49         Context(tcu::TestContext& testCtx, glu::ContextType contextType = glu::ContextType());
50         ~Context(void);
51
52         tcu::TestContext& getTestContext(void)
53         {
54                 return m_testCtx;
55         }
56
57         glu::RenderContext& getRenderContext(void)
58         {
59                 return *m_renderCtx;
60         }
61
62         void setRenderContext(glu::RenderContext* renderCtx)
63         {
64                 m_renderCtx = renderCtx;
65         }
66
67         const glu::ContextInfo& getContextInfo(void) const
68         {
69                 return *m_contextInfo;
70         }
71
72         const tcu::RenderTarget& getRenderTarget(void) const;
73
74 private:
75         Context(const Context& other);
76         Context& operator=(const Context& other);
77
78         void createRenderContext(glu::ContextType& contextType, glu::ContextFlags ctxFlags = (glu::ContextFlags)0);
79         void destroyRenderContext(void);
80
81         tcu::TestContext&   m_testCtx;
82         glu::RenderContext* m_renderCtx;
83         glu::ContextInfo*   m_contextInfo;
84         glu::ContextType        m_contextType;
85 };
86
87 } // deqp
88
89 #endif // _GLCCONTEXT_HPP