Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2078,7 +2078,7 @@ class DepthSurface {
std::exception_ptr publicationFailure;

void capturePublication() {
if ((target.format != VK_FORMAT_D32_SFLOAT_S8_UINT && !bareDepthTarget(target)) || context.detiler == nullptr) return;
if ((target.format != VK_FORMAT_D32_SFLOAT && target.format != VK_FORMAT_D32_SFLOAT_S8_UINT) || context.detiler == nullptr) return;
try {
const auto lease = GuestAllocations::GuestAllocationsAcquireAll_nid_postfix();
CheckCurrent();
Expand Down Expand Up @@ -3162,6 +3162,7 @@ std::uint32_t expandedHtileWord(std::uint32_t word, bool stencilInHtile, VkImage
}

bool DepthSurface::PublishToGuest(DepthReadCause cause) {
const bool stencil = target.format == VK_FORMAT_D32_SFLOAT_S8_UINT;
Require(!Recorder::InCompletion(), "native multisample depth publication inside a GPU completion is not implemented");
Require(!publicationInProgress, "recursive native multisample depth publication is not implemented");
Require(!publicationFailed, "a previous native multisample depth publication store did not complete");
Expand All @@ -3173,10 +3174,17 @@ bool DepthSurface::PublishToGuest(DepthReadCause cause) {
if (publicationFailure) std::rethrow_exception(publicationFailure);
const bool bare = bareDepthTarget(target);
const bool htile = !uniformPlaneTarget(target) && !bare;
const bool publishable = bare ? publication.size() == 1u : target.format == VK_FORMAT_D32_SFLOAT_S8_UINT && publication.size() == (htile ? 3u : 2u);
if (!stencil && !bare) {
Require(target.format != VK_FORMAT_D16_UNORM, "guest publication of a written native multisample D16 depth is not implemented");
Require(target.format == VK_FORMAT_D32_SFLOAT && hostFormat == target.format, "sample-preserving guest publication of a written native multisample depth that the device stores in another format is not implemented");
Require(sampleable, "guest publication of a written native multisample depth the device cannot sample is not implemented");
Require(context.detiler != nullptr, "guest publication of a written native multisample depth needs the texture detiler");
ApplyFastClear();
}
const bool publishable = bare ? publication.size() == 1u : publication.size() == (stencil && htile ? 3u : 2u);
Require(publishable && hostFormat == target.format, "sample-preserving guest publication of native multisample depth is not implemented for this owner");
Require(sampling.refusal.empty(), sampling.refusal);
RequireStencilProven();
if (stencil) RequireStencilProven();
Require(!clearPending && clearGeneration == 0u && stencilClearGeneration == 0u && pendingClear == 0u, "native multisample depth publication with an unapplied clear is not implemented");
Require(sampleable && context.detiler != nullptr, "sample-preserving guest publication of native multisample depth requires sampled readback support");
const auto lease = GuestAllocations::GuestAllocationsAcquireAll_nid_postfix();
Expand Down Expand Up @@ -3228,7 +3236,7 @@ bool DepthSurface::PublishToGuest(DepthReadCause cause) {
for (std::size_t offset = 0u; offset < result[1].size(); offset += 4u) {
std::uint32_t word;
std::memcpy(&word, result[1].data() + offset, 4u);
word = expandedHtileWord(word, !target.htileDepthOnly, VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT);
word = expandedHtileWord(word, !target.htileDepthOnly, VK_IMAGE_ASPECT_DEPTH_BIT | (stencil ? VK_IMAGE_ASPECT_STENCIL_BIT : 0u));
std::memcpy(result[1].data() + offset, &word, 4u);
}
}
Expand Down Expand Up @@ -3296,6 +3304,9 @@ bool DepthSurface::PublishToGuest(DepthReadCause cause) {
publication.clear();
if (superseded[0]) RetireMultisampleColorTarget(sampling.depthAlias->active);
if (superseded[2]) RetireMultisampleColorTarget(sampling.stencilAlias->active);
if (!stencil && !bare) {
active->store(false, std::memory_order_release);
}
return std::ranges::find(tookGuest, true) != tookGuest.end();
}

Expand Down
Loading
Loading