From d568810fa0dd75a91a3c399ad05102aed1aaa66f Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Wed, 28 Feb 2024 22:16:08 -0800 Subject: [PATCH] more misc fixes --- src/Refresh_Driver_Vulkan.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Refresh_Driver_Vulkan.c b/src/Refresh_Driver_Vulkan.c index 41d2e91..6ad120f 100644 --- a/src/Refresh_Driver_Vulkan.c +++ b/src/Refresh_Driver_Vulkan.c @@ -3482,11 +3482,8 @@ static void VULKAN_INTERNAL_DestroyTexture( VulkanTexture* texture ) { uint32_t i, j, k, rtIndex; - uint8_t isRenderTarget = - ((texture->usageFlags & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) != 0) || - ((texture->usageFlags & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) != 0); - if (isRenderTarget) + if (texture->renderTargets != NULL) { rtIndex = 0; @@ -5432,7 +5429,7 @@ static VulkanTexture* VULKAN_INTERNAL_CreateTexture( imageCreateInfo.extent.depth = depth; imageCreateInfo.mipLevels = levelCount; imageCreateInfo.arrayLayers = layerCount; - imageCreateInfo.samples = isMsaaTexture ? sampleCount : VK_SAMPLE_COUNT_1_BIT; + imageCreateInfo.samples = isMsaaTexture || IsDepthFormat(format) ? sampleCount : VK_SAMPLE_COUNT_1_BIT; imageCreateInfo.tiling = VK_IMAGE_TILING_OPTIMAL; imageCreateInfo.usage = imageUsageFlags; imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; @@ -8867,7 +8864,7 @@ static void VULKAN_CopyTextureToTexture( VulkanTextureContainer *dstContainer = (VulkanTextureContainer*) destination->texture; VkImageCopy imageCopy; - if (option == REFRESH_COPYOPTIONS_SAFEDISCARD && SDL_AtomicGet(&dstContainer->activeTextureHandle->vulkanTexture->referenceCount) > 0) + if (option == REFRESH_COPYOPTIONS_SAFEDISCARD && dstContainer->canBeDiscarded && SDL_AtomicGet(&dstContainer->activeTextureHandle->vulkanTexture->referenceCount) > 0) { VULKAN_INTERNAL_DiscardActiveTexture( renderer, @@ -9023,7 +9020,7 @@ static void VULKAN_CopyBufferToTexture( VulkanTextureContainer *textureContainer = (VulkanTextureContainer*) textureSlice->texture; VkBufferImageCopy imageCopy; - if (option == REFRESH_COPYOPTIONS_SAFEDISCARD && SDL_AtomicGet(&textureContainer->activeTextureHandle->vulkanTexture->referenceCount) > 0) + if (option == REFRESH_COPYOPTIONS_SAFEDISCARD && textureContainer->canBeDiscarded && SDL_AtomicGet(&textureContainer->activeTextureHandle->vulkanTexture->referenceCount) > 0) { VULKAN_INTERNAL_DiscardActiveTexture( renderer,