Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Unified Diff: src/gpu/gl/debug/GrGLCreateDebugInterface.cpp

Issue 262963002: Revert of Add support for glMapBufferRange. Use glMapBufferRange and glMapBufferSubData. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/debug/GrBufferObj.h ('k') | src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
index 7c430b4b738c82eee2c0adb496bb3a826d28dac6..087bd4723e44e5716bda8da5bd3ee80cd09d01be 100644
--- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
+++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
@@ -622,14 +622,12 @@
}
// 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,23 +638,26 @@
buffer = GrDebugGL::getInstance()->getElementArrayBuffer();
break;
default:
- SkFAIL("Unexpected target to glMapBufferRange");
- break;
- }
-
- if (NULL != buffer) {
- GrAlwaysAssert(offset >= 0 && offset + length <= buffer->getSize());
+ SkFAIL("Unexpected target to glMapBuffer");
+ break;
+ }
+
+ 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);
+// 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) {
+
+ GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target ||
+ GR_GL_ELEMENT_ARRAY_BUFFER == target);
GrBufferObj *buffer = NULL;
switch (target) {
@@ -667,20 +668,28 @@
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) {
+ SkFAIL("Unexpected target to glUnmapBuffer");
+ break;
+ }
+
+ if (buffer) {
+ GrAlwaysAssert(buffer->getMapped());
+ buffer->resetMapped();
+ return GR_GL_TRUE;
+ }
+
+ GrAlwaysAssert(false);
+ return GR_GL_FALSE; // GR_GL_INVALID_OPERATION;
+}
+
+GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target,
+ GrGLenum value,
+ GrGLint* params) {
GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target ||
GR_GL_ELEMENT_ARRAY_BUFFER == target);
+ GrAlwaysAssert(GR_GL_BUFFER_SIZE == value ||
+ GR_GL_BUFFER_USAGE == value);
GrBufferObj *buffer = NULL;
switch (target) {
@@ -690,66 +699,6 @@
case GR_GL_ELEMENT_ARRAY_BUFFER:
buffer = GrDebugGL::getInstance()->getElementArrayBuffer();
break;
- default:
- SkFAIL("Unexpected target to glUnmapBuffer");
- break;
- }
-
- if (NULL != buffer) {
- GrAlwaysAssert(buffer->getMapped());
- buffer->resetMapped();
- return GR_GL_TRUE;
- }
-
- GrAlwaysAssert(false);
- 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) {
-
- GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target ||
- GR_GL_ELEMENT_ARRAY_BUFFER == target);
- GrAlwaysAssert(GR_GL_BUFFER_SIZE == value ||
- GR_GL_BUFFER_USAGE == value);
-
- 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;
}
GrAlwaysAssert(buffer);
@@ -757,17 +706,17 @@
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 @@
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 @@
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 @@
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 @@
functions->fBlitFramebuffer = noOpGLBlitFramebuffer;
functions->fResolveMultisampleFramebuffer =
noOpGLResolveMultisampleFramebuffer;
+ functions->fMapBuffer = debugGLMapBuffer;
functions->fMatrixLoadf = noOpGLMatrixLoadf;
functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity;
-
+ functions->fUnmapBuffer = debugGLUnmapBuffer;
functions->fBindFragDataLocationIndexed =
noOpGLBindFragDataLocationIndexed;
« no previous file with comments | « src/gpu/gl/debug/GrBufferObj.h ('k') | src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698