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 "gluRenderContext.hpp"
28 #include "deDynamicLibrary.h"
29 #include "tcuWin32API.h"
46 /*--------------------------------------------------------------------*//*!
47 * \brief WGL pixel format info.
48 *//*--------------------------------------------------------------------*/
56 PIXELTYPE_RGBA_UNSIGNED_FLOAT,
57 PIXELTYPE_COLOR_INDEX,
65 SURFACE_WINDOW = (1<<0),
66 SURFACE_PIXMAP = (1<<1)
71 ACCELERATION_NONE = 0,
81 // From WGL_ARB_pixel_format
82 deUint32 surfaceTypes;
83 Acceleration acceleration;
85 // bool needSystemPalette;
86 // bool swapLayerBuffers;
87 // SwapMethod swapMethod; { EXCHANGE, UNDEFINED }
91 // int transparentRedValue;
92 // int transparentGreenValue;
93 // int transparentBlueValue;
94 // int transparentAlphaValue;
95 // int transparentIndexValue;
117 // int accumGreenBits;
118 // int accumBlueBits;
119 // int accumAlphaBits;
124 // int numAuxBuffers;
126 // From WGL_ARB_multisample
130 // \todo [2013-04-14 pyry] Version bits?
132 PixelFormatInfo (void)
135 , acceleration (ACCELERATION_LAST)
136 , supportOpenGL (false)
137 , doubleBuffer (false)
138 , pixelType (PIXELTYPE_LAST)
151 /*--------------------------------------------------------------------*//*!
152 * \brief Core WGL API
154 * \note Created API objects depend on Core object being live. User is
155 * resposible of keeping Core live as long as there are API objects
156 * (such as GL contexts) live!
157 *//*--------------------------------------------------------------------*/
161 Core (HINSTANCE instance);
164 std::vector<int> getPixelFormats (HDC deviceCtx) const;
165 PixelFormatInfo getPixelFormatInfo (HDC deviceCtx, int pixelFormat) const;
168 const Library* getLibrary (void) const { return m_library; }
171 Core (const Core& other);
172 Core& operator= (const Core& other);
177 //! Function pointer type.
178 typedef void (__stdcall* FunctionPtr) (void);
180 /*--------------------------------------------------------------------*//*!
183 * Context is currently made current to current thread in constructor
184 * and detached in destructor. Thus context should be created in and
185 * accessed from a single thread.
186 *//*--------------------------------------------------------------------*/
190 Context (const Core* core, HDC deviceCtx, glu::ContextType ctxType, int pixelFormat);
193 FunctionPtr getGLFunction (const char* name) const;
195 void swapBuffers (void) const;
197 HDC getDeviceContext (void) const { return m_deviceCtx; }
198 HGLRC getGLContext (void) const { return m_context; }
201 Context (const Context& other);
202 Context& operator= (const Context& other);
209 //! Utility for selecting config. Returns -1 if no matching pixel format was found.
210 int choosePixelFormat (const Core& wgl, HDC deviceCtx, const glu::RenderConfig& config);
215 #endif // _TCUWGL_HPP