fix(agc): inherit pending plane fills on fresh attachments

This commit is contained in:
JJenkx committed 2026-10-17 18:54:24 -04:00
1 parent 95670d0104
commit 6326d05f02
2 files changed
+11 -1

No files matched your search

@@ -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);
}
@@ -23,6 +23,8 @@ constexpr std::size_t StencilPlaneBytes = 256u * 256u;
alignas(4096) std::array<std::byte, DepthPlaneBytes> Depth{};
alignas(4096) std::array<std::byte, StencilPlaneBytes> Stencil{};
alignas(4096) std::array<std::byte, DepthPlaneBytes> HtileDepth{};
alignas(4096) std::array<std::byte, DepthPlaneBytes> AliasDepth{};
alignas(4096) std::array<std::byte, StencilPlaneBytes> AliasStencil{};
alignas(256) std::array<std::uint32_t, HtileBytes / 4u> 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<std::uintptr_t>(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<std::uintptr_t>(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) {