summaryrefslogtreecommitdiff
path: root/src/vulkan
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2017-03-17 14:04:57 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2017-05-16 08:38:43 -0700
commit56901c9ea4d419aad68fd75b0e89aff600730587 (patch)
treec8ff2059230e3fcdbb57ab4aa8a3d40528e6b7a6 /src/vulkan
parenta28163db05a308abaca51adeaf2578d75864041a (diff)
vulkan/wsi/x11: Add support for VK_KHR_get_surface_capabilities2
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Diffstat (limited to 'src/vulkan')
-rw-r--r--src/vulkan/wsi/wsi_common_x11.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 35801947f8e..5be56f1232f 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -512,6 +512,16 @@ x11_surface_get_capabilities(VkIcdSurfaceBase *icd_surface,
}
static VkResult
+x11_surface_get_capabilities2(VkIcdSurfaceBase *icd_surface,
+ const void *info_next,
+ VkSurfaceCapabilities2KHR *caps)
+{
+ assert(caps->sType == VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR);
+
+ return x11_surface_get_capabilities(icd_surface, &caps->surfaceCapabilities);
+}
+
+static VkResult
x11_surface_get_formats(VkIcdSurfaceBase *surface,
struct wsi_device *wsi_device,
uint32_t *pSurfaceFormatCount,
@@ -530,6 +540,26 @@ x11_surface_get_formats(VkIcdSurfaceBase *surface,
}
static VkResult
+x11_surface_get_formats2(VkIcdSurfaceBase *surface,
+ struct wsi_device *wsi_device,
+ const void *info_next,
+ uint32_t *pSurfaceFormatCount,
+ VkSurfaceFormat2KHR *pSurfaceFormats)
+{
+ VK_OUTARRAY_MAKE(out, pSurfaceFormats, pSurfaceFormatCount);
+
+ for (unsigned i = 0; i < ARRAY_SIZE(formats); i++) {
+ vk_outarray_append(&out, f) {
+ assert(f->sType == VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR);
+ f->surfaceFormat.format = formats[i];
+ f->surfaceFormat.colorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
+ }
+ }
+
+ return vk_outarray_status(&out);
+}
+
+static VkResult
x11_surface_get_present_modes(VkIcdSurfaceBase *surface,
uint32_t *pPresentModeCount,
VkPresentModeKHR *pPresentModes)
@@ -1243,7 +1273,9 @@ wsi_x11_init_wsi(struct wsi_device *wsi_device,
wsi->base.get_support = x11_surface_get_support;
wsi->base.get_capabilities = x11_surface_get_capabilities;
+ wsi->base.get_capabilities2 = x11_surface_get_capabilities2;
wsi->base.get_formats = x11_surface_get_formats;
+ wsi->base.get_formats2 = x11_surface_get_formats2;
wsi->base.get_present_modes = x11_surface_get_present_modes;
wsi->base.create_swapchain = x11_surface_create_swapchain;