[D3D12] Trace guest memory operations
This commit is contained in:
@@ -12,9 +12,11 @@
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/mutex.h"
|
||||
#include "xenia/gpu/trace_writer.h"
|
||||
#include "xenia/memory.h"
|
||||
#include "xenia/ui/d3d12/d3d12_api.h"
|
||||
#include "xenia/ui/d3d12/pools.h"
|
||||
@@ -30,7 +32,8 @@ class D3D12CommandProcessor;
|
||||
// system page size granularity.
|
||||
class SharedMemory {
|
||||
public:
|
||||
SharedMemory(D3D12CommandProcessor* command_processor, Memory* memory);
|
||||
SharedMemory(D3D12CommandProcessor* command_processor, Memory* memory,
|
||||
TraceWriter* trace_writer);
|
||||
~SharedMemory();
|
||||
|
||||
bool Initialize();
|
||||
@@ -124,6 +127,10 @@ class SharedMemory {
|
||||
void WriteRawSRVDescriptor(D3D12_CPU_DESCRIPTOR_HANDLE handle);
|
||||
void WriteRawUAVDescriptor(D3D12_CPU_DESCRIPTOR_HANDLE handle);
|
||||
|
||||
// Returns true if any downloads were submitted to the command processor.
|
||||
bool InitializeTraceSubmitDownloads();
|
||||
void InitializeTraceCompleteDownloads();
|
||||
|
||||
private:
|
||||
bool AreTiledResourcesUsed() const;
|
||||
|
||||
@@ -132,8 +139,8 @@ class SharedMemory {
|
||||
bool written_by_gpu);
|
||||
|
||||
D3D12CommandProcessor* command_processor_;
|
||||
|
||||
Memory* memory_;
|
||||
TraceWriter* trace_writer_;
|
||||
|
||||
// The 512 MB tiled buffer.
|
||||
static constexpr uint32_t kBufferSizeLog2 = 29;
|
||||
@@ -268,6 +275,13 @@ class SharedMemory {
|
||||
std::unique_ptr<ui::d3d12::UploadBufferPool> upload_buffer_pool_ = nullptr;
|
||||
|
||||
void TransitionBuffer(D3D12_RESOURCE_STATES new_state);
|
||||
|
||||
// GPU-written memory downloading for traces.
|
||||
// Start page, length in pages.
|
||||
std::vector<std::pair<uint32_t, uint32_t>> trace_gpu_written_ranges_;
|
||||
// Created temporarily, only for downloading.
|
||||
ID3D12Resource* trace_gpu_written_buffer_ = nullptr;
|
||||
void ResetTraceGPUWrittenBuffer();
|
||||
};
|
||||
|
||||
} // namespace d3d12
|
||||
|
||||
Reference in New Issue
Block a user