st/oxr: Frame end uses the most recently released image

This commit is contained in:
Benjamin Saunders 2019-04-30 08:33:56 -07:00
parent f6b8cb25b8
commit b6f2013bc5
7 changed files with 14 additions and 11 deletions

View file

@ -127,7 +127,7 @@ static void
client_gl_compositor_end_frame(struct xrt_compositor *xc,
enum xrt_blend_mode blend_mode,
struct xrt_swapchain **xscs,
uint32_t *acquired_index,
uint32_t *image_index,
uint32_t num_swapchains)
{
struct client_gl_compositor *c = client_gl_compositor(xc);
@ -145,7 +145,7 @@ client_gl_compositor_end_frame(struct xrt_compositor *xc,
// Pipe down call into fd compositor.
c->xcfd->base.end_frame(&c->xcfd->base, blend_mode, internal,
acquired_index, num_swapchains);
image_index, num_swapchains);
}
static int64_t

View file

@ -147,7 +147,7 @@ static void
client_vk_compositor_end_frame(struct xrt_compositor *xc,
enum xrt_blend_mode blend_mode,
struct xrt_swapchain **xscs,
uint32_t *acquired_index,
uint32_t *image_index,
uint32_t num_swapchains)
{
struct client_vk_compositor *c = client_vk_compositor(xc);
@ -165,7 +165,7 @@ client_vk_compositor_end_frame(struct xrt_compositor *xc,
// Pipe down call into fd compositor.
c->xcfd->base.end_frame(&c->xcfd->base, blend_mode, internal,
acquired_index, num_swapchains);
image_index, num_swapchains);
}
static struct xrt_swapchain *

View file

@ -109,7 +109,7 @@ static void
compositor_end_frame(struct xrt_compositor *xc,
enum xrt_blend_mode blend_mode,
struct xrt_swapchain **xscs,
uint32_t *acquired_index,
uint32_t *image_index,
uint32_t num_swapchains)
{
struct comp_compositor *c = comp_compositor(xc);
@ -120,8 +120,8 @@ compositor_end_frame(struct xrt_compositor *xc,
// Stereo!
if (num_swapchains == 2) {
left = &comp_swapchain(xscs[0])->images[acquired_index[0]];
right = &comp_swapchain(xscs[1])->images[acquired_index[1]];
left = &comp_swapchain(xscs[0])->images[image_index[0]];
right = &comp_swapchain(xscs[1])->images[image_index[1]];
comp_renderer_frame(c->r, left, right);
} else {
COMP_ERROR(c, "non-stereo rendering not supported");

View file

@ -185,7 +185,7 @@ struct xrt_compositor
void (*end_frame)(struct xrt_compositor *xc,
enum xrt_blend_mode blend_mode,
struct xrt_swapchain **xscs,
uint32_t *acquired_index,
uint32_t *image_index,
uint32_t num_swapchains);
/*!

View file

@ -679,6 +679,7 @@ struct oxr_swapchain
//! Actual state tracked! :D
int acquired_index;
int released_index;
XrResult (*destroy)(struct oxr_logger *, struct oxr_swapchain *);

View file

@ -463,7 +463,7 @@ oxr_session_frame_end(struct oxr_logger *log,
*/
struct xrt_swapchain *chains[2];
uint32_t acquired_index[2];
uint32_t image_index[2];
uint32_t num_chains = ARRAY_SIZE(chains);
for (uint32_t i = 0; i < num_chains; i++) {
@ -471,10 +471,10 @@ oxr_session_frame_end(struct oxr_logger *log,
struct oxr_swapchain *sc =
(struct oxr_swapchain *)proj->views[i].subImage.swapchain;
chains[i] = sc->swapchain;
acquired_index[i] = proj->views[i].subImage.imageArrayIndex;
image_index[i] = sc->released_index;
}
xc->end_frame(xc, blend_mode, chains, acquired_index, num_chains);
xc->end_frame(xc, blend_mode, chains, image_index, num_chains);
sess->frame_started = false;

View file

@ -78,6 +78,7 @@ oxr_swapchain_release_image(struct oxr_logger *log,
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
" call to xsc->release_image failed");
}
sc->released_index = sc->acquired_index;
sc->acquired_index = -1;
return XR_SUCCESS;
@ -119,6 +120,7 @@ oxr_create_swapchain(struct oxr_logger *log,
sc->wait_image = oxr_swapchain_wait_image;
sc->release_image = oxr_swapchain_release_image;
sc->acquired_index = -1;
sc->released_index = -1;
*out_swapchain = sc;