[GPU] Double-buffer readback_resolve.
Introduce "fast" readback resolve that reads from previous frame's resolve buffers, quick swap between buffers each frame to avoid copies so minimal performance impact and mostly correct bahavior. Checks if previous frame had a buffer for the current resolve and falls through to the slow path, which also allows to support "screenshot" features in the games that do that without stalling on normal resolve operations. Re-enabled readback_memexport as separate feature, was previously bundled with readback_resolve (probably not intentionally) and ensures destination address is writeable to avoid memory access related crashes and unnecessary work. readback_resolve cvar changes from bool to string ternary with "none", "fast" and "full" options, defaulting to the new "fast" mode.
This commit is contained in:
committed by
Radosław Gliński
parent
93adb2bb95
commit
e2c33686cc
@@ -692,8 +692,19 @@ class D3D12CommandProcessor final : public CommandProcessor {
|
||||
D3D12_RESOURCE_STATES scratch_buffer_state_;
|
||||
bool scratch_buffer_used_ = false;
|
||||
|
||||
ID3D12Resource* readback_buffer_ = nullptr;
|
||||
uint32_t readback_buffer_size_ = 0;
|
||||
// Per-resolve double-buffered readback for delayed sync
|
||||
struct ReadbackBuffer {
|
||||
ID3D12Resource* buffers[2] = {nullptr, nullptr};
|
||||
uint32_t sizes[2] = {0, 0};
|
||||
uint32_t current_index = 0;
|
||||
uint64_t last_used_frame = 0;
|
||||
};
|
||||
// Map: (written_address << 32 | written_length) -> ReadbackBuffer
|
||||
std::unordered_map<uint64_t, ReadbackBuffer> readback_buffers_;
|
||||
|
||||
// Simple single buffer for memexport (always syncs, no double-buffering)
|
||||
ID3D12Resource* memexport_readback_buffer_ = nullptr;
|
||||
uint32_t memexport_readback_buffer_size_ = 0;
|
||||
|
||||
// The current fixed-function drawing state.
|
||||
D3D12_VIEWPORT ff_viewport_;
|
||||
|
||||
Reference in New Issue
Block a user