mirror of
https://github.com/charles-lunarg/vk-bootstrap.git
synced 2024-11-22 23:24:34 +00:00
Documented that features & extensions are propagated to DeviceBuilder
This commit is contained in:
parent
f74ee5e9fc
commit
f389114811
@ -960,8 +960,10 @@ void destroy_device (Device device) {
|
|||||||
|
|
||||||
DeviceBuilder::DeviceBuilder (PhysicalDevice phys_device) {
|
DeviceBuilder::DeviceBuilder (PhysicalDevice phys_device) {
|
||||||
info.physical_device = phys_device;
|
info.physical_device = phys_device;
|
||||||
info.extensions = phys_device.extensions_to_enable;
|
info.surface = phys_device.surface;
|
||||||
info.queue_families = phys_device.queue_families;
|
info.queue_families = phys_device.queue_families;
|
||||||
|
info.features = phys_device.features;
|
||||||
|
info.extensions_to_enable = phys_device.extensions_to_enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
detail::Expected<Device, detail::Error<DeviceError>> DeviceBuilder::build () {
|
detail::Expected<Device, detail::Error<DeviceError>> DeviceBuilder::build () {
|
||||||
@ -986,11 +988,8 @@ detail::Expected<Device, detail::Error<DeviceError>> DeviceBuilder::build () {
|
|||||||
queueCreateInfos.push_back (queue_create_info);
|
queueCreateInfos.push_back (queue_create_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<const char*> extensions;
|
std::vector<const char*> extensions = info.extensions_to_enable;
|
||||||
for (auto& ext : info.extensions)
|
if (info.surface != VK_NULL_HANDLE) extensions.push_back ({ VK_KHR_SWAPCHAIN_EXTENSION_NAME });
|
||||||
extensions.push_back (ext);
|
|
||||||
if (info.physical_device.surface != VK_NULL_HANDLE)
|
|
||||||
extensions.push_back ({ VK_KHR_SWAPCHAIN_EXTENSION_NAME });
|
|
||||||
|
|
||||||
VkDeviceCreateInfo device_create_info = {};
|
VkDeviceCreateInfo device_create_info = {};
|
||||||
device_create_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
|
device_create_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
|
||||||
@ -1000,7 +999,7 @@ detail::Expected<Device, detail::Error<DeviceError>> DeviceBuilder::build () {
|
|||||||
device_create_info.pQueueCreateInfos = queueCreateInfos.data ();
|
device_create_info.pQueueCreateInfos = queueCreateInfos.data ();
|
||||||
device_create_info.enabledExtensionCount = static_cast<uint32_t> (extensions.size ());
|
device_create_info.enabledExtensionCount = static_cast<uint32_t> (extensions.size ());
|
||||||
device_create_info.ppEnabledExtensionNames = extensions.data ();
|
device_create_info.ppEnabledExtensionNames = extensions.data ();
|
||||||
device_create_info.pEnabledFeatures = &info.physical_device.features;
|
device_create_info.pEnabledFeatures = &info.features;
|
||||||
|
|
||||||
Device device;
|
Device device;
|
||||||
VkResult res = vkCreateDevice (
|
VkResult res = vkCreateDevice (
|
||||||
@ -1009,7 +1008,7 @@ detail::Expected<Device, detail::Error<DeviceError>> DeviceBuilder::build () {
|
|||||||
return detail::Error<DeviceError>{ DeviceError::failed_create_device, res };
|
return detail::Error<DeviceError>{ DeviceError::failed_create_device, res };
|
||||||
}
|
}
|
||||||
device.physical_device = info.physical_device;
|
device.physical_device = info.physical_device;
|
||||||
device.surface = info.physical_device.surface;
|
device.surface = info.surface;
|
||||||
device.queue_families = info.queue_families;
|
device.queue_families = info.queue_families;
|
||||||
device.allocation_callbacks = info.allocation_callbacks;
|
device.allocation_callbacks = info.allocation_callbacks;
|
||||||
return device;
|
return device;
|
||||||
|
@ -445,6 +445,7 @@ struct CustomQueueDescription {
|
|||||||
|
|
||||||
class DeviceBuilder {
|
class DeviceBuilder {
|
||||||
public:
|
public:
|
||||||
|
// Any features and extensions that are requested/required in PhysicalDeviceSelector are automatically enabled.
|
||||||
DeviceBuilder (PhysicalDevice physical_device);
|
DeviceBuilder (PhysicalDevice physical_device);
|
||||||
|
|
||||||
detail::Expected<Device, detail::Error<DeviceError>> build ();
|
detail::Expected<Device, detail::Error<DeviceError>> build ();
|
||||||
@ -465,8 +466,10 @@ class DeviceBuilder {
|
|||||||
VkDeviceCreateFlags flags = 0;
|
VkDeviceCreateFlags flags = 0;
|
||||||
std::vector<VkBaseOutStructure*> pNext_chain;
|
std::vector<VkBaseOutStructure*> pNext_chain;
|
||||||
PhysicalDevice physical_device;
|
PhysicalDevice physical_device;
|
||||||
std::vector<const char*> extensions;
|
VkSurfaceKHR surface;
|
||||||
std::vector<VkQueueFamilyProperties> queue_families;
|
std::vector<VkQueueFamilyProperties> queue_families;
|
||||||
|
VkPhysicalDeviceFeatures features;
|
||||||
|
std::vector<const char*> extensions_to_enable;
|
||||||
std::vector<CustomQueueDescription> queue_descriptions;
|
std::vector<CustomQueueDescription> queue_descriptions;
|
||||||
VkAllocationCallbacks* allocation_callbacks = VK_NULL_HANDLE;
|
VkAllocationCallbacks* allocation_callbacks = VK_NULL_HANDLE;
|
||||||
} info;
|
} info;
|
||||||
@ -522,9 +525,9 @@ class SwapchainBuilder {
|
|||||||
std::vector<VkPresentModeKHR> desired_present_modes;
|
std::vector<VkPresentModeKHR> desired_present_modes;
|
||||||
uint32_t desired_width = 256;
|
uint32_t desired_width = 256;
|
||||||
uint32_t desired_height = 256;
|
uint32_t desired_height = 256;
|
||||||
std::vector<VkBaseOutStructure*> pNext_elements;
|
|
||||||
uint32_t graphics_queue_index = 0;
|
uint32_t graphics_queue_index = 0;
|
||||||
uint32_t present_queue_index = 0;
|
uint32_t present_queue_index = 0;
|
||||||
|
std::vector<VkBaseOutStructure*> pNext_elements;
|
||||||
VkAllocationCallbacks* allocation_callbacks = VK_NULL_HANDLE;
|
VkAllocationCallbacks* allocation_callbacks = VK_NULL_HANDLE;
|
||||||
} info;
|
} info;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user