From 636585e0aacb2bd4ca184dbef4e388a6b36d33a6 Mon Sep 17 00:00:00 2001 From: Triang3l Date: Fri, 1 Jul 2022 19:53:41 +0300 Subject: [PATCH] [Vulkan] Trace viewer --- src/xenia/gpu/vulkan/premake5.lua | 62 ++++++++++++++++++ .../gpu/vulkan/vulkan_trace_viewer_main.cc | 64 +++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 src/xenia/gpu/vulkan/vulkan_trace_viewer_main.cc diff --git a/src/xenia/gpu/vulkan/premake5.lua b/src/xenia/gpu/vulkan/premake5.lua index e704547ee..f68b886a7 100644 --- a/src/xenia/gpu/vulkan/premake5.lua +++ b/src/xenia/gpu/vulkan/premake5.lua @@ -23,6 +23,65 @@ project("xenia-gpu-vulkan") "../shaders/bytecode/vulkan_spirv/*.h", }) +group("src") +project("xenia-gpu-vulkan-trace-viewer") + uuid("86a1dddc-a26a-4885-8c55-cf745225d93e") + kind("WindowedApp") + language("C++") + links({ + "xenia-apu", + "xenia-apu-nop", + "xenia-base", + "xenia-core", + "xenia-cpu", + "xenia-cpu-backend-x64", + "xenia-gpu", + "xenia-gpu-vulkan", + "xenia-hid", + "xenia-hid-nop", + "xenia-kernel", + "xenia-ui", + "xenia-ui-vulkan", + "xenia-vfs", + }) + links({ + "aes_128", + "capstone", + "fmt", + "glslang-spirv", + "imgui", + "libavcodec", + "libavutil", + "mspack", + "snappy", + "xxhash", + }) + includedirs({ + project_root.."/third_party/Vulkan-Headers/include", + }) + files({ + "vulkan_trace_viewer_main.cc", + "../../ui/windowed_app_main_"..platform_suffix..".cc", + }) + + filter("platforms:Linux") + links({ + "X11", + "xcb", + "X11-xcb", + }) + + filter("platforms:Windows") + -- Only create the .user file if it doesn't already exist. + local user_file = project_root.."/build/xenia-gpu-vulkan-trace-viewer.vcxproj.user" + if not os.isfile(user_file) then + debugdir(project_root) + debugargs({ + "2>&1", + "1>scratch/stdout-trace-viewer.txt", + }) + end + group("src") project("xenia-gpu-vulkan-trace-dump") uuid("0dd0dd1c-b321-494d-ab9a-6c062f0c65cc") @@ -56,6 +115,9 @@ project("xenia-gpu-vulkan-trace-dump") "snappy", "xxhash", }) + includedirs({ + project_root.."/third_party/Vulkan-Headers/include", + }) files({ "vulkan_trace_dump_main.cc", "../../base/console_app_main_"..platform_suffix..".cc", diff --git a/src/xenia/gpu/vulkan/vulkan_trace_viewer_main.cc b/src/xenia/gpu/vulkan/vulkan_trace_viewer_main.cc new file mode 100644 index 000000000..1c0616052 --- /dev/null +++ b/src/xenia/gpu/vulkan/vulkan_trace_viewer_main.cc @@ -0,0 +1,64 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2022 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include +#include + +#include "xenia/base/logging.h" +#include "xenia/gpu/trace_viewer.h" +#include "xenia/gpu/vulkan/vulkan_command_processor.h" +#include "xenia/gpu/vulkan/vulkan_graphics_system.h" + +namespace xe { +namespace gpu { +namespace vulkan { + +class VulkanTraceViewer final : public TraceViewer { + public: + static std::unique_ptr Create( + xe::ui::WindowedAppContext& app_context) { + return std::unique_ptr(new VulkanTraceViewer(app_context)); + } + + std::unique_ptr CreateGraphicsSystem() override { + return std::unique_ptr(new VulkanGraphicsSystem()); + } + + uintptr_t GetColorRenderTarget( + uint32_t pitch, xenos::MsaaSamples samples, uint32_t base, + xenos::ColorRenderTargetFormat format) override { + // TODO(Triang3l): EDRAM viewer. + return 0; + } + + uintptr_t GetDepthRenderTarget( + uint32_t pitch, xenos::MsaaSamples samples, uint32_t base, + xenos::DepthRenderTargetFormat format) override { + // TODO(Triang3l): EDRAM viewer. + return 0; + } + + uintptr_t GetTextureEntry(const TextureInfo& texture_info, + const SamplerInfo& sampler_info) override { + // TODO(Triang3l): Textures, but from a fetch constant rather than + // TextureInfo/SamplerInfo which are going away. + return 0; + } + + private: + explicit VulkanTraceViewer(xe::ui::WindowedAppContext& app_context) + : TraceViewer(app_context, "xenia-gpu-vulkan-trace-viewer") {} +}; + +} // namespace vulkan +} // namespace gpu +} // namespace xe + +XE_DEFINE_WINDOWED_APP(xenia_gpu_vulkan_trace_viewer, + xe::gpu::vulkan::VulkanTraceViewer::Create);