From 75128355ecce6bb9d2d5affbacd4d41361a4dd73 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Wed, 28 Feb 2024 19:57:43 -0800 Subject: [PATCH] misc fixes --- src/Refresh_Driver_Vulkan.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/Refresh_Driver_Vulkan.c b/src/Refresh_Driver_Vulkan.c index 61927a7..41d2e91 100644 --- a/src/Refresh_Driver_Vulkan.c +++ b/src/Refresh_Driver_Vulkan.c @@ -3544,10 +3544,13 @@ static void VULKAN_INTERNAL_DestroyRenderTarget( NULL ); - VULKAN_INTERNAL_DestroyTexture( - renderer, - renderTarget->msaaTex - ); + if (renderTarget->msaaTex != NULL) + { + VULKAN_INTERNAL_DestroyTexture( + renderer, + renderTarget->msaaTex + ); + } } static void VULKAN_INTERNAL_DestroyBuffer( @@ -5706,7 +5709,7 @@ static uint32_t VULKAN_INTERNAL_GetRenderTargetIndex( return (level * texture->depth * texture->layerCount) + (layer * texture->depth) + - texture->depth; + depth; } static VulkanRenderTarget* VULKAN_INTERNAL_FetchRenderTarget( @@ -5802,9 +5805,7 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass( attachmentDescriptions[attachmentDescriptionCount].flags = 0; attachmentDescriptions[attachmentDescriptionCount].format = texture->format; - attachmentDescriptions[attachmentDescriptionCount].samples = RefreshToVK_SampleCount[ - texture->sampleCount - ]; + attachmentDescriptions[attachmentDescriptionCount].samples = texture->sampleCount; attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[ colorAttachmentInfos[i].loadOp ]; @@ -5877,9 +5878,8 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass( attachmentDescriptions[attachmentDescriptionCount].flags = 0; attachmentDescriptions[attachmentDescriptionCount].format = texture->format; - attachmentDescriptions[attachmentDescriptionCount].samples = RefreshToVK_SampleCount[ - texture->sampleCount - ]; + attachmentDescriptions[attachmentDescriptionCount].samples = texture->sampleCount; + attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[ depthStencilAttachmentInfo->loadOp ]; @@ -5996,9 +5996,8 @@ static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass( attachmentDescriptions[attachmentDescriptionCount].format = RefreshToVK_SurfaceFormat[ attachmentDescription.format ]; - attachmentDescriptions[attachmentDescriptionCount].samples = RefreshToVK_SampleCount[ - sampleCount - ]; + attachmentDescriptions[attachmentDescriptionCount].samples = sampleCount; + attachmentDescriptions[attachmentDescriptionCount].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; attachmentDescriptions[attachmentDescriptionCount].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; @@ -6061,9 +6060,8 @@ static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass( renderer, attachmentInfo.depthStencilFormat ); - attachmentDescriptions[attachmentDescriptionCount].samples = RefreshToVK_SampleCount[ - sampleCount - ]; + attachmentDescriptions[attachmentDescriptionCount].samples = sampleCount; + attachmentDescriptions[attachmentDescriptionCount].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; attachmentDescriptions[attachmentDescriptionCount].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; @@ -6844,6 +6842,7 @@ static Refresh_Texture* VULKAN_CreateTexture( container->textureHandles = SDL_malloc( container->textureCapacity * sizeof(VulkanTextureHandle*) ); + container->textureHandles[0] = container->activeTextureHandle; return (Refresh_Texture*) container; }