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

Unified Diff: gm/beziereffects.cpp

Issue 1116943004: Move instanced index buffer creation to flush time (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix missing assignment of keys to index buffers Created 5 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 | « no previous file | gm/convexpolyeffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/beziereffects.cpp
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index 182d71aaf6749c52a7bd8b50cc8bdeb4137bdb36..656842289867710a072b6ae1456d409d0cbd9a93 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -16,6 +16,7 @@
#include "GrBufferAllocPool.h"
#include "GrContext.h"
#include "GrPathUtils.h"
+#include "GrResourceProvider.h"
#include "GrTest.h"
#include "GrTestBatch.h"
#include "SkColorPriv.h"
@@ -66,17 +67,18 @@ private:
}
void onGenerateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
- size_t vertexStride = this->geometryProcessor()->getVertexStride();
+ SkAutoTUnref<const GrIndexBuffer> indexBuffer(
+ batchTarget->resourceProvider()->refQuadIndexBuffer());
+ size_t vertexStride = this->geometryProcessor()->getVertexStride();
const GrVertexBuffer* vertexBuffer;
int firstVertex;
-
void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride,
kVertsPerCubic,
&vertexBuffer,
&firstVertex);
- if (!vertices || !batchTarget->quadIndexBuffer()) {
+ if (!vertices || !indexBuffer) {
SkDebugf("Could not allocate buffers\n");
return;
}
@@ -100,7 +102,7 @@ private:
drawInfo.setVertexCount(kVertsPerCubic);
drawInfo.setStartIndex(0);
drawInfo.setIndexCount(kIndicesPerCubic);
- drawInfo.setIndexBuffer(batchTarget->quadIndexBuffer());
+ drawInfo.setIndexBuffer(indexBuffer);
batchTarget->draw(drawInfo);
}
@@ -473,8 +475,10 @@ private:
}
void onGenerateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override {
- size_t vertexStride = this->geometryProcessor()->getVertexStride();
+ SkAutoTUnref<const GrIndexBuffer> indexBuffer(
+ batchTarget->resourceProvider()->refQuadIndexBuffer());
+ size_t vertexStride = this->geometryProcessor()->getVertexStride();
const GrVertexBuffer* vertexBuffer;
int firstVertex;
@@ -483,7 +487,7 @@ private:
&vertexBuffer,
&firstVertex);
- if (!vertices || !batchTarget->quadIndexBuffer()) {
+ if (!vertices || !indexBuffer) {
SkDebugf("Could not allocate buffers\n");
return;
}
@@ -505,7 +509,7 @@ private:
drawInfo.setVertexCount(kVertsPerCubic);
drawInfo.setStartIndex(0);
drawInfo.setIndexCount(kIndicesPerCubic);
- drawInfo.setIndexBuffer(batchTarget->quadIndexBuffer());
+ drawInfo.setIndexBuffer(indexBuffer);
batchTarget->draw(drawInfo);
}
« no previous file with comments | « no previous file | gm/convexpolyeffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698