Make NVPR a GL context option instead of a GL context

Make NVPR a GL context option instead of a GL context.
This may enable NVPR to be run with command buffer
interface.

No functionality change in DM or nanobench. NVPR can
only be run with normal GL APIs.

BUG=skia:2992

Committed: https://skia.googlesource.com/skia/+/eeebdb538d476c1bfc8b63a946094ca1b505ecd1

Committed: https://skia.googlesource.com/skia/+/64492c43c3faee7ab0f69b1c84e0267616f85e52

Review URL: https://codereview.chromium.org/1448883002
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index a4fb028..2503dc3 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -789,12 +789,14 @@
 DEFINE_bool(gpuStats, false, "Append GPU stats to the log for each GPU task?");
 
 GPUSink::GPUSink(GrContextFactory::GLContextType ct,
-                 GrGLStandard api,
+                 GrContextFactory::GLContextOptions options,
+                 GrGLStandard gpuAPI,
                  int samples,
                  bool diText,
                  bool threaded)
     : fContextType(ct)
-    , fGpuAPI(api)
+    , fContextOptions(options)
+    , fGpuAPI(gpuAPI)
     , fSampleCount(samples)
     , fUseDIText(diText)
     , fThreaded(threaded) {}
@@ -810,24 +812,26 @@
 DEFINE_bool(batchBounds, false, "Draw a wireframe bounds of each GrBatch.");
 
 Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) const {
-    GrContextOptions options;
+    GrContextOptions grOptions;
     if (FLAGS_imm) {
-        options.fImmediateMode = true;
+        grOptions.fImmediateMode = true;
     }
     if (FLAGS_batchClip) {
-        options.fClipBatchToBounds = true;
+        grOptions.fClipBatchToBounds = true;
     }
-    if (FLAGS_batchBounds) {
-        options.fDrawBatchBounds = true;
-    }
-    src.modifyGrContextOptions(&options);
 
-    GrContextFactory factory(options);
+    if (FLAGS_batchBounds) {
+        grOptions.fDrawBatchBounds = true;
+    }
+    src.modifyGrContextOptions(&grOptions);
+
+    GrContextFactory factory(grOptions);
     const SkISize size = src.size();
     const SkImageInfo info =
         SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul_SkAlphaType);
     SkAutoTUnref<SkSurface> surface(
-            NewGpuSurface(&factory, fContextType, fGpuAPI, info, fSampleCount, fUseDIText));
+            NewGpuSurface(&factory, fContextType, fContextOptions, fGpuAPI, info, fSampleCount,
+                          fUseDIText));
     if (!surface) {
         return "Could not create a surface.";
     }