vulkan: Move vk_t pointer dereferences after the null check

This commit is contained in:
Lioncash 2016-11-25 23:21:25 -05:00
parent 6352b4a82e
commit d34202aea6

View File

@ -2076,9 +2076,9 @@ static void vulkan_set_texture_frame(void *data,
uint8_t *dst = NULL;
const uint8_t *src = NULL;
vk_t *vk = (vk_t*)data;
unsigned index = vk->context->current_swapchain_index;
struct vk_texture *texture = &vk->menu.textures[index];
struct vk_texture *texture_optimal = &vk->menu.textures_optimal[index];
unsigned index = 0;
struct vk_texture *texture = NULL;
struct vk_texture *texture_optimal = NULL;
const VkComponentMapping br_swizzle = {
VK_COMPONENT_SWIZZLE_B,
VK_COMPONENT_SWIZZLE_G,
@ -2089,6 +2089,10 @@ static void vulkan_set_texture_frame(void *data,
if (!vk)
return;
index = vk->context->current_swapchain_index;
texture = &vk->menu.textures[index];
texture_optimal = &vk->menu.textures_optimal[index];
/* B4G4R4A4 must be supported, but R4G4B4A4 is optional,
* just apply the swizzle in the image view instead. */
*texture = vulkan_create_texture(vk,