The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

comp: Return proper errors for Vulkan xrCreateSwapchain

authored by

Christoph Haag and committed by
Jakob Bornecrantz
b23f04fe b64b6f75

+20 -3
+3 -3
src/xrt/compositor/main/comp_compositor.c
··· 1315 1315 return c->r != NULL; 1316 1316 } 1317 1317 1318 - static bool 1319 - is_format_supported(struct comp_compositor *c, VkFormat format) 1318 + bool 1319 + comp_is_format_supported(struct comp_compositor *c, VkFormat format) 1320 1320 { 1321 1321 VkFormatProperties prop; 1322 1322 c->vk.vkGetPhysicalDeviceFormatProperties(c->vk.physical_device, format, &prop); ··· 1328 1328 1329 1329 #define ADD_IF_SUPPORTED(format) \ 1330 1330 do { \ 1331 - if (is_format_supported(c, format)) { \ 1331 + if (comp_is_format_supported(c, format)) { \ 1332 1332 info->formats[formats++] = format; \ 1333 1333 } \ 1334 1334 } while (false)
+6
src/xrt/compositor/main/comp_compositor.h
··· 253 253 */ 254 254 255 255 /*! 256 + * Check if the compositor can create swapchains with this format. 257 + */ 258 + bool 259 + comp_is_format_supported(struct comp_compositor *c, VkFormat format); 260 + 261 + /*! 256 262 * Convenience function to convert a xrt_swapchain to a comp_swapchain. 257 263 * 258 264 * @private @memberof comp_swapchain
+11
src/xrt/compositor/main/comp_swapchain.c
··· 285 285 uint32_t num_images = 3; 286 286 VkResult ret; 287 287 288 + if (!comp_is_format_supported(c, info->format)) { 289 + return XRT_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED; 290 + } 291 + 288 292 if ((info->create & XRT_SWAPCHAIN_CREATE_PROTECTED_CONTENT) != 0) { 289 293 // This compositor doesn't support creating protected content 290 294 // swapchains. ··· 301 305 302 306 // Use the image helper to allocate the images. 303 307 ret = vk_ic_allocate(&c->vk, info, num_images, &sc->vkic); 308 + if (ret == VK_ERROR_FEATURE_NOT_PRESENT) { 309 + free(sc); 310 + return XRT_ERROR_SWAPCHAIN_FLAG_VALID_BUT_UNSUPPORTED; 311 + } else if (ret == VK_ERROR_FORMAT_NOT_SUPPORTED) { 312 + free(sc); 313 + return XRT_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED; 314 + } 304 315 if (ret != VK_SUCCESS) { 305 316 free(sc); 306 317 return XRT_ERROR_VULKAN;