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

Unified Diff: src/gpu/instanced/GLInstancedRendering.cpp

Issue 2143333002: Add resource provider flag to avoid client-side buffers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add resource provider flag to avoid client-side buffers Created 4 years, 5 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/instanced/GLInstancedRendering.h ('k') | src/gpu/instanced/InstancedRendering.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/instanced/GLInstancedRendering.cpp
diff --git a/src/gpu/instanced/GLInstancedRendering.cpp b/src/gpu/instanced/GLInstancedRendering.cpp
index 7df39f07df15de889149110bb2889a9019764181..2962a865481b7d97bbdb07e051fd9afa14ec1d15 100644
--- a/src/gpu/instanced/GLInstancedRendering.cpp
+++ b/src/gpu/instanced/GLInstancedRendering.cpp
@@ -96,12 +96,12 @@ void GLInstancedRendering::onBeginFlush(GrResourceProvider* rp) {
this->glGpu()->bindVertexArray(fVertexArrayID);
// Attach our index buffer to the vertex array.
+ SkASSERT(!this->indexBuffer()->isCPUBacked());
GL_CALL(BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER,
static_cast<const GrGLBuffer*>(this->indexBuffer())->bufferID()));
// Set up the non-instanced attribs.
- this->glGpu()->bindBuffer(kVertex_GrBufferType,
- static_cast<const GrGLBuffer*>(this->vertexBuffer()));
+ this->glGpu()->bindBuffer(kVertex_GrBufferType, this->vertexBuffer());
GL_CALL(EnableVertexAttribArray((int)Attrib::kShapeCoords));
GL_CALL(VertexAttribPointer((int)Attrib::kShapeCoords, 2, GR_GL_FLOAT, GR_GL_FALSE,
sizeof(ShapeVertex), (void*) offsetof(ShapeVertex, fX)));
@@ -114,18 +114,21 @@ void GLInstancedRendering::onBeginFlush(GrResourceProvider* rp) {
// Create and map instance and draw-indirect buffers.
SkASSERT(!fInstanceBuffer);
- fInstanceBuffer.reset(static_cast<GrGLBuffer*>(
+ fInstanceBuffer.reset(
rp->createBuffer(sizeof(Instance) * numGLInstances, kVertex_GrBufferType,
- kDynamic_GrAccessPattern, GrResourceProvider::kNoPendingIO_Flag)));
+ kDynamic_GrAccessPattern,
+ GrResourceProvider::kNoPendingIO_Flag |
+ GrResourceProvider::kRequireGpuMemory_Flag));
if (!fInstanceBuffer) {
return;
}
SkASSERT(!fDrawIndirectBuffer);
- fDrawIndirectBuffer.reset(static_cast<GrGLBuffer*>(
+ fDrawIndirectBuffer.reset(
rp->createBuffer(sizeof(GrGLDrawElementsIndirectCommand) * numGLDrawCmds,
kDrawIndirect_GrBufferType, kDynamic_GrAccessPattern,
- GrResourceProvider::kNoPendingIO_Flag)));
+ GrResourceProvider::kNoPendingIO_Flag |
+ GrResourceProvider::kRequireGpuMemory_Flag));
if (!fDrawIndirectBuffer) {
return;
}
« no previous file with comments | « src/gpu/instanced/GLInstancedRendering.h ('k') | src/gpu/instanced/InstancedRendering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698