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

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

Issue 1870553002: Revert of Track GL buffer state based on unique resource ID (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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/GrGLVertexArray.h ('k') | src/gpu/vk/GrVkGpu.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLVertexArray.cpp
diff --git a/src/gpu/gl/GrGLVertexArray.cpp b/src/gpu/gl/GrGLVertexArray.cpp
index d131ff21862421d7a749128b46076166fb8a7293..564a91a1b64451b340a3d24c5c22368cadf227b2 100644
--- a/src/gpu/gl/GrGLVertexArray.cpp
+++ b/src/gpu/gl/GrGLVertexArray.cpp
@@ -6,7 +6,6 @@
*/
#include "GrGLVertexArray.h"
-#include "GrGLBuffer.h"
#include "GrGLGpu.h"
struct AttribLayout {
@@ -39,7 +38,7 @@
void GrGLAttribArrayState::set(GrGLGpu* gpu,
int index,
- const GrGLBuffer* vertexBuffer,
+ GrGLuint vertexBufferID,
GrVertexAttribType type,
GrGLsizei stride,
GrGLvoid* offset) {
@@ -50,11 +49,13 @@
array->fEnableIsValid = true;
array->fEnabled = true;
}
- if (array->fVertexBufferUniqueID != vertexBuffer->getUniqueID() ||
+ if (!array->fAttribPointerIsValid ||
+ array->fVertexBufferID != vertexBufferID ||
array->fType != type ||
array->fStride != stride ||
array->fOffset != offset) {
- gpu->bindBuffer(kVertex_GrBufferType, vertexBuffer);
+
+ gpu->bindVertexBuffer(vertexBufferID);
const AttribLayout& layout = gLayouts[type];
if (!GrVertexAttribTypeIsIntType(type)) {
GR_GL_CALL(gpu->glInterface(), VertexAttribPointer(index,
@@ -72,7 +73,8 @@
stride,
offset));
}
- array->fVertexBufferUniqueID = vertexBuffer->getUniqueID();
+ array->fAttribPointerIsValid = true;
+ array->fVertexBufferID = vertexBufferID;
array->fType = type;
array->fStride = stride;
array->fOffset = offset;
@@ -101,7 +103,7 @@
GrGLVertexArray::GrGLVertexArray(GrGLint id, int attribCount)
: fID(id)
, fAttribArrays(attribCount)
- , fIndexBufferUniqueID(SK_InvalidUniqueID) {
+ , fIndexBufferIDIsValid(false) {
}
GrGLAttribArrayState* GrGLVertexArray::bind(GrGLGpu* gpu) {
@@ -112,16 +114,25 @@
return &fAttribArrays;
}
-GrGLAttribArrayState* GrGLVertexArray::bindWithIndexBuffer(GrGLGpu* gpu, const GrGLBuffer* ibuff) {
+GrGLAttribArrayState* GrGLVertexArray::bindWithIndexBuffer(GrGLGpu* gpu, GrGLuint ibufferID) {
GrGLAttribArrayState* state = this->bind(gpu);
- if (state && fIndexBufferUniqueID != ibuff->getUniqueID()) {
- GR_GL_CALL(gpu->glInterface(), BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, ibuff->bufferID()));
- fIndexBufferUniqueID = ibuff->getUniqueID();
+ if (state) {
+ if (!fIndexBufferIDIsValid || ibufferID != fIndexBufferID) {
+ GR_GL_CALL(gpu->glInterface(), BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER, ibufferID));
+ fIndexBufferIDIsValid = true;
+ fIndexBufferID = ibufferID;
+ }
}
return state;
}
+void GrGLVertexArray::notifyIndexBufferDelete(GrGLuint bufferID) {
+ if (fIndexBufferIDIsValid && bufferID == fIndexBufferID) {
+ fIndexBufferID = 0;
+ }
+ }
+
void GrGLVertexArray::invalidateCachedState() {
fAttribArrays.invalidate();
- fIndexBufferUniqueID = SK_InvalidUniqueID;
+ fIndexBufferIDIsValid = false;
}
« no previous file with comments | « src/gpu/gl/GrGLVertexArray.h ('k') | src/gpu/vk/GrVkGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698