From 97939accdaa92d86facb8ff7c1a7e7891342af70 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz <jakob@collabora.com> Date: Fri, 28 Jun 2019 16:03:31 +0100 Subject: [PATCH] st/oxr: Slightly improve swapchain image status The current code is not up spec at all anyways, but this at least helps to avoid some bad situations in the current code. --- src/xrt/state_trackers/oxr/oxr_swapchain.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/xrt/state_trackers/oxr/oxr_swapchain.c b/src/xrt/state_trackers/oxr/oxr_swapchain.c index accd09718..e48c013ff 100644 --- a/src/xrt/state_trackers/oxr/oxr_swapchain.c +++ b/src/xrt/state_trackers/oxr/oxr_swapchain.c @@ -38,6 +38,13 @@ oxr_swapchain_acquire_image(struct oxr_logger *log, } sc->acquired_index = (int)index; + + // If the compositor is resuing the image, + // mark it as invalid to use in xrEndFrame. + if (sc->released_index == (int)index) { + sc->released_index = -1; + } + *out_index = index; return XR_SUCCESS; @@ -78,6 +85,8 @@ oxr_swapchain_release_image(struct oxr_logger *log, return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, " call to xsc->release_image failed"); } + + // Overwrite the old released image, with new. sc->released_index = sc->acquired_index; sc->acquired_index = -1;