Add bindless textures
Created bindless descriptors for holding texture data.
This commit is contained in:
1 parent
d328e38761
commit
bd4dd74881
13 files changed
+136
-43
No files matched your search
@@ -342,6 +342,8 @@ uint8_t pick_physical_device()
|
||||
{
|
||||
uint32_t physical_device_count = 0U;
|
||||
VkPhysicalDevice* physical_devices = NULL;
|
||||
VkPhysicalDeviceProperties device_properties = {0};;
|
||||
VkPhysicalDeviceFeatures device_features = {0};
|
||||
|
||||
/* Get number of existing physical devices */
|
||||
vkEnumeratePhysicalDevices(g_vulkan_instance, &physical_device_count, NULL);
|
||||
@@ -356,8 +358,6 @@ uint8_t pick_physical_device()
|
||||
|
||||
/* Check for suitability */
|
||||
for (size_t physicalDeviceIdx = 0U; physicalDeviceIdx < physical_device_count; ++physicalDeviceIdx) {
|
||||
VkPhysicalDeviceProperties device_properties;
|
||||
VkPhysicalDeviceFeatures device_features;
|
||||
vkGetPhysicalDeviceProperties(physical_devices[physicalDeviceIdx], &device_properties);
|
||||
vkGetPhysicalDeviceFeatures(physical_devices[physicalDeviceIdx], &device_features);
|
||||
|
||||
@@ -398,6 +398,22 @@ uint8_t create_device()
|
||||
VkDeviceQueueCreateInfo device_queue_createinfos[2] = {}; /* TODO: Change when we want more queues */
|
||||
float* graphics_familiy_queue_priorities = NULL;
|
||||
float* presentation_familiy_queue_priorities = NULL;
|
||||
VkPhysicalDeviceFeatures2 physical_features2 = {0};
|
||||
VkPhysicalDeviceDescriptorIndexingFeatures indexing_features = {0};
|
||||
VkBool32 bindless_supported = VK_FALSE;
|
||||
|
||||
indexing_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT;
|
||||
|
||||
physical_features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
|
||||
physical_features2.pNext = &indexing_features;
|
||||
|
||||
vkGetPhysicalDeviceFeatures2(g_vulkan_state.physical_device, &physical_features2);
|
||||
|
||||
bindless_supported = indexing_features.descriptorBindingPartiallyBound && indexing_features.runtimeDescriptorArray;
|
||||
if (bindless_supported == VK_FALSE) {
|
||||
LOGE("This engine requires bindless support");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Get information about supported queue families */
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(g_vulkan_state.physical_device, &queue_families_property_count, NULL);
|
||||
@@ -473,7 +489,7 @@ uint8_t create_device()
|
||||
device_queue_createinfos[1].pQueuePriorities = presentation_familiy_queue_priorities;
|
||||
|
||||
device_create_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
|
||||
device_create_info.pNext = NULL;
|
||||
device_create_info.pNext = &physical_features2;
|
||||
device_create_info.flags = 0U;
|
||||
device_create_info.queueCreateInfoCount = device_queues_count;
|
||||
device_create_info.pQueueCreateInfos = device_queue_createinfos;
|
||||
@@ -483,6 +499,7 @@ uint8_t create_device()
|
||||
device_create_info.ppEnabledExtensionNames = g_enabled_device_extensions_names;
|
||||
device_create_info.pEnabledFeatures = NULL; /* TODO: Enable features, when needed */
|
||||
|
||||
|
||||
if (VK_SUCCESS != vkCreateDevice(g_vulkan_state.physical_device, &device_create_info, NULL, &g_vulkan_state.device)) {
|
||||
LOGF(vulkan_error_messages[VULKAN_FAILED_TO_CREATE_DEVICE]);
|
||||
return VULKAN_ERROR_DEVICE_CREATION_FAILED;
|
||||
|
||||
Reference in new issue
Block a user