[GPU] Trace dump: Do PIX/RenderDoc capture if attached
This commit is contained in:
parent
f75d927cc5
commit
36f4158f09
|
@ -12,6 +12,7 @@
|
|||
#include "xenia/gpu/d3d12/d3d12_command_processor.h"
|
||||
#include "xenia/gpu/d3d12/d3d12_graphics_system.h"
|
||||
#include "xenia/gpu/trace_dump.h"
|
||||
#include "xenia/ui/d3d12/d3d12_provider.h"
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
@ -24,6 +25,24 @@ class D3D12TraceDump : public TraceDump {
|
|||
std::unique_ptr<gpu::GraphicsSystem> CreateGraphicsSystem() override {
|
||||
return std::unique_ptr<gpu::GraphicsSystem>(new D3D12GraphicsSystem());
|
||||
}
|
||||
|
||||
void BeginHostCapture() override {
|
||||
auto provider = static_cast<const ui::d3d12::D3D12Provider*>(
|
||||
graphics_system_->provider());
|
||||
IDXGraphicsAnalysis* graphics_analysis = provider->GetGraphicsAnalysis();
|
||||
if (graphics_analysis) {
|
||||
graphics_analysis->BeginCapture();
|
||||
}
|
||||
}
|
||||
|
||||
void EndHostCapture() override {
|
||||
auto provider = static_cast<const ui::d3d12::D3D12Provider*>(
|
||||
graphics_system_->provider());
|
||||
IDXGraphicsAnalysis* graphics_analysis = provider->GetGraphicsAnalysis();
|
||||
if (graphics_analysis) {
|
||||
graphics_analysis->EndCapture();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
int trace_dump_main(const std::vector<std::wstring>& args) {
|
||||
|
|
|
@ -126,10 +126,12 @@ bool TraceDump::Load(std::wstring trace_file_path) {
|
|||
}
|
||||
|
||||
int TraceDump::Run() {
|
||||
BeginHostCapture();
|
||||
player_->SeekFrame(0);
|
||||
player_->SeekCommand(
|
||||
static_cast<int>(player_->current_frame()->commands.size() - 1));
|
||||
player_->WaitOnPlayback();
|
||||
EndHostCapture();
|
||||
|
||||
// Capture.
|
||||
int result = 0;
|
||||
|
|
|
@ -43,6 +43,9 @@ class TraceDump {
|
|||
|
||||
virtual std::unique_ptr<gpu::GraphicsSystem> CreateGraphicsSystem() = 0;
|
||||
|
||||
virtual void BeginHostCapture() = 0;
|
||||
virtual void EndHostCapture() = 0;
|
||||
|
||||
std::unique_ptr<Emulator> emulator_;
|
||||
GraphicsSystem* graphics_system_ = nullptr;
|
||||
std::unique_ptr<TracePlayer> player_;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include "xenia/gpu/trace_dump.h"
|
||||
#include "xenia/gpu/vulkan/vulkan_command_processor.h"
|
||||
#include "xenia/gpu/vulkan/vulkan_graphics_system.h"
|
||||
#include "xenia/ui/vulkan/vulkan_device.h"
|
||||
#include "xenia/ui/vulkan/vulkan_provider.h"
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
@ -24,6 +26,24 @@ class VulkanTraceDump : public TraceDump {
|
|||
std::unique_ptr<gpu::GraphicsSystem> CreateGraphicsSystem() override {
|
||||
return std::unique_ptr<gpu::GraphicsSystem>(new VulkanGraphicsSystem());
|
||||
}
|
||||
|
||||
void BeginHostCapture() override {
|
||||
auto device = static_cast<const ui::vulkan::VulkanProvider*>(
|
||||
graphics_system_->provider())
|
||||
->device();
|
||||
if (device->is_renderdoc_attached()) {
|
||||
device->BeginRenderDocFrameCapture();
|
||||
}
|
||||
}
|
||||
|
||||
void EndHostCapture() override {
|
||||
auto device = static_cast<const ui::vulkan::VulkanProvider*>(
|
||||
graphics_system_->provider())
|
||||
->device();
|
||||
if (device->is_renderdoc_attached()) {
|
||||
device->EndRenderDocFrameCapture();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
int trace_dump_main(const std::vector<std::wstring>& args) {
|
||||
|
|
Loading…
Reference in New Issue