vk: Dump diagnostic messages if device creation fails

This commit is contained in:
kd-11 2024-05-30 01:56:02 +03:00 committed by kd-11
parent 67893fb8f8
commit 53b81af704
2 changed files with 90 additions and 2 deletions

View File

@ -372,7 +372,6 @@ namespace vk
// Render Device - The actual usable device
void render_device::create(vk::physical_device& pdev, u32 graphics_queue_idx, u32 present_queue_idx, u32 transfer_queue_idx)
{
std::string message_on_error;
float queue_priorities[1] = { 0.f };
pgpu = &pdev;
@ -680,7 +679,11 @@ namespace vk
device.pNext = &synchronization2_info;
}
CHECK_RESULT_EX(vkCreateDevice(*pgpu, &device, nullptr, &dev), message_on_error);
if (auto error = vkCreateDevice(*pgpu, &device, nullptr, &dev))
{
dump_debug_info(requested_extensions, enabled_features);
vk::die_with_error(error);
}
// Dump some diagnostics to the log
rsx_log.notice("%u extensions loaded:", ::size32(requested_extensions));
@ -808,6 +811,87 @@ namespace vk
memory_map.device_local.rebalance();
}
void render_device::dump_debug_info(
const std::vector<const char*>& requested_extensions,
const VkPhysicalDeviceFeatures& requested_features) const
{
rsx_log.notice("Dumping requested extensions...");
auto device_extensions = vk::supported_extensions(vk::supported_extensions::enumeration_class::device, nullptr, *pgpu);
for (const auto& ext : requested_extensions)
{
rsx_log.notice("[%s] %s", device_extensions.is_supported(ext) ? "Supported" : "Not supported", ext);
}
rsx_log.notice("Dumping requested features...");
const auto& supported_features = pgpu->features;
#define TEST_VK_FEATURE(name) \
if (requested_features.name) {\
if (supported_features.name) \
rsx_log.notice("[Supported] "#name); \
else \
rsx_log.error("[Not supported] "#name); \
}
TEST_VK_FEATURE(robustBufferAccess);
TEST_VK_FEATURE(fullDrawIndexUint32);
TEST_VK_FEATURE(imageCubeArray);
TEST_VK_FEATURE(independentBlend);
TEST_VK_FEATURE(geometryShader);
TEST_VK_FEATURE(tessellationShader);
TEST_VK_FEATURE(sampleRateShading);
TEST_VK_FEATURE(dualSrcBlend);
TEST_VK_FEATURE(logicOp);
TEST_VK_FEATURE(multiDrawIndirect);
TEST_VK_FEATURE(drawIndirectFirstInstance);
TEST_VK_FEATURE(depthClamp);
TEST_VK_FEATURE(depthBiasClamp);
TEST_VK_FEATURE(fillModeNonSolid);
TEST_VK_FEATURE(depthBounds);
TEST_VK_FEATURE(wideLines);
TEST_VK_FEATURE(largePoints);
TEST_VK_FEATURE(alphaToOne);
TEST_VK_FEATURE(multiViewport);
TEST_VK_FEATURE(samplerAnisotropy);
TEST_VK_FEATURE(textureCompressionETC2);
TEST_VK_FEATURE(textureCompressionASTC_LDR);
TEST_VK_FEATURE(textureCompressionBC);
TEST_VK_FEATURE(occlusionQueryPrecise);
TEST_VK_FEATURE(pipelineStatisticsQuery);
TEST_VK_FEATURE(vertexPipelineStoresAndAtomics);
TEST_VK_FEATURE(fragmentStoresAndAtomics);
TEST_VK_FEATURE(shaderTessellationAndGeometryPointSize);
TEST_VK_FEATURE(shaderImageGatherExtended);
TEST_VK_FEATURE(shaderStorageImageExtendedFormats);
TEST_VK_FEATURE(shaderStorageImageMultisample);
TEST_VK_FEATURE(shaderStorageImageReadWithoutFormat);
TEST_VK_FEATURE(shaderStorageImageWriteWithoutFormat);
TEST_VK_FEATURE(shaderUniformBufferArrayDynamicIndexing);
TEST_VK_FEATURE(shaderSampledImageArrayDynamicIndexing);
TEST_VK_FEATURE(shaderStorageBufferArrayDynamicIndexing);
TEST_VK_FEATURE(shaderStorageImageArrayDynamicIndexing);
TEST_VK_FEATURE(shaderClipDistance);
TEST_VK_FEATURE(shaderCullDistance);
TEST_VK_FEATURE(shaderFloat64);
TEST_VK_FEATURE(shaderInt64);
TEST_VK_FEATURE(shaderInt16);
TEST_VK_FEATURE(shaderResourceResidency);
TEST_VK_FEATURE(shaderResourceMinLod);
TEST_VK_FEATURE(sparseBinding);
TEST_VK_FEATURE(sparseResidencyBuffer);
TEST_VK_FEATURE(sparseResidencyImage2D);
TEST_VK_FEATURE(sparseResidencyImage3D);
TEST_VK_FEATURE(sparseResidency2Samples);
TEST_VK_FEATURE(sparseResidency4Samples);
TEST_VK_FEATURE(sparseResidency8Samples);
TEST_VK_FEATURE(sparseResidency16Samples);
TEST_VK_FEATURE(sparseResidencyAliased);
TEST_VK_FEATURE(variableMultisampleRate);
TEST_VK_FEATURE(inheritedQueries);
#undef TEST_VK_FEATURE
}
// Shared Util
memory_type_mapping get_memory_mapping(const vk::physical_device& dev)
{

View File

@ -129,6 +129,10 @@ namespace vk
u32 m_present_queue_family = 0;
u32 m_transfer_queue_family = 0;
void dump_debug_info(
const std::vector<const char*>& requested_extensions,
const VkPhysicalDeviceFeatures& requested_features) const;
public:
// Exported device endpoints
PFN_vkCmdBeginConditionalRenderingEXT _vkCmdBeginConditionalRenderingEXT = nullptr;