From 6326d05f02868252bf64cc3e1699bb60e84fdf9f Mon Sep 17 00:00:00 2001 From: JJenkx Date: Sat, 17 Oct 2026 17:41:06 -0400 Subject: [PATCH] fix(agc): inherit pending plane fills on fresh attachments --- .../prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp | 2 +- .../libSceAgcDriver/tests/execution/DepthPlaneFill.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp index 93e52c1343..6440942fff 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp @@ -973,9 +973,9 @@ void takePlane(DepthSurface& surface, PlaneOwners& owners, std::uint64_t address auto* owner = entry.surface; if (owner != nullptr && owner->active->load(std::memory_order_acquire) && owner != &surface && owner->target.format == surface.target.format && owner->target.samples == surface.target.samples && owner->target.extent.width == surface.target.extent.width && owner->target.extent.height == surface.target.extent.height && (!created || (clearAspects & aspect) == 0)) { if ((owner->pendingClear & aspect) != 0) { - if (!created) surface.pendingClear |= aspect; if (aspect == VK_IMAGE_ASPECT_DEPTH_BIT) surface.depthFill = owner->depthFill; else surface.stencilFill = owner->stencilFill; + if (!created || (aspect == VK_IMAGE_ASPECT_DEPTH_BIT ? surface.depthFill.has_value() : surface.stencilFill.has_value())) surface.pendingClear |= aspect; } else { surface.CopyAspectFrom(*owner, aspect); } diff --git a/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneFill.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneFill.cpp index d833893a47..fb67e951b8 100644 --- a/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneFill.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneFill.cpp @@ -23,6 +23,8 @@ constexpr std::size_t StencilPlaneBytes = 256u * 256u; alignas(4096) std::array Depth{}; alignas(4096) std::array Stencil{}; alignas(4096) std::array HtileDepth{}; +alignas(4096) std::array AliasDepth{}; +alignas(4096) std::array AliasStencil{}; alignas(256) std::array Htile{}; VkStencilOpState StencilState(VkCompareOp compare, VkStencilOp pass, std::uint32_t reference) { @@ -91,6 +93,14 @@ int main() { AgcDriver::Graphics::NoteDepthMetadataFill(htiled.depth, DepthPlaneBytes, 0u); AgcDriver::Graphics::NoteHtileDepthClear(htiled.htile, HtileBytes); Require(Draw(*device, shaders, htiled, {}) == Covered, "an HTILE clear kernel after a depth plane fill of 0.0 did not clear the depth to DB_DEPTH_CLEAR (1.0)"); + Htile.fill(0xfffff3ffu); + AgcDriver::Graphics::NoteDepthMetadataFill(stencil, StencilPlaneBytes, 0x07070707u); + const Surface stencilAlias{reinterpret_cast(AliasDepth.data()), stencil, htiled.htile, false, VK_FORMAT_D32_SFLOAT_S8_UINT}; + Require(Draw(*device, shaders, stencilAlias, StencilEquals(7u)) == Covered, "a new attachment lost its inherited pending stencil fill"); + + AgcDriver::Graphics::NoteDepthMetadataFill(stencilAlias.depth, DepthPlaneBytes, 0u); + const Surface depthAlias{stencilAlias.depth, reinterpret_cast(AliasStencil.data()), htiled.htile, false, VK_FORMAT_D32_SFLOAT_S8_UINT}; + Require(Draw(*device, shaders, depthAlias, {}) == 0u, "a new attachment lost its inherited pending depth fill"); std::puts("depth plane fill tests passed"); return 0; } catch (const std::exception& error) {