The open source OpenXR runtime
0
fork

Configure Feed

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

ipc: Use xrt_swapchain_create_properties when using XINA

+18 -8
+18 -8
src/xrt/ipc/client/ipc_client_compositor.c
··· 362 362 const struct xrt_swapchain_create_info *info, 363 363 struct xrt_swapchain **out_xsc) 364 364 { 365 - struct xrt_image_native images[3]; 366 - uint32_t image_count = (uint32_t)ARRAY_SIZE(images); 365 + struct xrt_swapchain_create_properties xsccp = {0}; 366 + struct xrt_image_native *images = NULL; 367 367 xrt_result_t xret; 368 368 369 - if ((info->create & XRT_SWAPCHAIN_CREATE_STATIC_IMAGE) != 0) { 370 - image_count = 1; 369 + // Get any needed properties. 370 + xret = ipc_compositor_get_swapchain_create_properties(&icc->base.base, info, &xsccp); 371 + if (xret != XRT_SUCCESS) { 372 + // IPC error already reported. 373 + return xret; 371 374 } 372 375 373 - xret = xrt_images_allocate(xina, info, image_count, images); 376 + // Alloc the array of structs for the images. 377 + images = U_TYPED_ARRAY_CALLOC(struct xrt_image_native, xsccp.image_count); 378 + 379 + // Now allocate the images themselves 380 + xret = xrt_images_allocate(xina, info, xsccp.image_count, images); 374 381 if (xret != XRT_SUCCESS) { 375 - return xret; 382 + goto out_free; 376 383 } 377 384 378 385 /* 379 386 * The import function takes ownership of the handles, 380 387 * we do not need free them if the call succeeds. 381 388 */ 382 - xret = swapchain_server_import(icc, info, images, image_count, out_xsc); 389 + xret = swapchain_server_import(icc, info, images, xsccp.image_count, out_xsc); 383 390 if (xret != XRT_SUCCESS) { 384 - xrt_images_free(xina, image_count, images); 391 + xrt_images_free(xina, xsccp.image_count, images); 385 392 } 393 + 394 + out_free: 395 + free(images); 386 396 387 397 return xret; 388 398 }