Merge branch 'master' into vulkan

This commit is contained in:
Triang3l 2020-10-07 23:18:08 +03:00
commit afcd01def5
2 changed files with 10 additions and 7 deletions

View File

@ -22,7 +22,7 @@
DEFINE_bool(d3d12_tiled_shared_memory, true,
"Enable tiled resources for shared memory emulation. Disabling "
"them greatly video memory usage - a 512 MB buffer is created - "
"them increases video memory usage - a 512 MB buffer is created - "
"but allows graphics debuggers that don't support tiled resources "
"to work.",
"D3D12");
@ -100,7 +100,7 @@ bool D3D12SharedMemory::Initialize() {
&buffer_descriptor_heap_desc,
IID_PPV_ARGS(&buffer_descriptor_heap_)))) {
XELOGE(
"Failed to create the descriptor heap for shared memory buffer views");
"Shared memory: Failed to create the descriptor heap for buffer views");
Shutdown();
return false;
}
@ -286,7 +286,6 @@ bool D3D12SharedMemory::InitializeTraceSubmitDownloads() {
ResetTraceDownload();
PrepareForTraceDownload();
uint32_t download_page_count = trace_download_page_count();
// Request downloading of GPU-written memory.
if (!download_page_count) {
return false;
}
@ -312,7 +311,7 @@ bool D3D12SharedMemory::InitializeTraceSubmitDownloads() {
UseAsCopySource();
command_processor_.SubmitBarriers();
uint32_t download_buffer_offset = 0;
for (auto& download_range : trace_download_ranges()) {
for (const auto& download_range : trace_download_ranges()) {
command_list.D3DCopyBufferRegion(
trace_download_buffer_, download_buffer_offset, buffer_,
download_range.first, download_range.second);
@ -328,7 +327,7 @@ void D3D12SharedMemory::InitializeTraceCompleteDownloads() {
void* download_mapping;
if (SUCCEEDED(trace_download_buffer_->Map(0, nullptr, &download_mapping))) {
uint32_t download_buffer_offset = 0;
for (auto download_range : trace_download_ranges()) {
for (const auto& download_range : trace_download_ranges()) {
trace_writer_.WriteMemoryRead(
download_range.first, download_range.second,
reinterpret_cast<const uint8_t*>(download_mapping) +
@ -338,8 +337,8 @@ void D3D12SharedMemory::InitializeTraceCompleteDownloads() {
trace_download_buffer_->Unmap(0, &download_write_range);
} else {
XELOGE(
"Failed to map the GPU-written memory download buffer for frame "
"tracing");
"Shared memory: Failed to map the GPU-written memory download buffer "
"for frame tracing");
}
ResetTraceDownload();
}

View File

@ -536,6 +536,10 @@ void SharedMemory::PrepareForTraceDownload() {
} else {
uint32_t gpu_written_range_length =
gpu_written_page - gpu_written_range_start;
// Call EnsureHostGpuMemoryAllocated in case the page was marked as
// GPU-written not as a result to an actual write to the shared memory
// buffer, but, for instance, by resolving with resolution scaling (to a
// separate buffer).
if (EnsureHostGpuMemoryAllocated(
gpu_written_range_start << page_size_log2_,
gpu_written_range_length << page_size_log2_)) {