OpenXR doesn't crash if lovr.draw errors;

renderTo is idempotent in openxr driver now.
This commit is contained in:
bjorn 2022-03-17 19:11:07 -07:00
parent 99a42c5c71
commit c35c2bb7eb
1 changed files with 7 additions and 0 deletions

View File

@ -142,6 +142,7 @@ static struct {
float clipNear;
float clipFar;
float offset;
bool hasImage;
XrActionSet actionSet;
XrAction actions[MAX_ACTIONS];
XrPath actionFilters[2];
@ -907,6 +908,11 @@ static void openxr_renderTo(void (*callback)(void*), void* userdata) {
XR(xrBeginFrame(state.session, &beginInfo));
if (state.frameState.shouldRender) {
if (state.hasImage) {
XR(xrReleaseSwapchainImage(state.swapchain, NULL));
}
state.hasImage = true;
XR(xrAcquireSwapchainImage(state.swapchain, NULL, &state.imageIndex));
XrSwapchainImageWaitInfo waitInfo = { XR_TYPE_SWAPCHAIN_IMAGE_WAIT_INFO, .timeout = 1e9 };
@ -941,6 +947,7 @@ static void openxr_renderTo(void (*callback)(void*), void* userdata) {
}
XR(xrReleaseSwapchainImage(state.swapchain, NULL));
state.hasImage = false;
}
XR(xrEndFrame(state.session, &endInfo));