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

Unified Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1796713005: Begin tracking GL_TEXTURE_ and GL_DRAW_INDIRECT_ buffer bindings (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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/GrGLGpu.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLGpu.cpp
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 3e8f507b4a107250646b85746402ddcf809aca80..f742efe70d1b829fb4135ce4d21b93426cad3dfb 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -412,6 +412,9 @@ void GrGLGpu::onResetContext(uint32_t resetBits) {
GL_CALL(Disable(GR_GL_DEPTH_TEST));
GL_CALL(DepthMask(GR_GL_FALSE));
+ fHWBoundTextureBufferIDIsValid = false;
+ fHWBoundDrawIndirectBufferIDIsValid = false;
+
fHWDrawFace = GrPipelineBuilder::kInvalid_DrawFace;
if (kGL_GrGLStandard == this->glStandard()) {
@@ -2177,22 +2180,54 @@ void GrGLGpu::buildProgramDesc(GrProgramDesc* desc,
void GrGLGpu::bindBuffer(GrGLuint id, GrGLenum type) {
this->handleDirtyContext();
- if (GR_GL_ARRAY_BUFFER == type) {
- this->bindVertexBuffer(id);
- } else if (GR_GL_ELEMENT_ARRAY_BUFFER == type) {
- this->bindIndexBufferAndDefaultVertexArray(id);
- } else {
- GR_GL_CALL(this->glInterface(), BindBuffer(type, id));
+ switch (type) {
+ case GR_GL_ARRAY_BUFFER:
+ this->bindVertexBuffer(id);
+ break;
+ case GR_GL_ELEMENT_ARRAY_BUFFER:
+ this->bindIndexBufferAndDefaultVertexArray(id);
+ break;
+ case GR_GL_TEXTURE_BUFFER:
+ if (!fHWBoundTextureBufferIDIsValid || id != fHWBoundTextureBufferID) {
+ GR_GL_CALL(this->glInterface(), BindBuffer(type, id));
+ fHWBoundTextureBufferID = id;
+ fHWBoundTextureBufferIDIsValid = true;
+ }
+ break;
+ case GR_GL_DRAW_INDIRECT_BUFFER:
+ if (!fHWBoundDrawIndirectBufferIDIsValid || id != fHWBoundDrawIndirectBufferID) {
+ GR_GL_CALL(this->glInterface(), BindBuffer(type, id));
+ fHWBoundDrawIndirectBufferID = id;
+ fHWBoundDrawIndirectBufferIDIsValid = true;
+ }
+ break;
+ default:
+ SkDebugf("WARNING: buffer target 0x%x is not tracked by GrGLGpu.\n", type);
+ GR_GL_CALL(this->glInterface(), BindBuffer(type, id));
+ break;
}
}
void GrGLGpu::releaseBuffer(GrGLuint id, GrGLenum type) {
this->handleDirtyContext();
GL_CALL(DeleteBuffers(1, &id));
- if (GR_GL_ARRAY_BUFFER == type) {
- this->notifyVertexBufferDelete(id);
- } else if (GR_GL_ELEMENT_ARRAY_BUFFER == type) {
- this->notifyIndexBufferDelete(id);
+ switch (type) {
Chris Dalton 2016/03/14 15:46:53 This has technically been a bit dangerous because
bsalomon 2016/03/16 13:42:23 Right now the buffer type is inherent to the Gr-ob
+ case GR_GL_ARRAY_BUFFER:
+ this->notifyVertexBufferDelete(id);
+ break;
+ case GR_GL_ELEMENT_ARRAY_BUFFER:
+ this->notifyIndexBufferDelete(id);
+ break;
+ case GR_GL_TEXTURE_BUFFER:
+ if (fHWBoundTextureBufferIDIsValid && id == fHWBoundTextureBufferID) {
+ fHWBoundTextureBufferID = 0;
+ }
+ break;
+ case GR_GL_DRAW_INDIRECT_BUFFER:
+ if (fHWBoundDrawIndirectBufferIDIsValid && id == fHWBoundDrawIndirectBufferID) {
+ fHWBoundDrawIndirectBufferID = 0;
+ }
+ break;
}
}
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698