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

Side by Side Diff: samplecode/SampleApp.cpp

Issue 1684413003: Implement support for using GL ES 3.0 with command buffer (Closed) Base URL: https://skia.googlesource.com/skia.git@no-texture-rectangle-gles
Patch Set: comment wording Created 4 years, 10 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 | « samplecode/SampleApp.h ('k') | src/gpu/GrContextFactory.h » ('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 7
8 #include "SampleApp.h" 8 #include "SampleApp.h"
9 9
10 #include "OverView.h" 10 #include "OverView.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // all these guys use the native backend 199 // all these guys use the native backend
200 fBackend = kNativeGL_BackEndType; 200 fBackend = kNativeGL_BackEndType;
201 break; 201 break;
202 #if SK_ANGLE 202 #if SK_ANGLE
203 case kANGLE_DeviceType: 203 case kANGLE_DeviceType:
204 // ANGLE is really the only odd man out 204 // ANGLE is really the only odd man out
205 fBackend = kANGLE_BackEndType; 205 fBackend = kANGLE_BackEndType;
206 break; 206 break;
207 #endif // SK_ANGLE 207 #endif // SK_ANGLE
208 #if SK_COMMAND_BUFFER 208 #if SK_COMMAND_BUFFER
209 case kCommandBuffer_DeviceType: 209 case kCommandBufferES2_DeviceType:
210 // Command buffer is really the only other odd man out :D 210 // Command buffer is really the only other odd man out :D
211 fBackend = kCommandBuffer_BackEndType; 211 fBackend = kCommandBufferES2_BackEndType;
212 break; 212 break;
213 #endif // SK_COMMAND_BUFFER 213 #endif // SK_COMMAND_BUFFER
214 default: 214 default:
215 SkASSERT(false); 215 SkASSERT(false);
216 break; 216 break;
217 } 217 }
218 AttachmentInfo attachmentInfo; 218 AttachmentInfo attachmentInfo;
219 bool result = win->attach(fBackend, msaaSampleCount, &attachmentInfo); 219 bool result = win->attach(fBackend, msaaSampleCount, &attachmentInfo);
220 if (!result) { 220 if (!result) {
221 SkDebugf("Failed to initialize GL"); 221 SkDebugf("Failed to initialize GL");
222 return; 222 return;
223 } 223 }
224 fMSAASampleCount = msaaSampleCount; 224 fMSAASampleCount = msaaSampleCount;
225 225
226 SkASSERT(nullptr == fCurIntf); 226 SkASSERT(nullptr == fCurIntf);
227 SkAutoTUnref<const GrGLInterface> glInterface; 227 SkAutoTUnref<const GrGLInterface> glInterface;
228 switch (win->getDeviceType()) { 228 switch (win->getDeviceType()) {
229 case kRaster_DeviceType: // fallthrough 229 case kRaster_DeviceType: // fallthrough
230 case kGPU_DeviceType: 230 case kGPU_DeviceType:
231 // all these guys use the native interface 231 // all these guys use the native interface
232 glInterface.reset(GrGLCreateNativeInterface()); 232 glInterface.reset(GrGLCreateNativeInterface());
233 break; 233 break;
234 #if SK_ANGLE 234 #if SK_ANGLE
235 case kANGLE_DeviceType: 235 case kANGLE_DeviceType:
236 glInterface.reset(GrGLCreateANGLEInterface()); 236 glInterface.reset(GrGLCreateANGLEInterface());
237 break; 237 break;
238 #endif // SK_ANGLE 238 #endif // SK_ANGLE
239 #if SK_COMMAND_BUFFER 239 #if SK_COMMAND_BUFFER
240 case kCommandBuffer_DeviceType: 240 case kCommandBufferES2_DeviceType:
241 glInterface.reset(GrGLCreateCommandBufferInterface()); 241 glInterface.reset(GrGLCreateCommandBufferInterface());
242 break; 242 break;
243 #endif // SK_COMMAND_BUFFER 243 #endif // SK_COMMAND_BUFFER
244 default: 244 default:
245 SkASSERT(false); 245 SkASSERT(false);
246 break; 246 break;
247 } 247 }
248 248
249 // Currently SampleApp does not use NVPR. TODO: Provide an NVPR device t ype that is skipped 249 // Currently SampleApp does not use NVPR. TODO: Provide an NVPR device t ype that is skipped
250 // when the driver doesn't support NVPR. 250 // when the driver doesn't support NVPR.
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 685
686 static inline SampleWindow::DeviceType cycle_devicetype(SampleWindow::DeviceType ct) { 686 static inline SampleWindow::DeviceType cycle_devicetype(SampleWindow::DeviceType ct) {
687 static const SampleWindow::DeviceType gCT[] = { 687 static const SampleWindow::DeviceType gCT[] = {
688 SampleWindow::kRaster_DeviceType 688 SampleWindow::kRaster_DeviceType
689 #if SK_SUPPORT_GPU 689 #if SK_SUPPORT_GPU
690 , SampleWindow::kGPU_DeviceType 690 , SampleWindow::kGPU_DeviceType
691 #if SK_ANGLE 691 #if SK_ANGLE
692 , SampleWindow::kANGLE_DeviceType 692 , SampleWindow::kANGLE_DeviceType
693 #endif // SK_ANGLE 693 #endif // SK_ANGLE
694 #if SK_COMMAND_BUFFER 694 #if SK_COMMAND_BUFFER
695 , SampleWindow::kCommandBuffer_DeviceType 695 , SampleWindow::kCommandBufferES2_DeviceType
696 #endif // SK_COMMAND_BUFFER 696 #endif // SK_COMMAND_BUFFER
697 #endif // SK_SUPPORT_GPU 697 #endif // SK_SUPPORT_GPU
698 }; 698 };
699 static_assert(SK_ARRAY_COUNT(gCT) == SampleWindow::kDeviceTypeCnt, "array_si ze_mismatch"); 699 static_assert(SK_ARRAY_COUNT(gCT) == SampleWindow::kDeviceTypeCnt, "array_si ze_mismatch");
700 return gCT[ct]; 700 return gCT[ct];
701 } 701 }
702 702
703 static SkString getSampleTitle(const SkViewFactory* sampleFactory) { 703 static SkString getSampleTitle(const SkViewFactory* sampleFactory) {
704 SkView* view = (*sampleFactory)(); 704 SkView* view = (*sampleFactory)();
705 SkString title; 705 SkString title;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 } 852 }
853 #endif 853 #endif
854 854
855 #if DEFAULT_TO_GPU 855 #if DEFAULT_TO_GPU
856 fDeviceType = kGPU_DeviceType; 856 fDeviceType = kGPU_DeviceType;
857 #endif 857 #endif
858 #if SK_ANGLE && DEFAULT_TO_ANGLE 858 #if SK_ANGLE && DEFAULT_TO_ANGLE
859 fDeviceType = kANGLE_DeviceType; 859 fDeviceType = kANGLE_DeviceType;
860 #endif 860 #endif
861 #if SK_COMMAND_BUFFER && DEFAULT_TO_COMMAND_BUFFER 861 #if SK_COMMAND_BUFFER && DEFAULT_TO_COMMAND_BUFFER
862 fDeviceType = kCommandBuffer_DeviceType; 862 fDeviceType = kCommandBufferES2_DeviceType;
863 #endif 863 #endif
864 864
865 fUseClip = false; 865 fUseClip = false;
866 fUsePicture = false; 866 fUsePicture = false;
867 fAnimating = false; 867 fAnimating = false;
868 fRotate = false; 868 fRotate = false;
869 fPerspAnim = false; 869 fPerspAnim = false;
870 fRequestGrabImage = false; 870 fRequestGrabImage = false;
871 fTilingMode = kNo_Tiling; 871 fTilingMode = kNo_Tiling;
872 fMeasureFPS = false; 872 fMeasureFPS = false;
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
2303 #ifdef SK_BUILD_FOR_MAC 2303 #ifdef SK_BUILD_FOR_MAC
2304 setenv("ANDROID_ROOT", "/android/device/data", 0); 2304 setenv("ANDROID_ROOT", "/android/device/data", 0);
2305 #endif 2305 #endif
2306 SkGraphics::Init(); 2306 SkGraphics::Init();
2307 SkEvent::Init(); 2307 SkEvent::Init();
2308 } 2308 }
2309 2309
2310 void application_term() { 2310 void application_term() {
2311 SkEvent::Term(); 2311 SkEvent::Term();
2312 } 2312 }
OLDNEW
« no previous file with comments | « samplecode/SampleApp.h ('k') | src/gpu/GrContextFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698