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
// 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,
sk_sp<GrVkRenderTarget>
GrVkRenderTarget::MakeWrappedRenderTarget(GrVkGpu* gpu,
const GrSurfaceDesc& desc,
const GrVkImageInfo& info,
sk_sp<GrVkImageLayout> layout,
GrBackendObjectOwnership ownership) {
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,
vkRT = new GrVkRenderTarget(gpu, desc, info, std::move(layout), msInfo,
std::move(msLayout), colorAttachmentView,
resolveAttachmentView, ownership);
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() {

View File

@ -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;