diff options
author | Greg Daniel <egdaniel@google.com> | 2018-06-26 13:51:57 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-26 18:22:22 +0000 |
commit | 001c67fde17106c0b415b345ac17ed74d379f941 (patch) | |
tree | 5059021f29c8089e74d959860d241a2a91c5c153 /src/gpu | |
parent | a4f5ce0c9879ebce8d46e2823311c193a514d93b (diff) |
Remove Vulkan code that supported creating a GrVkRenderTarget.
We never create a pure RenderTarget. If we are creating a RT it is always
a TexRT. The only pure RTs are wrapped.
Bug: skia:
Change-Id: If95d17d244e78c986ed6c63822d4b936ff67b88a
Reviewed-on: https://skia-review.googlesource.com/137700
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/vk/GrVkRenderTarget.cpp | 76 | ||||
-rw-r--r-- | src/gpu/vk/GrVkRenderTarget.h | 15 |
2 files changed, 21 insertions, 70 deletions
diff --git a/src/gpu/vk/GrVkRenderTarget.cpp b/src/gpu/vk/GrVkRenderTarget.cpp index 9ca8a98928..bca72d589f 100644 --- a/src/gpu/vk/GrVkRenderTarget.cpp +++ b/src/gpu/vk/GrVkRenderTarget.cpp @@ -23,17 +23,15 @@ // We're virtually derived from GrSurface (via GrRenderTarget) so its // constructor must be explicitly called. GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, - SkBudgeted budgeted, const GrSurfaceDesc& desc, const GrVkImageInfo& info, sk_sp<GrVkImageLayout> layout, const GrVkImageInfo& msaaInfo, sk_sp<GrVkImageLayout> msaaLayout, const GrVkImageView* colorAttachmentView, - const GrVkImageView* resolveAttachmentView, - GrBackendObjectOwnership ownership) + const GrVkImageView* resolveAttachmentView) : GrSurface(gpu, desc) - , GrVkImage(info, std::move(layout), ownership) + , GrVkImage(info, std::move(layout), GrBackendObjectOwnership::kBorrowed) // for the moment we only support 1:1 color to stencil , GrRenderTarget(gpu, desc) , fColorAttachmentView(colorAttachmentView) @@ -43,7 +41,7 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, , fCachedSimpleRenderPass(nullptr) { SkASSERT(desc.fSampleCnt > 1); this->createFramebuffer(gpu); - this->registerWithCache(budgeted); + this->registerWithCacheWrapped(); } // We're virtually derived from GrSurface (via GrRenderTarget) so its @@ -73,14 +71,12 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, // We're virtually derived from GrSurface (via GrRenderTarget) so its // constructor must be explicitly called. GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, - SkBudgeted budgeted, const GrSurfaceDesc& desc, const GrVkImageInfo& info, sk_sp<GrVkImageLayout> layout, - const GrVkImageView* colorAttachmentView, - GrBackendObjectOwnership ownership) + const GrVkImageView* colorAttachmentView) : GrSurface(gpu, desc) - , GrVkImage(info, std::move(layout), ownership) + , GrVkImage(info, std::move(layout), GrBackendObjectOwnership::kBorrowed) , GrRenderTarget(gpu, desc) , fColorAttachmentView(colorAttachmentView) , fMSAAImage(nullptr) @@ -89,7 +85,7 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, , fCachedSimpleRenderPass(nullptr) { SkASSERT(1 == desc.fSampleCnt); this->createFramebuffer(gpu); - this->registerWithCache(budgeted); + this->registerWithCacheWrapped(); } // We're virtually derived from GrSurface (via GrRenderTarget) so its @@ -112,13 +108,13 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, this->createFramebuffer(gpu); } -GrVkRenderTarget* -GrVkRenderTarget::Create(GrVkGpu* gpu, - SkBudgeted budgeted, - const GrSurfaceDesc& desc, - const GrVkImageInfo& info, - sk_sp<GrVkImageLayout> layout, - GrBackendObjectOwnership ownership) { +sk_sp<GrVkRenderTarget> +GrVkRenderTarget::MakeWrappedRenderTarget(GrVkGpu* gpu, + const GrSurfaceDesc& desc, + const GrVkImageInfo& info, + sk_sp<GrVkImageLayout> layout) { + SkASSERT(VK_NULL_HANDLE != info.fImage); + SkASSERT(1 == info.fLevelCount); VkFormat pixelFormat; GrPixelConfigToVkFormat(desc.fConfig, &pixelFormat); @@ -174,50 +170,16 @@ GrVkRenderTarget::Create(GrVkGpu* gpu, return nullptr; } - GrVkRenderTarget* texRT; + GrVkRenderTarget* vkRT; if (desc.fSampleCnt > 1) { - texRT = new GrVkRenderTarget(gpu, budgeted, desc, info, std::move(layout), msInfo, - std::move(msLayout), colorAttachmentView, - resolveAttachmentView, ownership); + vkRT = new GrVkRenderTarget(gpu, desc, info, std::move(layout), msInfo, + std::move(msLayout), colorAttachmentView, + resolveAttachmentView); } else { - texRT = new GrVkRenderTarget(gpu, budgeted, desc, info, std::move(layout), - colorAttachmentView, ownership); + vkRT = new GrVkRenderTarget(gpu, desc, info, std::move(layout), colorAttachmentView); } - return texRT; -} - -GrVkRenderTarget* -GrVkRenderTarget::CreateNewRenderTarget(GrVkGpu* gpu, - SkBudgeted budgeted, - const GrSurfaceDesc& desc, - const GrVkImage::ImageDesc& imageDesc) { - SkASSERT(imageDesc.fUsageFlags & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT); - - GrVkImageInfo info; - if (!GrVkImage::InitImageInfo(gpu, imageDesc, &info)) { - return nullptr; - } - - sk_sp<GrVkImageLayout> layout(new GrVkImageLayout(info.fImageLayout)); - GrVkRenderTarget* rt = GrVkRenderTarget::Create(gpu, budgeted, desc, info, std::move(layout), - GrBackendObjectOwnership::kOwned); - if (!rt) { - GrVkImage::DestroyImageInfo(gpu, &info); - } - return rt; -} - -sk_sp<GrVkRenderTarget> -GrVkRenderTarget::MakeWrappedRenderTarget(GrVkGpu* gpu, - const GrSurfaceDesc& desc, - const GrVkImageInfo& info, - sk_sp<GrVkImageLayout> layout) { - SkASSERT(VK_NULL_HANDLE != info.fImage); - - return sk_sp<GrVkRenderTarget>( - GrVkRenderTarget::Create(gpu, SkBudgeted::kNo, desc, info, std::move(layout), - GrBackendObjectOwnership::kBorrowed)); + return sk_sp<GrVkRenderTarget>(vkRT); } bool GrVkRenderTarget::completeStencilAttachment() { diff --git a/src/gpu/vk/GrVkRenderTarget.h b/src/gpu/vk/GrVkRenderTarget.h index de2317ef06..2438a90ad5 100644 --- a/src/gpu/vk/GrVkRenderTarget.h +++ b/src/gpu/vk/GrVkRenderTarget.h @@ -31,9 +31,6 @@ struct GrVkImageInfo; class GrVkRenderTarget: public GrRenderTarget, public virtual GrVkImage { public: - static GrVkRenderTarget* CreateNewRenderTarget(GrVkGpu*, SkBudgeted, const GrSurfaceDesc&, - const GrVkImage::ImageDesc&); - static sk_sp<GrVkRenderTarget> MakeWrappedRenderTarget(GrVkGpu*, const GrSurfaceDesc&, const GrVkImageInfo&, sk_sp<GrVkImageLayout>); @@ -119,27 +116,19 @@ protected: private: GrVkRenderTarget(GrVkGpu* gpu, - SkBudgeted, const GrSurfaceDesc& desc, const GrVkImageInfo& info, sk_sp<GrVkImageLayout> layout, const GrVkImageInfo& msaaInfo, sk_sp<GrVkImageLayout> msaaLayout, const GrVkImageView* colorAttachmentView, - const GrVkImageView* resolveAttachmentView, - GrBackendObjectOwnership); + const GrVkImageView* resolveAttachmentView); GrVkRenderTarget(GrVkGpu* gpu, - SkBudgeted, const GrSurfaceDesc& desc, const GrVkImageInfo& info, sk_sp<GrVkImageLayout> layout, - const GrVkImageView* colorAttachmentView, - GrBackendObjectOwnership); - - static GrVkRenderTarget* Create(GrVkGpu*, SkBudgeted, const GrSurfaceDesc&, - const GrVkImageInfo&, sk_sp<GrVkImageLayout>, - GrBackendObjectOwnership); + const GrVkImageView* colorAttachmentView); bool completeStencilAttachment() override; |