3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Tester Core
5 * ----------------------------------------
7 * Copyright 2014 The Android Open Source Project
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 * \brief WGL Utilities.
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "gluRenderConfig.hpp"
28 #include "gluRenderContext.hpp"
29 #include "deDynamicLibrary.h"
30 #include "tcuWin32API.h"
47 /*--------------------------------------------------------------------*//*!
48 * \brief WGL pixel format info.
49 *//*--------------------------------------------------------------------*/
57 PIXELTYPE_RGBA_UNSIGNED_FLOAT,
58 PIXELTYPE_COLOR_INDEX,
66 SURFACE_WINDOW = (1<<0),
67 SURFACE_PIXMAP = (1<<1)
72 ACCELERATION_NONE = 0,
82 // From WGL_ARB_pixel_format
83 deUint32 surfaceTypes;
84 Acceleration acceleration;
86 bool needSystemPalette;
87 // bool swapLayerBuffers;
88 // SwapMethod swapMethod; { EXCHANGE, UNDEFINED }
92 // int transparentRedValue;
93 // int transparentGreenValue;
94 // int transparentBlueValue;
95 // int transparentAlphaValue;
96 // int transparentIndexValue;
118 // int accumGreenBits;
119 // int accumBlueBits;
120 // int accumAlphaBits;
127 // From WGL_ARB_multisample
131 // \todo [2013-04-14 pyry] Version bits?
133 PixelFormatInfo (void)
136 , acceleration (ACCELERATION_LAST)
137 , needPalette (false)
138 , needSystemPalette (false)
141 , supportOpenGL (false)
142 , doubleBuffer (false)
144 , pixelType (PIXELTYPE_LAST)
159 /*--------------------------------------------------------------------*//*!
160 * \brief Core WGL API
162 * \note Created API objects depend on Core object being live. User is
163 * resposible of keeping Core live as long as there are API objects
164 * (such as GL contexts) live!
165 *//*--------------------------------------------------------------------*/
169 Core (HINSTANCE instance);
172 std::vector<int> getPixelFormats (HDC deviceCtx) const;
173 PixelFormatInfo getPixelFormatInfo (HDC deviceCtx, int pixelFormat) const;
176 const Library* getLibrary (void) const { return m_library; }
179 Core (const Core& other);
180 Core& operator= (const Core& other);
185 //! Function pointer type.
186 typedef void (__stdcall* FunctionPtr) (void);
188 /*--------------------------------------------------------------------*//*!
191 * Context is currently made current to current thread in constructor
192 * and detached in destructor. Thus context should be created in and
193 * accessed from a single thread.
194 *//*--------------------------------------------------------------------*/
198 Context (const Core* core,
200 const Context* sharedContext,
201 glu::ContextType ctxType,
203 glu::ResetNotificationStrategy resetNotificationStrategy);
206 FunctionPtr getGLFunction (const char* name) const;
208 void makeCurrent (void);
209 void swapBuffers (void) const;
211 HDC getDeviceContext (void) const { return m_deviceCtx; }
212 HGLRC getGLContext (void) const { return m_context; }
215 Context (const Context& other);
216 Context& operator= (const Context& other);
223 //! Utility for selecting config. Returns -1 if no matching pixel format was found.
224 int choosePixelFormat (const Core& wgl, HDC deviceCtx, const glu::RenderConfig& config);
226 //! Is pixel format in general supported by dEQP tests?
227 bool isSupportedByTests (const PixelFormatInfo& pixelFormatInfo);
232 #endif // _TCUWGL_HPP