diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index 7688fea680..5eb55a326d 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -390,18 +390,30 @@ namespace return result; } - std::array get_precomputed_render_passes(VkDevice dev, const vk::gpu_formats_support &gpu_format_support) + std::array get_precomputed_render_passes(VkPhysicalDevice gpu, VkDevice dev, const vk::gpu_formats_support &gpu_format_support) { std::array result = {}; + VkImageFormatProperties props = {}; const std::array depth_format_list = { VK_FORMAT_UNDEFINED, VK_FORMAT_D16_UNORM, gpu_format_support.d24_unorm_s8 ? VK_FORMAT_D24_UNORM_S8_UINT : VK_FORMAT_D32_SFLOAT_S8_UINT }; const std::array color_format_list = { VK_FORMAT_R5G6B5_UNORM_PACK16, VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R16G16B16A16_SFLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, VK_FORMAT_R8_UNORM, VK_FORMAT_R8G8_UNORM, VK_FORMAT_A1R5G5B5_UNORM_PACK16, VK_FORMAT_R32_SFLOAT }; - for (const VkFormat &color_format : color_format_list) { + VkResult support = vkGetPhysicalDeviceImageFormatProperties(gpu, color_format, VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, 0, &props); + if (support != VK_SUCCESS) + { + assert(support == VK_ERROR_FORMAT_NOT_SUPPORTED); + continue; + } for (const VkFormat &depth_stencil_format : depth_format_list) { + VkResult support = vkGetPhysicalDeviceImageFormatProperties(gpu, depth_stencil_format, VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, 0, &props); + if (depth_stencil_format != VK_FORMAT_UNDEFINED && support != VK_SUCCESS) + { + assert(support == VK_ERROR_FORMAT_NOT_SUPPORTED); + continue; + } for (u8 number_of_draw_buffer = 0; number_of_draw_buffer <= 4; number_of_draw_buffer++) { size_t idx = vk::get_render_pass_location(color_format, depth_stencil_format, number_of_draw_buffer); @@ -575,7 +587,7 @@ VKGSRender::VKGSRender() : GSRender() m_secondary_command_buffer.access_hint = vk::command_buffer::access_type_hint::all; //Precalculated stuff - m_render_passes = get_precomputed_render_passes(*m_device, m_device->get_formats_support()); + m_render_passes = get_precomputed_render_passes(m_device->gpu(), *m_device, m_device->get_formats_support()); std::tie(pipeline_layout, descriptor_layouts) = get_shared_pipeline_layout(*m_device); //Occlusion