Index: src/gpu/gl/debug/GrGLCreateDebugInterface.cpp |
=================================================================== |
--- src/gpu/gl/debug/GrGLCreateDebugInterface.cpp (revision 7907) |
+++ src/gpu/gl/debug/GrGLCreateDebugInterface.cpp (working copy) |
@@ -16,6 +16,7 @@ |
#include "GrTextureObj.h" |
#include "GrFrameBufferObj.h" |
#include "GrRenderBufferObj.h" |
+#include "GrVertexArrayObj.h" |
#include "SkFloatingPoint.h" |
#include "../GrGLNoOpInterface.h" |
@@ -212,8 +213,7 @@ |
GrDebugGL::getInstance()->setFrameBuffer(frameBuffer); |
} |
- GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindRenderbuffer(GrGLenum target, |
- GrGLuint renderBufferID) { |
+ GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindRenderbuffer(GrGLenum target, GrGLuint renderBufferID) { |
GrAlwaysAssert(GR_GL_RENDERBUFFER == target); |
@@ -225,8 +225,7 @@ |
GrDebugGL::getInstance()->setRenderBuffer(renderBuffer); |
} |
- GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteTextures(GrGLsizei n, |
- const GrGLuint* textures) { |
+ GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteTextures(GrGLsizei n, const GrGLuint* textures) { |
// first potentially unbind the texture |
// TODO: move this into GrDebugGL as unBindTexture? |
@@ -287,7 +286,6 @@ |
} |
- |
GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteFramebuffers(GrGLsizei n, |
const GrGLuint *frameBuffers) { |
@@ -518,33 +516,56 @@ |
} |
GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenBuffers(GrGLsizei n, GrGLuint* ids) { |
- |
debugGenObjs(GrDebugGL::kBuffer_ObjTypes, n, ids); |
} |
GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenFramebuffers(GrGLsizei n, |
GrGLuint* ids) { |
- |
debugGenObjs(GrDebugGL::kFrameBuffer_ObjTypes, n, ids); |
} |
GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenRenderbuffers(GrGLsizei n, |
GrGLuint* ids) { |
- |
debugGenObjs(GrDebugGL::kRenderBuffer_ObjTypes, n, ids); |
} |
GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenTextures(GrGLsizei n, GrGLuint* ids) { |
- |
debugGenObjs(GrDebugGL::kTexture_ObjTypes, n, ids); |
} |
-GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindBuffer(GrGLenum target, |
- GrGLuint bufferID) { |
+GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenVertexArrays(GrGLsizei n, GrGLuint* ids) { |
+ debugGenObjs(GrDebugGL::kVertexArray_ObjTypes, n, ids); |
+} |
- GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || |
- GR_GL_ELEMENT_ARRAY_BUFFER == target); |
+GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteVertexArrays(GrGLsizei n, const GrGLuint* ids) { |
+ for (GrGLsizei i = 0; i < n; ++i) { |
+ GrVertexArrayObj* array = |
+ GR_FIND(ids[i], GrVertexArrayObj, GrDebugGL::kVertexArray_ObjTypes); |
+ GrAlwaysAssert(array); |
+ // Deleting the current vertex array binds object 0 |
+ if (GrDebugGL::getInstance()->getVertexArray() == array) { |
+ GrDebugGL::getInstance()->setVertexArray(NULL); |
+ } |
+ |
+ if (array->getRefCount()) { |
+ // someone is still using this vertex array so we can't delete it here |
+ array->setMarkedForDeletion(); |
+ } else { |
+ array->deleteAction(); |
+ } |
+ } |
+} |
+ |
+GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindVertexArray(GrGLuint id) { |
+ GrVertexArrayObj* array = GR_FIND(id, GrVertexArrayObj, GrDebugGL::kVertexArray_ObjTypes); |
+ GrAlwaysAssert(array); |
+ GrDebugGL::getInstance()->setVertexArray(array); |
+} |
+ |
+GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindBuffer(GrGLenum target, GrGLuint bufferID) { |
+ GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || GR_GL_ELEMENT_ARRAY_BUFFER == target); |
+ |
GrBufferObj *buffer = GR_FIND(bufferID, |
GrBufferObj, |
GrDebugGL::kBuffer_ObjTypes); |
@@ -564,8 +585,7 @@ |
} |
// deleting a bound buffer has the side effect of binding 0 |
-GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteBuffers(GrGLsizei n, |
- const GrGLuint* ids) { |
+GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteBuffers(GrGLsizei n, const GrGLuint* ids) { |
// first potentially unbind the buffers |
for (int i = 0; i < n; ++i) { |
@@ -595,8 +615,7 @@ |
} |
// map a buffer to the caller's address space |
-GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBuffer(GrGLenum target, |
- GrGLenum access) { |
+GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBuffer(GrGLenum target, GrGLenum access) { |
GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || |
GR_GL_ELEMENT_ARRAY_BUFFER == target); |
@@ -767,6 +786,7 @@ |
interface->fBindBuffer = debugGLBindBuffer; |
interface->fBindFragDataLocation = noOpGLBindFragDataLocation; |
interface->fBindTexture = debugGLBindTexture; |
+ interface->fBindVertexArray = debugGLBindVertexArray; |
interface->fBlendColor = noOpGLBlendColor; |
interface->fBlendFunc = noOpGLBlendFunc; |
interface->fBufferData = debugGLBufferData; |
@@ -785,6 +805,7 @@ |
interface->fDeleteQueries = noOpGLDeleteIds; |
interface->fDeleteShader = debugGLDeleteShader; |
interface->fDeleteTextures = debugGLDeleteTextures; |
+ interface->fDeleteVertexArrays = debugGLDeleteVertexArrays; |
interface->fDepthMask = noOpGLDepthMask; |
interface->fDisable = noOpGLDisable; |
interface->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray; |
@@ -817,6 +838,7 @@ |
interface->fGetStringi = noOpGLGetStringi; |
interface->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv; |
interface->fGetUniformLocation = noOpGLGetUniformLocation; |
+ interface->fGenVertexArrays = debugGLGenVertexArrays; |
interface->fLineWidth = noOpGLLineWidth; |
interface->fLinkProgram = noOpGLLinkProgram; |
interface->fPixelStorei = debugGLPixelStorei; |