Add support for glMapBufferRange. Use glMapBufferRange and glMapBufferSubData.

BUG=skia:2402

Committed: http://code.google.com/p/skia/source/detail?r=14533

R=robertphillips@google.com, djsollen@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/243413002

git-svn-id: http://skia.googlecode.com/svn/trunk@14564 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrDrawTargetCaps.h b/src/gpu/GrDrawTargetCaps.h
index a77bce4..648b5c3 100644
--- a/src/gpu/GrDrawTargetCaps.h
+++ b/src/gpu/GrDrawTargetCaps.h
@@ -37,12 +37,25 @@
     bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; }
     bool geometryShaderSupport() const { return fGeometryShaderSupport; }
     bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; }
-    bool bufferLockSupport() const { return fBufferLockSupport; }
     bool pathRenderingSupport() const { return fPathRenderingSupport; }
     bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; }
     bool discardRenderTargetSupport() const { return fDiscardRenderTargetSupport; }
     bool gpuTracingSupport() const { return fGpuTracingSupport; }
 
+    /**
+     * Indicates whether GPU->CPU memory mapping for GPU resources such as vertex buffers and
+     * textures allows partial mappings or full mappings.
+     */
+    enum MapFlags {
+        kNone_MapFlags   = 0x0,       //<! Cannot map the resource.
+
+        kCanMap_MapFlag  = 0x1,       //<! The resource can be mapped. Must be set for any of
+                                      //   the other flags to have meaning.k
+        kSubset_MapFlag  = 0x2,       //<! The resource can be partially mapped.
+    };
+
+    uint32_t mapBufferFlags() const { return fMapBufferFlags; }
+
     // Scratch textures not being reused means that those scratch textures
     // that we upload to (i.e., don't have a render target) will not be
     // recycled in the texture cache. This is to prevent ghosting by drivers
@@ -69,13 +82,14 @@
     bool fShaderDerivativeSupport   : 1;
     bool fGeometryShaderSupport     : 1;
     bool fDualSourceBlendingSupport : 1;
-    bool fBufferLockSupport         : 1;
     bool fPathRenderingSupport      : 1;
     bool fDstReadInShaderSupport    : 1;
     bool fDiscardRenderTargetSupport: 1;
     bool fReuseScratchTextures      : 1;
     bool fGpuTracingSupport         : 1;
 
+    uint32_t fMapBufferFlags;
+
     int fMaxRenderTargetSize;
     int fMaxTextureSize;
     int fMaxSampleCount;