aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/win
diff options
context:
space:
mode:
authorGravatar rmistry <rmistry@google.com>2014-06-23 06:13:46 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-23 06:13:46 -0700
commit05ead8afe5e4db21f9004334ac339bdad48d5057 (patch)
treee673ecba6ecdf971f20a860dd4eff014d19a372a /src/utils/win
parentc986b1fd284a63413c3bd2be8acb6dcd5c7e7532 (diff)
Revert of Support using OpenGL ES context on desktop (https://codereview.chromium.org/319043005/)
Reason for revert: Caused segmentation fault on many builders. Please see reverted CL's msg #21 for details. Original issue's description: > Support using OpenGL ES context on desktop > > Support using OpenGL ES context on desktop for unix and Android platforms. This > is mainly useful in development. > > Add --gpuAPI flag to gm, dm, bench, bench_pictures and render_pictures. The > possible parameters for the flag are "gl" and "gles". > > Committed: https://skia.googlesource.com/skia/+/74fc727dc88ee24d89f88cb1709f963e9073aeb3 R=bsalomon@google.com, mtklein@google.com, robertphillips@google.com, kkinnunen@nvidia.com TBR=bsalomon@google.com, kkinnunen@nvidia.com NOTREECHECKS=true NOTRY=true Author: rmistry@google.com Review URL: https://codereview.chromium.org/351583002
Diffstat (limited to 'src/utils/win')
-rw-r--r--src/utils/win/SkWGL_win.cpp57
1 files changed, 20 insertions, 37 deletions
diff --git a/src/utils/win/SkWGL_win.cpp b/src/utils/win/SkWGL_win.cpp
index a8552a8ea3..3b1966dae8 100644
--- a/src/utils/win/SkWGL_win.cpp
+++ b/src/utils/win/SkWGL_win.cpp
@@ -245,7 +245,7 @@ SkWGLExtensions::SkWGLExtensions()
wglMakeCurrent(prevDC, prevGLRC);
}
-HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, SkWGLContextRequest contextType) {
+HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, bool preferCoreProfile) {
SkWGLExtensions extensions;
if (!extensions.hasExtension(dc, "WGL_ARB_pixel_format")) {
return NULL;
@@ -307,44 +307,27 @@ HGLRC SkCreateWGLContext(HDC dc, int msaaSampleCount, SkWGLContextRequest contex
}
HGLRC glrc = NULL;
- if (kGLES_SkWGLContextRequest == contextType) {
- if (!extensions.hasExtension(dc, "WGL_EXT_create_context_es2_profile")) {
- return NULL;
- }
- static const int glesAttribs[] = {
- SK_WGL_CONTEXT_MAJOR_VERSION, 3,
- SK_WGL_CONTEXT_MINOR_VERSION, 0,
- SK_WGL_CONTEXT_PROFILE_MASK, SK_WGL_CONTEXT_ES2_PROFILE_BIT,
+ if (preferCoreProfile && extensions.hasExtension(dc, "WGL_ARB_create_context")) {
+ static const int kCoreGLVersions[] = {
+ 4, 3,
+ 4, 2,
+ 4, 1,
+ 4, 0,
+ 3, 3,
+ 3, 2,
+ };
+ int coreProfileAttribs[] = {
+ SK_WGL_CONTEXT_MAJOR_VERSION, -1,
+ SK_WGL_CONTEXT_MINOR_VERSION, -1,
+ SK_WGL_CONTEXT_PROFILE_MASK, SK_WGL_CONTEXT_CORE_PROFILE_BIT,
0,
};
- glrc = extensions.createContextAttribs(dc, NULL, glesAttribs);
- if (NULL == glrc) {
- return NULL;
- }
- } else {
- if (kGLPreferCoreProfile_SkWGLContextRequest == contextType &&
- extensions.hasExtension(dc, "WGL_ARB_create_context")) {
- static const int kCoreGLVersions[] = {
- 4, 3,
- 4, 2,
- 4, 1,
- 4, 0,
- 3, 3,
- 3, 2,
- };
- int coreProfileAttribs[] = {
- SK_WGL_CONTEXT_MAJOR_VERSION, -1,
- SK_WGL_CONTEXT_MINOR_VERSION, -1,
- SK_WGL_CONTEXT_PROFILE_MASK, SK_WGL_CONTEXT_CORE_PROFILE_BIT,
- 0,
- };
- for (int v = 0; v < SK_ARRAY_COUNT(kCoreGLVersions) / 2; ++v) {
- coreProfileAttribs[1] = kCoreGLVersions[2 * v];
- coreProfileAttribs[3] = kCoreGLVersions[2 * v + 1];
- glrc = extensions.createContextAttribs(dc, NULL, coreProfileAttribs);
- if (NULL != glrc) {
- break;
- }
+ for (int v = 0; v < SK_ARRAY_COUNT(kCoreGLVersions) / 2; ++v) {
+ coreProfileAttribs[1] = kCoreGLVersions[2 * v];
+ coreProfileAttribs[3] = kCoreGLVersions[2 * v + 1];
+ glrc = extensions.createContextAttribs(dc, NULL, coreProfileAttribs);
+ if (NULL != glrc) {
+ break;
}
}
}