The open source OpenXR runtime
0
fork

Configure Feed

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

xrt: Add swapchain_[dec|inc]_image_count functions

authored by

Christoph Haag and committed by
Jakob Bornecrantz
cd37974c eace6e31

+39 -1
+39 -1
src/xrt/include/xrt/xrt_compositor.h
··· 411 411 uint32_t image_count; 412 412 413 413 /*! 414 - * Must have called release_image before calling this function. 414 + * @ref dec_image_use must have been called as often as @ref inc_image_use. 415 415 */ 416 416 void (*destroy)(struct xrt_swapchain *xsc); 417 417 ··· 430 430 * Call @ref xrt_swapchain_wait_image before writing to the image index output from this function. 431 431 */ 432 432 xrt_result_t (*acquire_image)(struct xrt_swapchain *xsc, uint32_t *out_index); 433 + 434 + /*! 435 + * @brief Increments the use counter of a swapchain image. 436 + */ 437 + xrt_result_t (*inc_image_use)(struct xrt_swapchain *xsc, uint32_t index); 438 + 439 + /*! 440 + * @brief Decrements the use counter of a swapchain image. 441 + * 442 + * @ref wait_image will return once the image use counter is 0. 443 + */ 444 + xrt_result_t (*dec_image_use)(struct xrt_swapchain *xsc, uint32_t index); 433 445 434 446 /*! 435 447 * Wait until image @p index is available for exclusive use, or until @p timeout_ns expires. ··· 502 514 xrt_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *out_index) 503 515 { 504 516 return xsc->acquire_image(xsc, out_index); 517 + } 518 + 519 + /*! 520 + * @copydoc xrt_swapchain::inc_image_use 521 + * 522 + * Helper for calling through the function pointer. 523 + * 524 + * @public @memberof xrt_swapchain 525 + */ 526 + static inline xrt_result_t 527 + xrt_swapchain_inc_image_use(struct xrt_swapchain *xsc, uint32_t index) 528 + { 529 + return xsc->inc_image_use(xsc, index); 530 + } 531 + 532 + /*! 533 + * @copydoc xrt_swapchain::dec_image_use 534 + * 535 + * Helper for calling through the function pointer. 536 + * 537 + * @public @memberof xrt_swapchain 538 + */ 539 + static inline xrt_result_t 540 + xrt_swapchain_dec_image_use(struct xrt_swapchain *xsc, uint32_t index) 541 + { 542 + return xsc->dec_image_use(xsc, index); 505 543 } 506 544 507 545 /*!