Hash :
931c78cb
Author :
Date :
2015-05-04T12:45:53
Fix typo intialize -> initialize Change-Id: Ia39fffc6f2782b918b37ab7ae25ee16ecc98e93a Reviewed-on: https://chromium-review.googlesource.com/269120 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
//
// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// FunctionsWGL.h: Implements the FuntionsWGL class.
#include "libANGLE/renderer/gl/wgl/FunctionsWGL.h"
namespace rx
{
template <typename T>
static void GetWGLProcAddress(HMODULE glModule, PFNWGLGETPROCADDRESSPROC getProcAddressWGL,
const std::string &procName, T *outProcAddress)
{
T proc = nullptr;
if (getProcAddressWGL)
{
proc = reinterpret_cast<T>(getProcAddressWGL(procName.c_str()));
}
if (!proc)
{
proc = reinterpret_cast<T>(GetProcAddress(glModule, procName.c_str()));
}
*outProcAddress = proc;
}
template <typename T>
static void GetWGLExtensionProcAddress(HMODULE glModule, PFNWGLGETPROCADDRESSPROC getProcAddressWGL,
const std::string &extensions, const std::string &extensionName,
const std::string &procName, T *outProcAddress)
{
T proc = nullptr;
if (extensions.find(extensionName) != std::string::npos)
{
GetWGLProcAddress(glModule, getProcAddressWGL, procName, &proc);
}
*outProcAddress = proc;
}
FunctionsWGL::FunctionsWGL()
: copyContext(nullptr),
createContext(nullptr),
createLayerContext(nullptr),
deleteContext(nullptr),
getCurrentContext(nullptr),
getCurrentDC(nullptr),
getProcAddress(nullptr),
makeCurrent(nullptr),
shareLists(nullptr),
useFontBitmapsA(nullptr),
useFontBitmapsW(nullptr),
swapBuffers(nullptr),
useFontOutlinesA(nullptr),
useFontOutlinesW(nullptr),
describeLayerPlane(nullptr),
setLayerPaletteEntries(nullptr),
getLayerPaletteEntries(nullptr),
realizeLayerPalette(nullptr),
swapLayerBuffers(nullptr),
swapMultipleBuffers(nullptr),
createContextAttribsARB(nullptr),
getPixelFormatAttribivARB(nullptr),
getExtensionStringEXT(nullptr),
getExtensionStringARB(nullptr),
swapIntervalEXT(nullptr),
createPbufferARB(nullptr),
getPbufferDCARB(nullptr),
releasePbufferDCARB(nullptr),
destroyPbufferARB(nullptr),
queryPbufferARB(nullptr),
bindTexImageARB(nullptr),
releaseTexImageARB(nullptr),
setPbufferAttribARB(nullptr)
{
}
void FunctionsWGL::initialize(HMODULE glModule, HDC context)
{
// First grab the wglGetProcAddress function from the gl module
GetWGLProcAddress(glModule, nullptr, "wglGetProcAddress", &getProcAddress);
// Load the core wgl functions
GetWGLProcAddress(glModule, getProcAddress, "wglCopyContext", ©Context);
GetWGLProcAddress(glModule, getProcAddress, "wglCreateContext", &createContext);
GetWGLProcAddress(glModule, getProcAddress, "wglCreateLayerContext", &createLayerContext);
GetWGLProcAddress(glModule, getProcAddress, "wglDeleteContext", &deleteContext);
GetWGLProcAddress(glModule, getProcAddress, "wglGetCurrentContext", &getCurrentContext);
GetWGLProcAddress(glModule, getProcAddress, "wglGetCurrentDC", &getCurrentDC);
GetWGLProcAddress(glModule, getProcAddress, "wglMakeCurrent", &makeCurrent);
GetWGLProcAddress(glModule, getProcAddress, "wglShareLists", &shareLists);
GetWGLProcAddress(glModule, getProcAddress, "wglUseFontBitmapsA", &useFontBitmapsA);
GetWGLProcAddress(glModule, getProcAddress, "wglUseFontBitmapsW", &useFontBitmapsW);
swapBuffers = SwapBuffers; // SwapBuffers is statically linked from GDI
GetWGLProcAddress(glModule, getProcAddress, "wglUseFontOutlinesA", &useFontOutlinesA);
GetWGLProcAddress(glModule, getProcAddress, "wglUseFontOutlinesW", &useFontOutlinesW);
GetWGLProcAddress(glModule, getProcAddress, "wglDescribeLayerPlane", &describeLayerPlane);
GetWGLProcAddress(glModule, getProcAddress, "wglSetLayerPaletteEntries", &setLayerPaletteEntries);
GetWGLProcAddress(glModule, getProcAddress, "wglGetLayerPaletteEntries", &getLayerPaletteEntries);
GetWGLProcAddress(glModule, getProcAddress, "wglRealizeLayerPalette", &realizeLayerPalette);
GetWGLProcAddress(glModule, getProcAddress, "wglSwapLayerBuffers", &swapLayerBuffers);
GetWGLProcAddress(glModule, getProcAddress, "wglSwapMultipleBuffers", &swapMultipleBuffers);
// Load extension string getter functions
GetWGLProcAddress(glModule, getProcAddress, "wglGetExtensionsStringEXT", &getExtensionStringEXT);
GetWGLProcAddress(glModule, getProcAddress, "wglGetExtensionsStringARB", &getExtensionStringARB);
std::string extensions = "";
if (getExtensionStringEXT)
{
extensions = getExtensionStringEXT();
}
else if (getExtensionStringARB && context)
{
extensions = getExtensionStringARB(context);
}
// Load the wgl extension functions by checking if the context supports the extension first
GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, "WGL_ARB_create_context", "wglCreateContextAttribsARB", &createContextAttribsARB);
GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, "WGL_ARB_pixel_format", "wglGetPixelFormatAttribivARB", &getPixelFormatAttribivARB);
GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, "WGL_EXT_swap_control", "wglSwapIntervalEXT", &swapIntervalEXT);
// WGL_ARB_pbuffer
GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, "WGL_ARB_pbuffer", "wglCreatePbufferARB", &createPbufferARB);
GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, "WGL_ARB_pbuffer", "wglGetPbufferDCARB", &getPbufferDCARB);
GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, "WGL_ARB_pbuffer", "wglReleasePbufferDCARB", &releasePbufferDCARB);
GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, "WGL_ARB_pbuffer", "wglDestroyPbufferARB", &destroyPbufferARB);
GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, "WGL_ARB_pbuffer", "wglQueryPbufferARB", &queryPbufferARB);
// WGL_ARB_render_texture
GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, "WGL_ARB_render_texture", "wglBindTexImageARB", &bindTexImageARB);
GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, "WGL_ARB_render_texture", "wglReleaseTexImageARB", &releaseTexImageARB);
GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, "WGL_ARB_render_texture", "wglSetPbufferAttribARB", &setPbufferAttribARB);
}
}