Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: samplecode/SampleApp.cpp

Issue 146863003: Revert "Turn NVPR on by default (but off in tools)." (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/gpu/gl/GrGLInterface.h ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | 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 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "SampleApp.h" 7 #include "SampleApp.h"
8 8
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 203 }
204 AttachmentInfo attachmentInfo; 204 AttachmentInfo attachmentInfo;
205 bool result = win->attach(fBackend, msaaSampleCount, &attachmentInfo); 205 bool result = win->attach(fBackend, msaaSampleCount, &attachmentInfo);
206 if (!result) { 206 if (!result) {
207 SkDebugf("Failed to initialize GL"); 207 SkDebugf("Failed to initialize GL");
208 return; 208 return;
209 } 209 }
210 fMSAASampleCount = msaaSampleCount; 210 fMSAASampleCount = msaaSampleCount;
211 211
212 SkASSERT(NULL == fCurIntf); 212 SkASSERT(NULL == fCurIntf);
213 SkAutoTUnref<const GrGLInterface> glInterface;
214 switch (win->getDeviceType()) { 213 switch (win->getDeviceType()) {
215 case kRaster_DeviceType: 214 case kRaster_DeviceType:
216 // fallthrough 215 // fallthrough
217 case kPicture_DeviceType: 216 case kPicture_DeviceType:
218 // fallthrough 217 // fallthrough
219 case kGPU_DeviceType: 218 case kGPU_DeviceType:
220 // all these guys use the native interface 219 // all these guys use the native interface
221 glInterface.reset(GrGLCreateNativeInterface()); 220 fCurIntf = GrGLCreateNativeInterface();
222 break; 221 break;
223 #if SK_ANGLE 222 #if SK_ANGLE
224 case kANGLE_DeviceType: 223 case kANGLE_DeviceType:
225 glInterface.reset(GrGLCreateANGLEInterface()); 224 fCurIntf = GrGLCreateANGLEInterface();
226 break; 225 break;
227 #endif // SK_ANGLE 226 #endif // SK_ANGLE
228 case kNullGPU_DeviceType: 227 case kNullGPU_DeviceType:
229 glInterface.reset(GrGLCreateNullInterface()); 228 fCurIntf = GrGLCreateNullInterface();
230 break; 229 break;
231 default: 230 default:
232 SkASSERT(false); 231 SkASSERT(false);
233 break; 232 break;
234 } 233 }
235 234
236 // Currently SampleApp does not use NVPR. TODO: Provide an NVPR device t ype that is skipped
237 // when the driver doesn't support NVPR.
238 fCurIntf = GrGLInterfaceRemoveNVPR(glInterface.get());
239
240 SkASSERT(NULL == fCurContext); 235 SkASSERT(NULL == fCurContext);
241 fCurContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fC urIntf); 236 fCurContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fC urIntf);
242 237
243 if (NULL == fCurContext || NULL == fCurIntf) { 238 if (NULL == fCurContext || NULL == fCurIntf) {
244 // We need some context and interface to see results 239 // We need some context and interface to see results
245 SkSafeUnref(fCurContext); 240 SkSafeUnref(fCurContext);
246 SkSafeUnref(fCurIntf); 241 SkSafeUnref(fCurIntf);
247 fCurContext = NULL;
248 fCurIntf = NULL;
249 SkDebugf("Failed to setup 3D"); 242 SkDebugf("Failed to setup 3D");
250 243
251 win->detach(); 244 win->detach();
252 } 245 }
253 #endif // SK_SUPPORT_GPU 246 #endif // SK_SUPPORT_GPU
254 // call windowSizeChanged to create the render target 247 // call windowSizeChanged to create the render target
255 this->windowSizeChanged(win); 248 this->windowSizeChanged(win);
256 } 249 }
257 250
258 virtual void tearDownBackend(SampleWindow *win) { 251 virtual void tearDownBackend(SampleWindow *win) {
(...skipping 2351 matching lines...) Expand 10 before | Expand all | Expand 10 after
2610 SkGraphics::Init(); 2603 SkGraphics::Init();
2611 SkEvent::Init(); 2604 SkEvent::Init();
2612 } 2605 }
2613 2606
2614 // FIXME: this should be in a header 2607 // FIXME: this should be in a header
2615 void application_term(); 2608 void application_term();
2616 void application_term() { 2609 void application_term() {
2617 SkEvent::Term(); 2610 SkEvent::Term();
2618 SkGraphics::Term(); 2611 SkGraphics::Term();
2619 } 2612 }
OLDNEW
« no previous file with comments | « include/gpu/gl/GrGLInterface.h ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698