Linuxviewer API
LogicalDevice.h
#pragma once
#include <vulkan/LogicalDevice.h>
class LogicalDevice : public vulkan::LogicalDevice
{
Also vulkan::LogicalDevice
has virtual functions that allow the user to configure it.
The following virtual functions of vulkan::LogicalDevice
allow further configuration of the device:
-
void prepare_physical_device_features( vk::PhysicalDeviceFeatures& features10, vk::PhysicalDeviceVulkan11Features& features11, vk::PhysicalDeviceVulkan12Features& features12, vk::PhysicalDeviceVulkan13Features& features13) const
Override this function to change the default physical device features. Each argument is a non-const reference to a vulkan class that allows changing the necessary features by calling member functions on them. For example,
features10.setDepthClamp(true)
orfeatures13.setShaderZeroInitializeWorkgroupMemory(true)
. See the vulkan documentation of VkPhysicalDeviceFeatures , VkPhysicalDeviceVulkan11Features , VkPhysicalDeviceVulkan12Features and VkPhysicalDeviceVulkan13Features for a list of things that can be changed; or consult /usr/include/vulkan/vulkan_structs.hpp for the available member functions. void prepare_logical_device(DeviceCreateInfo& device_create_info) const
Override this function to add QueueRequest objects. The default will create a graphics and presentation queue. See below.
Every time create_root_window
is called a int
“cookie” must be passed.
This cookie is matched against the cookies used in the virtual
function prepare_logical_device
of LogicalDevice
(see above) in order
to determine which presentation queue family to use for that window (and related windows)
and there should be defined in the LogicalDevice
class.
public:
static constexpr int root_window_request_cookie = 1;
};
When overriding the default prepare_logical_device
one might also
need a “transfer” cookie for more fine grained control over the use of
a transfer queue family.
The only requirement here is that cookies have different values.
In this example we’re not using the cookie because we’re not overriding prepare_logical_device
.
The default simply creates one graphics capable queue (for the command buffer), a presentation queue
(to present the final image) and a transfer queue (to upload textures to the GPU).
The graphics and presentation queue will be combined if possible because that is more efficient
and supported by virtually all hardware anyway.