Handle stencil storage/depth transitions

This commit is contained in:
nmzik committed 2026-07-18 04:56:20 +02:00
1 parent df385a7aad
commit 78431dba4a
4 files changed
+81 -6

No files matched your search

@@ -326,6 +326,7 @@ inline constexpr std::array<VideoOutFormatPolicy, 6> VIDEO_OUT_FORMAT_POLICIES {
enum class DepthOverlap : uint8_t {
None,
RetireSampled,
RetireStorage,
ExpandTarget,
DiscardTarget,
Unsupported
@@ -815,6 +816,23 @@ ClassifyStorageBufferRebind(bool buffer_overlap, bool cached_gpu_modified,
return DepthOverlap::Unsupported;
}
// Mirrors storage -> depth-target binding transition. An inaccessible stencil aspect
// does not require the otherwise necessary image content copy.
[[nodiscard]] inline DepthOverlap ClassifyStorageDepthOverlap(const ImageInfo& storage,
const DepthTargetInfo& depth) {
const bool overlaps_depth = ImageRangeOverlaps(storage.address, storage.size, depth.address,
depth.size);
const bool overlaps_stencil = depth.stencil_address != 0 &&
ImageRangeOverlaps(storage.address, storage.size,
depth.stencil_address, depth.stencil_size);
if (!overlaps_depth && !overlaps_stencil) {
return DepthOverlap::None;
}
return !overlaps_depth && overlaps_stencil && !depth.stencil_access
? DepthOverlap::RetireStorage
: DepthOverlap::Unsupported;
}
[[nodiscard]] inline RenderTargetOverlap
ClassifyRenderTargetOverlap(const ImageInfo& sampled, bool sampled_gpu_modified, bool same_context,
const RenderTargetInfo& target) {