mirror of
https://github.com/yquake2/ref_vk.git
synced 2025-02-17 01:22:13 +00:00
Enables beta extensions for MoltenVK
This commit is contained in:
parent
48a73aa92f
commit
8ca794ab68
2 changed files with 25 additions and 5 deletions
|
@ -1752,6 +1752,10 @@ qboolean QVk_Init(void)
|
|||
if (vk_validation->value)
|
||||
extCount++;
|
||||
|
||||
#if defined(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME)
|
||||
extCount++;
|
||||
#endif
|
||||
|
||||
wantedExtensions = malloc(extCount * sizeof(char *));
|
||||
if (!SDL_Vulkan_GetInstanceExtensions(vk_window, &extCount, (const char **)wantedExtensions))
|
||||
{
|
||||
|
@ -1768,6 +1772,11 @@ qboolean QVk_Init(void)
|
|||
wantedExtensions[extCount - 1] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
|
||||
}
|
||||
|
||||
#if defined(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME)
|
||||
extCount++;
|
||||
wantedExtensions[extCount - 1] = VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME;
|
||||
#endif
|
||||
|
||||
R_Printf(PRINT_ALL, "Enabled extensions: ");
|
||||
for (int i = 0; i < extCount; i++)
|
||||
{
|
||||
|
@ -1780,6 +1789,9 @@ qboolean QVk_Init(void)
|
|||
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
|
||||
.pNext = NULL,
|
||||
.pApplicationInfo = &appInfo,
|
||||
#if defined(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME)
|
||||
.flags = VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR,
|
||||
#endif
|
||||
.enabledLayerCount = 0,
|
||||
.ppEnabledLayerNames = NULL,
|
||||
.enabledExtensionCount = extCount,
|
||||
|
|
|
@ -76,12 +76,15 @@ static void getBestPhysicalDevice(const VkPhysicalDevice *devices, int preferred
|
|||
uint32_t presentModesCount = 0;
|
||||
|
||||
// check if requested device extensions are present
|
||||
qboolean extSupported = deviceExtensionsSupported(&devices[i], VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
||||
|
||||
if (!deviceExtensionsSupported(&devices[i], VK_KHR_SWAPCHAIN_EXTENSION_NAME))
|
||||
// no required extensions? try next device
|
||||
if (!extSupported)
|
||||
continue;
|
||||
|
||||
#if defined(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME)
|
||||
if (!deviceExtensionsSupported(&devices[i], VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME))
|
||||
continue;
|
||||
#endif
|
||||
|
||||
// if extensions are fine, query surface formats and present modes to see if the device can be used
|
||||
VK_VERIFY(vkGetPhysicalDeviceSurfaceFormatsKHR(devices[i], vk_surface, &formatCount, NULL));
|
||||
VK_VERIFY(vkGetPhysicalDeviceSurfacePresentModesKHR(devices[i], vk_surface, &presentModesCount, NULL));
|
||||
|
@ -232,13 +235,18 @@ static VkResult createLogicalDevice()
|
|||
queueCreateInfo[numQueues++].queueFamilyIndex = vk_device.transferFamilyIndex;
|
||||
}
|
||||
|
||||
const char *deviceExtensions[] = { VK_KHR_SWAPCHAIN_EXTENSION_NAME };
|
||||
const char *deviceExtensions[] = {
|
||||
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
|
||||
#if defined(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME)
|
||||
VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME,
|
||||
#endif
|
||||
};
|
||||
|
||||
VkDeviceCreateInfo deviceCreateInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
|
||||
.pEnabledFeatures = &wantedDeviceFeatures,
|
||||
.ppEnabledExtensionNames = deviceExtensions,
|
||||
.enabledExtensionCount = 1,
|
||||
.enabledExtensionCount = sizeof(deviceExtensions) / sizeof(deviceExtensions[0]),
|
||||
.enabledLayerCount = 0,
|
||||
.ppEnabledLayerNames = NULL,
|
||||
.queueCreateInfoCount = numQueues,
|
||||
|
|
Loading…
Reference in a new issue