mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 18:53:28 +01:00
[vk] check for attachment format properties before pre-creating render passes
This commit is contained in:
parent
f294729b28
commit
89ddeda24a
@ -390,18 +390,30 @@ namespace
|
||||
return result;
|
||||
}
|
||||
|
||||
std::array<VkRenderPass, 120> get_precomputed_render_passes(VkDevice dev, const vk::gpu_formats_support &gpu_format_support)
|
||||
std::array<VkRenderPass, 120> get_precomputed_render_passes(VkPhysicalDevice gpu, VkDevice dev, const vk::gpu_formats_support &gpu_format_support)
|
||||
{
|
||||
std::array<VkRenderPass, 120> result = {};
|
||||
VkImageFormatProperties props = {};
|
||||
|
||||
const std::array<VkFormat, 3> 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<VkFormat, 8> 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
|
||||
|
Loading…
Reference in New Issue
Block a user