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

Side by Side Diff: samplecode/SampleApp.cpp

Issue 144003006: Turn NVPR on by default (but off in tools). (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix vs 2010 x86 debugger builds 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 | Annotate | Revision Log
« 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;
213 switch (win->getDeviceType()) { 214 switch (win->getDeviceType()) {
214 case kRaster_DeviceType: 215 case kRaster_DeviceType:
215 // fallthrough 216 // fallthrough
216 case kPicture_DeviceType: 217 case kPicture_DeviceType:
217 // fallthrough 218 // fallthrough
218 case kGPU_DeviceType: 219 case kGPU_DeviceType:
219 // all these guys use the native interface 220 // all these guys use the native interface
220 fCurIntf = GrGLCreateNativeInterface(); 221 glInterface.reset(GrGLCreateNativeInterface());
221 break; 222 break;
222 #if SK_ANGLE 223 #if SK_ANGLE
223 case kANGLE_DeviceType: 224 case kANGLE_DeviceType:
224 fCurIntf = GrGLCreateANGLEInterface(); 225 glInterface.reset(GrGLCreateANGLEInterface());
225 break; 226 break;
226 #endif // SK_ANGLE 227 #endif // SK_ANGLE
227 case kNullGPU_DeviceType: 228 case kNullGPU_DeviceType:
228 fCurIntf = GrGLCreateNullInterface(); 229 glInterface.reset(GrGLCreateNullInterface());
229 break; 230 break;
230 default: 231 default:
231 SkASSERT(false); 232 SkASSERT(false);
232 break; 233 break;
233 } 234 }
234 235
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
235 SkASSERT(NULL == fCurContext); 240 SkASSERT(NULL == fCurContext);
236 fCurContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fC urIntf); 241 fCurContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fC urIntf);
237 242
238 if (NULL == fCurContext || NULL == fCurIntf) { 243 if (NULL == fCurContext || NULL == fCurIntf) {
239 // We need some context and interface to see results 244 // We need some context and interface to see results
240 SkSafeUnref(fCurContext); 245 SkSafeUnref(fCurContext);
241 SkSafeUnref(fCurIntf); 246 SkSafeUnref(fCurIntf);
247 fCurContext = NULL;
248 fCurIntf = NULL;
242 SkDebugf("Failed to setup 3D"); 249 SkDebugf("Failed to setup 3D");
243 250
244 win->detach(); 251 win->detach();
245 } 252 }
246 #endif // SK_SUPPORT_GPU 253 #endif // SK_SUPPORT_GPU
247 // call windowSizeChanged to create the render target 254 // call windowSizeChanged to create the render target
248 this->windowSizeChanged(win); 255 this->windowSizeChanged(win);
249 } 256 }
250 257
251 virtual void tearDownBackend(SampleWindow *win) { 258 virtual void tearDownBackend(SampleWindow *win) {
(...skipping 2351 matching lines...) Expand 10 before | Expand all | Expand 10 after
2603 SkGraphics::Init(); 2610 SkGraphics::Init();
2604 SkEvent::Init(); 2611 SkEvent::Init();
2605 } 2612 }
2606 2613
2607 // FIXME: this should be in a header 2614 // FIXME: this should be in a header
2608 void application_term(); 2615 void application_term();
2609 void application_term() { 2616 void application_term() {
2610 SkEvent::Term(); 2617 SkEvent::Term();
2611 SkGraphics::Term(); 2618 SkGraphics::Term();
2612 } 2619 }
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