mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-22 21:00:05 +00:00
vk_instance: Collect tooling info
This commit is contained in:
parent
6b51afaf1f
commit
a8d590ae80
@ -195,4 +195,10 @@ inline vk::FrontFace FrontFace(Pica::RasterizerRegs::CullMode mode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline Common::Vec4f ColorRGBA8(const u32 color) {
|
||||||
|
const auto rgba =
|
||||||
|
Common::Vec4u{color >> 0 & 0xFF, color >> 8 & 0xFF, color >> 16 & 0xFF, color >> 24 & 0xFF};
|
||||||
|
return rgba / 255.0f;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace PicaToVK
|
} // namespace PicaToVK
|
||||||
|
@ -134,8 +134,8 @@ Instance::Instance(Frontend::EmuWindow& window, u32 physical_device_index)
|
|||||||
*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)}, physical_devices{
|
debug_callback{CreateDebugCallback(*instance, debug_utils_supported)},
|
||||||
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());
|
||||||
ASSERT_MSG(physical_device_index < num_physical_devices,
|
ASSERT_MSG(physical_device_index < num_physical_devices,
|
||||||
"Invalid physical device index {} provided when only {} devices exist",
|
"Invalid physical device index {} provided when only {} devices exist",
|
||||||
@ -146,6 +146,7 @@ Instance::Instance(Frontend::EmuWindow& window, u32 physical_device_index)
|
|||||||
|
|
||||||
CollectTelemetryParameters();
|
CollectTelemetryParameters();
|
||||||
CreateDevice();
|
CreateDevice();
|
||||||
|
CollectToolingInfo();
|
||||||
CreateFormatTable();
|
CreateFormatTable();
|
||||||
CreateCustomFormatTable();
|
CreateCustomFormatTable();
|
||||||
CreateAttribTable();
|
CreateAttribTable();
|
||||||
@ -403,6 +404,7 @@ bool Instance::CreateDevice() {
|
|||||||
add_extension(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
add_extension(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
||||||
image_format_list = add_extension(VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
|
image_format_list = add_extension(VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
|
||||||
shader_stencil_export = add_extension(VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME);
|
shader_stencil_export = add_extension(VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME);
|
||||||
|
tooling_info = add_extension(VK_EXT_TOOLING_INFO_EXTENSION_NAME);
|
||||||
const bool has_timeline_semaphores = add_extension(
|
const bool has_timeline_semaphores = add_extension(
|
||||||
VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME, is_qualcomm, "it is broken on Qualcomm drivers");
|
VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME, is_qualcomm, "it is broken on Qualcomm drivers");
|
||||||
const bool has_portability_subset = add_extension(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME);
|
const bool has_portability_subset = add_extension(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME);
|
||||||
@ -580,4 +582,17 @@ void Instance::CollectTelemetryParameters() {
|
|||||||
vendor_name = driver.driverName.data();
|
vendor_name = driver.driverName.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Instance::CollectToolingInfo() {
|
||||||
|
if (!tooling_info) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto tools = physical_device.getToolProperties();
|
||||||
|
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
|
||||||
|
@ -90,6 +90,16 @@ public:
|
|||||||
return present_queue;
|
return present_queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns true when a known debugging tool is attached.
|
||||||
|
bool HasDebuggingToolAttached() const {
|
||||||
|
return has_renderdoc || has_nsight_graphics;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns true when VK_EXT_debug_utils is supported.
|
||||||
|
bool IsExtDebugUtilsSupported() const {
|
||||||
|
return debug_utils_supported;
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns true if logic operations need shader emulation
|
/// Returns true if logic operations need shader emulation
|
||||||
bool NeedsLogicOpEmulation() const {
|
bool NeedsLogicOpEmulation() const {
|
||||||
return !features.logicOp;
|
return !features.logicOp;
|
||||||
@ -145,11 +155,6 @@ public:
|
|||||||
return shader_stencil_export;
|
return shader_stencil_export;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if VK_EXT_debug_utils is supported
|
|
||||||
bool IsExtDebugUtilsSupported() const {
|
|
||||||
return debug_messenger_supported;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the vendor ID of the physical device
|
/// Returns the vendor ID of the physical device
|
||||||
u32 GetVendorID() const {
|
u32 GetVendorID() const {
|
||||||
return properties.vendorID;
|
return properties.vendorID;
|
||||||
@ -249,6 +254,7 @@ private:
|
|||||||
|
|
||||||
/// Collects telemetry information from the device.
|
/// Collects telemetry information from the device.
|
||||||
void CollectTelemetryParameters();
|
void CollectTelemetryParameters();
|
||||||
|
void CollectToolingInfo();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<Common::DynamicLibrary> library;
|
std::shared_ptr<Common::DynamicLibrary> library;
|
||||||
@ -280,7 +286,10 @@ private:
|
|||||||
bool image_format_list{};
|
bool image_format_list{};
|
||||||
bool pipeline_creation_cache_control{};
|
bool pipeline_creation_cache_control{};
|
||||||
bool shader_stencil_export{};
|
bool shader_stencil_export{};
|
||||||
bool debug_messenger_supported{};
|
bool tooling_info{};
|
||||||
|
bool debug_utils_supported{};
|
||||||
|
bool has_nsight_graphics{};
|
||||||
|
bool has_renderdoc{};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Vulkan
|
} // namespace Vulkan
|
||||||
|
@ -343,7 +343,7 @@ vk::UniqueDebugReportCallbackEXT CreateDebugReportCallback(vk::Instance instance
|
|||||||
return instance.createDebugReportCallbackEXTUnique(callback_ci);
|
return instance.createDebugReportCallbackEXTUnique(callback_ci);
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugCallback CreateDebugCallback(vk::Instance instance) {
|
DebugCallback CreateDebugCallback(vk::Instance instance, bool& debug_utils_supported) {
|
||||||
if (!Settings::values.renderer_debug) {
|
if (!Settings::values.renderer_debug) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -356,7 +356,8 @@ DebugCallback CreateDebugCallback(vk::Instance instance) {
|
|||||||
return std::strcmp(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, prop.extensionName) == 0;
|
return std::strcmp(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, prop.extensionName) == 0;
|
||||||
});
|
});
|
||||||
// Prefer debug util messenger if available.
|
// Prefer debug util messenger if available.
|
||||||
if (it != properties.end()) {
|
debug_utils_supported = it != properties.end();
|
||||||
|
if (debug_utils_supported) {
|
||||||
return CreateDebugMessenger(instance);
|
return CreateDebugMessenger(instance);
|
||||||
}
|
}
|
||||||
// Otherwise fallback to debug report callback.
|
// Otherwise fallback to debug report callback.
|
||||||
|
@ -29,6 +29,6 @@ vk::UniqueInstance CreateInstance(const Common::DynamicLibrary& library,
|
|||||||
Frontend::WindowSystemType window_type, bool enable_validation,
|
Frontend::WindowSystemType window_type, bool enable_validation,
|
||||||
bool dump_command_buffers);
|
bool dump_command_buffers);
|
||||||
|
|
||||||
DebugCallback CreateDebugCallback(vk::Instance instance);
|
DebugCallback CreateDebugCallback(vk::Instance instance, bool& debug_utils_supported);
|
||||||
|
|
||||||
} // namespace Vulkan
|
} // namespace Vulkan
|
||||||
|
Loading…
Reference in New Issue
Block a user