diff options
author | Brian Salomon <bsalomon@google.com> | 2017-10-17 09:11:04 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-17 17:30:12 +0000 |
commit | fa2d604a7ded95a3ace905519b476129cd0fffcb (patch) | |
tree | d885e28a4f54375418d97c76ce668ffbc17cf9c0 /src/gpu/GrResourceProvider.cpp | |
parent | 8580d51cd8cb733321978966621056fa38b7be8c (diff) |
Make GPU backend triangulate rects such that they are rendered as tri strips rather than tri fans.
Right now when we turn rects into quads we use a vertex order compatible with a tri fan rather than a tri strip.
I wanted it to be the case that the same code could be used to generate a non-indexed mesh for a single rect or indexed using the quad index buffer when batching. Triangle fanning is not available in all APIS (e.g. is emulated in ANGLE and not supported in Metal) so it seems better to use a triangle strip over a fan in the single rect case.
Change-Id: I31eebd794e7328f4b39e3ec3377bf2ec556360ca
Reviewed-on: https://skia-review.googlesource.com/60081
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrResourceProvider.cpp')
-rw-r--r-- | src/gpu/GrResourceProvider.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp index 5139ee3adf..dfde098c55 100644 --- a/src/gpu/GrResourceProvider.cpp +++ b/src/gpu/GrResourceProvider.cpp @@ -353,7 +353,7 @@ static constexpr int kMaxQuads = 1 << 12; // max possible: (1 << 14) - 1; sk_sp<const GrBuffer> GrResourceProvider::createQuadIndexBuffer() { GR_STATIC_ASSERT(4 * kMaxQuads <= 65535); - static const uint16_t kPattern[] = { 0, 1, 2, 0, 2, 3 }; + static const uint16_t kPattern[] = { 0, 1, 2, 2, 1, 3 }; return this->createPatternedIndexBuffer(kPattern, 6, kMaxQuads, 4, fQuadIndexBufferKey); } |