vulkan: enable samplerYcbcrConversion when creating the device

main
Sam Lantinga 2024-03-04 10:26:28 -08:00
parent ffef13e1e1
commit 759ade8c90
1 changed files with 9 additions and 1 deletions

View File

@ -1782,10 +1782,11 @@ static VkResult VULKAN_CreateDeviceResources(SDL_Renderer *renderer, SDL_Propert
if (rendererData->device) {
rendererData->device_external = SDL_TRUE;
} else {
VkPhysicalDeviceSamplerYcbcrConversionFeatures deviceSamplerYcbcrConversionFeatures = { 0 };
VkDeviceQueueCreateInfo deviceQueueCreateInfo[2] = { { 0 }, { 0 } };
static const float queuePriority[] = { 1.0f };
VkDeviceCreateInfo deviceCreateInfo = { 0 };
VkDeviceCreateInfo deviceCreateInfo = { 0 };
deviceCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
deviceCreateInfo.queueCreateInfoCount = 0;
deviceCreateInfo.pQueueCreateInfos = deviceQueueCreateInfo;
@ -1807,6 +1808,13 @@ static VkResult VULKAN_CreateDeviceResources(SDL_Renderer *renderer, SDL_Propert
++deviceCreateInfo.queueCreateInfoCount;
}
if (rendererData->supportsKHRSamplerYCbCrConversion) {
deviceSamplerYcbcrConversionFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES;
deviceSamplerYcbcrConversionFeatures.samplerYcbcrConversion = VK_TRUE;
deviceSamplerYcbcrConversionFeatures.pNext = (void *)deviceCreateInfo.pNext;
deviceCreateInfo.pNext = &deviceSamplerYcbcrConversionFeatures;
}
result = vkCreateDevice(rendererData->physicalDevice, &deviceCreateInfo, NULL, &rendererData->device);
if (result != VK_SUCCESS) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "vkCreateDevice(): %s\n", SDL_Vulkan_GetResultString(result));