Index: samplecode/SampleApp.cpp |
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp |
index 44daeb63a1d110d880d47ee922881fdfcc06b610..52050071146bc071c56d26b76dfe8eb6f015b28d 100644 |
--- a/samplecode/SampleApp.cpp |
+++ b/samplecode/SampleApp.cpp |
@@ -81,7 +81,9 @@ public: |
SkTCPServer gServer; |
#endif |
-#if SK_ANGLE |
+#if SK_COMMAND_BUFFER |
+#define DEFAULT_TO_COMMAND_BUFFER 1 |
+#elif SK_ANGLE |
//#define DEFAULT_TO_ANGLE 1 |
#else |
#define DEFAULT_TO_GPU 0 // if 1 default rendering is on GPU |
@@ -197,6 +199,12 @@ public: |
fBackend = kANGLE_BackEndType; |
break; |
#endif // SK_ANGLE |
+#if SK_COMMAND_BUFFER |
+ case kCommandBuffer_DeviceType: |
+ // Command buffer is really the only other odd man out :D |
+ fBackend = kCommandBuffer_BackEndType; |
+ break; |
+#endif // SK_COMMAND_BUFFER |
default: |
SkASSERT(false); |
break; |
@@ -223,6 +231,11 @@ public: |
glInterface.reset(GrGLCreateANGLEInterface()); |
break; |
#endif // SK_ANGLE |
+#if SK_COMMAND_BUFFER |
+ case kCommandBuffer_DeviceType: |
+ glInterface.reset(GrGLCreateCommandBufferInterface()); |
+ break; |
+#endif // SK_COMMAND_BUFFER |
default: |
SkASSERT(false); |
break; |
@@ -670,6 +683,9 @@ static inline SampleWindow::DeviceType cycle_devicetype(SampleWindow::DeviceType |
#if SK_ANGLE |
SampleWindow::kANGLE_DeviceType, |
#endif // SK_ANGLE |
+#if SK_COMMAND_BUFFER |
+ SampleWindow::kCommandBuffer_DeviceType, |
+#endif // SK_COMMAND_BUFFER |
#endif // SK_SUPPORT_GPU |
SampleWindow::kRaster_DeviceType, |
}; |
@@ -790,6 +806,9 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev |
#if SK_ANGLE && DEFAULT_TO_ANGLE |
fDeviceType = kANGLE_DeviceType; |
#endif |
+#if SK_COMMAND_BUFFER && DEFAULT_TO_COMMAND_BUFFER |
+ fDeviceType = kCommandBuffer_DeviceType; |
+#endif |
fUseClip = false; |
fAnimating = false; |
@@ -830,6 +849,9 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev |
#if SK_ANGLE |
"ANGLE", |
#endif |
+#if SK_COMMAND_BUFFER |
+ "Command Buffer", |
+#endif |
nullptr); |
fAppMenu->assignKeyEquivalentToItem(itemID, 'd'); |
itemID = fAppMenu->appendTriState("AA", "AA", sinkID, fAAState); |
@@ -1939,6 +1961,9 @@ static const char* gDeviceTypePrefix[] = { |
#if SK_ANGLE |
"angle: ", |
#endif // SK_ANGLE |
+#if SK_COMMAND_BUFFER |
+ "command buffer: ", |
+#endif // SK_COMMAND_BUFFER |
#endif // SK_SUPPORT_GPU |
}; |
static_assert(SK_ARRAY_COUNT(gDeviceTypePrefix) == SampleWindow::kDeviceTypeCnt, |