mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 16:39:43 +00:00
Merge pull request #12380 from stenzek/vulkan-software-fb
(video/vulkan) Avoid caching stale mapped GPU texture as frame data
This commit is contained in:
commit
a04fe66032
@ -57,6 +57,8 @@
|
||||
|
||||
static void vulkan_set_viewport(void *data, unsigned viewport_width,
|
||||
unsigned viewport_height, bool force_full, bool allow_rotate);
|
||||
static bool vulkan_is_mapped_swapchain_texture_ptr(const vk_t* vk,
|
||||
const void* ptr);
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
static void vulkan_overlay_free(vk_t *vk);
|
||||
@ -682,6 +684,12 @@ static void vulkan_deinit_textures(vk_t *vk)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
/* Avoid memcpying from a destroyed/unmapped texture later on. */
|
||||
const void* cached_frame;
|
||||
video_driver_cached_frame_get(&cached_frame, NULL, NULL, NULL);
|
||||
if (vulkan_is_mapped_swapchain_texture_ptr(vk, cached_frame))
|
||||
video_driver_set_cached_frame_ptr(NULL);
|
||||
|
||||
vulkan_deinit_samplers(vk);
|
||||
|
||||
for (i = 0; i < vk->num_swapchain_images; i++)
|
||||
@ -2389,6 +2397,18 @@ static bool vulkan_get_current_sw_framebuffer(void *data,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool vulkan_is_mapped_swapchain_texture_ptr(const vk_t* vk,
|
||||
const void* ptr)
|
||||
{
|
||||
for (unsigned i = 0; i < vk->num_swapchain_images; i++)
|
||||
{
|
||||
if (ptr == vk->swapchain[i].texture.mapped)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool vulkan_get_hw_render_interface(void *data,
|
||||
const struct retro_hw_render_interface **iface)
|
||||
{
|
||||
|
@ -30897,8 +30897,7 @@ static void video_driver_lock_new(struct rarch_state *p_rarch)
|
||||
void video_driver_set_cached_frame_ptr(const void *data)
|
||||
{
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
if (data)
|
||||
p_rarch->frame_cache_data = data;
|
||||
p_rarch->frame_cache_data = data;
|
||||
}
|
||||
|
||||
void video_driver_set_stub_frame(void)
|
||||
|
Loading…
Reference in New Issue
Block a user