Add workaround to use full screen loads for vk discardable msaa.

Bug: skia:10979
Change-Id: I81b8692b0bb1582b60a9324492a782d04a09538f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344963
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2021-01-06 09:24:09 -05:00 committed by Skia Commit-Bot
parent 4a5656834e
commit 417743f806
3 changed files with 19 additions and 1 deletions

View File

@ -507,6 +507,13 @@ void GrVkCaps::applyDriverCorrectnessWorkarounds(const VkPhysicalDevicePropertie
fMustInvalidatePrimaryCmdBufferStateAfterClearAttachments = true;
}
// On Qualcomm and Arm the gpu resolves an area larger than the render pass bounds when using
// discardable msaa attachments. This causes the resolve to resolve uninitialized data from the
// msaa image into the resolve image.
if (kQualcomm_VkVendor == properties.vendorID || kARM_VkVendor == properties.vendorID) {
fMustLoadFullImageWithDiscardableMSAA = true;
}
////////////////////////////////////////////////////////////////////////////
// GrCaps workarounds
////////////////////////////////////////////////////////////////////////////

View File

@ -222,6 +222,10 @@ public:
// This flag is similar to enabling gl render to texture for msaa rendering.
bool preferDiscardableMSAAAttachment() const { return fPreferDiscardableMSAAAttachment; }
bool mustLoadFullImageWithDiscardableMSAA() const {
return fMustLoadFullImageWithDiscardableMSAA;
}
#if GR_TEST_UTILS
std::vector<TestFormatColorTypeCombination> getTestingCombinations() const override;
#endif
@ -363,6 +367,7 @@ private:
bool fPreferCachedCpuMemory = true;
bool fPreferDiscardableMSAAAttachment = false;
bool fMustLoadFullImageWithDiscardableMSAA = false;
using INHERITED = GrCaps;
};

View File

@ -180,7 +180,13 @@ bool GrVkOpsRenderPass::beginRenderPass(const VkClearValue& clearColor,
bool firstSubpassUsesSecondaryCB =
loadFromResolve != LoadFromResolve::kLoad && SkToBool(fCurrentSecondaryCommandBuffer);
auto nativeBounds = GrNativeRect::MakeRelativeTo(fOrigin, vkRT->height(), fBounds);
bool useFullBounds = fCurrentRenderPass->hasResolveAttachment() &&
fGpu->vkCaps().mustLoadFullImageWithDiscardableMSAA();
auto nativeBounds = GrNativeRect::MakeRelativeTo(
fOrigin, vkRT->height(),
useFullBounds ? SkIRect::MakeWH(vkRT->width(), vkRT->height()) : fBounds);
// The bounds we use for the render pass should be of the granularity supported
// by the device.
const VkExtent2D& granularity = fCurrentRenderPass->granularity();