mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-09 04:10:05 +00:00
rebase renderer_vulkan
This commit is contained in:
parent
a7a73e0f23
commit
e70301d48c
3 changed files with 63 additions and 8 deletions
|
@ -53,8 +53,9 @@ constexpr static std::array<vk::DescriptorSetLayoutBinding, 1> PRESENT_BINDINGS
|
|||
RendererVulkan::RendererVulkan(Core::System& system, Pica::PicaCore& pica_,
|
||||
Frontend::EmuWindow& window, Frontend::EmuWindow* secondary_window)
|
||||
: RendererBase{system, window, secondary_window}, memory{system.Memory()}, pica{pica_},
|
||||
instance{window, Settings::values.physical_device.GetValue()}, scheduler{instance},
|
||||
render_manager{instance, scheduler}, main_window{window, instance, scheduler},
|
||||
instance{system.TelemetrySession(), window, Settings::values.physical_device.GetValue()},
|
||||
scheduler{instance}, renderpass_cache{instance, scheduler}, pool{instance},
|
||||
main_window{window, instance, scheduler},
|
||||
vertex_buffer{instance, scheduler, vk::BufferUsageFlagBits::eVertexBuffer,
|
||||
VERTEX_BUFFER_SIZE},
|
||||
rasterizer{memory,
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "common/assert.h"
|
||||
#include "common/settings.h"
|
||||
#include "core/frontend/emu_window.h"
|
||||
#include "core/telemetry_session.h"
|
||||
#include "video_core/custom_textures/custom_format.h"
|
||||
#include "video_core/renderer_vulkan/vk_instance.h"
|
||||
#include "video_core/renderer_vulkan/vk_platform.h"
|
||||
|
@ -137,11 +138,12 @@ Instance::Instance(bool enable_validation, bool dump_command_buffers)
|
|||
enable_validation, dump_command_buffers)},
|
||||
physical_devices{instance->enumeratePhysicalDevices()} {}
|
||||
|
||||
Instance::Instance(Frontend::EmuWindow& window, u32 physical_device_index)
|
||||
: library{OpenLibrary(&window)},
|
||||
instance{CreateInstance(*library, window.GetWindowInfo().type,
|
||||
Settings::values.renderer_debug.GetValue(),
|
||||
Settings::values.dump_command_buffers.GetValue())},
|
||||
Instance::Instance(Core::TelemetrySession& telemetry, Frontend::EmuWindow& window,
|
||||
u32 physical_device_index)
|
||||
: library{OpenLibrary(&window)}, instance{CreateInstance(
|
||||
*library, window.GetWindowInfo().type,
|
||||
Settings::values.renderer_debug.GetValue(),
|
||||
Settings::values.dump_command_buffers.GetValue())},
|
||||
debug_callback{CreateDebugCallback(*instance, debug_utils_supported)},
|
||||
physical_devices{instance->enumeratePhysicalDevices()} {
|
||||
const std::size_t num_physical_devices = static_cast<u16>(physical_devices.size());
|
||||
|
@ -159,7 +161,9 @@ Instance::Instance(Frontend::EmuWindow& window, u32 physical_device_index)
|
|||
VK_VERSION_MAJOR(properties.apiVersion), VK_VERSION_MINOR(properties.apiVersion)));
|
||||
}
|
||||
|
||||
CollectTelemetryParameters(telemetry);
|
||||
CreateDevice();
|
||||
CollectToolingInfo();
|
||||
CreateFormatTable();
|
||||
CreateCustomFormatTable();
|
||||
CreateAttribTable();
|
||||
|
@ -641,4 +645,45 @@ 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
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
#include "video_core/rasterizer_cache/pixel_format.h"
|
||||
#include "video_core/renderer_vulkan/vk_platform.h"
|
||||
|
||||
namespace Core {
|
||||
class TelemetrySession;
|
||||
}
|
||||
|
||||
namespace Frontend {
|
||||
class EmuWindow;
|
||||
}
|
||||
|
@ -37,7 +41,8 @@ struct FormatTraits {
|
|||
class Instance {
|
||||
public:
|
||||
explicit Instance(bool validation = false, bool dump_command_buffers = false);
|
||||
explicit Instance(Frontend::EmuWindow& window, u32 physical_device_index);
|
||||
explicit Instance(Core::TelemetrySession& telemetry, Frontend::EmuWindow& window,
|
||||
u32 physical_device_index);
|
||||
~Instance();
|
||||
|
||||
/// Returns the FormatTraits struct for the provided pixel format
|
||||
|
@ -285,6 +290,10 @@ private:
|
|||
/// Creates the VMA allocator handle
|
||||
void CreateAllocator();
|
||||
|
||||
/// Collects telemetry information from the device.
|
||||
void CollectTelemetryParameters(Core::TelemetrySession& telemetry);
|
||||
void CollectToolingInfo();
|
||||
|
||||
private:
|
||||
std::shared_ptr<Common::DynamicLibrary> library;
|
||||
vk::UniqueInstance instance;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue