diff --git a/src/xrt/compositor/main/comp_renderer.c b/src/xrt/compositor/main/comp_renderer.c index 1ee67739e..f7fc707d5 100644 --- a/src/xrt/compositor/main/comp_renderer.c +++ b/src/xrt/compositor/main/comp_renderer.c @@ -167,6 +167,12 @@ comp_renderer_frame(struct comp_renderer *r, renderer_render(r); } +void +comp_renderer_frame_cached(struct comp_renderer *r) +{ + renderer_render(r); +} + void comp_renderer_destroy(struct comp_renderer *r) { @@ -606,6 +612,15 @@ _create_fences(struct comp_renderer *r) } } +static void +_set_dummy_images(struct comp_renderer *r) +{ + for (uint32_t i = 0; i < 2; i++) + comp_distortion_update_descriptor_set( + r->distortion, r->dummy_images[i].sampler, + r->dummy_images[i].views[0], i); +} + static void renderer_init(struct comp_renderer *r) { @@ -636,14 +651,18 @@ renderer_init(struct comp_renderer *r) r->c->xdev->hmd, r->descriptor_pool, r->settings->flip_y); - for (uint32_t i = 0; i < 2; i++) - comp_distortion_update_descriptor_set( - r->distortion, r->dummy_images[i].sampler, - r->dummy_images[i].views[0], i); + _set_dummy_images(r); renderer_build_command_buffers(r); } +void +comp_renderer_set_idle_images(struct comp_renderer *r) +{ + _set_dummy_images(r); + renderer_rebuild_command_buffers(r); +} + static void renderer_set_swapchain_image(struct comp_renderer *r, uint32_t eye, diff --git a/src/xrt/compositor/main/comp_renderer.h b/src/xrt/compositor/main/comp_renderer.h index d9c2210bd..17b806335 100644 --- a/src/xrt/compositor/main/comp_renderer.h +++ b/src/xrt/compositor/main/comp_renderer.h @@ -58,6 +58,21 @@ comp_renderer_reset(struct comp_renderer *r); void comp_renderer_destroy(struct comp_renderer *r); +/*! + * Set dummy images in renderer. + * + * @ingroup comp_main + */ +void +comp_renderer_set_idle_images(struct comp_renderer *r); + +/*! + * Render frame without setting new images. + * + * @ingroup comp_main + */ +void +comp_renderer_frame_cached(struct comp_renderer *r); #ifdef __cplusplus }