[graphite] Handle dynamic instances that never accumulated anything
In the curve tessellating render step, a path that is only linear segments is entirely handled by the inner triangles, so the patch writing never actually emits any instances. This is detected after the fact by seeing that the per-instance vertex count remains 0, so we just skip issuing the draw call. Change-Id: I708797484073f5afcfb5d734467378861091ce8a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542616 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
parent
7a9744cc4c
commit
b9195414fd
@ -83,7 +83,9 @@ void DrawWriter::setTemplate(BindBufferInfo vertices,
|
||||
}
|
||||
|
||||
void DrawWriter::flush() {
|
||||
if (fPendingCount == 0) {
|
||||
// If nothing was appended, or the only appended data was through dynamic instances and the
|
||||
// final vertex count per instance is 0 (-1 in the sign encoded field), nothing should be drawn.
|
||||
if (fPendingCount == 0 || fTemplateCount == -1) {
|
||||
return;
|
||||
}
|
||||
if (fPendingBufferBinds) {
|
||||
|
@ -343,6 +343,7 @@ public:
|
||||
BindBufferInfo indices,
|
||||
unsigned int vertexCount)
|
||||
: Appender(w, Target::kInstances) {
|
||||
SkASSERT(vertexCount > 0);
|
||||
w.setTemplate(vertices, indices, w.fInstances, SkTo<int>(vertexCount));
|
||||
}
|
||||
|
||||
@ -380,8 +381,7 @@ public:
|
||||
|
||||
private:
|
||||
void updateTemplateCount() {
|
||||
unsigned int count = static_cast<unsigned int>(fProxy);
|
||||
SkASSERT(count > 0);
|
||||
const unsigned int count = static_cast<unsigned int>(fProxy);
|
||||
fDrawer.fTemplateCount = std::min(fDrawer.fTemplateCount, -SkTo<int>(count) - 1);
|
||||
// By resetting the proxy after updating the template count, the next batch will start over
|
||||
// with the minimum required vertex count and grow from there.
|
||||
|
Loading…
Reference in New Issue
Block a user