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>
This commit is contained in:
Greg Daniel 2018-06-26 13:51:57 -04:00 committed by Skia Commit-Bot
parent a4f5ce0c98
commit 001c67fde1
2 changed files with 21 additions and 70 deletions

View File

@ -23,17 +23,15 @@
// We're virtually derived from GrSurface (via GrRenderTarget) so its // We're virtually derived from GrSurface (via GrRenderTarget) so its
// constructor must be explicitly called. // constructor must be explicitly called.
GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
SkBudgeted budgeted,
const GrSurfaceDesc& desc, const GrSurfaceDesc& desc,
const GrVkImageInfo& info, const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout, sk_sp<GrVkImageLayout> layout,
const GrVkImageInfo& msaaInfo, const GrVkImageInfo& msaaInfo,
sk_sp<GrVkImageLayout> msaaLayout, sk_sp<GrVkImageLayout> msaaLayout,
const GrVkImageView* colorAttachmentView, const GrVkImageView* colorAttachmentView,
const GrVkImageView* resolveAttachmentView, const GrVkImageView* resolveAttachmentView)
GrBackendObjectOwnership ownership)
: GrSurface(gpu, desc) : 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 // for the moment we only support 1:1 color to stencil
, GrRenderTarget(gpu, desc) , GrRenderTarget(gpu, desc)
, fColorAttachmentView(colorAttachmentView) , fColorAttachmentView(colorAttachmentView)
@ -43,7 +41,7 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
, fCachedSimpleRenderPass(nullptr) { , fCachedSimpleRenderPass(nullptr) {
SkASSERT(desc.fSampleCnt > 1); SkASSERT(desc.fSampleCnt > 1);
this->createFramebuffer(gpu); this->createFramebuffer(gpu);
this->registerWithCache(budgeted); this->registerWithCacheWrapped();
} }
// We're virtually derived from GrSurface (via GrRenderTarget) so its // 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 // We're virtually derived from GrSurface (via GrRenderTarget) so its
// constructor must be explicitly called. // constructor must be explicitly called.
GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
SkBudgeted budgeted,
const GrSurfaceDesc& desc, const GrSurfaceDesc& desc,
const GrVkImageInfo& info, const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout, sk_sp<GrVkImageLayout> layout,
const GrVkImageView* colorAttachmentView, const GrVkImageView* colorAttachmentView)
GrBackendObjectOwnership ownership)
: GrSurface(gpu, desc) : GrSurface(gpu, desc)
, GrVkImage(info, std::move(layout), ownership) , GrVkImage(info, std::move(layout), GrBackendObjectOwnership::kBorrowed)
, GrRenderTarget(gpu, desc) , GrRenderTarget(gpu, desc)
, fColorAttachmentView(colorAttachmentView) , fColorAttachmentView(colorAttachmentView)
, fMSAAImage(nullptr) , fMSAAImage(nullptr)
@ -89,7 +85,7 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
, fCachedSimpleRenderPass(nullptr) { , fCachedSimpleRenderPass(nullptr) {
SkASSERT(1 == desc.fSampleCnt); SkASSERT(1 == desc.fSampleCnt);
this->createFramebuffer(gpu); this->createFramebuffer(gpu);
this->registerWithCache(budgeted); this->registerWithCacheWrapped();
} }
// We're virtually derived from GrSurface (via GrRenderTarget) so its // We're virtually derived from GrSurface (via GrRenderTarget) so its
@ -112,13 +108,13 @@ GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu,
this->createFramebuffer(gpu); this->createFramebuffer(gpu);
} }
GrVkRenderTarget* sk_sp<GrVkRenderTarget>
GrVkRenderTarget::Create(GrVkGpu* gpu, GrVkRenderTarget::MakeWrappedRenderTarget(GrVkGpu* gpu,
SkBudgeted budgeted,
const GrSurfaceDesc& desc, const GrSurfaceDesc& desc,
const GrVkImageInfo& info, const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout, sk_sp<GrVkImageLayout> layout) {
GrBackendObjectOwnership ownership) { SkASSERT(VK_NULL_HANDLE != info.fImage);
SkASSERT(1 == info.fLevelCount); SkASSERT(1 == info.fLevelCount);
VkFormat pixelFormat; VkFormat pixelFormat;
GrPixelConfigToVkFormat(desc.fConfig, &pixelFormat); GrPixelConfigToVkFormat(desc.fConfig, &pixelFormat);
@ -174,50 +170,16 @@ GrVkRenderTarget::Create(GrVkGpu* gpu,
return nullptr; return nullptr;
} }
GrVkRenderTarget* texRT; GrVkRenderTarget* vkRT;
if (desc.fSampleCnt > 1) { if (desc.fSampleCnt > 1) {
texRT = new GrVkRenderTarget(gpu, budgeted, desc, info, std::move(layout), msInfo, vkRT = new GrVkRenderTarget(gpu, desc, info, std::move(layout), msInfo,
std::move(msLayout), colorAttachmentView, std::move(msLayout), colorAttachmentView,
resolveAttachmentView, ownership); resolveAttachmentView);
} else { } else {
texRT = new GrVkRenderTarget(gpu, budgeted, desc, info, std::move(layout), vkRT = new GrVkRenderTarget(gpu, desc, info, std::move(layout), colorAttachmentView);
colorAttachmentView, ownership);
} }
return texRT; return sk_sp<GrVkRenderTarget>(vkRT);
}
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));
} }
bool GrVkRenderTarget::completeStencilAttachment() { bool GrVkRenderTarget::completeStencilAttachment() {

View File

@ -31,9 +31,6 @@ struct GrVkImageInfo;
class GrVkRenderTarget: public GrRenderTarget, public virtual GrVkImage { class GrVkRenderTarget: public GrRenderTarget, public virtual GrVkImage {
public: public:
static GrVkRenderTarget* CreateNewRenderTarget(GrVkGpu*, SkBudgeted, const GrSurfaceDesc&,
const GrVkImage::ImageDesc&);
static sk_sp<GrVkRenderTarget> MakeWrappedRenderTarget(GrVkGpu*, const GrSurfaceDesc&, static sk_sp<GrVkRenderTarget> MakeWrappedRenderTarget(GrVkGpu*, const GrSurfaceDesc&,
const GrVkImageInfo&, const GrVkImageInfo&,
sk_sp<GrVkImageLayout>); sk_sp<GrVkImageLayout>);
@ -119,27 +116,19 @@ protected:
private: private:
GrVkRenderTarget(GrVkGpu* gpu, GrVkRenderTarget(GrVkGpu* gpu,
SkBudgeted,
const GrSurfaceDesc& desc, const GrSurfaceDesc& desc,
const GrVkImageInfo& info, const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout, sk_sp<GrVkImageLayout> layout,
const GrVkImageInfo& msaaInfo, const GrVkImageInfo& msaaInfo,
sk_sp<GrVkImageLayout> msaaLayout, sk_sp<GrVkImageLayout> msaaLayout,
const GrVkImageView* colorAttachmentView, const GrVkImageView* colorAttachmentView,
const GrVkImageView* resolveAttachmentView, const GrVkImageView* resolveAttachmentView);
GrBackendObjectOwnership);
GrVkRenderTarget(GrVkGpu* gpu, GrVkRenderTarget(GrVkGpu* gpu,
SkBudgeted,
const GrSurfaceDesc& desc, const GrSurfaceDesc& desc,
const GrVkImageInfo& info, const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout, sk_sp<GrVkImageLayout> layout,
const GrVkImageView* colorAttachmentView, const GrVkImageView* colorAttachmentView);
GrBackendObjectOwnership);
static GrVkRenderTarget* Create(GrVkGpu*, SkBudgeted, const GrSurfaceDesc&,
const GrVkImageInfo&, sk_sp<GrVkImageLayout>,
GrBackendObjectOwnership);
bool completeStencilAttachment() override; bool completeStencilAttachment() override;