Avoid clearing depth on partial HTILE writes (#3167)

* vk_rasterizer: Avoid full depth clear in case of partial HTILE update

* resource_tracking: Mark image as written when its used with atomics
This commit is contained in:
TheTurtle
2025-06-29 00:53:14 +03:00
committed by GitHub
parent 83056712e0
commit 59dd73492b
5 changed files with 28 additions and 30 deletions

View File

@@ -58,6 +58,7 @@ struct BufferResource {
BufferType buffer_type;
u8 instance_attrib{};
bool is_written{};
bool is_read{};
bool is_formatted{};
bool IsSpecial() const noexcept {

View File

@@ -197,6 +197,7 @@ public:
auto& buffer = buffer_resources[index];
buffer.used_types |= desc.used_types;
buffer.is_written |= desc.is_written;
buffer.is_read |= desc.is_read;
buffer.is_formatted |= desc.is_formatted;
return index;
}
@@ -367,6 +368,7 @@ s32 TryHandleInlineCbuf(IR::Inst& inst, Info& info, Descriptors& descriptors,
.used_types = BufferDataType(inst, cbuf.GetNumberFmt()),
.inline_cbuf = cbuf,
.buffer_type = BufferType::Guest,
.is_read = true,
});
}
@@ -378,11 +380,13 @@ void PatchBufferSharp(IR::Block& block, IR::Inst& inst, Info& info, Descriptors&
IR::Inst* producer = handle->Arg(0).InstRecursive();
SharpLocation sharp;
std::tie(sharp, buffer) = TrackSharp<AmdGpu::Buffer>(producer, info);
const bool is_written = IsBufferStore(inst);
binding = descriptors.Add(BufferResource{
.sharp_idx = sharp,
.used_types = BufferDataType(inst, buffer.GetNumberFmt()),
.buffer_type = BufferType::Guest,
.is_written = IsBufferStore(inst),
.is_written = is_written,
.is_read = !is_written,
.is_formatted = inst.GetOpcode() == IR::Opcode::LoadBufferFormatF32 ||
inst.GetOpcode() == IR::Opcode::StoreBufferFormatF32,
});
@@ -409,11 +413,12 @@ void PatchImageSharp(IR::Block& block, IR::Inst& inst, Info& info, Descriptors&
// Read image sharp.
const auto tsharp = TrackSharp(tsharp_handle, info);
const auto inst_info = inst.Flags<IR::TextureInstInfo>();
const bool is_written = inst.GetOpcode() == IR::Opcode::ImageWrite;
const bool is_atomic = IsImageAtomicInstruction(inst);
const bool is_written = inst.GetOpcode() == IR::Opcode::ImageWrite || is_atomic;
const ImageResource image_res = {
.sharp_idx = tsharp,
.is_depth = bool(inst_info.is_depth),
.is_atomic = IsImageAtomicInstruction(inst),
.is_atomic = is_atomic,
.is_array = bool(inst_info.is_array),
.is_written = is_written,
.is_r128 = bool(inst_info.is_r128),