From a97b9a59909b40ad534d3b5ae2cd00c38b28f984 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Fri, 16 Jun 2023 16:49:57 -0500 Subject: [PATCH] st/oxr: Less obvious warning fixes Co-authored-by: Jakob Bornecrantz --- src/xrt/state_trackers/oxr/oxr_swapchain.c | 9 ++++++--- src/xrt/state_trackers/oxr/oxr_swapchain_vk.c | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/xrt/state_trackers/oxr/oxr_swapchain.c b/src/xrt/state_trackers/oxr/oxr_swapchain.c index 177efa11a..db90e7d65 100644 --- a/src/xrt/state_trackers/oxr/oxr_swapchain.c +++ b/src/xrt/state_trackers/oxr/oxr_swapchain.c @@ -220,8 +220,11 @@ oxr_swapchain_common_acquire(struct oxr_logger *log, struct oxr_swapchain *sc, u XrResult oxr_swapchain_common_wait(struct oxr_logger *log, struct oxr_swapchain *sc, XrDuration timeout) { - uint32_t index; - u_index_fifo_pop(&sc->acquired.fifo, &index); + uint32_t index = UINT32_MAX; + if (u_index_fifo_pop(&sc->acquired.fifo, &index) != 0) { + return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "u_index_fifo_pop: failed!"); + } + assert(index < INT32_MAX); struct xrt_swapchain *xsc = (struct xrt_swapchain *)sc->swapchain; @@ -230,7 +233,7 @@ oxr_swapchain_common_wait(struct oxr_logger *log, struct oxr_swapchain *sc, XrDu // The app can only wait on one image. sc->inflight.yes = true; - sc->inflight.index = index; + sc->inflight.index = (int)index; sc->images[index].state = OXR_IMAGE_STATE_WAITED; return XR_SUCCESS; diff --git a/src/xrt/state_trackers/oxr/oxr_swapchain_vk.c b/src/xrt/state_trackers/oxr/oxr_swapchain_vk.c index 363ceb785..ab276cdd1 100644 --- a/src/xrt/state_trackers/oxr/oxr_swapchain_vk.c +++ b/src/xrt/state_trackers/oxr/oxr_swapchain_vk.c @@ -14,6 +14,7 @@ #include "oxr_logger.h" #include "oxr_swapchain_common.h" #include "oxr_xret.h" +#include #define WAIT_IN_ACQUIRE (true) @@ -59,8 +60,11 @@ vk_implicit_wait_image(struct oxr_logger *log, struct oxr_swapchain *sc, const X { CHECK_OXR_RET(oxr_swapchain_verify_wait_state(log, sc)); - uint32_t index; - u_index_fifo_pop(&sc->acquired.fifo, &index); + uint32_t index = UINT32_MAX; + if (u_index_fifo_pop(&sc->acquired.fifo, &index) != 0) { + return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "u_index_fifo_pop: failed!"); + } + assert(index < INT32_MAX); struct xrt_swapchain *xsc = (struct xrt_swapchain *)sc->swapchain; @@ -74,7 +78,7 @@ vk_implicit_wait_image(struct oxr_logger *log, struct oxr_swapchain *sc, const X // The app can only wait on one image. sc->inflight.yes = true; - sc->inflight.index = index; + sc->inflight.index = (int)index; sc->images[index].state = OXR_IMAGE_STATE_WAITED; return XR_SUCCESS;