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

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: egl destruction update 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
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // all these guys use the native backend 180 // all these guys use the native backend
181 fBackend = kNativeGL_BackEndType; 181 fBackend = kNativeGL_BackEndType;
182 break; 182 break;
183 #if SK_ANGLE 183 #if SK_ANGLE
184 case kANGLE_DeviceType: 184 case kANGLE_DeviceType:
185 // ANGLE is really the only odd man out 185 // ANGLE is really the only odd man out
186 fBackend = kANGLE_BackEndType; 186 fBackend = kANGLE_BackEndType;
187 break; 187 break;
188 #endif // SK_ANGLE 188 #endif // SK_ANGLE
189 #if SK_COMMAND_BUFFER 189 #if SK_COMMAND_BUFFER
190 case kCommandBuffer_DeviceType: 190 case kCommandBufferES2_DeviceType:
191 // Command buffer is really the only other odd man out :D 191 // Command buffer is really the only other odd man out :D
192 fBackend = kCommandBuffer_BackEndType; 192 fBackend = kCommandBufferES2_BackEndType;
193 break; 193 break;
194 #endif // SK_COMMAND_BUFFER 194 #endif // SK_COMMAND_BUFFER
195 default: 195 default:
196 SkASSERT(false); 196 SkASSERT(false);
197 break; 197 break;
198 } 198 }
199 AttachmentInfo attachmentInfo; 199 AttachmentInfo attachmentInfo;
200 bool result = win->attach(fBackend, msaaSampleCount, &attachmentInfo); 200 bool result = win->attach(fBackend, msaaSampleCount, &attachmentInfo);
201 if (!result) { 201 if (!result) {
202 SkDebugf("Failed to initialize GL"); 202 SkDebugf("Failed to initialize GL");
203 return; 203 return;
204 } 204 }
205 fMSAASampleCount = msaaSampleCount; 205 fMSAASampleCount = msaaSampleCount;
206 206
207 SkASSERT(nullptr == fCurIntf); 207 SkASSERT(nullptr == fCurIntf);
208 SkAutoTUnref<const GrGLInterface> glInterface; 208 SkAutoTUnref<const GrGLInterface> glInterface;
209 switch (win->getDeviceType()) { 209 switch (win->getDeviceType()) {
210 case kRaster_DeviceType: // fallthrough 210 case kRaster_DeviceType: // fallthrough
211 case kGPU_DeviceType: 211 case kGPU_DeviceType:
212 // all these guys use the native interface 212 // all these guys use the native interface
213 glInterface.reset(GrGLCreateNativeInterface()); 213 glInterface.reset(GrGLCreateNativeInterface());
214 break; 214 break;
215 #if SK_ANGLE 215 #if SK_ANGLE
216 case kANGLE_DeviceType: 216 case kANGLE_DeviceType:
217 glInterface.reset(GrGLCreateANGLEInterface()); 217 glInterface.reset(GrGLCreateANGLEInterface());
218 break; 218 break;
219 #endif // SK_ANGLE 219 #endif // SK_ANGLE
220 #if SK_COMMAND_BUFFER 220 #if SK_COMMAND_BUFFER
221 case kCommandBuffer_DeviceType: 221 case kCommandBufferES2_DeviceType:
222 glInterface.reset(GrGLCreateCommandBufferInterface()); 222 glInterface.reset(GrGLCreateCommandBufferInterface());
223 break; 223 break;
224 #endif // SK_COMMAND_BUFFER 224 #endif // SK_COMMAND_BUFFER
225 default: 225 default:
226 SkASSERT(false); 226 SkASSERT(false);
227 break; 227 break;
228 } 228 }
229 229
230 // Currently SampleApp does not use NVPR. TODO: Provide an NVPR device t ype that is skipped 230 // Currently SampleApp does not use NVPR. TODO: Provide an NVPR device t ype that is skipped
231 // when the driver doesn't support NVPR. 231 // when the driver doesn't support NVPR.
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 666
667 static inline SampleWindow::DeviceType cycle_devicetype(SampleWindow::DeviceType ct) { 667 static inline SampleWindow::DeviceType cycle_devicetype(SampleWindow::DeviceType ct) {
668 static const SampleWindow::DeviceType gCT[] = { 668 static const SampleWindow::DeviceType gCT[] = {
669 SampleWindow::kRaster_DeviceType 669 SampleWindow::kRaster_DeviceType
670 #if SK_SUPPORT_GPU 670 #if SK_SUPPORT_GPU
671 , SampleWindow::kGPU_DeviceType 671 , SampleWindow::kGPU_DeviceType
672 #if SK_ANGLE 672 #if SK_ANGLE
673 , SampleWindow::kANGLE_DeviceType 673 , SampleWindow::kANGLE_DeviceType
674 #endif // SK_ANGLE 674 #endif // SK_ANGLE
675 #if SK_COMMAND_BUFFER 675 #if SK_COMMAND_BUFFER
676 , SampleWindow::kCommandBuffer_DeviceType 676 , SampleWindow::kCommandBufferES2_DeviceType
677 #endif // SK_COMMAND_BUFFER 677 #endif // SK_COMMAND_BUFFER
678 #endif // SK_SUPPORT_GPU 678 #endif // SK_SUPPORT_GPU
679 }; 679 };
680 static_assert(SK_ARRAY_COUNT(gCT) == SampleWindow::kDeviceTypeCnt, "array_si ze_mismatch"); 680 static_assert(SK_ARRAY_COUNT(gCT) == SampleWindow::kDeviceTypeCnt, "array_si ze_mismatch");
681 return gCT[ct]; 681 return gCT[ct];
682 } 682 }
683 683
684 static SkString getSampleTitle(const SkViewFactory* sampleFactory) { 684 static SkString getSampleTitle(const SkViewFactory* sampleFactory) {
685 SkView* view = (*sampleFactory)(); 685 SkView* view = (*sampleFactory)();
686 SkString title; 686 SkString title;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 } 832 }
833 #endif 833 #endif
834 834
835 #if DEFAULT_TO_GPU 835 #if DEFAULT_TO_GPU
836 fDeviceType = kGPU_DeviceType; 836 fDeviceType = kGPU_DeviceType;
837 #endif 837 #endif
838 #if SK_ANGLE && DEFAULT_TO_ANGLE 838 #if SK_ANGLE && DEFAULT_TO_ANGLE
839 fDeviceType = kANGLE_DeviceType; 839 fDeviceType = kANGLE_DeviceType;
840 #endif 840 #endif
841 #if SK_COMMAND_BUFFER && DEFAULT_TO_COMMAND_BUFFER 841 #if SK_COMMAND_BUFFER && DEFAULT_TO_COMMAND_BUFFER
842 fDeviceType = kCommandBuffer_DeviceType; 842 fDeviceType = kCommandBufferES2_DeviceType;
843 #endif 843 #endif
844 844
845 fUseClip = false; 845 fUseClip = false;
846 fUsePicture = false; 846 fUsePicture = false;
847 fAnimating = false; 847 fAnimating = false;
848 fRotate = false; 848 fRotate = false;
849 fPerspAnim = false; 849 fPerspAnim = false;
850 fRequestGrabImage = false; 850 fRequestGrabImage = false;
851 fTilingMode = kNo_Tiling; 851 fTilingMode = kNo_Tiling;
852 fMeasureFPS = false; 852 fMeasureFPS = false;
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 #ifdef SK_BUILD_FOR_MAC 2262 #ifdef SK_BUILD_FOR_MAC
2263 setenv("ANDROID_ROOT", "/android/device/data", 0); 2263 setenv("ANDROID_ROOT", "/android/device/data", 0);
2264 #endif 2264 #endif
2265 SkGraphics::Init(); 2265 SkGraphics::Init();
2266 SkEvent::Init(); 2266 SkEvent::Init();
2267 } 2267 }
2268 2268
2269 void application_term() { 2269 void application_term() {
2270 SkEvent::Term(); 2270 SkEvent::Term();
2271 } 2271 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698