gfx/gl/WGLLibrary.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "GLContextTypes.h"
michael@0 7 #include <windows.h>
michael@0 8
michael@0 9 struct PRLibrary;
michael@0 10
michael@0 11 namespace mozilla {
michael@0 12 namespace gl {
michael@0 13
michael@0 14 class WGLLibrary
michael@0 15 {
michael@0 16 public:
michael@0 17 WGLLibrary()
michael@0 18 : mInitialized(false),
michael@0 19 mOGLLibrary(nullptr),
michael@0 20 mHasRobustness(false),
michael@0 21 mWindow (0),
michael@0 22 mWindowDC(0),
michael@0 23 mWindowGLContext(0),
michael@0 24 mWindowPixelFormat (0)
michael@0 25 {}
michael@0 26
michael@0 27 typedef HGLRC (GLAPIENTRY * PFNWGLCREATECONTEXTPROC) (HDC);
michael@0 28 PFNWGLCREATECONTEXTPROC fCreateContext;
michael@0 29 typedef BOOL (GLAPIENTRY * PFNWGLDELETECONTEXTPROC) (HGLRC);
michael@0 30 PFNWGLDELETECONTEXTPROC fDeleteContext;
michael@0 31 typedef BOOL (GLAPIENTRY * PFNWGLMAKECURRENTPROC) (HDC, HGLRC);
michael@0 32 PFNWGLMAKECURRENTPROC fMakeCurrent;
michael@0 33 typedef PROC (GLAPIENTRY * PFNWGLGETPROCADDRESSPROC) (LPCSTR);
michael@0 34 PFNWGLGETPROCADDRESSPROC fGetProcAddress;
michael@0 35 typedef HGLRC (GLAPIENTRY * PFNWGLGETCURRENTCONTEXT) (void);
michael@0 36 PFNWGLGETCURRENTCONTEXT fGetCurrentContext;
michael@0 37 typedef HDC (GLAPIENTRY * PFNWGLGETCURRENTDC) (void);
michael@0 38 PFNWGLGETCURRENTDC fGetCurrentDC;
michael@0 39 typedef BOOL (GLAPIENTRY * PFNWGLSHARELISTS) (HGLRC oldContext, HGLRC newContext);
michael@0 40 PFNWGLSHARELISTS fShareLists;
michael@0 41
michael@0 42 typedef HANDLE (WINAPI * PFNWGLCREATEPBUFFERPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);
michael@0 43 PFNWGLCREATEPBUFFERPROC fCreatePbuffer;
michael@0 44 typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERPROC) (HANDLE hPbuffer);
michael@0 45 PFNWGLDESTROYPBUFFERPROC fDestroyPbuffer;
michael@0 46 typedef HDC (WINAPI * PFNWGLGETPBUFFERDCPROC) (HANDLE hPbuffer);
michael@0 47 PFNWGLGETPBUFFERDCPROC fGetPbufferDC;
michael@0 48
michael@0 49 typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEPROC) (HANDLE hPbuffer, int iBuffer);
michael@0 50 PFNWGLBINDTEXIMAGEPROC fBindTexImage;
michael@0 51 typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEPROC) (HANDLE hPbuffer, int iBuffer);
michael@0 52 PFNWGLRELEASETEXIMAGEPROC fReleaseTexImage;
michael@0 53
michael@0 54 typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
michael@0 55 PFNWGLCHOOSEPIXELFORMATPROC fChoosePixelFormat;
michael@0 56 typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues);
michael@0 57 PFNWGLGETPIXELFORMATATTRIBIVPROC fGetPixelFormatAttribiv;
michael@0 58
michael@0 59 typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGPROC) (HDC hdc);
michael@0 60 PFNWGLGETEXTENSIONSSTRINGPROC fGetExtensionsString;
michael@0 61
michael@0 62 typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSPROC) (HDC hdc, HGLRC hShareContext, const int *attribList);
michael@0 63 PFNWGLCREATECONTEXTATTRIBSPROC fCreateContextAttribs;
michael@0 64
michael@0 65 bool EnsureInitialized();
michael@0 66 HWND CreateDummyWindow(HDC *aWindowDC = nullptr);
michael@0 67
michael@0 68 bool HasRobustness() const { return mHasRobustness; }
michael@0 69 bool IsInitialized() const { return mInitialized; }
michael@0 70 HWND GetWindow() const { return mWindow; }
michael@0 71 HDC GetWindowDC() const {return mWindowDC; }
michael@0 72 HGLRC GetWindowGLContext() const {return mWindowGLContext; }
michael@0 73 int GetWindowPixelFormat() const { return mWindowPixelFormat; }
michael@0 74 PRLibrary *GetOGLLibrary() { return mOGLLibrary; }
michael@0 75
michael@0 76 private:
michael@0 77 bool mInitialized;
michael@0 78 PRLibrary *mOGLLibrary;
michael@0 79 bool mHasRobustness;
michael@0 80
michael@0 81 HWND mWindow;
michael@0 82 HDC mWindowDC;
michael@0 83 HGLRC mWindowGLContext;
michael@0 84 int mWindowPixelFormat;
michael@0 85
michael@0 86 };
michael@0 87
michael@0 88 // a global WGLLibrary instance
michael@0 89 extern WGLLibrary sWGLLibrary;
michael@0 90
michael@0 91 } /* namespace gl */
michael@0 92 } /* namespace mozilla */
michael@0 93

mercurial