Hash :
a6206854
Author :
Date :
2019-10-24T12:55:09
Enable "-Wmissing-field-initializers". This is another warning required by Skia. This one didn't find anything that surprising. Enabling the warning does help enforce code consistency and avoids a bit of possible undefined behaviour. Bug: angleproject:4046 Change-Id: Ifec7f4afad49cd820bf3c0a79df3f46559473ee2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1877477 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@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
//
// Copyright 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 = {};
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;
}
} // namespace wgl
} // namespace rx