The open source OpenXR runtime
0
fork

Configure Feed

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

c/client: Refactor image barrier submission into a helper function

+35 -27
+35 -27
src/xrt/compositor/client/comp_vk_client.c
··· 43 43 44 44 /* 45 45 * 46 + * Transition helpers. 47 + * 48 + */ 49 + 50 + static xrt_result_t 51 + submit_image_barrier(struct client_vk_swapchain *sc, VkCommandBuffer cmd_buffer) 52 + { 53 + COMP_TRACE_MARKER(); 54 + 55 + struct client_vk_compositor *c = sc->c; 56 + struct vk_bundle *vk = &c->vk; 57 + VkResult ret; 58 + 59 + // Note we do not submit a fence here, it's not needed. 60 + ret = vk_cmd_pool_submit_cmd_buffer(vk, &c->pool, cmd_buffer); 61 + if (ret != VK_SUCCESS) { 62 + VK_ERROR(vk, "vk_cmd_pool_submit_cmd_buffer: %s %u", vk_result_string(ret), ret); 63 + return XRT_ERROR_FAILED_TO_SUBMIT_VULKAN_COMMANDS; 64 + } 65 + 66 + return XRT_SUCCESS; 67 + } 68 + 69 + 70 + /* 71 + * 46 72 * Semaphore helpers. 47 73 * 48 74 */ ··· 254 280 COMP_TRACE_MARKER(); 255 281 256 282 struct client_vk_swapchain *sc = client_vk_swapchain(xsc); 257 - struct client_vk_compositor *c = sc->c; 258 - struct vk_bundle *vk = &c->vk; 259 - 283 + xrt_result_t xret; 260 284 uint32_t index = 0; 261 285 262 286 // Pipe down call into native swapchain. 263 - xrt_result_t xret = xrt_swapchain_acquire_image(&sc->xscn->base, &index); 287 + xret = xrt_swapchain_acquire_image(&sc->xscn->base, &index); 264 288 if (xret != XRT_SUCCESS) { 265 289 return xret; 266 290 } 267 291 268 - VkResult ret; 269 - 270 - 271 - COMP_TRACE_IDENT(submit); 272 - 273 - // Note we do not submit a fence here, it's not needed. 274 - ret = vk_cmd_pool_submit_cmd_buffer(vk, &c->pool, sc->acquire[index]); 275 - if (ret != VK_SUCCESS) { 276 - VK_ERROR(vk, "Could not submit to queue: %d", ret); 277 - return XRT_ERROR_FAILED_TO_SUBMIT_VULKAN_COMMANDS; 292 + xret = submit_image_barrier(sc, sc->acquire[index]); 293 + if (xret != XRT_SUCCESS) { 294 + return xret; 278 295 } 279 296 280 297 // Finally done. ··· 306 323 COMP_TRACE_MARKER(); 307 324 308 325 struct client_vk_swapchain *sc = client_vk_swapchain(xsc); 309 - struct client_vk_compositor *c = sc->c; 310 - struct vk_bundle *vk = &c->vk; 326 + xrt_result_t xret; 311 327 312 - VkResult ret; 313 - 314 - { 315 - COMP_TRACE_IDENT(submit); 316 - 317 - // Note we do not submit a fence here, it's not needed. 318 - ret = vk_cmd_pool_submit_cmd_buffer(vk, &c->pool, sc->release[index]); 319 - if (ret != VK_SUCCESS) { 320 - VK_ERROR(vk, "Could not submit to queue: %d", ret); 321 - return XRT_ERROR_FAILED_TO_SUBMIT_VULKAN_COMMANDS; 322 - } 328 + xret = submit_image_barrier(sc, sc->release[index]); 329 + if (xret != XRT_SUCCESS) { 330 + return xret; 323 331 } 324 332 325 333 COMP_TRACE_IDENT(release_image);