[D3D12] Fix resolve not syncing with CPU memory and memory extent calculation
This commit is contained in:
parent
a1d33615b0
commit
210c30aef9
|
@ -1133,7 +1133,7 @@ bool RenderTargetCache::Resolve(const Memory& memory,
|
||||||
copy_dest_resident = texture_cache.EnsureScaledResolveBufferResident(
|
copy_dest_resident = texture_cache.EnsureScaledResolveBufferResident(
|
||||||
resolve_info.copy_dest_base, resolve_info.copy_dest_length);
|
resolve_info.copy_dest_base, resolve_info.copy_dest_length);
|
||||||
} else {
|
} else {
|
||||||
copy_dest_resident = shared_memory.EnsureTilesResident(
|
copy_dest_resident = shared_memory.RequestRange(
|
||||||
resolve_info.copy_dest_base, resolve_info.copy_dest_length);
|
resolve_info.copy_dest_base, resolve_info.copy_dest_length);
|
||||||
}
|
}
|
||||||
if (copy_dest_resident) {
|
if (copy_dest_resident) {
|
||||||
|
@ -1225,6 +1225,8 @@ bool RenderTargetCache::Resolve(const Memory& memory,
|
||||||
written_length_out = resolve_info.copy_dest_length;
|
written_length_out = resolve_info.copy_dest_length;
|
||||||
copied = true;
|
copied = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
XELOGE("Failed to obtain the resolve destination memory region");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -85,10 +85,6 @@ class SharedMemory {
|
||||||
// Unregisters previously registered watched memory range.
|
// Unregisters previously registered watched memory range.
|
||||||
void UnwatchMemoryRange(WatchHandle handle);
|
void UnwatchMemoryRange(WatchHandle handle);
|
||||||
|
|
||||||
// Ensures the buffer tiles backing the range are resident, but doesn't upload
|
|
||||||
// anything.
|
|
||||||
bool EnsureTilesResident(uint32_t start, uint32_t length);
|
|
||||||
|
|
||||||
// Checks if the range has been updated, uploads new data if needed and
|
// Checks if the range has been updated, uploads new data if needed and
|
||||||
// ensures the buffer tiles backing the range are resident. May transition the
|
// ensures the buffer tiles backing the range are resident. May transition the
|
||||||
// tiled buffer to copy destination - call this before UseForReading or
|
// tiled buffer to copy destination - call this before UseForReading or
|
||||||
|
@ -106,7 +102,10 @@ class SharedMemory {
|
||||||
// Marks the range as containing GPU-generated data (such as resolves),
|
// Marks the range as containing GPU-generated data (such as resolves),
|
||||||
// triggering modification callbacks, making it valid (so pages are not
|
// triggering modification callbacks, making it valid (so pages are not
|
||||||
// copied from the main memory until they're modified by the CPU) and
|
// copied from the main memory until they're modified by the CPU) and
|
||||||
// protecting it.
|
// protecting it. Before writing anything from the GPU side, RequestRange must
|
||||||
|
// be called, to make sure, if the GPU writes don't overwrite *everything* in
|
||||||
|
// the pages they touch, the CPU data is properly loaded to the unmodified
|
||||||
|
// regions in those pages.
|
||||||
void RangeWrittenByGPU(uint32_t start, uint32_t length);
|
void RangeWrittenByGPU(uint32_t start, uint32_t length);
|
||||||
|
|
||||||
// Makes the buffer usable for vertices, indices and texture untiling.
|
// Makes the buffer usable for vertices, indices and texture untiling.
|
||||||
|
@ -185,6 +184,10 @@ class SharedMemory {
|
||||||
// Total buffer page count.
|
// Total buffer page count.
|
||||||
uint32_t page_count_;
|
uint32_t page_count_;
|
||||||
|
|
||||||
|
// Ensures the buffer tiles backing the range are resident, but doesn't upload
|
||||||
|
// anything.
|
||||||
|
bool EnsureTilesResident(uint32_t start, uint32_t length);
|
||||||
|
|
||||||
// Non-shader-visible buffer descriptor heap for faster binding (via copying
|
// Non-shader-visible buffer descriptor heap for faster binding (via copying
|
||||||
// rather than creation).
|
// rather than creation).
|
||||||
enum class BufferDescriptorIndex : uint32_t {
|
enum class BufferDescriptorIndex : uint32_t {
|
||||||
|
|
|
@ -1878,7 +1878,7 @@ void TextureCache::LogTextureAction(const Texture* texture,
|
||||||
const char* action) {
|
const char* action) {
|
||||||
XELOGGPU(
|
XELOGGPU(
|
||||||
"{} {} {}{}x{}x{} {} {} texture with {} {}packed mip level{}, "
|
"{} {} {}{}x{}x{} {} {} texture with {} {}packed mip level{}, "
|
||||||
"base at 0x{:08X} (size {}), mips at 0x{:08X} (size {})",
|
"base at 0x{:08X} (size 0x{:08X}), mips at 0x{:08X} (size 0x{:08X})",
|
||||||
action, texture->key.tiled ? "tiled" : "linear",
|
action, texture->key.tiled ? "tiled" : "linear",
|
||||||
texture->key.scaled_resolve ? "2x-scaled " : "", texture->key.width,
|
texture->key.scaled_resolve ? "2x-scaled " : "", texture->key.width,
|
||||||
texture->key.height, texture->key.depth,
|
texture->key.height, texture->key.depth,
|
||||||
|
|
|
@ -380,8 +380,7 @@ bool GetResolveInfo(const RegisterFile& regs, const Memory& memory,
|
||||||
dest_width, dest_height, dest_depth);
|
dest_width, dest_height, dest_depth);
|
||||||
}
|
}
|
||||||
copy_dest_length = texture_util::GetGuestMipSliceStorageSize(
|
copy_dest_length = texture_util::GetGuestMipSliceStorageSize(
|
||||||
dest_width, dest_height, dest_depth, false, dest_format, nullptr,
|
dest_width, dest_height, dest_depth, true, dest_format, nullptr, false);
|
||||||
false);
|
|
||||||
} else {
|
} else {
|
||||||
XELOGE("Tried to resolve to format {}, which is not a ColorFormat",
|
XELOGE("Tried to resolve to format {}, which is not a ColorFormat",
|
||||||
dest_format_info.name);
|
dest_format_info.name);
|
||||||
|
|
Loading…
Reference in New Issue