mirror of
https://gitlab.freedesktop.org/mesa/vulkan-wsi-layer.git
synced 2025-12-20 09:10:07 +01:00
Add vulkan 1.1 function entrypoints
Implement vkGetDeviceGroupSurfacePresentModesKHR, vkGetDeviceGroupPresentCapabilitiesKHR, vkAcquireNextImage2KHR and vkGetPhysicalDevicePresentRectanglesKHR function entrypoints in the layer. We assume that if the layer should not handle the surface the device or instance should handle it as appropriate and fallback to this implmentation. Change-Id: Iafc585d8738ad80413ad616d834d966f92c4f8cb Signed-off-by: Ben Davis <ben.davis@arm.com>
This commit is contained in:
parent
293ae2ab13
commit
bcd934f2aa
4 changed files with 125 additions and 2 deletions
|
|
@ -435,6 +435,10 @@ VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI_CALL wsi_layer_vkGetDeviceProcAddr(VkDe
|
||||||
GET_PROC_ADDR(vkAcquireNextImageKHR);
|
GET_PROC_ADDR(vkAcquireNextImageKHR);
|
||||||
GET_PROC_ADDR(vkQueuePresentKHR);
|
GET_PROC_ADDR(vkQueuePresentKHR);
|
||||||
|
|
||||||
|
GET_PROC_ADDR(vkGetDeviceGroupSurfacePresentModesKHR);
|
||||||
|
GET_PROC_ADDR(vkGetDeviceGroupPresentCapabilitiesKHR);
|
||||||
|
GET_PROC_ADDR(vkAcquireNextImage2KHR);
|
||||||
|
|
||||||
return layer::device_private_data::get(device).disp.GetDeviceProcAddr(device, funcName);
|
return layer::device_private_data::get(device).disp.GetDeviceProcAddr(device, funcName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -460,6 +464,8 @@ VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL wsi_layer_vkGetInstance
|
||||||
GET_PROC_ADDR(vkEnumerateDeviceExtensionProperties);
|
GET_PROC_ADDR(vkEnumerateDeviceExtensionProperties);
|
||||||
GET_PROC_ADDR(vkEnumerateInstanceLayerProperties);
|
GET_PROC_ADDR(vkEnumerateInstanceLayerProperties);
|
||||||
|
|
||||||
|
GET_PROC_ADDR(vkGetPhysicalDevicePresentRectanglesKHR);
|
||||||
|
|
||||||
return layer::instance_private_data::get(instance).disp.GetInstanceProcAddr(instance, funcName);
|
return layer::instance_private_data::get(instance).disp.GetInstanceProcAddr(instance, funcName);
|
||||||
}
|
}
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,8 @@ namespace layer
|
||||||
OPTIONAL(GetPhysicalDeviceSurfacePresentModesKHR) \
|
OPTIONAL(GetPhysicalDeviceSurfacePresentModesKHR) \
|
||||||
OPTIONAL(GetPhysicalDeviceSurfaceSupportKHR) \
|
OPTIONAL(GetPhysicalDeviceSurfaceSupportKHR) \
|
||||||
OPTIONAL(GetPhysicalDeviceImageFormatProperties2KHR) \
|
OPTIONAL(GetPhysicalDeviceImageFormatProperties2KHR) \
|
||||||
OPTIONAL(GetPhysicalDeviceFormatProperties2KHR)
|
OPTIONAL(GetPhysicalDeviceFormatProperties2KHR) \
|
||||||
|
OPTIONAL(GetPhysicalDevicePresentRectanglesKHR)
|
||||||
|
|
||||||
struct instance_dispatch_table
|
struct instance_dispatch_table
|
||||||
{
|
{
|
||||||
|
|
@ -116,7 +117,10 @@ struct instance_dispatch_table
|
||||||
OPTIONAL(AcquireNextImageKHR) \
|
OPTIONAL(AcquireNextImageKHR) \
|
||||||
OPTIONAL(QueuePresentKHR) \
|
OPTIONAL(QueuePresentKHR) \
|
||||||
OPTIONAL(GetMemoryFdPropertiesKHR) \
|
OPTIONAL(GetMemoryFdPropertiesKHR) \
|
||||||
OPTIONAL(BindImageMemory2KHR)
|
OPTIONAL(BindImageMemory2KHR) \
|
||||||
|
OPTIONAL(GetDeviceGroupSurfacePresentModesKHR) \
|
||||||
|
OPTIONAL(GetDeviceGroupPresentCapabilitiesKHR) \
|
||||||
|
OPTIONAL(AcquireNextImage2KHR)
|
||||||
|
|
||||||
struct device_dispatch_table
|
struct device_dispatch_table
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -166,4 +166,104 @@ VKAPI_ATTR VkResult wsi_layer_vkQueuePresentKHR(VkQueue queue, const VkPresentIn
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VKAPI_ATTR VkResult wsi_layer_vkGetDeviceGroupPresentCapabilitiesKHR(
|
||||||
|
VkDevice device, VkDeviceGroupPresentCapabilitiesKHR *pDeviceGroupPresentCapabilities)
|
||||||
|
{
|
||||||
|
assert(pDeviceGroupPresentCapabilities != nullptr);
|
||||||
|
|
||||||
|
pDeviceGroupPresentCapabilities->presentMask[0] = 1;
|
||||||
|
pDeviceGroupPresentCapabilities->modes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR;
|
||||||
|
|
||||||
|
for (uint32_t i = 1; i < VK_MAX_DEVICE_GROUP_SIZE_KHR; i++)
|
||||||
|
{
|
||||||
|
pDeviceGroupPresentCapabilities->presentMask[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return VK_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
VKAPI_ATTR VkResult wsi_layer_vkGetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSurfaceKHR surface,
|
||||||
|
VkDeviceGroupPresentModeFlagsKHR *pModes)
|
||||||
|
{
|
||||||
|
assert(pModes != nullptr);
|
||||||
|
|
||||||
|
auto &device_data = layer::device_private_data::get(device);
|
||||||
|
auto &instance = device_data.instance_data;
|
||||||
|
|
||||||
|
if (!instance.should_layer_handle_surface(device_data.physical_device, surface))
|
||||||
|
{
|
||||||
|
return device_data.disp.GetDeviceGroupSurfacePresentModesKHR(device, surface, pModes);
|
||||||
|
}
|
||||||
|
|
||||||
|
*pModes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR;
|
||||||
|
return VK_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
VKAPI_ATTR VkResult wsi_layer_vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice,
|
||||||
|
VkSurfaceKHR surface, uint32_t *pRectCount,
|
||||||
|
VkRect2D *pRects)
|
||||||
|
{
|
||||||
|
assert(surface);
|
||||||
|
assert(pRectCount != nullptr);
|
||||||
|
|
||||||
|
auto &instance = layer::instance_private_data::get(physicalDevice);
|
||||||
|
|
||||||
|
if (!instance.should_layer_handle_surface(physicalDevice, surface))
|
||||||
|
{
|
||||||
|
return instance.disp.GetPhysicalDevicePresentRectanglesKHR(physicalDevice, surface, pRectCount, pRects);
|
||||||
|
}
|
||||||
|
|
||||||
|
VkResult result;
|
||||||
|
wsi::surface_properties *props = wsi::get_surface_properties(surface);
|
||||||
|
assert(props);
|
||||||
|
|
||||||
|
if (nullptr == pRects)
|
||||||
|
{
|
||||||
|
*pRectCount = 1;
|
||||||
|
result = VK_SUCCESS;
|
||||||
|
}
|
||||||
|
else if (0 == *pRectCount)
|
||||||
|
{
|
||||||
|
result = VK_INCOMPLETE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*pRectCount = 1;
|
||||||
|
|
||||||
|
VkSurfaceCapabilitiesKHR surface_caps;
|
||||||
|
result = props->get_surface_capabilities(physicalDevice, surface, &surface_caps);
|
||||||
|
|
||||||
|
if (result != VK_SUCCESS)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
pRects[0].offset.x = 0;
|
||||||
|
pRects[0].offset.y = 0;
|
||||||
|
pRects[0].extent = surface_caps.currentExtent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
VKAPI_ATTR VkResult wsi_layer_vkAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo,
|
||||||
|
uint32_t *pImageIndex)
|
||||||
|
{
|
||||||
|
assert(pAcquireInfo != VK_NULL_HANDLE);
|
||||||
|
assert(pAcquireInfo->swapchain != VK_NULL_HANDLE);
|
||||||
|
assert(pAcquireInfo->semaphore != VK_NULL_HANDLE || pAcquireInfo->fence != VK_NULL_HANDLE);
|
||||||
|
assert(pImageIndex != nullptr);
|
||||||
|
|
||||||
|
auto &device_data = layer::device_private_data::get(device);
|
||||||
|
|
||||||
|
if (!device_data.layer_owns_swapchain(pAcquireInfo->swapchain))
|
||||||
|
{
|
||||||
|
return device_data.disp.AcquireNextImage2KHR(device, pAcquireInfo, pImageIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
wsi::swapchain_base *sc = reinterpret_cast<wsi::swapchain_base *>(pAcquireInfo->swapchain);
|
||||||
|
|
||||||
|
return sc->acquire_next_image(pAcquireInfo->timeout, pAcquireInfo->semaphore, pAcquireInfo->fence, pImageIndex);
|
||||||
|
}
|
||||||
|
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
|
||||||
|
|
@ -49,4 +49,17 @@ extern "C"
|
||||||
|
|
||||||
VKAPI_ATTR VkResult wsi_layer_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo);
|
VKAPI_ATTR VkResult wsi_layer_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo);
|
||||||
|
|
||||||
|
/* 1.1 entrypoints */
|
||||||
|
VKAPI_ATTR VkResult wsi_layer_vkGetDeviceGroupPresentCapabilitiesKHR(
|
||||||
|
VkDevice device, VkDeviceGroupPresentCapabilitiesKHR *pDeviceGroupPresentCapabilities);
|
||||||
|
|
||||||
|
VKAPI_ATTR VkResult wsi_layer_vkGetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSurfaceKHR surface,
|
||||||
|
VkDeviceGroupPresentModeFlagsKHR *pModes);
|
||||||
|
|
||||||
|
VKAPI_ATTR VkResult wsi_layer_vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice,
|
||||||
|
VkSurfaceKHR surface, uint32_t *pRectCount,
|
||||||
|
VkRect2D *pRects);
|
||||||
|
|
||||||
|
VKAPI_ATTR VkResult wsi_layer_vkAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo,
|
||||||
|
uint32_t *pImageIndex);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue