Add the ability to enable/disable GPU path renderers
Adds a bitfield to GrContextOptions that masks out path renderers.
Adds commandline flags support to set this bitfield in tools apps.
Removes GrGLInterfaceRemoveNVPR since we can now accomplish the same
thing in the context options.
BUG=skia:
Change-Id: Icf2a4df36374b3ba2f69ebf0db56e8aedd6cf65f
Reviewed-on: https://skia-review.googlesource.com/8786
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 57185d2..092910a 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -16,6 +16,7 @@
#include "SkATrace.h"
#include "SkCanvas.h"
#include "SkCommandLineFlags.h"
+#include "SkCommonFlagsPathRenderer.h"
#include "SkDashPathEffect.h"
#include "SkGraphics.h"
#include "SkImagePriv.h"
@@ -134,6 +135,8 @@
static DEFINE_bool(atrace, false, "Enable support for using ATrace. ATrace is only supported on Android.");
+DEFINE_pathrenderer_flag;
+
const char *kBackendTypeStrings[sk_app::Window::kBackendTypeCount] = {
" [OpenGL]",
#ifdef SK_VULKAN
diff --git a/tools/viewer/sk_app/GLWindowContext.cpp b/tools/viewer/sk_app/GLWindowContext.cpp
index 501f272..fac0c32 100644
--- a/tools/viewer/sk_app/GLWindowContext.cpp
+++ b/tools/viewer/sk_app/GLWindowContext.cpp
@@ -7,6 +7,7 @@
*/
#include "GrContext.h"
+#include "SkCommonFlagsPathRenderer.h"
#include "SkSurface.h"
#include "GLWindowContext.h"
@@ -30,12 +31,13 @@
void GLWindowContext::initializeContext() {
this->onInitializeContext();
- sk_sp<const GrGLInterface> glInterface;
- glInterface.reset(GrGLCreateNativeInterface());
- fBackendContext.reset(GrGLInterfaceRemoveNVPR(glInterface.get()));
-
SkASSERT(nullptr == fContext);
- fContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext)fBackendContext.get());
+
+ GrContextOptions ctxOptions;
+ ctxOptions.fGpuPathRenderers = CollectGpuPathRenderersFromFlags();
+ fBackendContext.reset(GrGLCreateNativeInterface());
+ fContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext)fBackendContext.get(),
+ ctxOptions);
// We may not have real sRGB support (ANGLE, in particular), so check for
// that, and fall back to L32:
diff --git a/tools/viewer/sk_app/VulkanWindowContext.cpp b/tools/viewer/sk_app/VulkanWindowContext.cpp
index b4e6676..65273b0 100644
--- a/tools/viewer/sk_app/VulkanWindowContext.cpp
+++ b/tools/viewer/sk_app/VulkanWindowContext.cpp
@@ -8,6 +8,7 @@
#include "GrContext.h"
#include "GrRenderTarget.h"
+#include "SkCommonFlagsPathRenderer.h"
#include "SkAutoMalloc.h"
#include "SkSurface.h"
#include "VulkanWindowContext.h"
@@ -61,7 +62,10 @@
GET_DEV_PROC(AcquireNextImageKHR);
GET_DEV_PROC(QueuePresentKHR);
- fContext = GrContext::Create(kVulkan_GrBackend, (GrBackendContext) fBackendContext.get());
+ GrContextOptions ctxOptions;
+ ctxOptions.fGpuPathRenderers = CollectGpuPathRenderersFromFlags();
+ fContext = GrContext::Create(kVulkan_GrBackend, (GrBackendContext) fBackendContext.get(),
+ ctxOptions);
fSurface = createVkSurface(instance);
if (VK_NULL_HANDLE == fSurface) {