diff options
author | Greg Daniel <egdaniel@google.com> | 2018-04-10 09:34:07 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-10 14:20:22 +0000 |
commit | 52e16d984898f18c84de773507da875a7954b922 (patch) | |
tree | 61dc6aaa14903f6b8c2e7e55d5d40c136e653354 /src/gpu/mock | |
parent | 58627cb8eb559670b86f06225eb87e6c1c5e8504 (diff) |
Update getBackendInfo calls on GrBackendTexture to support VkImageLayout better.
The big api level change here is that the getBackendInfo calls now return by value
instead of a pointer. These changes are being made in support of Vulkan so that
the client can update the VkImageLayout on the GrBackendTexture and have that
update get reflected in our internal tracking of the image. This is done by storing
a ref counted GrVkImageLayout object on the GrBackendTexture and the GrVkImage.
Bug: skia:
Change-Id: I8c6158fd3a66eb61fef97ebf09ea5364bca3f1ae
Reviewed-on: https://skia-review.googlesource.com/119101
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/mock')
-rw-r--r-- | src/gpu/mock/GrMockCaps.h | 6 | ||||
-rw-r--r-- | src/gpu/mock/GrMockGpu.cpp | 27 |
2 files changed, 18 insertions, 15 deletions
diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h index 27d295ebd5..65dd766d8d 100644 --- a/src/gpu/mock/GrMockCaps.h +++ b/src/gpu/mock/GrMockCaps.h @@ -77,12 +77,12 @@ public: bool validateBackendTexture(const GrBackendTexture& tex, SkColorType, GrPixelConfig* config) const override { - const GrMockTextureInfo* texInfo = tex.getMockTextureInfo(); - if (!texInfo) { + GrMockTextureInfo texInfo; + if (!tex.getMockTextureInfo(&texInfo)) { return false; } - *config = texInfo->fConfig; + *config = texInfo.fConfig; return true; } diff --git a/src/gpu/mock/GrMockGpu.cpp b/src/gpu/mock/GrMockGpu.cpp index a677d63bba..060d7bd261 100644 --- a/src/gpu/mock/GrMockGpu.cpp +++ b/src/gpu/mock/GrMockGpu.cpp @@ -95,8 +95,9 @@ sk_sp<GrTexture> GrMockGpu::onWrapBackendTexture(const GrBackendTexture& tex, GrSurfaceDesc desc; desc.fWidth = tex.width(); desc.fHeight = tex.height(); - SkASSERT(tex.getMockTextureInfo()); - GrMockTextureInfo info = *tex.getMockTextureInfo(); + + GrMockTextureInfo info; + SkAssertResult(tex.getMockTextureInfo(&info)); desc.fConfig = info.fConfig; GrMipMapsStatus mipMapsStatus = tex.hasMipMaps() ? GrMipMapsStatus::kValid @@ -113,8 +114,9 @@ sk_sp<GrTexture> GrMockGpu::onWrapRenderableBackendTexture(const GrBackendTextur desc.fFlags = kRenderTarget_GrSurfaceFlag; desc.fWidth = tex.width(); desc.fHeight = tex.height(); - SkASSERT(tex.getMockTextureInfo()); - GrMockTextureInfo texInfo = *tex.getMockTextureInfo(); + + GrMockTextureInfo texInfo; + SkAssertResult(tex.getMockTextureInfo(&texInfo)); desc.fConfig = texInfo.fConfig; GrMipMapsStatus mipMapsStatus = @@ -148,8 +150,9 @@ sk_sp<GrRenderTarget> GrMockGpu::onWrapBackendTextureAsRenderTarget(const GrBack desc.fFlags = kRenderTarget_GrSurfaceFlag; desc.fWidth = tex.width(); desc.fHeight = tex.height(); - SkASSERT(tex.getMockTextureInfo()); - const GrMockTextureInfo texInfo = *tex.getMockTextureInfo(); + + GrMockTextureInfo texInfo; + SkAssertResult(tex.getMockTextureInfo(&texInfo)); desc.fConfig = texInfo.fConfig; desc.fSampleCnt = sampleCnt; @@ -189,20 +192,20 @@ GrBackendTexture GrMockGpu::createTestingOnlyBackendTexture(const void* pixels, bool GrMockGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const { SkASSERT(kMock_GrBackend == tex.backend()); - const GrMockTextureInfo* info = tex.getMockTextureInfo(); - if (!info) { + GrMockTextureInfo info; + if (!tex.getMockTextureInfo(&info)) { return false; } - return fOutstandingTestingOnlyTextureIDs.contains(info->fID); + return fOutstandingTestingOnlyTextureIDs.contains(info.fID); } void GrMockGpu::deleteTestingOnlyBackendTexture(const GrBackendTexture& tex) { SkASSERT(kMock_GrBackend == tex.backend()); - const GrMockTextureInfo* info = tex.getMockTextureInfo(); - if (info) { - fOutstandingTestingOnlyTextureIDs.remove(info->fID); + GrMockTextureInfo info; + if (tex.getMockTextureInfo(&info)) { + fOutstandingTestingOnlyTextureIDs.remove(info.fID); } } |