diff options
author | Robert Phillips <robertphillips@google.com> | 2017-05-12 14:49:16 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-12 19:20:22 +0000 |
commit | 8a02f65c5cc16d010f188c34861b03d96cb8ec10 (patch) | |
tree | e90adb6d5167987d1b93fb3c0ba2511ff435bdc0 /src/gpu/GrProcessor.cpp | |
parent | 177266339c3aa6dda4fa2912af9eaa8e8206f78f (diff) |
Switch ImageStorageAccess over to GrTextureProxies
Split out of: https://skia-review.googlesource.com/c/10484/ (Omnibus: Push instantiation of GrTextures later (post TextureSampler))
Change-Id: I341de6ae121620d30e50bff21450878a18bdf4f2
Reviewed-on: https://skia-review.googlesource.com/16714
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrProcessor.cpp')
-rw-r--r-- | src/gpu/GrProcessor.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp index 57a8008dae..1533257bad 100644 --- a/src/gpu/GrProcessor.cpp +++ b/src/gpu/GrProcessor.cpp @@ -129,6 +129,8 @@ void GrProcessor::operator delete(void* target) { /////////////////////////////////////////////////////////////////////////////// void GrResourceIOProcessor::addTextureSampler(const TextureSampler* access) { + // MDB TODO: this 'isBad' call checks to ensure the underlying texture exists. It needs to + // be moved later. if (access->isBad()) { this->markAsBad(); } @@ -140,7 +142,13 @@ void GrResourceIOProcessor::addBufferAccess(const BufferAccess* access) { fBufferAccesses.push_back(access); } -void GrResourceIOProcessor::addImageStorageAccess(const ImageStorageAccess* access) { +void GrResourceIOProcessor::addImageStorageAccess(GrResourceProvider* resourceProvider, + const ImageStorageAccess* access) { + // MDB TODO: this 'isBad' call attempts to instantiate 'access'. It needs to be moved later. + if (access->isBad(resourceProvider)) { + this->markAsBad(); + } + fImageStorageAccesses.push_back(access); } @@ -152,7 +160,7 @@ void GrResourceIOProcessor::addPendingIOs() const { buffer->programBuffer()->markPendingIO(); } for (const auto& imageStorage : fImageStorageAccesses) { - imageStorage->programTexture()->markPendingIO(); + imageStorage->programProxy()->markPendingIO(); } } @@ -164,7 +172,7 @@ void GrResourceIOProcessor::removeRefs() const { buffer->programBuffer()->removeRef(); } for (const auto& imageStorage : fImageStorageAccesses) { - imageStorage->programTexture()->removeRef(); + imageStorage->programProxy()->removeRef(); } } @@ -176,7 +184,7 @@ void GrResourceIOProcessor::pendingIOComplete() const { buffer->programBuffer()->pendingIOComplete(); } for (const auto& imageStorage : fImageStorageAccesses) { - imageStorage->programTexture()->pendingIOComplete(); + imageStorage->programProxy()->pendingIOComplete(); } } @@ -272,19 +280,20 @@ void GrResourceIOProcessor::TextureSampler::reset(GrResourceProvider* resourcePr /////////////////////////////////////////////////////////////////////////////////////////////////// -GrResourceIOProcessor::ImageStorageAccess::ImageStorageAccess(sk_sp<GrTexture> texture, +GrResourceIOProcessor::ImageStorageAccess::ImageStorageAccess(sk_sp<GrTextureProxy> proxy, GrIOType ioType, GrSLMemoryModel memoryModel, GrSLRestrict restrict, - GrShaderFlags visibility) { - SkASSERT(texture); - fTexture.set(texture.release(), ioType); + GrShaderFlags visibility) + : fProxyRef(std::move(proxy), ioType) { + SkASSERT(fProxyRef.getProxy()); + fMemoryModel = memoryModel; fRestrict = restrict; fVisibility = visibility; // We currently infer this from the config. However, we could allow the client to specify // a format that is different but compatible with the config. - switch (fTexture.get()->config()) { + switch (fProxyRef.getProxy()->config()) { case kRGBA_8888_GrPixelConfig: fFormat = GrImageStorageFormat::kRGBA8; break; |