diff --git a/src/xenia/gpu/command_processor.h b/src/xenia/gpu/command_processor.h index f2fbb6c54..c2784480b 100644 --- a/src/xenia/gpu/command_processor.h +++ b/src/xenia/gpu/command_processor.h @@ -84,9 +84,9 @@ class CommandProcessor { swap_request_handler_ = fn; } - void RequestFrameTrace(const std::wstring& root_path); - void BeginTracing(const std::wstring& root_path); - void EndTracing(); + virtual void RequestFrameTrace(const std::wstring& root_path); + virtual void BeginTracing(const std::wstring& root_path); + virtual void EndTracing(); void InitializeRingBuffer(uint32_t ptr, uint32_t page_count); void EnableReadPointerWriteBack(uint32_t ptr, uint32_t block_size); diff --git a/src/xenia/gpu/vulkan/vulkan_command_processor.cc b/src/xenia/gpu/vulkan/vulkan_command_processor.cc index d29c6e8bf..a213ea6e5 100644 --- a/src/xenia/gpu/vulkan/vulkan_command_processor.cc +++ b/src/xenia/gpu/vulkan/vulkan_command_processor.cc @@ -37,9 +37,22 @@ VulkanCommandProcessor::VulkanCommandProcessor( VulkanCommandProcessor::~VulkanCommandProcessor() = default; +void VulkanCommandProcessor::RequestFrameTrace(const std::wstring& root_path) { + // Override traces if renderdoc is attached. + if (device_->is_renderdoc_attached()) { + trace_requested_ = true; + return; + } + + return CommandProcessor::RequestFrameTrace(root_path); +} + void VulkanCommandProcessor::ClearCaches() { CommandProcessor::ClearCaches(); + auto status = vkQueueWaitIdle(queue_); + CheckResult(status, "vkQueueWaitIdle"); + buffer_cache_->ClearCache(); pipeline_cache_->ClearCache(); render_cache_->ClearCache(); @@ -349,12 +362,6 @@ void VulkanCommandProcessor::PerformSwap(uint32_t frontbuffer_ptr, if (device_->is_renderdoc_attached() && capturing_) { device_->EndRenderDocFrameCapture(); capturing_ = false; - - // HACK(DrChat): Used b/c I disabled trace saving code in the CP. - // Remove later. - if (!trace_writer_.is_open()) { - trace_state_ = TraceState::kDisabled; - } } if (queue_mutex_) { queue_mutex_->unlock(); @@ -459,13 +466,13 @@ bool VulkanCommandProcessor::IssueDraw(PrimitiveType primitive_type, static uint32_t frame = 0; if (device_->is_renderdoc_attached() && !capturing_ && - (FLAGS_vulkan_renderdoc_capture_all || - trace_state_ == TraceState::kSingleFrame)) { + (FLAGS_vulkan_renderdoc_capture_all || trace_requested_)) { if (queue_mutex_) { queue_mutex_->lock(); } capturing_ = true; + trace_requested_ = false; device_->BeginRenderDocFrameCapture(); if (queue_mutex_) { diff --git a/src/xenia/gpu/vulkan/vulkan_command_processor.h b/src/xenia/gpu/vulkan/vulkan_command_processor.h index 4a7788e09..f58e2319b 100644 --- a/src/xenia/gpu/vulkan/vulkan_command_processor.h +++ b/src/xenia/gpu/vulkan/vulkan_command_processor.h @@ -49,6 +49,7 @@ class VulkanCommandProcessor : public CommandProcessor { kernel::KernelState* kernel_state); ~VulkanCommandProcessor() override; + virtual void RequestFrameTrace(const std::wstring& root_path) override; void ClearCaches() override; RenderCache* render_cache() { return render_cache_.get(); } @@ -103,6 +104,7 @@ class VulkanCommandProcessor : public CommandProcessor { // Last copy base address, for debugging only. uint32_t last_copy_base_ = 0; bool capturing_ = false; + bool trace_requested_ = false; std::unique_ptr buffer_cache_; std::unique_ptr pipeline_cache_;