void GrGLBuffer::onUnmap() { SkASSERT(fBufferID); VALIDATE(); SkASSERT(this->isMapped()); if (0 == fBufferID) { fMapPtr = nullptr; return; } // bind buffer handles the dirty context switch (this->glCaps().mapBufferType()) { case GrGLCaps::kNone_MapBufferType: SkDEBUGFAIL("Shouldn't get here."); return; case GrGLCaps::kMapBuffer_MapBufferType: // fall through case GrGLCaps::kMapBufferRange_MapBufferType: { GrGLenum target = this->glGpu()->bindBuffer(fIntendedType, this); GL_CALL(UnmapBuffer(target)); break; } case GrGLCaps::kChromium_MapBufferType: this->glGpu()->bindBuffer(fIntendedType, this); // TODO: Is this needed? GL_CALL(UnmapBufferSubData(fMapPtr)); break; } fMapPtr = nullptr; }
void GrGLBufferImpl::unmap(GrGpuGL* gpu) { VALIDATE(); SkASSERT(this->isMapped()); 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(fMapPtr)); break; } } fMapPtr = NULL; }