diff options
author | Brian Salomon <bsalomon@google.com> | 2018-05-01 18:49:38 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-01 18:49:46 +0000 |
commit | 763abf01643cb738b81b66b8e1d296a7247b4af4 (patch) | |
tree | b50f2a8ce4e941c7e58ffe9604bb3bf806f27459 /src/gpu/GrResourceProvider.cpp | |
parent | 101d56359a5a5dc3b8a2a4149ac171e25eb0bec0 (diff) |
Revert "Use a cached index buffer for triangle fans in GrDefaultPathRenderer."
This reverts commit ddff425b0a9cd4b178c74d7feee2c5c22e37c8d1.
Reason for revert: bad gms
Original change's description:
> Use a cached index buffer for triangle fans in GrDefaultPathRenderer.
>
> Change-Id: I3c3c8db6506c71e4b273c8bc7adcc68d3d768626
> Reviewed-on: https://skia-review.googlesource.com/124841
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,brianosman@google.com
Change-Id: I701b55f188c949c2ee39b39f9bbf5b233f80f174
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/125040
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrResourceProvider.cpp')
-rw-r--r-- | src/gpu/GrResourceProvider.cpp | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp index 62e2675b79..2d2b3a7bc9 100644 --- a/src/gpu/GrResourceProvider.cpp +++ b/src/gpu/GrResourceProvider.cpp @@ -27,7 +27,6 @@ #include "SkMathPriv.h" GR_DECLARE_STATIC_UNIQUE_KEY(gQuadIndexBufferKey); -GR_DECLARE_STATIC_UNIQUE_KEY(gFanIndexBufferKey); const uint32_t GrResourceProvider::kMinScratchTextureSize = 16; @@ -60,9 +59,6 @@ GrResourceProvider::GrResourceProvider(GrGpu* gpu, GrResourceCache* cache, GrSin GR_DEFINE_STATIC_UNIQUE_KEY(gQuadIndexBufferKey); fQuadIndexBufferKey = gQuadIndexBufferKey; - - GR_DEFINE_STATIC_UNIQUE_KEY(gFanIndexBufferKey); - fFanIndexBufferKey = gFanIndexBufferKey; } sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, @@ -345,49 +341,13 @@ sk_sp<const GrBuffer> GrResourceProvider::createPatternedIndexBuffer(const uint1 static constexpr int kMaxQuads = 1 << 12; // max possible: (1 << 14) - 1; -int GrResourceProvider::QuadCountOfQuadBuffer() { return kMaxQuads; } - sk_sp<const GrBuffer> GrResourceProvider::createQuadIndexBuffer() { GR_STATIC_ASSERT(4 * kMaxQuads <= 65535); static const uint16_t kPattern[] = { 0, 1, 2, 2, 1, 3 }; return this->createPatternedIndexBuffer(kPattern, 6, kMaxQuads, 4, fQuadIndexBufferKey); } -// Don't make this maximally sized. It'd be way bigger than required for most cases. -static constexpr int kMaxFanTris = 1 << 12; - -int GrResourceProvider::TriCountOfFanBuffer() { return kMaxFanTris; } - -sk_sp<const GrBuffer> GrResourceProvider::createFanIndexBuffer() { - GR_STATIC_ASSERT(kMaxFanTris + 2 <= SK_MaxU16 + 1); - size_t numIndices = kMaxFanTris * 3; - size_t bufferSize = numIndices * sizeof(uint16_t); - sk_sp<GrBuffer> buffer(this->createBuffer(bufferSize, kIndex_GrBufferType, - kStatic_GrAccessPattern, kNoPendingIO_Flag)); - if (!buffer) { - return nullptr; - } - uint16_t* data = (uint16_t*)buffer->map(); - SkAutoTArray<uint16_t> temp; - if (!data) { - temp.reset(numIndices); - data = temp.get(); - } - for (int i = 0; i < kMaxFanTris; ++i) { - data[3 * i + 0] = 0; - data[3 * i + 1] = i + 1; - data[3 * i + 2] = i + 2; - } - if (temp.get()) { - if (!buffer->updateData(data, bufferSize)) { - return nullptr; - } - } else { - buffer->unmap(); - } - this->assignUniqueKeyToResource(fFanIndexBufferKey, buffer.get()); - return std::move(buffer); -} +int GrResourceProvider::QuadCountOfQuadBuffer() { return kMaxQuads; } sk_sp<GrPath> GrResourceProvider::createPath(const SkPath& path, const GrStyle& style) { if (this->isAbandoned()) { |