OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SkTypes.h" | 8 #include "SkTypes.h" |
9 | 9 |
10 #if defined(SK_BUILD_FOR_WIN) | 10 #if defined(SK_BUILD_FOR_WIN) |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 } | 389 } |
390 | 390 |
391 if (0 == format) { | 391 if (0 == format) { |
392 GLuint num; | 392 GLuint num; |
393 extensions.choosePixelFormat(dc, iAttrs, fAttrs, 1, &format, &num); | 393 extensions.choosePixelFormat(dc, iAttrs, fAttrs, 1, &format, &num); |
394 DescribePixelFormat(dc, format, sizeof(pfd), &pfd); | 394 DescribePixelFormat(dc, format, sizeof(pfd), &pfd); |
395 BOOL set = SetPixelFormat(dc, format, &pfd); | 395 BOOL set = SetPixelFormat(dc, format, &pfd); |
396 SkASSERT(TRUE == set); | 396 SkASSERT(TRUE == set); |
397 } | 397 } |
398 | 398 |
399 HGLRC glrc = wglCreateContext(dc); | 399 HGLRC glrc = NULL; |
| 400 #if 0 // Change to 1 to attempt to create a core profile GL context of version 4
.3 or lower |
| 401 if (extensions.hasExtension(dc, "WGL_ARB_create_context")) { |
| 402 static const GLint kCoreGLVersions[] = { |
| 403 4, 3, |
| 404 4, 2, |
| 405 4, 1, |
| 406 4, 0, |
| 407 3, 3, |
| 408 3, 2, |
| 409 }; |
| 410 GLint coreProfileAttribs[] = { |
| 411 SK_WGL_CONTEXT_MAJOR_VERSION, -1, |
| 412 SK_WGL_CONTEXT_MINOR_VERSION, -1, |
| 413 SK_WGL_CONTEXT_PROFILE_MASK, SK_WGL_CONTEXT_CORE_PROFILE_BIT, |
| 414 0, |
| 415 }; |
| 416 for (int v = 0; v < SK_ARRAY_COUNT(kCoreGLVersions) / 2; ++v) { |
| 417 coreProfileAttribs[1] = kCoreGLVersions[2 * v]; |
| 418 coreProfileAttribs[3] = kCoreGLVersions[2 * v + 1]; |
| 419 glrc = extensions.createContextAttribs(dc, NULL, coreProfileAttribs)
; |
| 420 if (NULL != glrc) { |
| 421 break; |
| 422 } |
| 423 } |
| 424 } |
| 425 #endif |
| 426 |
| 427 if (NULL == glrc) { |
| 428 glrc = wglCreateContext(dc); |
| 429 } |
400 SkASSERT(glrc); | 430 SkASSERT(glrc); |
401 | 431 |
402 wglMakeCurrent(prevDC, prevGLRC); | 432 wglMakeCurrent(prevDC, prevGLRC); |
403 return glrc; | 433 return glrc; |
404 } | 434 } |
405 | 435 |
406 bool SkOSWindow::attachGL(int msaaSampleCount) { | 436 bool SkOSWindow::attachGL(int msaaSampleCount) { |
407 if (NULL == fHGLRC) { | 437 if (NULL == fHGLRC) { |
408 fHGLRC = create_gl((HWND)fHWND, msaaSampleCount); | 438 fHGLRC = create_gl((HWND)fHWND, msaaSampleCount); |
409 if (NULL == fHGLRC) { | 439 if (NULL == fHGLRC) { |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 break; | 687 break; |
658 #endif // SK_ANGLE | 688 #endif // SK_ANGLE |
659 #endif // SK_SUPPORT_GPU | 689 #endif // SK_SUPPORT_GPU |
660 default: | 690 default: |
661 SkASSERT(false); | 691 SkASSERT(false); |
662 break; | 692 break; |
663 } | 693 } |
664 } | 694 } |
665 | 695 |
666 #endif | 696 #endif |
OLD | NEW |