Revert of Add support for glMapBufferRange. Use glMapBufferRange and glMapBufferSubDa...
authordjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 2 May 2014 17:44:34 +0000 (17:44 +0000)
committerdjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 2 May 2014 17:44:34 +0000 (17:44 +0000)
Reason for revert:
This is firing an assert on many of the Android debug bots

Original issue's description:
> Add support for glMapBufferRange. Use glMapBufferRange and glMapBufferSubData.
>
> BUG=skia:2402
>
> Committed: http://code.google.com/p/skia/source/detail?r=14533

git-svn-id: http://skia.googlecode.com/svn/trunk@14541 2bbb7eff-a529-9590-31e7-b0007b416f81

18 files changed:
include/gpu/gl/GrGLFunctions.h
include/gpu/gl/GrGLInterface.h
src/gpu/GrBufferAllocPool.cpp
src/gpu/GrDrawTarget.cpp
src/gpu/GrDrawTargetCaps.h
src/gpu/gl/GrGLAssembleInterface.cpp
src/gpu/gl/GrGLBufferImpl.cpp
src/gpu/gl/GrGLBufferImpl.h
src/gpu/gl/GrGLCaps.cpp
src/gpu/gl/GrGLCaps.h
src/gpu/gl/GrGLCreateNullInterface.cpp
src/gpu/gl/GrGLDefines.h
src/gpu/gl/GrGLInterface.cpp
src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp
src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
src/gpu/gl/debug/GrBufferObj.h
src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp

index 51db053276c41f426ed0f8a110e2ecdf5d08f027..3f8736555ab6a2d79d3324885ac162d36ee56965 100644 (file)
@@ -111,7 +111,6 @@ extern "C" {
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEndQueryProc)(GrGLenum target);
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLFinishProc)();
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLFlushProc)();
-    typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLFlushMappedBufferRangeProc)(GrGLenum target, GrGLintptr offset, GrGLsizeiptr length);
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLFramebufferRenderbufferProc)(GrGLenum target, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer);
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLFramebufferTexture2DProc)(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level);
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLFramebufferTexture2DMultisampleProc)(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level, GrGLsizei samples);
@@ -151,7 +150,6 @@ extern "C" {
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLLineWidthProc)(GrGLfloat width);
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLLinkProgramProc)(GrGLuint program);
     typedef GrGLvoid* (GR_GL_FUNCTION_TYPE* GrGLMapBufferProc)(GrGLenum target, GrGLenum access);
-    typedef GrGLvoid* (GR_GL_FUNCTION_TYPE* GrGLMapBufferRangeProc)(GrGLenum target, GrGLintptr offset, GrGLsizeiptr length, GrGLbitfield access);
     typedef GrGLvoid* (GR_GL_FUNCTION_TYPE* GrGLMapBufferSubDataProc)(GrGLuint target, GrGLintptr offset, GrGLsizeiptr size, GrGLenum access);
     typedef GrGLvoid* (GR_GL_FUNCTION_TYPE* GrGLMapTexSubImage2DProc)(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLenum access);
     typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPixelStoreiProc)(GrGLenum pname, GrGLint param);
index 2b33e8e64186edefba8d53e201e38c8d280e67f9..9070af2aa84e6d2ff0ed8ebcfd8b627840b8da9a 100644 (file)
@@ -192,7 +192,6 @@ public:
         GLPtr<GrGLEndQueryProc> fEndQuery;
         GLPtr<GrGLFinishProc> fFinish;
         GLPtr<GrGLFlushProc> fFlush;
-        GLPtr<GrGLFlushMappedBufferRangeProc> fFlushMappedBufferRange;
         GLPtr<GrGLFramebufferRenderbufferProc> fFramebufferRenderbuffer;
         GLPtr<GrGLFramebufferTexture2DProc> fFramebufferTexture2D;
         GLPtr<GrGLFramebufferTexture2DMultisampleProc> fFramebufferTexture2DMultisample;
@@ -232,7 +231,6 @@ public:
         GLPtr<GrGLLineWidthProc> fLineWidth;
         GLPtr<GrGLLinkProgramProc> fLinkProgram;
         GLPtr<GrGLMapBufferProc> fMapBuffer;
-        GLPtr<GrGLMapBufferRangeProc> fMapBufferRange;
         GLPtr<GrGLMapBufferSubDataProc> fMapBufferSubData;
         GLPtr<GrGLMapTexSubImage2DProc> fMapTexSubImage2D;
         GLPtr<GrGLMatrixLoadfProc> fMatrixLoadf;
index 30d02d953e0b92567c3bd3d691bb986392367902..2dbf3eb283fb37ae40b1f6a54e08267d5e7e0048 100644 (file)
@@ -303,7 +303,7 @@ bool GrBufferAllocPool::createBlock(size_t requestSize) {
     //      threshold (since we don't expect it is likely that we will see more vertex data)
     //      b) If the hint is not set we lock if the buffer size is greater than the threshold.
     bool attemptLock = block.fBuffer->isCPUBacked();
-    if (!attemptLock && GrDrawTargetCaps::kNone_MapFlags != fGpu->caps()->mapBufferFlags()) {
+    if (!attemptLock && fGpu->caps()->bufferLockSupport()) {
         if (fFrequentResetHint) {
             attemptLock = requestSize > GR_GEOM_BUFFER_LOCK_THRESHOLD;
         } else {
@@ -351,7 +351,7 @@ void GrBufferAllocPool::flushCpuData(GrGeometryBuffer* buffer,
     SkASSERT(flushSize <= buffer->sizeInBytes());
     VALIDATE(true);
 
-    if (GrDrawTargetCaps::kNone_MapFlags != fGpu->caps()->mapBufferFlags() &&
+    if (fGpu->caps()->bufferLockSupport() &&
         flushSize > GR_GEOM_BUFFER_LOCK_THRESHOLD) {
         void* data = buffer->lock();
         if (NULL != data) {
index 8b84edd79aecbea970ca057ca45f121a2d75e1cb..5512f174d7c7cd144d17a3b1500bc9f3299e9186 100644 (file)
@@ -1016,14 +1016,13 @@ void GrDrawTargetCaps::reset() {
     fShaderDerivativeSupport = false;
     fGeometryShaderSupport = false;
     fDualSourceBlendingSupport = false;
+    fBufferLockSupport = false;
     fPathRenderingSupport = false;
     fDstReadInShaderSupport = false;
     fDiscardRenderTargetSupport = false;
     fReuseScratchTextures = true;
     fGpuTracingSupport = false;
 
-    fMapBufferFlags = kNone_MapFlags;
-
     fMaxRenderTargetSize = 0;
     fMaxTextureSize = 0;
     fMaxSampleCount = 0;
@@ -1041,14 +1040,13 @@ GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) {
     fShaderDerivativeSupport = other.fShaderDerivativeSupport;
     fGeometryShaderSupport = other.fGeometryShaderSupport;
     fDualSourceBlendingSupport = other.fDualSourceBlendingSupport;
+    fBufferLockSupport = other.fBufferLockSupport;
     fPathRenderingSupport = other.fPathRenderingSupport;
     fDstReadInShaderSupport = other.fDstReadInShaderSupport;
     fDiscardRenderTargetSupport = other.fDiscardRenderTargetSupport;
     fReuseScratchTextures = other.fReuseScratchTextures;
     fGpuTracingSupport = other.fGpuTracingSupport;
 
-    fMapBufferFlags = other.fMapBufferFlags;
-
     fMaxRenderTargetSize = other.fMaxRenderTargetSize;
     fMaxTextureSize = other.fMaxTextureSize;
     fMaxSampleCount = other.fMaxSampleCount;
@@ -1058,26 +1056,6 @@ GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) {
     return *this;
 }
 
-static SkString map_flags_to_string(uint32_t flags) {
-    SkString str;
-    if (GrDrawTargetCaps::kNone_MapFlags == flags) {
-        str = "none";
-    } else {
-        SkASSERT(GrDrawTargetCaps::kCanMap_MapFlag & flags);
-        SkDEBUGCODE(flags &= ~GrDrawTargetCaps::kCanMap_MapFlag);
-        str = "can_map";
-
-        if (GrDrawTargetCaps::kSubset_MapFlag & flags) {
-            str.append(" partial");
-        } else {
-            str.append(" full");
-        }
-        SkDEBUGCODE(flags &= ~GrDrawTargetCaps::kSubset_MapFlag);
-    }
-    SkASSERT(0 == flags); // Make sure we handled all the flags.
-    return str;
-}
-
 SkString GrDrawTargetCaps::dump() const {
     SkString r;
     static const char* gNY[] = {"NO", "YES"};
@@ -1090,6 +1068,7 @@ SkString GrDrawTargetCaps::dump() const {
     r.appendf("Shader Derivative Support    : %s\n", gNY[fShaderDerivativeSupport]);
     r.appendf("Geometry Shader Support      : %s\n", gNY[fGeometryShaderSupport]);
     r.appendf("Dual Source Blending Support : %s\n", gNY[fDualSourceBlendingSupport]);
+    r.appendf("Buffer Lock Support          : %s\n", gNY[fBufferLockSupport]);
     r.appendf("Path Rendering Support       : %s\n", gNY[fPathRenderingSupport]);
     r.appendf("Dst Read In Shader Support   : %s\n", gNY[fDstReadInShaderSupport]);
     r.appendf("Discard Render Target Support: %s\n", gNY[fDiscardRenderTargetSupport]);
@@ -1099,8 +1078,6 @@ SkString GrDrawTargetCaps::dump() const {
     r.appendf("Max Render Target Size       : %d\n", fMaxRenderTargetSize);
     r.appendf("Max Sample Count             : %d\n", fMaxSampleCount);
 
-    r.appendf("Map Buffer Support           : %s\n", map_flags_to_string(fMapBufferFlags).c_str());
-
     static const char* kConfigNames[] = {
         "Unknown",  // kUnknown_GrPixelConfig
         "Alpha8",   // kAlpha_8_GrPixelConfig,
index 648b5c36be15a523b96e47fc7c18d487715fb0c8..a77bce4430153d373f142d8e366b4ebbe7875d2e 100644 (file)
@@ -37,25 +37,12 @@ public:
     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
@@ -82,14 +69,13 @@ protected:
     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;
index e4337259a22de23161fc1b6fd228e0ac1b97defd..aed11e539f74d70674c2830827522f3f50f570af 100644 (file)
@@ -173,11 +173,6 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
         GET_PROC(DeleteVertexArrays);
     }
 
-    if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_map_buffer_range")) {
-        GET_PROC(MapBufferRange);
-        GET_PROC(FlushMappedBufferRange);
-    }
-
     // First look for GL3.0 FBO or GL_ARB_framebuffer_object (same since
     // GL_ARB_framebuffer_object doesn't use ARB suffix.)
     if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_framebuffer_object")) {
index 3dea4f5ac76c512c362e88fbc9dba1dcca6e6f78..3c75b9fe6a1fefa1af8a696736dfbb58808dceba 100644 (file)
@@ -26,22 +26,20 @@ GrGLBufferImpl::GrGLBufferImpl(GrGpuGL* gpu, const Desc& desc, GrGLenum bufferTy
     , fLockPtr(NULL) {
     if (0 == desc.fID) {
         fCPUData = sk_malloc_flags(desc.fSizeInBytes, SK_MALLOC_THROW);
-        fGLSizeInBytes = 0;
     } else {
         fCPUData = NULL;
-        // We assume that the GL buffer was created at the desc's size initially.
-        fGLSizeInBytes = fDesc.fSizeInBytes;
     }
     VALIDATE();
 }
 
 void GrGLBufferImpl::release(GrGpuGL* gpu) {
-    VALIDATE();
     // make sure we've not been abandoned or already released
     if (NULL != fCPUData) {
+        VALIDATE();
         sk_free(fCPUData);
         fCPUData = NULL;
     } else if (fDesc.fID && !fDesc.fIsWrapped) {
+        VALIDATE();
         GL_CALL(gpu, DeleteBuffers(1, &fDesc.fID));
         if (GR_GL_ARRAY_BUFFER == fBufferType) {
             gpu->notifyVertexBufferDelete(fDesc.fID);
@@ -50,19 +48,15 @@ void GrGLBufferImpl::release(GrGpuGL* gpu) {
             gpu->notifyIndexBufferDelete(fDesc.fID);
         }
         fDesc.fID = 0;
-        fGLSizeInBytes = 0;
     }
     fLockPtr = NULL;
-    VALIDATE();
 }
 
 void GrGLBufferImpl::abandon() {
     fDesc.fID = 0;
-    fGLSizeInBytes = 0;
     fLockPtr = NULL;
     sk_free(fCPUData);
     fCPUData = NULL;
-    VALIDATE();
 }
 
 void GrGLBufferImpl::bind(GrGpuGL* gpu) const {
@@ -73,7 +67,6 @@ void GrGLBufferImpl::bind(GrGpuGL* gpu) const {
         SkASSERT(GR_GL_ELEMENT_ARRAY_BUFFER == fBufferType);
         gpu->bindIndexBufferAndDefaultVertexArray(fDesc.fID);
     }
-    VALIDATE();
 }
 
 void* GrGLBufferImpl::lock(GrGpuGL* gpu) {
@@ -81,55 +74,17 @@ void* GrGLBufferImpl::lock(GrGpuGL* gpu) {
     SkASSERT(!this->isLocked());
     if (0 == fDesc.fID) {
         fLockPtr = fCPUData;
-    } else {
-        switch (gpu->glCaps().mapBufferType()) {
-            case GrGLCaps::kNone_MapBufferType:
-                VALIDATE();
-                return NULL;
-            case GrGLCaps::kMapBuffer_MapBufferType:
-                this->bind(gpu);
-                // Let driver know it can discard the old data
-                if (GR_GL_USE_BUFFER_DATA_NULL_HINT || fDesc.fSizeInBytes != fGLSizeInBytes) {
-                    fGLSizeInBytes = fDesc.fSizeInBytes;
-                    GL_CALL(gpu,
-                            BufferData(fBufferType, fGLSizeInBytes, NULL,
-                                       fDesc.fDynamic ? DYNAMIC_USAGE_PARAM : GR_GL_STATIC_DRAW));
-                }
-                GR_GL_CALL_RET(gpu->glInterface(), fLockPtr,
-                               MapBuffer(fBufferType, GR_GL_WRITE_ONLY));
-                break;
-            case GrGLCaps::kMapBufferRange_MapBufferType: {
-                this->bind(gpu);
-                // Make sure the GL buffer size agrees with fDesc before mapping.
-                if (fDesc.fSizeInBytes != fGLSizeInBytes) {
-                    fGLSizeInBytes = fDesc.fSizeInBytes;
-                    GL_CALL(gpu,
-                            BufferData(fBufferType, fGLSizeInBytes, NULL,
-                                       fDesc.fDynamic ? DYNAMIC_USAGE_PARAM : GR_GL_STATIC_DRAW));
-                }
-                static const GrGLbitfield kAccess = GR_GL_MAP_INVALIDATE_BUFFER_BIT |
-                                                    GR_GL_MAP_WRITE_BIT;
-                GR_GL_CALL_RET(gpu->glInterface(),
-                               fLockPtr,
-                               MapBufferRange(fBufferType, 0, fGLSizeInBytes, kAccess));
-                break;
-            }
-            case GrGLCaps::kChromium_MapBufferType:
-                this->bind(gpu);
-                // Make sure the GL buffer size agrees with fDesc before mapping.
-                if (fDesc.fSizeInBytes != fGLSizeInBytes) {
-                    fGLSizeInBytes = fDesc.fSizeInBytes;
-                    GL_CALL(gpu,
-                            BufferData(fBufferType, fGLSizeInBytes, NULL,
-                                       fDesc.fDynamic ? DYNAMIC_USAGE_PARAM : GR_GL_STATIC_DRAW));
-                }
-                GR_GL_CALL_RET(gpu->glInterface(),
-                               fLockPtr,
-                               MapBufferSubData(fBufferType, 0, fGLSizeInBytes, GR_GL_WRITE_ONLY));
-                break;
-        }
+    } else if (gpu->caps()->bufferLockSupport()) {
+        this->bind(gpu);
+        // Let driver know it can discard the old data
+        GL_CALL(gpu, BufferData(fBufferType,
+                                (GrGLsizeiptr) fDesc.fSizeInBytes,
+                                NULL,
+                                fDesc.fDynamic ? DYNAMIC_USAGE_PARAM : GR_GL_STATIC_DRAW));
+        GR_GL_CALL_RET(gpu->glInterface(),
+                       fLockPtr,
+                       MapBuffer(fBufferType, GR_GL_WRITE_ONLY));
     }
-    VALIDATE();
     return fLockPtr;
 }
 
@@ -137,20 +92,9 @@ void GrGLBufferImpl::unlock(GrGpuGL* gpu) {
     VALIDATE();
     SkASSERT(this->isLocked());
     if (0 != fDesc.fID) {
-        switch (gpu->glCaps().mapBufferType()) {
-            case GrGLCaps::kNone_MapBufferType:
-                SkDEBUGFAIL("Shouldn't get here.");
-                return;
-            case GrGLCaps::kMapBuffer_MapBufferType: // fall through
-            case GrGLCaps::kMapBufferRange_MapBufferType:
-                this->bind(gpu);
-                GL_CALL(gpu, UnmapBuffer(fBufferType));
-                break;
-            case GrGLCaps::kChromium_MapBufferType:
-                this->bind(gpu);
-                GR_GL_CALL(gpu->glInterface(), UnmapBufferSubData(fLockPtr));
-                break;
-        }
+        SkASSERT(gpu->caps()->bufferLockSupport());
+        this->bind(gpu);
+        GL_CALL(gpu, UnmapBuffer(fBufferType));
     }
     fLockPtr = NULL;
 }
@@ -183,8 +127,7 @@ bool GrGLBufferImpl::updateData(GrGpuGL* gpu, const void* src, size_t srcSizeInB
         // draws that reference the old contents. With this hint it can
         // assign a different allocation for the new contents to avoid
         // flushing the gpu past draws consuming the old contents.
-        fGLSizeInBytes = fDesc.fSizeInBytes;
-        GL_CALL(gpu, BufferData(fBufferType, fGLSizeInBytes, NULL, usage));
+        GL_CALL(gpu, BufferData(fBufferType, (GrGLsizeiptr) fDesc.fSizeInBytes, NULL, usage));
         GL_CALL(gpu, BufferSubData(fBufferType, 0, (GrGLsizeiptr) srcSizeInBytes, src));
     }
 #else
@@ -204,12 +147,10 @@ bool GrGLBufferImpl::updateData(GrGpuGL* gpu, const void* src, size_t srcSizeInB
         // Chromium's command buffer may turn a glBufferSubData where the size
         // exactly matches the buffer size into a glBufferData. So we tack 1
         // extra byte onto the glBufferData.
-        fGLSizeInBytes = srcSizeInBytes + 1;
-        GL_CALL(gpu, BufferData(fBufferType, fGLSizeInBytes, NULL, usage));
+        GL_CALL(gpu, BufferData(fBufferType, srcSizeInBytes + 1, NULL, usage));
         GL_CALL(gpu, BufferSubData(fBufferType, 0, srcSizeInBytes, src));
     } else {
-        fGLSizeInBytes = srcSizeInBytes;
-        GL_CALL(gpu, BufferData(fBufferType, fGLSizeInBytes, src, usage));
+        GL_CALL(gpu, BufferData(fBufferType, srcSizeInBytes, src, usage));
     }
 #endif
     return true;
@@ -220,7 +161,5 @@ void GrGLBufferImpl::validate() const {
     // The following assert isn't valid when the buffer has been abandoned:
     // SkASSERT((0 == fDesc.fID) == (NULL != fCPUData));
     SkASSERT(0 != fDesc.fID || !fDesc.fIsWrapped);
-    SkASSERT(NULL == fCPUData || 0 == fGLSizeInBytes);
-    SkASSERT(NULL == fLockPtr || fGLSizeInBytes == fDesc.fSizeInBytes);
     SkASSERT(NULL == fCPUData || NULL == fLockPtr || fCPUData == fLockPtr);
 }
index 19d23e0dac0b023d1ee677b42a21aa6df36612d7..148ca1b2ee6b4c1af0e6b812094f56fc0a23e096 100644 (file)
@@ -53,8 +53,6 @@ private:
     GrGLenum     fBufferType; // GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER
     void*        fCPUData;
     void*        fLockPtr;
-    size_t       fGLSizeInBytes;     // In certain cases we make the size of the GL buffer object
-                                     // smaller or larger than the size in fDesc.
 
     typedef SkNoncopyable INHERITED;
 };
index f577e9d740398dc5ca53fec9379b2e7266f544db..890b816752a1be093570d28169e10428778f11c9 100644 (file)
@@ -24,7 +24,6 @@ void GrGLCaps::reset() {
     fMSFBOType = kNone_MSFBOType;
     fFBFetchType = kNone_FBFetchType;
     fInvalidateFBType = kNone_InvalidateFBType;
-    fMapBufferType = kNone_MapBufferType;
     fMaxFragmentUniformVectors = 0;
     fMaxVertexAttributes = 0;
     fMaxFragmentTextureUnits = 0;
@@ -48,6 +47,7 @@ void GrGLCaps::reset() {
     fIsCoreProfile = false;
     fFullClearIsFree = false;
     fDropsTileOnZeroDivide = false;
+    fMapSubSupport = false;
 }
 
 GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrDrawTargetCaps() {
@@ -66,7 +66,6 @@ GrGLCaps& GrGLCaps::operator= (const GrGLCaps& caps) {
     fMSFBOType = caps.fMSFBOType;
     fFBFetchType = caps.fFBFetchType;
     fInvalidateFBType = caps.fInvalidateFBType;
-    fMapBufferType = caps.fMapBufferType;
     fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport;
     fBGRAFormatSupport = caps.fBGRAFormatSupport;
     fBGRAIsInternalFormat = caps.fBGRAIsInternalFormat;
@@ -86,6 +85,7 @@ GrGLCaps& GrGLCaps::operator= (const GrGLCaps& caps) {
     fIsCoreProfile = caps.fIsCoreProfile;
     fFullClearIsFree = caps.fFullClearIsFree;
     fDropsTileOnZeroDivide = caps.fDropsTileOnZeroDivide;
+    fMapSubSupport = caps.fMapSubSupport;
 
     return *this;
 }
@@ -290,27 +290,12 @@ bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
     }
 
     if (kGL_GrGLStandard == standard) {
-        fMapBufferFlags = kCanMap_MapFlag; // we require VBO support and the desktop VBO
-                                            // extension includes glMapBuffer.
-        if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_map_buffer_range")) {
-            fMapBufferFlags |= kSubset_MapFlag;
-            fMapBufferType = kMapBufferRange_MapBufferType;
-        } else {
-            fMapBufferType = kMapBuffer_MapBufferType;
-        }
+        fBufferLockSupport = true; // we require VBO support and the desktop VBO extension includes
+                                   // glMapBuffer.
+        fMapSubSupport = false;
     } else {
-        // Unextended GLES2 doesn't have any buffer mapping.
-        fMapBufferFlags = kNone_MapBufferType;
-        if (ctxInfo.hasExtension("GL_CHROMIUM_map_sub")) {
-            fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag;
-            fMapBufferType = kChromium_MapBufferType;
-        } else if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_EXT_map_buffer_range")) {
-            fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag;
-            fMapBufferType = kMapBufferRange_MapBufferType;
-        } else if (ctxInfo.hasExtension("GL_OES_mapbuffer")) {
-            fMapBufferFlags = kCanMap_MapFlag;
-            fMapBufferType = kMapBuffer_MapBufferType;
-        }
+        fBufferLockSupport = ctxInfo.hasExtension("GL_OES_mapbuffer");
+        fMapSubSupport = ctxInfo.hasExtension("GL_CHROMIUM_map_sub");
     }
 
     if (kGL_GrGLStandard == standard) {
@@ -670,23 +655,10 @@ SkString GrGLCaps::dump() const {
     GR_STATIC_ASSERT(2 == kInvalidate_InvalidateFBType);
     GR_STATIC_ASSERT(SK_ARRAY_COUNT(kInvalidateFBTypeStr) == kLast_InvalidateFBType + 1);
 
-    static const char* kMapBufferTypeStr[] = {
-        "None",
-        "MapBuffer",
-        "MapBufferRange",
-        "Chromium",
-    };
-    GR_STATIC_ASSERT(0 == kNone_MapBufferType);
-    GR_STATIC_ASSERT(1 == kMapBuffer_MapBufferType);
-    GR_STATIC_ASSERT(2 == kMapBufferRange_MapBufferType);
-    GR_STATIC_ASSERT(3 == kChromium_MapBufferType);
-    GR_STATIC_ASSERT(SK_ARRAY_COUNT(kMapBufferTypeStr) == kLast_MapBufferType + 1);
-
     r.appendf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO"));
     r.appendf("MSAA Type: %s\n", kMSFBOExtStr[fMSFBOType]);
     r.appendf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]);
     r.appendf("Invalidate FB Type: %s\n", kInvalidateFBTypeStr[fInvalidateFBType]);
-    r.appendf("Map Buffer Type: %s\n", kMapBufferTypeStr[fMapBufferType]);
     r.appendf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors);
     r.appendf("Max FS Texture Units: %d\n", fMaxFragmentTextureUnits);
     if (!fIsCoreProfile) {
index ea0f41245d20bedea2d4a0fa76f95510a09a024e..48925d48b4650b5db4631a2267ac2c27bed7693d 100644 (file)
@@ -86,15 +86,6 @@ public:
         kLast_InvalidateFBType = kInvalidate_InvalidateFBType
     };
 
-    enum MapBufferType {
-        kNone_MapBufferType,
-        kMapBuffer_MapBufferType,         // glMapBuffer()
-        kMapBufferRange_MapBufferType,    // glMapBufferRange()
-        kChromium_MapBufferType,          // GL_CHROMIUM_map_sub
-
-        kLast_MapBufferType = kChromium_MapBufferType,
-    };
-
     /**
      * Creates a GrGLCaps that advertises no support for any extensions,
      * formats, etc. Call init to initialize from a GrGLContextInfo.
@@ -178,8 +169,10 @@ public:
 
     InvalidateFBType invalidateFBType() const { return fInvalidateFBType; }
 
-    /// What type of buffer mapping is supported?
-    MapBufferType mapBufferType() const { return fMapBufferType; }
+    /**
+     * Returs a string containeng the caps info.
+     */
+    virtual SkString dump() const SK_OVERRIDE;
 
     /**
      * Gets an array of legal stencil formats. These formats are not guaranteed
@@ -265,10 +258,8 @@ public:
 
     bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; }
 
-    /**
-     * Returns a string containing the caps info.
-     */
-    virtual SkString dump() const SK_OVERRIDE;
+    /// Is GL_CHROMIUM_map_sub supported?
+    bool mapSubSupport() const { return fMapSubSupport; }
 
 private:
     /**
@@ -331,7 +322,6 @@ private:
     MSFBOType           fMSFBOType;
     FBFetchType         fFBFetchType;
     InvalidateFBType    fInvalidateFBType;
-    MapBufferType       fMapBufferType;
 
     bool fRGBA8RenderbufferSupport : 1;
     bool fBGRAFormatSupport : 1;
@@ -352,6 +342,7 @@ private:
     bool fIsCoreProfile : 1;
     bool fFullClearIsFree : 1;
     bool fDropsTileOnZeroDivide : 1;
+    bool fMapSubSupport : 1;
 
     typedef GrDrawTargetCaps INHERITED;
 };
index 6cfa8c29d08ca2bc7e4dff1a2cd6ea94ebb58448..2ef7659db7d87a96474db2f7c185ad82197eb92a 100644 (file)
@@ -186,29 +186,8 @@ GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteBuffers(GrGLsizei n, const GrGLuint* id
     }
 }
 
-GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBufferRange(GrGLenum target, GrGLintptr offset,
-                                                   GrGLsizeiptr length, GrGLbitfield access) {
-    GrGLuint id = 0;
-    switch (target) {
-        case GR_GL_ARRAY_BUFFER:
-            id = gCurrArrayBuffer;
-            break;
-        case GR_GL_ELEMENT_ARRAY_BUFFER:
-            id = gCurrElementArrayBuffer;
-            break;
-    }
-
-    if (id > 0) {
-        // We just ignore the offset and length here.
-        GrBufferObj* buffer = look_up(id);
-        SkASSERT(!buffer->mapped());
-        buffer->setMapped(true);
-        return buffer->dataPtr();
-    }
-    return NULL;
-}
-
 GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBuffer(GrGLenum target, GrGLenum access) {
+
     GrGLuint id = 0;
     switch (target) {
         case GR_GL_ARRAY_BUFFER:
@@ -230,11 +209,6 @@ GrGLvoid* GR_GL_FUNCTION_TYPE nullGLMapBuffer(GrGLenum target, GrGLenum access)
     return NULL;            // no buffer bound to target
 }
 
-GrGLvoid GR_GL_FUNCTION_TYPE nullGLFlushMappedBufferRange(GrGLenum target,
-                                                          GrGLintptr offset,
-                                                          GrGLsizeiptr length) {}
-
-
 GrGLboolean GR_GL_FUNCTION_TYPE nullGLUnmapBuffer(GrGLenum target) {
     GrGLuint id = 0;
     switch (target) {
@@ -330,7 +304,6 @@ const GrGLInterface* GrGLCreateNullInterface() {
     functions->fEndQuery = noOpGLEndQuery;
     functions->fFinish = noOpGLFinish;
     functions->fFlush = noOpGLFlush;
-    functions->fFlushMappedBufferRange = nullGLFlushMappedBufferRange;
     functions->fFrontFace = noOpGLFrontFace;
     functions->fGenBuffers = nullGLGenBuffers;
     functions->fGenerateMipmap = nullGLGenerateMipmap;
@@ -356,8 +329,6 @@ const GrGLInterface* GrGLCreateNullInterface() {
     functions->fInsertEventMarker = noOpGLInsertEventMarker;
     functions->fLineWidth = noOpGLLineWidth;
     functions->fLinkProgram = noOpGLLinkProgram;
-    functions->fMapBuffer = nullGLMapBuffer;
-    functions->fMapBufferRange = nullGLMapBufferRange;
     functions->fPixelStorei = nullGLPixelStorei;
     functions->fPopGroupMarker = noOpGLPopGroupMarker;
     functions->fPushGroupMarker = noOpGLPushGroupMarker;
@@ -397,7 +368,6 @@ const GrGLInterface* GrGLCreateNullInterface() {
     functions->fUniformMatrix2fv = noOpGLUniformMatrix2fv;
     functions->fUniformMatrix3fv = noOpGLUniformMatrix3fv;
     functions->fUniformMatrix4fv = noOpGLUniformMatrix4fv;
-    functions->fUnmapBuffer = nullGLUnmapBuffer;
     functions->fUseProgram = nullGLUseProgram;
     functions->fVertexAttrib4fv = noOpGLVertexAttrib4fv;
     functions->fVertexAttribPointer = noOpGLVertexAttribPointer;
@@ -417,8 +387,10 @@ const GrGLInterface* GrGLCreateNullInterface() {
     functions->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMultisample;
     functions->fBlitFramebuffer = noOpGLBlitFramebuffer;
     functions->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuffer;
+    functions->fMapBuffer = nullGLMapBuffer;
     functions->fMatrixLoadf = noOpGLMatrixLoadf;
     functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity;
+    functions->fUnmapBuffer = nullGLUnmapBuffer;
     functions->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed;
 
     interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functions->fGetStringi,
index 73f3d2e146e822ad40a4aa14ff4604f45c3e5674..a4dc2f782b0eefb1a3322775c3f56cd2465212db 100644 (file)
 /* Vertex Buffer Object */
 #define GR_GL_WRITE_ONLY                         0x88B9
 #define GR_GL_BUFFER_MAPPED                      0x88BC
-
-#define GR_GL_MAP_READ_BIT                       0x0001
-#define GR_GL_MAP_WRITE_BIT                      0x0002
-#define GR_GL_MAP_INVALIDATE_RANGE_BIT           0x0004
-#define GR_GL_MAP_INVALIDATE_BUFFER_BIT          0x0008
-#define GR_GL_MAP_FLUSH_EXPLICIT_BIT             0x0010
-#define GR_GL_MAP_UNSYNCHRONIZED_BIT             0x0020
-
 /* Read Format */
 #define GR_GL_IMPLEMENTATION_COLOR_READ_TYPE   0x8B9A
 #define GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
index ee184d0a56e58f47c9bd1911901ecfb98f1b892c..056a60187437b9fd2d31364159654ce34586fe35 100644 (file)
@@ -486,8 +486,8 @@ bool GrGLInterface::validate() const {
         }
     }
 
-    if ((kGL_GrGLStandard == fStandard && glVer >= GR_GL_VER(4,3)) ||
-        fExtensions.has("GL_ARB_invalidate_subdata")) {
+#if 0 // This can be enabled once Chromium is updated to set these functions pointers.
+    if ((kGL_GrGLStandard == fStandard) || fExtensions.has("GL_ARB_invalidate_subdata")) {
         if (NULL == fFunctions.fInvalidateBufferData ||
             NULL == fFunctions.fInvalidateBufferSubData ||
             NULL == fFunctions.fInvalidateFramebuffer ||
@@ -496,7 +496,7 @@ bool GrGLInterface::validate() const {
             NULL == fFunctions.fInvalidateTexSubImage) {
             RETURN_FALSE_INTERFACE;
         }
-    } else if (kGLES_GrGLStandard == fStandard && glVer >= GR_GL_VER(3,0)) {
+    } else if (glVer >= GR_GL_VER(3,0)) {
         // ES 3.0 adds the framebuffer functions but not the others.
         if (NULL == fFunctions.fInvalidateFramebuffer ||
             NULL == fFunctions.fInvalidateSubFramebuffer) {
@@ -512,15 +512,7 @@ bool GrGLInterface::validate() const {
             RETURN_FALSE_INTERFACE;
         }
     }
+#endif
 
-    // These functions are added to the 3.0 version of both GLES and GL.
-    if (glVer >= GR_GL_VER(3,0) ||
-        (kGLES_GrGLStandard == fStandard && fExtensions.has("GL_EXT_map_buffer_range")) ||
-        (kGL_GrGLStandard == fStandard && fExtensions.has("GL_ARB_map_buffer_range"))) {
-        if (NULL == fFunctions.fMapBufferRange ||
-            NULL == fFunctions.fFlushMappedBufferRange) {
-            RETURN_FALSE_INTERFACE;
-        }
-    }
     return true;
 }
index 312299adaea599d20ef512e29c7bc3b32e0b5238..b50063fb1a5911583425bd0363ef08bd1217561c 100644 (file)
@@ -75,7 +75,7 @@ static GrGLInterface* create_es_interface(GrGLVersion version,
     functions->fGetShaderInfoLog = glGetShaderInfoLog;
     functions->fGetShaderiv = glGetShaderiv;
     functions->fGetString = glGetString;
-#if GL_ES_VERSION_3_0
+#if GL_ES_VERSION_30
     functions->fGetStringi = glGetStringi;
 #else
     functions->fGetStringi = (GrGLGetStringiProc) eglGetProcAddress("glGetStringi");
@@ -183,24 +183,12 @@ static GrGLInterface* create_es_interface(GrGLVersion version,
     functions->fGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameteriv;
     functions->fGetRenderbufferParameteriv = glGetRenderbufferParameteriv;
     functions->fRenderbufferStorage = glRenderbufferStorage;
-
 #if GL_OES_mapbuffer
     functions->fMapBuffer = glMapBufferOES;
     functions->fUnmapBuffer = glUnmapBufferOES;
 #else
     functions->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBufferOES");
     functions->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnmapBufferOES");
-
-#endif
-
-#if GL_ES_VERSION_3_0 || GL_EXT_map_buffer_range
-    functions->fMapBufferRange = glMapBufferRange;
-    functions->fFlushMappedBufferRange = glFlushMappedBufferRange;
-#else
-    if (version >= GR_GL_VER(3,0) || extensions->has("GL_EXT_map_buffer_range")) {
-        functions->fMapBufferRange = (GrGLMapBufferRangeProc) eglGetProcAddress("glMapBufferRange");
-        functions->fFlushMappedBufferRange = (GrGLFlushMappedBufferRangeProc) eglGetProcAddress("glFlushMappedBufferRange");
-    }
 #endif
 
     if (extensions->has("GL_EXT_debug_marker")) {
index cb2fc953365ed98fe6634aebe25eec67596bbc4a..a316ff1c11913c6c8eb82822e9535577019f213b 100644 (file)
@@ -154,14 +154,6 @@ const GrGLInterface* GrGLCreateANGLEInterface() {
     functions->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBufferOES");
     functions->fUnmapBuffer = (GrGLUnmapBufferProc) eglGetProcAddress("glUnmapBufferOES");
 
-#if GL_ES_VERSION_3_0
-    functions->fMapBufferRange = GET_PROC(glMapBufferRange);
-    functions->fFlushMappedBufferRange = GET_PROC(glFlushMappedBufferRange);
-#else
-    functions->fMapBufferRange = (GrGLMapBufferRangeProc) eglGetProcAddress("glMapBufferRange");
-    functions->fFlushMappedBufferRange = (GrGLFlushMappedBufferRangeProc) eglGetProcAddress("glFlushMappedBufferRange");
-#endif
-
     functions->fInsertEventMarker = (GrGLInsertEventMarkerProc) eglGetProcAddress("glInsertEventMarkerEXT");
     functions->fPushGroupMarker = (GrGLInsertEventMarkerProc) eglGetProcAddress("glPushGroupMarkerEXT");
     functions->fPopGroupMarker = (GrGLPopGroupMarkerProc) eglGetProcAddress("glPopGroupMarkerEXT");
index 05d3cfddde04a33a91a59eb1f46bf740cfc49daa..fecfeb5e3ceb75607e3baefb5c71127176e3accb 100644 (file)
@@ -34,15 +34,9 @@ public:
         GrAlwaysAssert(!fMapped);
     }
 
-    void setMapped(GrGLintptr offset, GrGLsizeiptr length) {
-        fMapped = true;
-        fMappedOffset = offset;
-        fMappedLength = length;
-    }
+    void setMapped()             { fMapped = true; }
     void resetMapped()           { fMapped = false; }
     bool getMapped() const       { return fMapped; }
-    GrGLsizei getMappedOffset() const { return fMappedOffset; }
-    GrGLsizei getMappedLength() const { return fMappedLength; }
 
     void setBound()              { fBound = true; }
     void resetBound()            { fBound = false; }
@@ -61,9 +55,7 @@ protected:
 private:
 
     GrGLchar*    fDataPtr;
-    bool         fMapped;       // is the buffer object mapped via "glMapBuffer[Range]"?
-    GrGLintptr   fMappedOffset; // the offset of the buffer range that is mapped
-    GrGLsizeiptr fMappedLength; // the size of the buffer range that is mapped
+    bool         fMapped;       // is the buffer object mapped via "glMapBuffer"?
     bool         fBound;        // is the buffer object bound via "glBindBuffer"?
     GrGLsizeiptr fSize;         // size in bytes
     GrGLint      fUsage;        // one of: GL_STREAM_DRAW,
index 7c430b4b738c82eee2c0adb496bb3a826d28dac6..087bd4723e44e5716bda8da5bd3ee80cd09d01be 100644 (file)
@@ -622,14 +622,12 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteBuffers(GrGLsizei n, const GrGLuint* i
 }
 
 // map a buffer to the caller's address space
-GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBufferRange(GrGLenum target, GrGLintptr offset,
-                                                    GrGLsizeiptr length, GrGLbitfield access) {
+GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBuffer(GrGLenum target, GrGLenum access) {
+
     GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target ||
                    GR_GL_ELEMENT_ARRAY_BUFFER == target);
-
-    // We only expect read access and we expect that the buffer or range is always invalidated.
-    GrAlwaysAssert(!SkToBool(GR_GL_MAP_READ_BIT & access));
-    GrAlwaysAssert((GR_GL_MAP_INVALIDATE_BUFFER_BIT | GR_GL_MAP_INVALIDATE_RANGE_BIT) & access);
+    // GR_GL_READ_ONLY == access ||  || GR_GL_READ_WRIT == access);
+    GrAlwaysAssert(GR_GL_WRITE_ONLY == access);
 
     GrBufferObj *buffer = NULL;
     switch (target) {
@@ -640,41 +638,20 @@ GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBufferRange(GrGLenum target, GrGLintptr
             buffer = GrDebugGL::getInstance()->getElementArrayBuffer();
             break;
         default:
-            SkFAIL("Unexpected target to glMapBufferRange");
+            SkFAIL("Unexpected target to glMapBuffer");
             break;
     }
 
-    if (NULL != buffer) {
-        GrAlwaysAssert(offset >= 0 && offset + length <= buffer->getSize());
+    if (buffer) {
         GrAlwaysAssert(!buffer->getMapped());
-        buffer->setMapped(offset, length);
-        return buffer->getDataPtr() + offset;
+        buffer->setMapped();
+        return buffer->getDataPtr();
     }
 
     GrAlwaysAssert(false);
     return NULL;        // no buffer bound to the target
 }
 
-GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBuffer(GrGLenum target, GrGLenum access) {
-    GrAlwaysAssert(GR_GL_WRITE_ONLY == access);
-
-    GrBufferObj *buffer = NULL;
-    switch (target) {
-        case GR_GL_ARRAY_BUFFER:
-            buffer = GrDebugGL::getInstance()->getArrayBuffer();
-            break;
-        case GR_GL_ELEMENT_ARRAY_BUFFER:
-            buffer = GrDebugGL::getInstance()->getElementArrayBuffer();
-            break;
-        default:
-            SkFAIL("Unexpected target to glMapBuffer");
-            break;
-    }
-
-    return debugGLMapBufferRange(target, 0, buffer->getSize(),
-                                 GR_GL_MAP_WRITE_BIT | GR_GL_MAP_INVALIDATE_BUFFER_BIT);
-}
-
 // remove a buffer from the caller's address space
 // TODO: check if the "access" method from "glMapBuffer" was honored
 GrGLboolean GR_GL_FUNCTION_TYPE debugGLUnmapBuffer(GrGLenum target) {
@@ -695,7 +672,7 @@ GrGLboolean GR_GL_FUNCTION_TYPE debugGLUnmapBuffer(GrGLenum target) {
             break;
     }
 
-    if (NULL != buffer) {
+    if (buffer) {
         GrAlwaysAssert(buffer->getMapped());
         buffer->resetMapped();
         return GR_GL_TRUE;
@@ -705,34 +682,6 @@ GrGLboolean GR_GL_FUNCTION_TYPE debugGLUnmapBuffer(GrGLenum target) {
     return GR_GL_FALSE; // GR_GL_INVALID_OPERATION;
 }
 
-GrGLvoid GR_GL_FUNCTION_TYPE debugGLFlushMappedBufferRange(GrGLenum target,
-                                                           GrGLintptr offset,
-                                                           GrGLsizeiptr length) {
-    GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target ||
-                   GR_GL_ELEMENT_ARRAY_BUFFER == target);
-
-    GrBufferObj *buffer = NULL;
-    switch (target) {
-        case GR_GL_ARRAY_BUFFER:
-            buffer = GrDebugGL::getInstance()->getArrayBuffer();
-            break;
-        case GR_GL_ELEMENT_ARRAY_BUFFER:
-            buffer = GrDebugGL::getInstance()->getElementArrayBuffer();
-            break;
-        default:
-            SkFAIL("Unexpected target to glUnmapBuffer");
-            break;
-    }
-
-    if (NULL != buffer) {
-        GrAlwaysAssert(buffer->getMapped());
-        GrAlwaysAssert(offset >= 0 && (offset + length) <= buffer->getMappedLength());
-    } else {
-        GrAlwaysAssert(false);
-    }
-}
-
-
 GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target,
                                                          GrGLenum value,
                                                          GrGLint* params) {
@@ -757,17 +706,17 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target,
     switch (value) {
         case GR_GL_BUFFER_MAPPED:
             *params = GR_GL_FALSE;
-            if (NULL != buffer)
+            if (buffer)
                 *params = buffer->getMapped() ? GR_GL_TRUE : GR_GL_FALSE;
             break;
         case GR_GL_BUFFER_SIZE:
             *params = 0;
-            if (NULL != buffer)
+            if (buffer)
                 *params = SkToInt(buffer->getSize());
             break;
         case GR_GL_BUFFER_USAGE:
             *params = GR_GL_STATIC_DRAW;
-            if (NULL != buffer)
+            if (buffer)
                 *params = buffer->getUsage();
             break;
         default:
@@ -877,7 +826,6 @@ const GrGLInterface* GrGLCreateDebugInterface() {
     functions->fEndQuery = noOpGLEndQuery;
     functions->fFinish = noOpGLFinish;
     functions->fFlush = noOpGLFlush;
-    functions->fFlushMappedBufferRange = debugGLFlushMappedBufferRange;
     functions->fFrontFace = noOpGLFrontFace;
     functions->fGenerateMipmap = debugGLGenerateMipmap;
     functions->fGenBuffers = debugGLGenBuffers;
@@ -902,8 +850,6 @@ const GrGLInterface* GrGLCreateDebugInterface() {
     functions->fGenVertexArrays = debugGLGenVertexArrays;
     functions->fLineWidth = noOpGLLineWidth;
     functions->fLinkProgram = noOpGLLinkProgram;
-    functions->fMapBuffer = debugGLMapBuffer;
-    functions->fMapBufferRange = debugGLMapBufferRange;
     functions->fPixelStorei = debugGLPixelStorei;
     functions->fQueryCounter = noOpGLQueryCounter;
     functions->fReadBuffer = noOpGLReadBuffer;
@@ -941,7 +887,6 @@ const GrGLInterface* GrGLCreateDebugInterface() {
     functions->fUniformMatrix2fv = noOpGLUniformMatrix2fv;
     functions->fUniformMatrix3fv = noOpGLUniformMatrix3fv;
     functions->fUniformMatrix4fv = noOpGLUniformMatrix4fv;
-    functions->fUnmapBuffer = debugGLUnmapBuffer;
     functions->fUseProgram = debugGLUseProgram;
     functions->fVertexAttrib4fv = noOpGLVertexAttrib4fv;
     functions->fVertexAttribPointer = noOpGLVertexAttribPointer;
@@ -964,9 +909,10 @@ const GrGLInterface* GrGLCreateDebugInterface() {
     functions->fBlitFramebuffer = noOpGLBlitFramebuffer;
     functions->fResolveMultisampleFramebuffer =
                                     noOpGLResolveMultisampleFramebuffer;
+    functions->fMapBuffer = debugGLMapBuffer;
     functions->fMatrixLoadf = noOpGLMatrixLoadf;
     functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity;
-
+    functions->fUnmapBuffer = debugGLUnmapBuffer;
     functions->fBindFragDataLocationIndexed =
                                     noOpGLBindFragDataLocationIndexed;
 
index d61afbd675d218a0402c909d080fea3e6749a4f2..6af047159a7ed4890bf6eefc61561fe7b648f205 100644 (file)
@@ -132,11 +132,6 @@ const GrGLInterface* GrGLCreateNativeInterface() {
     functions->fUnmapBuffer = glUnmapBufferOES;
 #endif
 
-#if GL_EXT_map_buffer_range || GL_ES_VERSION_3_0
-    functions->fMapBufferRange = glMapBufferRange;
-    functions->fFlushMappedBufferRange = glFlushMappedBufferRange;
-#endif
-
 #if GL_APPLE_framebuffer_multisample
     functions->fRenderbufferStorageMultisample = glRenderbufferStorageMultisampleAPPLE;
     functions->fResolveMultisampleFramebuffer = glResolveMultisampleFramebufferAPPLE;