Skip to content

Commit c1d4376

Browse files
committed
Fixed Vulkan validation errors when using ffmpeg video decode
1 parent f653c5e commit c1d4376

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/render/vulkan/SDL_render_vulkan.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -896,11 +896,16 @@ static VkResult VULKAN_AllocateImage(VULKAN_RenderData *rendererData, SDL_Proper
896896
imageViewCreateInfo.subresourceRange.baseArrayLayer = 0;
897897
imageViewCreateInfo.subresourceRange.layerCount = 1;
898898

899+
VkImageViewUsageCreateInfo imageViewUsageCreateInfo = { 0 };
900+
imageViewUsageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO;
901+
imageViewUsageCreateInfo.usage = imageUsage;
902+
imageViewCreateInfo.pNext = &imageViewUsageCreateInfo;
903+
899904
// If it's a YCbCr image, we need to pass the conversion info to the VkImageView (and the VkSampler)
900905
if (samplerYcbcrConversion != VK_NULL_HANDLE) {
901906
samplerYcbcrConversionInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO_KHR;
902907
samplerYcbcrConversionInfo.conversion = samplerYcbcrConversion;
903-
imageViewCreateInfo.pNext = &samplerYcbcrConversionInfo;
908+
imageViewUsageCreateInfo.pNext = &samplerYcbcrConversionInfo;
904909
}
905910

906911
result = vkCreateImageView(rendererData->device, &imageViewCreateInfo, NULL, &imageOut->imageView);
@@ -2745,8 +2750,8 @@ static bool VULKAN_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, S
27452750
// Also create VkSampler object which we will need to pass to the PSO as an immutable sampler
27462751
VkSamplerCreateInfo samplerCreateInfo = { 0 };
27472752
samplerCreateInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
2748-
samplerCreateInfo.magFilter = VK_FILTER_NEAREST;
2749-
samplerCreateInfo.minFilter = VK_FILTER_NEAREST;
2753+
samplerCreateInfo.magFilter = VK_FILTER_LINEAR;
2754+
samplerCreateInfo.minFilter = VK_FILTER_LINEAR;
27502755
samplerCreateInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST;
27512756
samplerCreateInfo.addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
27522757
samplerCreateInfo.addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;

0 commit comments

Comments
 (0)