From 923b756926899687c7c129ec3626d6aa8a2461a8 Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Wed, 31 May 2023 19:38:49 +0200 Subject: [PATCH] Turn inline function into macro and move it to vulkan.c --- gfx/common/vulkan_common.h | 7 ------- gfx/drivers/vulkan.c | 10 ++++++---- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/gfx/common/vulkan_common.h b/gfx/common/vulkan_common.h index 3a6d3acbea..5b5ce08d19 100644 --- a/gfx/common/vulkan_common.h +++ b/gfx/common/vulkan_common.h @@ -731,13 +731,6 @@ void vulkan_set_uniform_buffer( void vulkan_debug_mark_image(VkDevice device, VkImage image); void vulkan_debug_mark_memory(VkDevice device, VkDeviceMemory memory); -static INLINE VkFormat vulkan_remap_to_texture_format(VkFormat fmt) -{ - if (fmt == VK_FORMAT_R5G6B5_UNORM_PACK16) - return VK_FORMAT_R8G8B8A8_UNORM; - return fmt; -} - RETRO_END_DECLS #endif diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 1ee836890a..e91cc98933 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -60,6 +60,8 @@ * VULKAN COMMON */ +#define VK_REMAP_TO_TEXFMT(fmt) ((fmt == VK_FORMAT_R5G6B5_UNORM_PACK16) ? VK_FORMAT_R8G8B8A8_UNORM : fmt) + #ifdef VULKAN_DEBUG_TEXTURE_ALLOC static VkImage vk_images[4 * 1024]; static unsigned vk_count; @@ -211,7 +213,7 @@ static struct vk_texture vulkan_create_texture(vk_t *vk, buffer_info.size = buffer_width * height; buffer_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; - remap_tex_fmt = vulkan_remap_to_texture_format(format); + remap_tex_fmt = VK_REMAP_TO_TEXFMT(format); /* Compatibility concern. Some Apple hardware does not support rgb565. * Use compute shader uploads instead. @@ -660,7 +662,7 @@ static void vulkan_copy_staging_to_dynamic(vk_t *vk, VkCommandBuffer cmd, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT); /* staging->format is always RGB565 here. - * Can be expanded as needed if more cases are added to vulkan_remap_to_texture_format. */ + * Can be expanded as needed if more cases are added to VK_REMAP_TO_TEXFMT. */ retro_assert(staging->format == VK_FORMAT_R5G6B5_UNORM_PACK16); set = vulkan_descriptor_manager_alloc( @@ -2198,7 +2200,7 @@ static bool vulkan_init_default_filter_chain(vk_t *vk) info.queue = vk->context->queue; info.command_pool = vk->swapchain[vk->context->current_frame_index].cmd_pool; info.num_passes = 0; - info.original_format = vulkan_remap_to_texture_format(vk->tex_fmt); + info.original_format = VK_REMAP_TO_TEXFMT(vk->tex_fmt); info.max_input_size.width = vk->tex_w; info.max_input_size.height = vk->tex_h; info.swapchain.viewport = vk->vk_vp; @@ -2270,7 +2272,7 @@ static bool vulkan_init_filter_chain_preset(vk_t *vk, const char *shader_path) info.queue = vk->context->queue; info.command_pool = vk->swapchain[vk->context->current_frame_index].cmd_pool; info.num_passes = 0; - info.original_format = vulkan_remap_to_texture_format(vk->tex_fmt); + info.original_format = VK_REMAP_TO_TEXFMT(vk->tex_fmt); info.max_input_size.width = vk->tex_w; info.max_input_size.height = vk->tex_h; info.swapchain.viewport = vk->vk_vp;