diff options
author | Robert Phillips <robertphillips@google.com> | 2017-02-28 15:05:52 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-28 15:06:07 +0000 |
commit | 2411c1112e7b3cb0126143e4c0a731aff7876dce (patch) | |
tree | 5a99fa6e95b84291556e2e99b40ccc6790f42393 /src | |
parent | e30cf80c8893db8ec61d29322f1992591dad3b6b (diff) |
Revert "Allow GrSurfaceProxy-derived classes to use flags when instantiating"
This reverts commit c8f1e3a5c08d58657dddccdeedbe5d6e8c16d891.
Reason for revert: check on ANGLE failure
Original change's description:
> Allow GrSurfaceProxy-derived classes to use flags when instantiating
>
> In some instances proxies must be created that, when instantiated, have no pending IO.
>
> This is split out of: (Add per-Flush callback to GrDrawingManager)
>
> https://skia-review.googlesource.com/c/8679/
>
> Change-Id: I68b5504d35ad436a4ae737ac4bb3c171fc9a5826
> Reviewed-on: https://skia-review.googlesource.com/8988
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
>
TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: I157417c443028b2148ee355ce69c946a96bb9407
Reviewed-on: https://skia-review.googlesource.com/9066
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrBufferAllocPool.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetProxy.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrSurfaceProxy.cpp | 21 | ||||
-rw-r--r-- | src/gpu/GrTextureProvider.cpp | 16 | ||||
-rw-r--r-- | src/gpu/GrTextureProxy.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrTextureRenderTargetProxy.cpp | 14 | ||||
-rw-r--r-- | src/gpu/effects/GrTextureStripAtlas.cpp | 10 |
7 files changed, 32 insertions, 41 deletions
diff --git a/src/gpu/GrBufferAllocPool.cpp b/src/gpu/GrBufferAllocPool.cpp index 38bde0dc9a..e3f30b0c1c 100644 --- a/src/gpu/GrBufferAllocPool.cpp +++ b/src/gpu/GrBufferAllocPool.cpp @@ -334,7 +334,7 @@ void* GrVertexBufferAllocPool::makeSpace(size_t vertexSize, SkASSERT(buffer); SkASSERT(startVertex); - size_t offset SK_INIT_TO_AVOID_WARNING; + size_t offset = 0; // assign to suppress warning void* ptr = INHERITED::makeSpace(vertexSize * vertexCount, vertexSize, buffer, @@ -359,7 +359,7 @@ void* GrIndexBufferAllocPool::makeSpace(int indexCount, SkASSERT(buffer); SkASSERT(startIndex); - size_t offset SK_INIT_TO_AVOID_WARNING; + size_t offset = 0; // assign to suppress warning void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t), sizeof(uint16_t), buffer, diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp index b3328ab638..882acf660c 100644 --- a/src/gpu/GrRenderTargetProxy.cpp +++ b/src/gpu/GrRenderTargetProxy.cpp @@ -18,8 +18,8 @@ // TODO: we can probably munge the 'desc' in both the wrapped and deferred // cases to make the sampleConfig/numSamples stuff more rational. GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps, const GrSurfaceDesc& desc, - SkBackingFit fit, SkBudgeted budgeted, uint32_t flags) - : INHERITED(desc, fit, budgeted, flags) + SkBackingFit fit, SkBudgeted budgeted) + : INHERITED(desc, fit, budgeted) , fFlags(GrRenderTarget::Flags::kNone) { // Since we know the newly created render target will be internal, we are able to precompute // what the flags will ultimately end up being. diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp index 3cac43b65d..bd60aa9fb9 100644 --- a/src/gpu/GrSurfaceProxy.cpp +++ b/src/gpu/GrSurfaceProxy.cpp @@ -23,7 +23,6 @@ GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, SkBackingFit fit) , fDesc(fTarget->desc()) , fFit(fit) , fBudgeted(fTarget->resourcePriv().isBudgeted()) - , fFlags(0) , fUniqueID(fTarget->uniqueID()) // Note: converting from unique resource ID to a proxy ID! , fGpuMemorySize(kInvalidGpuMemorySize) , fLastOpList(nullptr) { @@ -42,9 +41,9 @@ GrSurface* GrSurfaceProxy::instantiate(GrTextureProvider* texProvider) { } if (SkBackingFit::kApprox == fFit) { - fTarget = texProvider->createApproxTexture(fDesc, fFlags); + fTarget = texProvider->createApproxTexture(fDesc); } else { - fTarget = texProvider->createTexture(fDesc, fBudgeted, fFlags); + fTarget = texProvider->createTexture(fDesc, fBudgeted); } if (!fTarget) { return nullptr; @@ -144,15 +143,10 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrapped(sk_sp<GrTexture> tex) { } } -#include "GrResourceProvider.h" - sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeDeferred(const GrCaps& caps, const GrSurfaceDesc& desc, SkBackingFit fit, - SkBudgeted budgeted, - uint32_t flags) { - SkASSERT(0 == flags || GrResourceProvider::kNoPendingIO_Flag == flags); - + SkBudgeted budgeted) { // TODO: share this testing code with check_texture_creation_params if (GrPixelConfigIsCompressed(desc.fConfig)) { if (SkBackingFit::kApprox == fit || kBottomLeft_GrSurfaceOrigin == desc.fOrigin) { @@ -197,11 +191,10 @@ sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeDeferred(const GrCaps& caps, if (willBeRT) { // We know anything we instantiate later from this deferred path will be // both texturable and renderable - return sk_sp<GrSurfaceProxy>(new GrTextureRenderTargetProxy(caps, copyDesc, fit, - budgeted, flags)); + return sk_sp<GrSurfaceProxy>(new GrTextureRenderTargetProxy(caps, copyDesc, fit, budgeted)); } - return sk_sp<GrSurfaceProxy>(new GrTextureProxy(copyDesc, fit, budgeted, nullptr, 0, flags)); + return sk_sp<GrSurfaceProxy>(new GrTextureProxy(copyDesc, fit, budgeted, nullptr, 0)); } sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeDeferred(const GrCaps& caps, @@ -212,8 +205,8 @@ sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeDeferred(const GrCaps& caps, size_t rowBytes) { if (srcData) { // If we have srcData, for now, we create a wrapped GrTextureProxy - sk_sp<GrTexture> tex(texProvider->createTexture(desc, budgeted, srcData, rowBytes)); - return GrSurfaceProxy::MakeWrapped(std::move(tex)); + sk_sp<GrSurface> surf(texProvider->createTexture(desc, budgeted, srcData, rowBytes)); + return GrSurfaceProxy::MakeWrapped(std::move(surf)); } return GrSurfaceProxy::MakeDeferred(caps, desc, SkBackingFit::kExact, budgeted); diff --git a/src/gpu/GrTextureProvider.cpp b/src/gpu/GrTextureProvider.cpp index 3790f27fcc..993f4b8cfa 100644 --- a/src/gpu/GrTextureProvider.cpp +++ b/src/gpu/GrTextureProvider.cpp @@ -31,8 +31,7 @@ GrTextureProvider::GrTextureProvider(GrGpu* gpu, GrResourceCache* cache, GrSingl } GrTexture* GrTextureProvider::createMipMappedTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, - const GrMipLevel* texels, int mipLevelCount, - uint32_t flags) { + const GrMipLevel* texels, int mipLevelCount) { ASSERT_SINGLE_OWNER if (this->isAbandoned()) { @@ -55,8 +54,9 @@ GrTexture* GrTextureProvider::createMipMappedTexture(const GrSurfaceDesc& desc, } if (!GrPixelConfigIsCompressed(desc.fConfig)) { if (mipLevelCount < 2) { - flags |= kExact_ScratchTextureFlag | kNoCreate_ScratchTextureFlag; - if (GrTexture* texture = this->refScratchTexture(desc, flags)) { + static const uint32_t kFlags = kExact_ScratchTextureFlag | + kNoCreate_ScratchTextureFlag; + if (GrTexture* texture = this->refScratchTexture(desc, kFlags)) { if (!mipLevelCount || texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, texels[0].fPixels, texels[0].fRowBytes)) { @@ -78,7 +78,7 @@ GrTexture* GrTextureProvider::createMipMappedTexture(const GrSurfaceDesc& desc, } GrTexture* GrTextureProvider::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, - const void* srcData, size_t rowBytes, uint32_t flags) { + const void* srcData, size_t rowBytes) { GrMipLevel tempTexels; GrMipLevel* texels = nullptr; int levelCount = 0; @@ -88,12 +88,12 @@ GrTexture* GrTextureProvider::createTexture(const GrSurfaceDesc& desc, SkBudgete texels = &tempTexels; levelCount = 1; } - return this->createMipMappedTexture(desc, budgeted, texels, levelCount, flags); + return this->createMipMappedTexture(desc, budgeted, texels, levelCount); } -GrTexture* GrTextureProvider::createApproxTexture(const GrSurfaceDesc& desc, uint32_t flags) { +GrTexture* GrTextureProvider::createApproxTexture(const GrSurfaceDesc& desc) { ASSERT_SINGLE_OWNER - return this->internalCreateApproxTexture(desc, flags); + return this->internalCreateApproxTexture(desc, 0); } GrTexture* GrTextureProvider::internalCreateApproxTexture(const GrSurfaceDesc& desc, diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp index 9a65140816..77a8402dbe 100644 --- a/src/gpu/GrTextureProxy.cpp +++ b/src/gpu/GrTextureProxy.cpp @@ -10,8 +10,8 @@ #include "GrTextureProvider.h" GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit fit, SkBudgeted budgeted, - const void* srcData, size_t /*rowBytes*/, uint32_t flags) - : INHERITED(srcDesc, fit, budgeted, flags) { + const void* srcData, size_t /*rowBytes*/) + : INHERITED(srcDesc, fit, budgeted) { SkASSERT(!srcData); // currently handled in Make() } diff --git a/src/gpu/GrTextureRenderTargetProxy.cpp b/src/gpu/GrTextureRenderTargetProxy.cpp index 432d00854f..212ea0a049 100644 --- a/src/gpu/GrTextureRenderTargetProxy.cpp +++ b/src/gpu/GrTextureRenderTargetProxy.cpp @@ -8,21 +8,19 @@ #include "GrTextureRenderTargetProxy.h" // Deferred version -// This class is virtually derived from GrSurfaceProxy (via both GrTextureProxy and +// This class is virtually derived from GrSurfaceProxy (via both GrTextureProxy and // GrRenderTargetProxy) so its constructor must be explicitly called. GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps, const GrSurfaceDesc& desc, SkBackingFit fit, - SkBudgeted budgeted, - uint32_t flags) - : GrSurfaceProxy(desc, fit, budgeted, flags) - // for now textures w/ data are always wrapped - , GrTextureProxy(desc, fit, budgeted, nullptr, 0, flags) - , GrRenderTargetProxy(caps, desc, fit, budgeted, flags) { + SkBudgeted budgeted) + : GrSurfaceProxy(desc, fit, budgeted) + , GrTextureProxy(desc, fit, budgeted, nullptr, 0) // 4 now textures w/ data are always wrapped + , GrRenderTargetProxy(caps, desc, fit, budgeted) { } // Wrapped version -// This class is virtually derived from GrSurfaceProxy (via both GrTextureProxy and +// This class is virtually derived from GrSurfaceProxy (via both GrTextureProxy and // GrRenderTargetProxy) so its constructor must be explicitly called. GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(sk_sp<GrSurface> surf) : GrSurfaceProxy(surf, SkBackingFit::kExact) diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp index f49830481b..6bc7ec0480 100644 --- a/src/gpu/effects/GrTextureStripAtlas.cpp +++ b/src/gpu/effects/GrTextureStripAtlas.cpp @@ -8,7 +8,6 @@ #include "GrTextureStripAtlas.h" #include "GrContext.h" #include "GrContextPriv.h" -#include "GrResourceProvider.h" #include "GrSurfaceContext.h" #include "SkGr.h" #include "SkPixelRef.h" @@ -210,14 +209,15 @@ void GrTextureStripAtlas::lockTexture() { // MDB TODO (caching): this side-steps the issue of proxies with unique IDs sk_sp<GrTexture> texture(fDesc.fContext->textureProvider()->findAndRefTextureByUniqueKey(key)); if (!texture) { - texture.reset(fDesc.fContext->textureProvider()->createTexture( - texDesc, SkBudgeted::kYes, - nullptr, 0, - GrResourceProvider::kNoPendingIO_Flag)); + texture.reset(fDesc.fContext->textureProvider()->createTexture(texDesc, SkBudgeted::kYes, + nullptr, 0)); if (!texture) { return; } + // We will be issuing writes to the surface using kDontFlush_PixelOpsFlag, so we + // need to make sure any existing IO is flushed + fDesc.fContext->flushSurfaceIO(texture.get()); fDesc.fContext->textureProvider()->assignUniqueKeyToTexture(key, texture.get()); // This is a new texture, so all of our cache info is now invalid this->initLRU(); |