Hash :
b2e2425a
Author :
Date :
2015-10-05T16:03:10
Fixed compilation on mingw. BUG=angleproject:1184 This is reland of parts of commit 566273222683314d. It also adds <algorithm> include in FunctionsWGL.cpp, which is needed for std::find on GCC. Change-Id: I852008087afa6b12da6e7e29934fa83390fded21 Reviewed-on: https://chromium-review.googlesource.com/308090 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@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
//
// 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.
//
// wgl_utils.cpp: Utility routines specific to the WGL->EGL implementation.
#include "libANGLE/renderer/gl/wgl/wgl_utils.h"
#include "libANGLE/renderer/gl/wgl/FunctionsWGL.h"
namespace rx
{
namespace wgl
{
PIXELFORMATDESCRIPTOR GetDefaultPixelFormatDescriptor()
{
PIXELFORMATDESCRIPTOR pixelFormatDescriptor = { 0 };
pixelFormatDescriptor.nSize = sizeof(pixelFormatDescriptor);
pixelFormatDescriptor.nVersion = 1;
pixelFormatDescriptor.dwFlags = PFD_DRAW_TO_WINDOW | PFD_GENERIC_ACCELERATED | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pixelFormatDescriptor.iPixelType = PFD_TYPE_RGBA;
pixelFormatDescriptor.cColorBits = 24;
pixelFormatDescriptor.cAlphaBits = 8;
pixelFormatDescriptor.cDepthBits = 24;
pixelFormatDescriptor.cStencilBits = 8;
pixelFormatDescriptor.iLayerType = PFD_MAIN_PLANE;
return pixelFormatDescriptor;
}
std::vector<int> GetDefaultPixelFormatAttributes(bool preservedSwap)
{
std::vector<int> attribs;
attribs.push_back(WGL_DRAW_TO_WINDOW_ARB);
attribs.push_back(TRUE);
attribs.push_back(WGL_ACCELERATION_ARB);
attribs.push_back(WGL_FULL_ACCELERATION_ARB);
attribs.push_back(WGL_SUPPORT_OPENGL_ARB);
attribs.push_back(TRUE);
attribs.push_back(WGL_DOUBLE_BUFFER_ARB);
attribs.push_back(TRUE);
attribs.push_back(WGL_PIXEL_TYPE_ARB);
attribs.push_back(WGL_TYPE_RGBA_ARB);
attribs.push_back(WGL_COLOR_BITS_ARB);
attribs.push_back(24);
attribs.push_back(WGL_ALPHA_BITS_ARB);
attribs.push_back(8);
attribs.push_back(WGL_DEPTH_BITS_ARB);
attribs.push_back(24);
attribs.push_back(WGL_STENCIL_BITS_ARB);
attribs.push_back(8);
attribs.push_back(WGL_SWAP_METHOD_ARB);
attribs.push_back(preservedSwap ? WGL_SWAP_COPY_ARB : WGL_SWAP_UNDEFINED_ARB);
attribs.push_back(0);
return attribs;
}
int QueryWGLFormatAttrib(HDC dc, int format, int attribName, const FunctionsWGL *functions)
{
int result = 0;
if (functions->getPixelFormatAttribivARB == nullptr ||
!functions->getPixelFormatAttribivARB(dc, format, 0, 1, &attribName, &result))
{
return 0;
}
return result;
}
}
}