Chromium Code Reviews

Side by Side Diff: src/utils/win/SkWGL_win.cpp

Issue 1427583007: Assert when running SampleApp with msaa 16 on Windows 10 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8
9 #include "SkWGL.h" 9 #include "SkWGL.h"
10 10
(...skipping 105 matching lines...)
116 return true; 116 return true;
117 } 117 }
118 return false; 118 return false;
119 } 119 }
120 } 120 }
121 121
122 int SkWGLExtensions::selectFormat(const int formats[], 122 int SkWGLExtensions::selectFormat(const int formats[],
123 int formatCount, 123 int formatCount,
124 HDC dc, 124 HDC dc,
125 int desiredSampleCount) const { 125 int desiredSampleCount) const {
126 if (formatCount <= 0)
bsalomon 2015/11/03 18:28:14 We always use braces
127 return -1;
126 PixelFormat desiredFormat = { 128 PixelFormat desiredFormat = {
127 0, 129 0,
128 desiredSampleCount, 130 desiredSampleCount,
129 0, 131 0,
130 }; 132 };
131 SkTDArray<PixelFormat> rankedFormats; 133 SkTDArray<PixelFormat> rankedFormats;
132 rankedFormats.setCount(formatCount); 134 rankedFormats.setCount(formatCount);
133 for (int i = 0; i < formatCount; ++i) { 135 for (int i = 0; i < formatCount; ++i) {
134 static const int kQueryAttr = SK_WGL_SAMPLES; 136 static const int kQueryAttr = SK_WGL_SAMPLES;
135 int numSamples; 137 int numSamples;
(...skipping 173 matching lines...)
309 msaaIAttrs[kIAttrsCount - 2] = SK_WGL_SAMPLE_BUFFERS; 311 msaaIAttrs[kIAttrsCount - 2] = SK_WGL_SAMPLE_BUFFERS;
310 msaaIAttrs[kIAttrsCount - 1] = TRUE; 312 msaaIAttrs[kIAttrsCount - 1] = TRUE;
311 msaaIAttrs[kIAttrsCount + 0] = SK_WGL_SAMPLES; 313 msaaIAttrs[kIAttrsCount + 0] = SK_WGL_SAMPLES;
312 msaaIAttrs[kIAttrsCount + 1] = msaaSampleCount; 314 msaaIAttrs[kIAttrsCount + 1] = msaaSampleCount;
313 msaaIAttrs[kIAttrsCount + 2] = 0; 315 msaaIAttrs[kIAttrsCount + 2] = 0;
314 msaaIAttrs[kIAttrsCount + 3] = 0; 316 msaaIAttrs[kIAttrsCount + 3] = 0;
315 unsigned int num; 317 unsigned int num;
316 int formats[64]; 318 int formats[64];
317 extensions.choosePixelFormat(dc, msaaIAttrs, fAttrs, 64, formats, &num); 319 extensions.choosePixelFormat(dc, msaaIAttrs, fAttrs, 64, formats, &num);
318 num = SkTMin(num, 64U); 320 num = SkTMin(num, 64U);
319 formatsToTry[0] = extensions.selectFormat(formats, num, dc, msaaSampleCo unt); 321 formatsToTry[0] = num == 0 ? -1 : extensions.selectFormat(formats, num, dc, msaaSampleCount);
bsalomon 2015/11/03 18:28:14 We wrap lines at 100 (usually). Maybe rewrite with
320 } 322 }
321 323
322 // Get a non-MSAA format 324 // Get a non-MSAA format
323 int* format = -1 == formatsToTry[0] ? &formatsToTry[0] : &formatsToTry[1]; 325 int* format = -1 == formatsToTry[0] ? &formatsToTry[0] : &formatsToTry[1];
324 unsigned int num; 326 unsigned int num;
325 extensions.choosePixelFormat(dc, iAttrs, fAttrs, 1, format, &num); 327 extensions.choosePixelFormat(dc, iAttrs, fAttrs, 1, format, &num);
326 } 328 }
327 329
328 static HGLRC create_gl_context(HDC dc, SkWGLExtensions extensions, SkWGLContextR equest contextType) { 330 static HGLRC create_gl_context(HDC dc, SkWGLExtensions extensions, SkWGLContextR equest contextType) {
329 HDC prevDC = wglGetCurrentDC(); 331 HDC prevDC = wglGetCurrentDC();
(...skipping 118 matching lines...)
448 wglDeleteContext(fGLRC); 450 wglDeleteContext(fGLRC);
449 fExtensions.releasePbufferDC(fPbuffer, fDC); 451 fExtensions.releasePbufferDC(fPbuffer, fDC);
450 fExtensions.destroyPbuffer(fPbuffer); 452 fExtensions.destroyPbuffer(fPbuffer);
451 } 453 }
452 454
453 SkWGLPbufferContext::SkWGLPbufferContext(HPBUFFER pbuffer, HDC dc, HGLRC glrc) 455 SkWGLPbufferContext::SkWGLPbufferContext(HPBUFFER pbuffer, HDC dc, HGLRC glrc)
454 : fPbuffer(pbuffer) 456 : fPbuffer(pbuffer)
455 , fDC(dc) 457 , fDC(dc)
456 , fGLRC(glrc) { 458 , fGLRC(glrc) {
457 } 459 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine