Add support for a new GPU interface

Review URL: https://codereview.chromium.org/1290813002
diff --git a/src/gpu/GrContextFactory.cpp b/src/gpu/GrContextFactory.cpp
index 6ed2c25..1f37130 100755
--- a/src/gpu/GrContextFactory.cpp
+++ b/src/gpu/GrContextFactory.cpp
@@ -76,7 +76,11 @@
 
     glCtx->makeCurrent();
     GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get());
+#ifdef SK_VULKAN
+    grCtx.reset(GrContext::Create(kVulkan_GrBackend, p3dctx, fGlobalOptions));
+#else
     grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions));
+#endif
     if (!grCtx.get()) {
         return NULL;
     }
diff --git a/src/gpu/GrGpuFactory.cpp b/src/gpu/GrGpuFactory.cpp
index 3001a0d..854e484 100644
--- a/src/gpu/GrGpuFactory.cpp
+++ b/src/gpu/GrGpuFactory.cpp
@@ -13,8 +13,13 @@
 #include "gl/GrGLConfig.h"
 #include "gl/GrGLGpu.h"
 
-static const int kMaxNumBackends = 4;
-static CreateGpuProc gGpuFactories[kMaxNumBackends] = {GrGLGpu::Create, NULL, NULL, NULL};
+static CreateGpuProc gGpuFactories[kBackendCount] = { GrGLGpu::Create, NULL };
+
+#ifdef SK_VULKAN
+extern GrGpu* vk_gpu_create(GrBackendContext backendContext, const GrContextOptions& options,
+                            GrContext* context);
+GrGpuFactoryRegistrar gVkGpuFactoryProc(kVulkan_GrBackend, vk_gpu_create);
+#endif
 
 GrGpuFactoryRegistrar::GrGpuFactoryRegistrar(int i, CreateGpuProc proc) {
     gGpuFactories[i] = proc;
@@ -24,7 +29,7 @@
                      GrBackendContext backendContext,
                      const GrContextOptions& options,
                      GrContext* context) {
-    SkASSERT((int)backend < kMaxNumBackends);
+    SkASSERT((int)backend < kBackendCount);
     if (!gGpuFactories[backend]) {
         return NULL;
     }