mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-09 04:10:05 +00:00
clean up renderer_vulkan
This commit is contained in:
parent
e70301d48c
commit
a0087ead42
6 changed files with 20 additions and 74 deletions
|
@ -53,8 +53,8 @@ constexpr static std::array<vk::DescriptorSetLayoutBinding, 1> PRESENT_BINDINGS
|
||||||
RendererVulkan::RendererVulkan(Core::System& system, Pica::PicaCore& pica_,
|
RendererVulkan::RendererVulkan(Core::System& system, Pica::PicaCore& pica_,
|
||||||
Frontend::EmuWindow& window, Frontend::EmuWindow* secondary_window)
|
Frontend::EmuWindow& window, Frontend::EmuWindow* secondary_window)
|
||||||
: RendererBase{system, window, secondary_window}, memory{system.Memory()}, pica{pica_},
|
: RendererBase{system, window, secondary_window}, memory{system.Memory()}, pica{pica_},
|
||||||
instance{system.TelemetrySession(), window, Settings::values.physical_device.GetValue()},
|
instance{window, Settings::values.physical_device.GetValue()}, scheduler{instance},
|
||||||
scheduler{instance}, renderpass_cache{instance, scheduler}, pool{instance},
|
renderpass_cache{instance, scheduler}, pool{instance},
|
||||||
main_window{window, instance, scheduler},
|
main_window{window, instance, scheduler},
|
||||||
vertex_buffer{instance, scheduler, vk::BufferUsageFlagBits::eVertexBuffer,
|
vertex_buffer{instance, scheduler, vk::BufferUsageFlagBits::eVertexBuffer,
|
||||||
VERTEX_BUFFER_SIZE},
|
VERTEX_BUFFER_SIZE},
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "core/frontend/emu_window.h"
|
#include "core/frontend/emu_window.h"
|
||||||
#include "core/telemetry_session.h"
|
|
||||||
#include "video_core/custom_textures/custom_format.h"
|
#include "video_core/custom_textures/custom_format.h"
|
||||||
#include "video_core/renderer_vulkan/vk_instance.h"
|
#include "video_core/renderer_vulkan/vk_instance.h"
|
||||||
#include "video_core/renderer_vulkan/vk_platform.h"
|
#include "video_core/renderer_vulkan/vk_platform.h"
|
||||||
|
@ -133,17 +132,16 @@ std::string GetReadableVersion(u32 version) {
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
Instance::Instance(bool enable_validation, bool dump_command_buffers)
|
Instance::Instance(bool enable_validation, bool dump_command_buffers)
|
||||||
: library{OpenLibrary()}, instance{CreateInstance(*library,
|
: library{OpenLibrary()},
|
||||||
Frontend::WindowSystemType::Headless,
|
instance{CreateInstance(*library, Frontend::WindowSystemType::Headless, enable_validation,
|
||||||
enable_validation, dump_command_buffers)},
|
dump_command_buffers)},
|
||||||
physical_devices{instance->enumeratePhysicalDevices()} {}
|
physical_devices{instance->enumeratePhysicalDevices()} {}
|
||||||
|
|
||||||
Instance::Instance(Core::TelemetrySession& telemetry, Frontend::EmuWindow& window,
|
Instance::Instance(Frontend::EmuWindow& window, u32 physical_device_index)
|
||||||
u32 physical_device_index)
|
: library{OpenLibrary(&window)},
|
||||||
: library{OpenLibrary(&window)}, instance{CreateInstance(
|
instance{CreateInstance(*library, window.GetWindowInfo().type,
|
||||||
*library, window.GetWindowInfo().type,
|
Settings::values.renderer_debug.GetValue(),
|
||||||
Settings::values.renderer_debug.GetValue(),
|
Settings::values.dump_command_buffers.GetValue())},
|
||||||
Settings::values.dump_command_buffers.GetValue())},
|
|
||||||
debug_callback{CreateDebugCallback(*instance, debug_utils_supported)},
|
debug_callback{CreateDebugCallback(*instance, debug_utils_supported)},
|
||||||
physical_devices{instance->enumeratePhysicalDevices()} {
|
physical_devices{instance->enumeratePhysicalDevices()} {
|
||||||
const std::size_t num_physical_devices = static_cast<u16>(physical_devices.size());
|
const std::size_t num_physical_devices = static_cast<u16>(physical_devices.size());
|
||||||
|
@ -161,9 +159,7 @@ Instance::Instance(Core::TelemetrySession& telemetry, Frontend::EmuWindow& windo
|
||||||
VK_VERSION_MAJOR(properties.apiVersion), VK_VERSION_MINOR(properties.apiVersion)));
|
VK_VERSION_MAJOR(properties.apiVersion), VK_VERSION_MINOR(properties.apiVersion)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CollectTelemetryParameters(telemetry);
|
|
||||||
CreateDevice();
|
CreateDevice();
|
||||||
CollectToolingInfo();
|
|
||||||
CreateFormatTable();
|
CreateFormatTable();
|
||||||
CreateCustomFormatTable();
|
CreateCustomFormatTable();
|
||||||
CreateAttribTable();
|
CreateAttribTable();
|
||||||
|
@ -645,45 +641,4 @@ void Instance::CreateAllocator() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instance::CollectTelemetryParameters(Core::TelemetrySession& telemetry) {
|
|
||||||
const vk::StructureChain property_chain =
|
|
||||||
physical_device
|
|
||||||
.getProperties2<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceDriverProperties>();
|
|
||||||
const vk::PhysicalDeviceDriverProperties driver =
|
|
||||||
property_chain.get<vk::PhysicalDeviceDriverProperties>();
|
|
||||||
|
|
||||||
driver_id = driver.driverID;
|
|
||||||
vendor_name = driver.driverName.data();
|
|
||||||
|
|
||||||
const std::string model_name{GetModelName()};
|
|
||||||
const std::string driver_version = GetDriverVersionName();
|
|
||||||
const std::string driver_name = fmt::format("{} {}", vendor_name, driver_version);
|
|
||||||
const std::string api_version = GetReadableVersion(properties.apiVersion);
|
|
||||||
const std::string extensions = fmt::format("{}", fmt::join(available_extensions, ", "));
|
|
||||||
|
|
||||||
LOG_INFO(Render_Vulkan, "VK_DRIVER: {}", driver_name);
|
|
||||||
LOG_INFO(Render_Vulkan, "VK_DEVICE: {}", model_name);
|
|
||||||
LOG_INFO(Render_Vulkan, "VK_VERSION: {}", api_version);
|
|
||||||
|
|
||||||
static constexpr auto field = Common::Telemetry::FieldType::UserSystem;
|
|
||||||
telemetry.AddField(field, "GPU_Vendor", vendor_name);
|
|
||||||
telemetry.AddField(field, "GPU_Model", model_name);
|
|
||||||
telemetry.AddField(field, "GPU_Vulkan_Driver", driver_name);
|
|
||||||
telemetry.AddField(field, "GPU_Vulkan_Version", api_version);
|
|
||||||
telemetry.AddField(field, "GPU_Vulkan_Extensions", extensions);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Instance::CollectToolingInfo() {
|
|
||||||
if (!tooling_info) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const auto tools = physical_device.getToolPropertiesEXT();
|
|
||||||
for (const vk::PhysicalDeviceToolProperties& tool : tools) {
|
|
||||||
const std::string_view name = tool.name;
|
|
||||||
LOG_INFO(Render_Vulkan, "Attached debugging tool: {}", name);
|
|
||||||
has_renderdoc = has_renderdoc || name == "RenderDoc";
|
|
||||||
has_nsight_graphics = has_nsight_graphics || name == "NVIDIA Nsight Graphics";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Vulkan
|
} // namespace Vulkan
|
||||||
|
|
|
@ -10,10 +10,6 @@
|
||||||
#include "video_core/rasterizer_cache/pixel_format.h"
|
#include "video_core/rasterizer_cache/pixel_format.h"
|
||||||
#include "video_core/renderer_vulkan/vk_platform.h"
|
#include "video_core/renderer_vulkan/vk_platform.h"
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
class TelemetrySession;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Frontend {
|
namespace Frontend {
|
||||||
class EmuWindow;
|
class EmuWindow;
|
||||||
}
|
}
|
||||||
|
@ -41,8 +37,7 @@ struct FormatTraits {
|
||||||
class Instance {
|
class Instance {
|
||||||
public:
|
public:
|
||||||
explicit Instance(bool validation = false, bool dump_command_buffers = false);
|
explicit Instance(bool validation = false, bool dump_command_buffers = false);
|
||||||
explicit Instance(Core::TelemetrySession& telemetry, Frontend::EmuWindow& window,
|
explicit Instance(Frontend::EmuWindow& window, u32 physical_device_index);
|
||||||
u32 physical_device_index);
|
|
||||||
~Instance();
|
~Instance();
|
||||||
|
|
||||||
/// Returns the FormatTraits struct for the provided pixel format
|
/// Returns the FormatTraits struct for the provided pixel format
|
||||||
|
@ -290,10 +285,6 @@ private:
|
||||||
/// Creates the VMA allocator handle
|
/// Creates the VMA allocator handle
|
||||||
void CreateAllocator();
|
void CreateAllocator();
|
||||||
|
|
||||||
/// Collects telemetry information from the device.
|
|
||||||
void CollectTelemetryParameters(Core::TelemetrySession& telemetry);
|
|
||||||
void CollectToolingInfo();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<Common::DynamicLibrary> library;
|
std::shared_ptr<Common::DynamicLibrary> library;
|
||||||
vk::UniqueInstance instance;
|
vk::UniqueInstance instance;
|
||||||
|
|
|
@ -100,9 +100,9 @@ bool CanBlitToSwapchain(const vk::PhysicalDevice& physical_device, vk::Format fo
|
||||||
PresentWindow::PresentWindow(Frontend::EmuWindow& emu_window_, const Instance& instance_,
|
PresentWindow::PresentWindow(Frontend::EmuWindow& emu_window_, const Instance& instance_,
|
||||||
Scheduler& scheduler_)
|
Scheduler& scheduler_)
|
||||||
: emu_window{emu_window_}, instance{instance_}, scheduler{scheduler_},
|
: emu_window{emu_window_}, instance{instance_}, scheduler{scheduler_},
|
||||||
surface{CreateSurface(instance.GetInstance(), emu_window)},
|
surface{CreateSurface(instance.GetInstance(), emu_window)}, next_surface{surface},
|
||||||
next_surface{surface}, swapchain{instance, emu_window.GetFramebufferLayout().width,
|
swapchain{instance, emu_window.GetFramebufferLayout().width,
|
||||||
emu_window.GetFramebufferLayout().height, surface},
|
emu_window.GetFramebufferLayout().height, surface},
|
||||||
graphics_queue{instance.GetGraphicsQueue()}, present_renderpass{CreateRenderpass()},
|
graphics_queue{instance.GetGraphicsQueue()}, present_renderpass{CreateRenderpass()},
|
||||||
vsync_enabled{Settings::values.use_vsync_new.GetValue()},
|
vsync_enabled{Settings::values.use_vsync_new.GetValue()},
|
||||||
blit_supported{
|
blit_supported{
|
||||||
|
|
|
@ -61,8 +61,8 @@ RasterizerVulkan::RasterizerVulkan(Memory::MemorySystem& memory, Pica::PicaCore&
|
||||||
Scheduler& scheduler, DescriptorPool& pool,
|
Scheduler& scheduler, DescriptorPool& pool,
|
||||||
RenderpassCache& renderpass_cache, u32 image_count)
|
RenderpassCache& renderpass_cache, u32 image_count)
|
||||||
: RasterizerAccelerated{memory, pica}, instance{instance}, scheduler{scheduler},
|
: RasterizerAccelerated{memory, pica}, instance{instance}, scheduler{scheduler},
|
||||||
renderpass_cache{renderpass_cache}, pipeline_cache{instance, scheduler, renderpass_cache,
|
renderpass_cache{renderpass_cache},
|
||||||
pool},
|
pipeline_cache{instance, scheduler, renderpass_cache, pool},
|
||||||
runtime{instance, scheduler, renderpass_cache, pool, pipeline_cache.TextureProvider(),
|
runtime{instance, scheduler, renderpass_cache, pool, pipeline_cache.TextureProvider(),
|
||||||
image_count},
|
image_count},
|
||||||
res_cache{memory, custom_tex_manager, runtime, regs, renderer},
|
res_cache{memory, custom_tex_manager, runtime, regs, renderer},
|
||||||
|
|
|
@ -1458,8 +1458,8 @@ void Surface::BlitScale(const VideoCore::TextureBlit& blit, bool up_scale) {
|
||||||
|
|
||||||
Framebuffer::Framebuffer(TextureRuntime& runtime, const VideoCore::FramebufferParams& params,
|
Framebuffer::Framebuffer(TextureRuntime& runtime, const VideoCore::FramebufferParams& params,
|
||||||
Surface* color, Surface* depth)
|
Surface* color, Surface* depth)
|
||||||
: VideoCore::FramebufferParams{params}, res_scale{color ? color->res_scale
|
: VideoCore::FramebufferParams{params},
|
||||||
: (depth ? depth->res_scale : 1u)} {
|
res_scale{color ? color->res_scale : (depth ? depth->res_scale : 1u)} {
|
||||||
auto& renderpass_cache = runtime.GetRenderpassCache();
|
auto& renderpass_cache = runtime.GetRenderpassCache();
|
||||||
if (shadow_rendering && !color) {
|
if (shadow_rendering && !color) {
|
||||||
return;
|
return;
|
||||||
|
@ -1552,8 +1552,8 @@ Sampler::Sampler(TextureRuntime& runtime, const VideoCore::SamplerParams& params
|
||||||
Sampler::~Sampler() = default;
|
Sampler::~Sampler() = default;
|
||||||
|
|
||||||
DebugScope::DebugScope(TextureRuntime& runtime, Common::Vec4f color, std::string_view label)
|
DebugScope::DebugScope(TextureRuntime& runtime, Common::Vec4f color, std::string_view label)
|
||||||
: scheduler{runtime.GetScheduler()}, has_debug_tool{
|
: scheduler{runtime.GetScheduler()},
|
||||||
runtime.GetInstance().HasDebuggingToolAttached()} {
|
has_debug_tool{runtime.GetInstance().HasDebuggingToolAttached()} {
|
||||||
if (!has_debug_tool) {
|
if (!has_debug_tool) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue