Revert "Have GrVkRenderTarget only use GrVkAttachments and not derive from GrVkImage."
This reverts commit 3dc6c190dabbe424345f3a8220be87bb92cdaf05.
Reason for revert: hitting assert about RT having input attachment on mali bots
Original change's description:
> Have GrVkRenderTarget only use GrVkAttachments and not derive from GrVkImage.
>
> This change moves the color and resolve attachments used in a
> GrVkRenderTarget to be a GrVkAttachment. These along with the msaa
> attachment now mean that GrVkRenderTarget no longer needs to derive from
> a GrVkImage.
>
> There are a couple ugly things in this CL since GrVkTexture still is a
> GrVkImage since we can't share attachments between GrVkRT and GrVkTex.
> But when that gets updated in the follow on CL things will look much nicer.
>
> Bug: skia:10727
> Change-Id: I2f12674d7517c6d6dea389e2d1fb7296028bcc85
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379576
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,jvanverth@google.com,bsalomon@google.com
Change-Id: Ic46f3947ed9f7b2ca26e8418d643e7f89b6108d2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10727
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380459
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrAttachment.cpp b/src/gpu/GrAttachment.cpp
index 04edf57..6db517d 100644
--- a/src/gpu/GrAttachment.cpp
+++ b/src/gpu/GrAttachment.cpp
@@ -14,28 +14,13 @@
#include "src/gpu/GrGpu.h"
size_t GrAttachment::onGpuMemorySize() const {
- // The GrTexture[RenderTarget] is built up by a bunch of attachments each of which are their
- // own GrGpuResource. Ideally the GrRenderTarget would not be a GrGpuResource and the GrTexture
- // would just merge with the new GrSurface/Attachment world. Then we could just depend on each
- // attachment to give its own size since we don't have GrGpuResources owning other
- // GrGpuResources. Until we get to that point we need to live in some hybrid world. We will let
- // the msaa and stencil attachments track their own size because they do get cached separately.
- // For all GrTexture* based things we will continue to to use the GrTexture* to report size and
- // the owned attachments will have no size and be uncached.
- // TODO: Once we start using texture attachments this check really should be !texture. However,
- // until then in GrVkTextureRenderTarget we make a wrapped attachment to use for the render
- // target which duplicates the GrTexture. These will be merged once we use texture attachments.
- if ((fSupportedUsages & UsageFlags::kStencilAttachment) ||
- ((fSupportedUsages & UsageFlags::kColorAttachment) && fSampleCnt > 1)) {
- GrBackendFormat format = this->backendFormat();
- SkImage::CompressionType compression = GrBackendFormatToCompressionType(format);
+ GrBackendFormat format = this->backendFormat();
+ SkImage::CompressionType compression = GrBackendFormatToCompressionType(format);
- uint64_t size = GrNumBlocks(compression, this->dimensions());
- size *= GrBackendFormatBytesPerBlock(this->backendFormat());
- size *= this->numSamples();
- return size;
- }
- return 0;
+ uint64_t size = GrNumBlocks(compression, this->dimensions());
+ size *= GrBackendFormatBytesPerBlock(this->backendFormat());
+ size *= this->numSamples();
+ return size;
}
static void build_key(GrResourceKey::Builder* builder,