mirror of
https://github.com/libretro/RetroArch
synced 2025-03-27 23:37:39 +00:00
(Vulkan) turn superfluous functions in vulkan_common.c into macros
to avoid unnecessary function overhead
This commit is contained in:
parent
83057301c2
commit
6c97a7514c
gfx
@ -138,7 +138,8 @@ void vulkan_emulated_mailbox_deinit(struct vulkan_emulated_mailbox *mailbox)
|
||||
memset(mailbox, 0, sizeof(*mailbox));
|
||||
}
|
||||
|
||||
VkResult vulkan_emulated_mailbox_acquire_next_image(struct vulkan_emulated_mailbox *mailbox,
|
||||
VkResult vulkan_emulated_mailbox_acquire_next_image(
|
||||
struct vulkan_emulated_mailbox *mailbox,
|
||||
unsigned *index)
|
||||
{
|
||||
VkResult res;
|
||||
@ -250,21 +251,22 @@ static void vulkan_emulated_mailbox_loop(void *userdata)
|
||||
vkDestroyFence(mailbox->device, fence, NULL);
|
||||
}
|
||||
|
||||
bool vulkan_emulated_mailbox_init(struct vulkan_emulated_mailbox *mailbox,
|
||||
VkDevice device,
|
||||
VkSwapchainKHR swapchain)
|
||||
bool vulkan_emulated_mailbox_init(
|
||||
struct vulkan_emulated_mailbox *mailbox,
|
||||
VkDevice device,
|
||||
VkSwapchainKHR swapchain)
|
||||
{
|
||||
memset(mailbox, 0, sizeof(*mailbox));
|
||||
mailbox->device = device;
|
||||
mailbox->device = device;
|
||||
mailbox->swapchain = swapchain;
|
||||
|
||||
mailbox->cond = scond_new();
|
||||
mailbox->cond = scond_new();
|
||||
if (!mailbox->cond)
|
||||
return false;
|
||||
mailbox->lock = slock_new();
|
||||
mailbox->lock = slock_new();
|
||||
if (!mailbox->lock)
|
||||
return false;
|
||||
mailbox->thread = sthread_create(vulkan_emulated_mailbox_loop, mailbox);
|
||||
mailbox->thread = sthread_create(vulkan_emulated_mailbox_loop, mailbox);
|
||||
if (!mailbox->thread)
|
||||
return false;
|
||||
return true;
|
||||
@ -334,14 +336,6 @@ void vulkan_transfer_image_ownership(VkCommandBuffer cmd,
|
||||
false, 0, NULL, 0, NULL, 1, &barrier);
|
||||
}
|
||||
|
||||
void vulkan_map_persistent_texture(
|
||||
VkDevice device,
|
||||
struct vk_texture *texture)
|
||||
{
|
||||
vkMapMemory(device, texture->memory, texture->offset,
|
||||
texture->size, 0, &texture->mapped);
|
||||
}
|
||||
|
||||
void vulkan_copy_staging_to_dynamic(vk_t *vk, VkCommandBuffer cmd,
|
||||
struct vk_texture *dynamic,
|
||||
struct vk_texture *staging)
|
||||
@ -453,7 +447,7 @@ void vulkan_sync_texture_to_cpu(vk_t *vk, const struct vk_texture *tex)
|
||||
|
||||
range.memory = tex->memory;
|
||||
range.offset = 0;
|
||||
range.size = VK_WHOLE_SIZE;
|
||||
range.size = VK_WHOLE_SIZE;
|
||||
vkInvalidateMappedMemoryRanges(vk->context->device, 1, &range);
|
||||
}
|
||||
|
||||
@ -977,32 +971,25 @@ void vulkan_transition_texture(vk_t *vk, VkCommandBuffer cmd, struct vk_texture
|
||||
texture->layout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
}
|
||||
|
||||
static void vulkan_check_dynamic_state(
|
||||
vk_t *vk)
|
||||
static void vulkan_check_dynamic_state(vk_t *vk)
|
||||
{
|
||||
VkRect2D sci;
|
||||
|
||||
if (vk->tracker.dirty & VULKAN_DIRTY_DYNAMIC_BIT)
|
||||
if (vk->tracker.use_scissor)
|
||||
sci = vk->tracker.scissor;
|
||||
else
|
||||
{
|
||||
VkRect2D sci;
|
||||
|
||||
if (vk->tracker.use_scissor)
|
||||
{
|
||||
sci = vk->tracker.scissor;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No scissor -> viewport */
|
||||
sci.offset.x = vk->vp.x;
|
||||
sci.offset.y = vk->vp.y;
|
||||
sci.extent.width = vk->vp.width;
|
||||
sci.extent.height = vk->vp.height;
|
||||
}
|
||||
|
||||
vkCmdSetViewport(vk->cmd, 0, 1, &vk->vk_vp);
|
||||
vkCmdSetScissor (vk->cmd, 0, 1, &sci);
|
||||
|
||||
vk->tracker.dirty &= ~VULKAN_DIRTY_DYNAMIC_BIT;
|
||||
/* No scissor -> viewport */
|
||||
sci.offset.x = vk->vp.x;
|
||||
sci.offset.y = vk->vp.y;
|
||||
sci.extent.width = vk->vp.width;
|
||||
sci.extent.height = vk->vp.height;
|
||||
}
|
||||
|
||||
vkCmdSetViewport(vk->cmd, 0, 1, &vk->vk_vp);
|
||||
vkCmdSetScissor (vk->cmd, 0, 1, &sci);
|
||||
|
||||
vk->tracker.dirty &= ~VULKAN_DIRTY_DYNAMIC_BIT;
|
||||
}
|
||||
|
||||
void vulkan_draw_triangles(vk_t *vk, const struct vk_draw_triangles *call)
|
||||
@ -1020,7 +1007,8 @@ void vulkan_draw_triangles(vk_t *vk, const struct vk_draw_triangles *call)
|
||||
vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT;
|
||||
}
|
||||
|
||||
vulkan_check_dynamic_state(vk);
|
||||
if (vk->tracker.dirty & VULKAN_DIRTY_DYNAMIC_BIT)
|
||||
vulkan_check_dynamic_state(vk);
|
||||
|
||||
/* Upload descriptors */
|
||||
{
|
||||
@ -1078,7 +1066,8 @@ void vulkan_draw_quad(vk_t *vk, const struct vk_draw_quad *quad)
|
||||
vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT;
|
||||
}
|
||||
|
||||
vulkan_check_dynamic_state(vk);
|
||||
if (vk->tracker.dirty & VULKAN_DIRTY_DYNAMIC_BIT)
|
||||
vulkan_check_dynamic_state(vk);
|
||||
|
||||
/* Upload descriptors */
|
||||
{
|
||||
@ -1306,12 +1295,6 @@ VkDescriptorSet vulkan_descriptor_manager_alloc(
|
||||
return manager->current->sets[manager->count++];
|
||||
}
|
||||
|
||||
void vulkan_descriptor_manager_restart(struct vk_descriptor_manager *manager)
|
||||
{
|
||||
manager->current = manager->head;
|
||||
manager->count = 0;
|
||||
}
|
||||
|
||||
struct vk_descriptor_manager vulkan_create_descriptor_manager(
|
||||
VkDevice device,
|
||||
const VkDescriptorPoolSize *sizes,
|
||||
@ -1406,12 +1389,6 @@ struct vk_buffer_chain vulkan_buffer_chain_init(
|
||||
return chain;
|
||||
}
|
||||
|
||||
void vulkan_buffer_chain_discard(struct vk_buffer_chain *chain)
|
||||
{
|
||||
chain->current = chain->head;
|
||||
chain->offset = 0;
|
||||
}
|
||||
|
||||
bool vulkan_buffer_chain_alloc(const struct vulkan_context *context,
|
||||
struct vk_buffer_chain *chain,
|
||||
size_t size, struct vk_buffer_range *range)
|
||||
@ -2128,7 +2105,7 @@ static bool vulkan_update_display_mode(
|
||||
const VkDisplayModePropertiesKHR *mode,
|
||||
const struct vulkan_display_surface_info *info)
|
||||
{
|
||||
unsigned visible_width = mode->parameters.visibleRegion.width;
|
||||
unsigned visible_width = mode->parameters.visibleRegion.width;
|
||||
unsigned visible_height = mode->parameters.visibleRegion.height;
|
||||
|
||||
if (!info->width || !info->height)
|
||||
@ -2137,54 +2114,53 @@ static bool vulkan_update_display_mode(
|
||||
unsigned area = visible_width * visible_height;
|
||||
if (area > (*width) * (*height))
|
||||
{
|
||||
*width = visible_width;
|
||||
*height = visible_height;
|
||||
*width = visible_width;
|
||||
*height = visible_height;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* For particular resolutions, find the closest. */
|
||||
int delta_x = (int)info->width - (int)visible_width;
|
||||
int delta_y = (int)info->height - (int)visible_height;
|
||||
int delta_x = (int)info->width - (int)visible_width;
|
||||
int delta_y = (int)info->height - (int)visible_height;
|
||||
int old_delta_x = (int)info->width - (int)*width;
|
||||
int old_delta_y = (int)info->height - (int)*height;
|
||||
|
||||
int dist = delta_x * delta_x + delta_y * delta_y;
|
||||
int old_dist = old_delta_x * old_delta_x + old_delta_y * old_delta_y;
|
||||
int dist = delta_x * delta_x + delta_y * delta_y;
|
||||
int old_dist = old_delta_x * old_delta_x + old_delta_y * old_delta_y;
|
||||
|
||||
if (dist < old_dist)
|
||||
{
|
||||
*width = visible_width;
|
||||
*height = visible_height;
|
||||
*width = visible_width;
|
||||
*height = visible_height;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool vulkan_create_display_surface(gfx_ctx_vulkan_data_t *vk,
|
||||
unsigned *width, unsigned *height,
|
||||
const struct vulkan_display_surface_info *info)
|
||||
{
|
||||
bool ret = true;
|
||||
uint32_t display_count = 0;
|
||||
uint32_t plane_count = 0;
|
||||
VkDisplayPropertiesKHR *displays = NULL;
|
||||
VkDisplayPlanePropertiesKHR *planes = NULL;
|
||||
uint32_t mode_count = 0;
|
||||
VkDisplayModePropertiesKHR *modes = NULL;
|
||||
bool ret = true;
|
||||
uint32_t display_count = 0;
|
||||
uint32_t plane_count = 0;
|
||||
VkDisplayPropertiesKHR *displays = NULL;
|
||||
VkDisplayPlanePropertiesKHR *planes = NULL;
|
||||
uint32_t mode_count = 0;
|
||||
VkDisplayModePropertiesKHR *modes = NULL;
|
||||
unsigned dpy, i, j;
|
||||
uint32_t best_plane = UINT32_MAX;
|
||||
uint32_t best_plane = UINT32_MAX;
|
||||
VkDisplayPlaneAlphaFlagBitsKHR alpha_mode = VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR;
|
||||
VkDisplaySurfaceCreateInfoKHR create_info = { VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR };
|
||||
VkDisplayModeKHR best_mode = VK_NULL_HANDLE;
|
||||
VkDisplayModeKHR best_mode = VK_NULL_HANDLE;
|
||||
/* Monitor index starts on 1, 0 is auto. */
|
||||
unsigned monitor_index = info->monitor_index;
|
||||
unsigned saved_width = *width;
|
||||
unsigned saved_height = *height;
|
||||
unsigned monitor_index = info->monitor_index;
|
||||
unsigned saved_width = *width;
|
||||
unsigned saved_height = *height;
|
||||
|
||||
/* We need to decide on GPU here to be able to query support. */
|
||||
if (!vulkan_context_init_gpu(vk))
|
||||
@ -2728,7 +2704,7 @@ static void vulkan_acquire_wait_fences(gfx_ctx_vulkan_data_t *vk)
|
||||
VkFenceCreateInfo fence_info =
|
||||
{ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO };
|
||||
|
||||
unsigned index = vk->context.current_swapchain_index;
|
||||
unsigned index = vk->context.current_swapchain_index;
|
||||
VkFence *next_fence = &vk->context.swapchain_fences[index];
|
||||
|
||||
if (*next_fence != VK_NULL_HANDLE)
|
||||
@ -2751,10 +2727,8 @@ static void vulkan_create_wait_fences(gfx_ctx_vulkan_data_t *vk)
|
||||
for (i = 0; i < vk->context.num_swapchain_images; i++)
|
||||
{
|
||||
if (!vk->context.swapchain_fences[i])
|
||||
{
|
||||
vkCreateFence(vk->context.device, &fence_info, NULL,
|
||||
&vk->context.swapchain_fences[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2763,12 +2737,11 @@ void vulkan_acquire_next_image(gfx_ctx_vulkan_data_t *vk)
|
||||
unsigned index;
|
||||
VkResult err;
|
||||
VkFence fence;
|
||||
VkFenceCreateInfo fence_info =
|
||||
VkFenceCreateInfo fence_info =
|
||||
{ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO };
|
||||
VkSemaphoreCreateInfo sem_info =
|
||||
{ VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO };
|
||||
|
||||
bool is_retrying = false;
|
||||
bool is_retrying = false;
|
||||
|
||||
retry:
|
||||
if (vk->swapchain == VK_NULL_HANDLE)
|
||||
@ -2799,7 +2772,8 @@ retry:
|
||||
/* Non-blocking acquire. If we don't get a swapchain frame right away,
|
||||
* just skip rendering to the swapchain this frame, similar to what
|
||||
* MAILBOX would do. */
|
||||
err = vulkan_emulated_mailbox_acquire_next_image(&vk->mailbox, &vk->context.current_swapchain_index);
|
||||
err = vulkan_emulated_mailbox_acquire_next_image(
|
||||
&vk->mailbox, &vk->context.current_swapchain_index);
|
||||
fence = VK_NULL_HANDLE;
|
||||
}
|
||||
else
|
||||
@ -2809,8 +2783,10 @@ retry:
|
||||
vk->swapchain, UINT64_MAX,
|
||||
VK_NULL_HANDLE, fence, &vk->context.current_swapchain_index);
|
||||
|
||||
/* VK_SUBOPTIMAL_KHR can be returned on Android 10 when prerotate is not dealt with.
|
||||
* This is not an error we need to care about, and we'll treat it as SUCCESS. */
|
||||
/* VK_SUBOPTIMAL_KHR can be returned on Android 10
|
||||
* when prerotate is not dealt with.
|
||||
* This is not an error we need to care about, and
|
||||
* we'll treat it as SUCCESS. */
|
||||
if (err == VK_SUBOPTIMAL_KHR)
|
||||
err = VK_SUCCESS;
|
||||
}
|
||||
@ -2903,13 +2879,14 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
|
||||
|
||||
if (swap_interval == 0 && vk->emulate_mailbox)
|
||||
{
|
||||
swap_interval = 1;
|
||||
vk->emulating_mailbox = true;
|
||||
swap_interval = 1;
|
||||
vk->emulating_mailbox = true;
|
||||
}
|
||||
else
|
||||
vk->emulating_mailbox = false;
|
||||
vk->emulating_mailbox = false;
|
||||
|
||||
vk->created_new_swapchain = true;
|
||||
|
||||
if (vk->swapchain != VK_NULL_HANDLE &&
|
||||
!vk->context.invalid_swapchain &&
|
||||
vk->context.swapchain_width == width &&
|
||||
@ -2931,11 +2908,9 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
|
||||
/* We are tearing down, and entering a state where we are supposed to have
|
||||
* acquired an image, so block until we have acquired. */
|
||||
if (!vk->context.has_acquired_swapchain)
|
||||
{
|
||||
res = vulkan_emulated_mailbox_acquire_next_image_blocking(
|
||||
&vk->mailbox,
|
||||
&vk->context.current_swapchain_index);
|
||||
}
|
||||
else
|
||||
res = VK_SUCCESS;
|
||||
|
||||
@ -2944,14 +2919,12 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
|
||||
if (res == VK_SUCCESS)
|
||||
{
|
||||
vk->context.has_acquired_swapchain = true;
|
||||
vk->created_new_swapchain = false;
|
||||
vk->created_new_swapchain = false;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
vk->context.has_acquired_swapchain = false;
|
||||
/* We failed for some reason, so create a new swapchain. */
|
||||
}
|
||||
|
||||
/* We failed for some reason, so create a new swapchain. */
|
||||
vk->context.has_acquired_swapchain = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3033,9 +3006,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
|
||||
formats[i].format == VK_FORMAT_R8G8B8A8_UNORM ||
|
||||
formats[i].format == VK_FORMAT_B8G8R8A8_UNORM ||
|
||||
formats[i].format == VK_FORMAT_A8B8G8R8_UNORM_PACK32)
|
||||
{
|
||||
format = formats[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (format.format == VK_FORMAT_UNDEFINED)
|
||||
@ -3075,7 +3046,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
|
||||
/* Cannot create swapchain yet, try again later. */
|
||||
if (vk->swapchain != VK_NULL_HANDLE)
|
||||
vkDestroySwapchainKHR(vk->context.device, vk->swapchain, NULL);
|
||||
vk->swapchain = VK_NULL_HANDLE;
|
||||
vk->swapchain = VK_NULL_HANDLE;
|
||||
vk->context.swapchain_width = width;
|
||||
vk->context.swapchain_height = height;
|
||||
vk->context.num_swapchain_images = 1;
|
||||
@ -3195,7 +3166,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk,
|
||||
vk->context.num_swapchain_images);
|
||||
|
||||
/* Force driver to reset swapchain image handles. */
|
||||
vk->context.invalid_swapchain = true;
|
||||
vk->context.invalid_swapchain = true;
|
||||
vk->context.has_acquired_swapchain = false;
|
||||
vulkan_create_wait_fences(vk);
|
||||
|
||||
|
@ -250,7 +250,11 @@ struct vk_buffer_chain vulkan_buffer_chain_init(
|
||||
VkDeviceSize alignment,
|
||||
VkBufferUsageFlags usage);
|
||||
|
||||
void vulkan_buffer_chain_discard(struct vk_buffer_chain *chain);
|
||||
#define VK_BUFFER_CHAIN_DISCARD(chain) \
|
||||
{ \
|
||||
chain->current = chain->head; \
|
||||
chain->offset = 0; \
|
||||
}
|
||||
|
||||
bool vulkan_buffer_chain_alloc(const struct vulkan_context *context,
|
||||
struct vk_buffer_chain *chain, size_t size,
|
||||
@ -462,10 +466,6 @@ void vulkan_transfer_image_ownership(VkCommandBuffer cmd,
|
||||
uint32_t src_queue_family,
|
||||
uint32_t dst_queue_family);
|
||||
|
||||
void vulkan_map_persistent_texture(
|
||||
VkDevice device,
|
||||
struct vk_texture *texture);
|
||||
|
||||
void vulkan_destroy_texture(
|
||||
VkDevice device,
|
||||
struct vk_texture *tex);
|
||||
@ -552,8 +552,16 @@ VkDescriptorSet vulkan_descriptor_manager_alloc(
|
||||
VkDevice device,
|
||||
struct vk_descriptor_manager *manager);
|
||||
|
||||
void vulkan_descriptor_manager_restart(
|
||||
struct vk_descriptor_manager *manager);
|
||||
#define VK_DESCRIPTOR_MANAGER_RESTART(manager) \
|
||||
{ \
|
||||
manager->current = manager->head; \
|
||||
manager->count = 0; \
|
||||
}
|
||||
|
||||
#define VK_MAP_PERSISTENT_TEXTURE(device, texture) \
|
||||
{ \
|
||||
vkMapMemory(device, texture->memory, texture->offset, texture->size, 0, &texture->mapped); \
|
||||
}
|
||||
|
||||
struct vk_descriptor_manager vulkan_create_descriptor_manager(
|
||||
VkDevice device,
|
||||
|
@ -660,9 +660,10 @@ static void vulkan_init_textures(vk_t *vk)
|
||||
vk->tex_w, vk->tex_h, vk->tex_fmt,
|
||||
NULL, NULL, VULKAN_TEXTURE_STREAMED);
|
||||
|
||||
vulkan_map_persistent_texture(
|
||||
vk->context->device,
|
||||
&vk->swapchain[i].texture);
|
||||
{
|
||||
struct vk_texture *texture = &vk->swapchain[i].texture;
|
||||
VK_MAP_PERSISTENT_TEXTURE(vk->context->device, texture);
|
||||
}
|
||||
|
||||
if (vk->swapchain[i].texture.type == VULKAN_TEXTURE_STAGING)
|
||||
vk->swapchain[i].texture_optimal = vulkan_create_texture(vk, NULL,
|
||||
@ -1684,9 +1685,19 @@ static bool vulkan_frame(void *data, const void *frame,
|
||||
chain = &vk->swapchain[frame_index];
|
||||
vk->chain = chain;
|
||||
|
||||
vulkan_descriptor_manager_restart(&chain->descriptor_manager);
|
||||
vulkan_buffer_chain_discard(&chain->vbo);
|
||||
vulkan_buffer_chain_discard(&chain->ubo);
|
||||
{
|
||||
struct vk_descriptor_manager *manager = &chain->descriptor_manager;
|
||||
VK_DESCRIPTOR_MANAGER_RESTART(manager);
|
||||
}
|
||||
|
||||
{
|
||||
struct vk_buffer_chain *buff_chain = &chain->vbo;
|
||||
VK_BUFFER_CHAIN_DISCARD(buff_chain);
|
||||
}
|
||||
{
|
||||
struct vk_buffer_chain *buff_chain = &chain->ubo;
|
||||
VK_BUFFER_CHAIN_DISCARD(buff_chain);
|
||||
}
|
||||
|
||||
/* Start recording the command buffer. */
|
||||
vk->cmd = chain->cmd;
|
||||
@ -1733,8 +1744,10 @@ static bool vulkan_frame(void *data, const void *frame,
|
||||
chain->texture_optimal.memory
|
||||
? VULKAN_TEXTURE_STAGING : VULKAN_TEXTURE_STREAMED);
|
||||
|
||||
vulkan_map_persistent_texture(
|
||||
vk->context->device, &chain->texture);
|
||||
{
|
||||
struct vk_texture *texture = &chain->texture;
|
||||
VK_MAP_PERSISTENT_TEXTURE(vk->context->device, texture);
|
||||
}
|
||||
|
||||
if (chain->texture.type == VULKAN_TEXTURE_STAGING)
|
||||
{
|
||||
@ -2196,8 +2209,10 @@ static bool vulkan_get_current_sw_framebuffer(void *data,
|
||||
chain->texture = vulkan_create_texture(vk, &chain->texture,
|
||||
framebuffer->width, framebuffer->height, chain->texture.format,
|
||||
NULL, NULL, VULKAN_TEXTURE_STREAMED);
|
||||
vulkan_map_persistent_texture(
|
||||
vk->context->device, &chain->texture);
|
||||
{
|
||||
struct vk_texture *texture = &chain->texture;
|
||||
VK_MAP_PERSISTENT_TEXTURE(vk->context->device, texture);
|
||||
}
|
||||
|
||||
if (chain->texture.type == VULKAN_TEXTURE_STAGING)
|
||||
{
|
||||
@ -2529,8 +2544,9 @@ static bool vulkan_read_viewport(void *data, uint8_t *buffer, bool is_idle)
|
||||
#endif
|
||||
|
||||
if (!staging->mapped)
|
||||
vulkan_map_persistent_texture(
|
||||
vk->context->device, staging);
|
||||
{
|
||||
VK_MAP_PERSISTENT_TEXTURE(vk->context->device, staging);
|
||||
}
|
||||
|
||||
vulkan_sync_texture_to_cpu(vk, staging);
|
||||
|
||||
|
@ -74,8 +74,10 @@ static void *vulkan_raster_font_init_font(void *data,
|
||||
font->atlas->width, font->atlas->height, VK_FORMAT_R8_UNORM, font->atlas->buffer,
|
||||
NULL /*&swizzle*/, VULKAN_TEXTURE_STAGING);
|
||||
|
||||
vulkan_map_persistent_texture(
|
||||
font->vk->context->device, &font->texture);
|
||||
{
|
||||
struct vk_texture *texture = &font->texture;
|
||||
VK_MAP_PERSISTENT_TEXTURE(font->vk->context->device, texture);
|
||||
}
|
||||
|
||||
font->texture_optimal = vulkan_create_texture(font->vk, NULL,
|
||||
font->atlas->width, font->atlas->height, VK_FORMAT_R8_UNORM, NULL,
|
||||
|
Loading…
x
Reference in New Issue
Block a user