aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrOpFlushState.h
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-06-20 14:43:58 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-20 19:15:58 +0000
commit49b7b6f38fc9d6cbcfa5865db364ff79c3ed7bfe (patch)
treec4bccaca446ff6b894ba85b42fc4874ce76420ef /src/gpu/GrOpFlushState.h
parent6081ebb6892e1779678b9d638f4b2a398e412f00 (diff)
Handle too many (or too large) paths in GrDefaultPathRenderer
PathGeoBuilder constructs the geometry with the same basic technique as before, but allows interrupting the process to emit multiple draws. Original test case was 2000 non-AA stroked circles, which created ~66000 vertices. That now renders, as do various tests with a single large path (as well as filled paths). Added a new set of 'AtLeast' allocators for vertex and index data. These take a minimum size and a fallback size. If the minimum size can be satisfied by an existing block, then the caller gets *all* memory in that block, otherwise they get a new block sized for the fallback amount. The previous allocation scheme wasn't a good fit for the new use-case, and because we don't usually need many verts, the flexible approach seems appropriate. TODO: I think that this could be extracted and re-used for MSAA path renderer without too much work? I need to read that code more carefully to make sure it lines up. Re-land of: https://skia-review.googlesource.com/18360 Re-land of: https://skia-review.googlesource.com/18983 Bug: skia:6695 Change-Id: I09ac1273e5af67ed0e3e886de90e2970c3d0b239 Reviewed-on: https://skia-review.googlesource.com/19480 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrOpFlushState.h')
-rw-r--r--src/gpu/GrOpFlushState.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gpu/GrOpFlushState.h b/src/gpu/GrOpFlushState.h
index 3a2fe328e6..b5cacfa0fe 100644
--- a/src/gpu/GrOpFlushState.h
+++ b/src/gpu/GrOpFlushState.h
@@ -59,6 +59,12 @@ public:
const GrBuffer** buffer, int* startVertex);
uint16_t* makeIndexSpace(int indexCount, const GrBuffer** buffer, int* startIndex);
+ void* makeVertexSpaceAtLeast(size_t vertexSize, int minVertexCount, int fallbackVertexCount,
+ const GrBuffer** buffer, int* startVertex, int* actualVertexCount);
+ uint16_t* makeIndexSpaceAtLeast(int minIndexCount, int fallbackIndexCount,
+ const GrBuffer** buffer, int* startIndex,
+ int* actualIndexCount);
+
/** This is called after each op has a chance to prepare its draws and before the draws are
issued. */
void preIssueDraws() {
@@ -205,6 +211,21 @@ public:
return this->state()->makeIndexSpace(indexCount, buffer, startIndex);
}
+ void* makeVertexSpaceAtLeast(size_t vertexSize, int minVertexCount, int fallbackVertexCount,
+ const GrBuffer** buffer, int* startVertex,
+ int* actualVertexCount) {
+ return this->state()->makeVertexSpaceAtLeast(vertexSize, minVertexCount,
+ fallbackVertexCount, buffer, startVertex,
+ actualVertexCount);
+ }
+
+ uint16_t* makeIndexSpaceAtLeast(int minIndexCount, int fallbackIndexCount,
+ const GrBuffer** buffer, int* startIndex,
+ int* actualIndexCount) {
+ return this->state()->makeIndexSpaceAtLeast(minIndexCount, fallbackIndexCount, buffer,
+ startIndex, actualIndexCount);
+ }
+
/** Helpers for ops which over-allocate and then return data to the pool. */
void putBackIndices(int indices) { this->state()->putBackIndices(indices); }
void putBackVertices(int vertices, size_t vertexStride) {