mirror of
https://gitlab.freedesktop.org/mesa/vulkan-wsi-layer.git
synced 2026-05-06 10:28:03 +02:00
Add initial support for VK_KHR_present_id
Layer updated to advertise support for the VK_KHR_present_id extension. vkGetPhysicalDeviceFeatures2KHR and vkCreateDevice updated to handle the new struct. Also add the extensions enabled by the layer to the instance_data and device_data objects so that the layer can correctly check which extensions have been enabled. Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com> Change-Id: I71ae2b28c94d3f16b485a06094712d6c3f6c7e77
This commit is contained in:
parent
743f00f9bb
commit
b1f9e5811a
4 changed files with 35 additions and 1 deletions
|
|
@ -36,6 +36,7 @@
|
|||
"vkGetPhysicalDevicePresentRectanglesKHR"
|
||||
]
|
||||
},
|
||||
{"name": "VK_KHR_present_id", "spec_version": "1"},
|
||||
{
|
||||
"name": "VK_EXT_swapchain_maintenance1",
|
||||
"spec_version": "1",
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ VKAPI_ATTR VkResult create_instance(const VkInstanceCreateInfo *pCreateInfo, con
|
|||
*/
|
||||
VkResult result =
|
||||
instance_private_data::get(*pInstance)
|
||||
.set_instance_enabled_extensions(pCreateInfo->ppEnabledExtensionNames, pCreateInfo->enabledExtensionCount);
|
||||
.set_instance_enabled_extensions(modified_enabled_extensions.data(), modified_enabled_extensions.size());
|
||||
if (result != VK_SUCCESS)
|
||||
{
|
||||
instance_private_data::disassociate(*pInstance);
|
||||
|
|
@ -312,6 +312,13 @@ VKAPI_ATTR VkResult create_device(VkPhysicalDevice physicalDevice, const VkDevic
|
|||
}
|
||||
#endif
|
||||
|
||||
const auto present_id_features = util::find_extension<VkPhysicalDevicePresentIdFeaturesKHR>(
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR, pCreateInfo->pNext);
|
||||
if (present_id_features != nullptr)
|
||||
{
|
||||
layer::device_private_data::get(*pDevice).set_present_id_feature_enabled(present_id_features->presentId);
|
||||
}
|
||||
|
||||
auto *physical_device_swapchain_maintenance1_features =
|
||||
util::find_extension<VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT>(
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT, pCreateInfo->pNext);
|
||||
|
|
@ -426,6 +433,13 @@ wsi_layer_vkGetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice,
|
|||
}
|
||||
#endif
|
||||
|
||||
auto *present_id_features = util::find_extension<VkPhysicalDevicePresentIdFeaturesKHR>(
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR, pFeatures->pNext);
|
||||
if (present_id_features != nullptr)
|
||||
{
|
||||
present_id_features->presentId = true;
|
||||
}
|
||||
|
||||
auto *physical_device_swapchain_maintenance1_features =
|
||||
util::find_extension<VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT>(
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT, pFeatures->pNext);
|
||||
|
|
|
|||
|
|
@ -395,6 +395,7 @@ device_private_data::device_private_data(instance_private_data &inst_data, VkPhy
|
|||
#if WSI_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN
|
||||
, compression_control_enabled{ false }
|
||||
#endif /* WSI_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN */
|
||||
, present_id_enabled { false }
|
||||
, swapchain_maintenance1_enabled{ false }
|
||||
/* clang-format on */
|
||||
{
|
||||
|
|
@ -548,6 +549,11 @@ bool device_private_data::is_swapchain_compression_control_enabled() const
|
|||
}
|
||||
#endif /* WSI_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN */
|
||||
|
||||
void device_private_data::set_present_id_feature_enabled(bool enable)
|
||||
{
|
||||
present_id_enabled = enable;
|
||||
}
|
||||
|
||||
void device_private_data::set_swapchain_maintenance1_enabled(bool enable)
|
||||
{
|
||||
swapchain_maintenance1_enabled = enable;
|
||||
|
|
|
|||
|
|
@ -805,6 +805,13 @@ public:
|
|||
bool is_swapchain_compression_control_enabled() const;
|
||||
#endif /* WSI_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN */
|
||||
|
||||
/**
|
||||
* @brief Set whether the device supports the present ID feature.
|
||||
*
|
||||
* @param enable Value to set m_present_id_enabled member variable.
|
||||
*/
|
||||
void set_present_id_feature_enabled(bool enable);
|
||||
|
||||
/**
|
||||
* @brief Selectively enable/disable the swapchain maintenance1 features for this device.
|
||||
*
|
||||
|
|
@ -862,6 +869,12 @@ private:
|
|||
bool compression_control_enabled;
|
||||
#endif /* WSI_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN */
|
||||
|
||||
/**
|
||||
* @brief Stores whether the device supports the present ID feature.
|
||||
*
|
||||
*/
|
||||
bool present_id_enabled;
|
||||
|
||||
/**
|
||||
* @brief Stores whether the device has enabled support for the swapchain maintenance1 features.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue