mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-02-17 19:20:13 +00:00
st/oxr: Enforce static swapchain acquire semantics
This commit is contained in:
parent
cdfd03a762
commit
d693bc2ef9
3
doc/changes/state_trackers/mr.359.6.md
Normal file
3
doc/changes/state_trackers/mr.359.6.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
OpenXR: Enforce that static swapchains can only be acquired once, this is
|
||||||
|
required by the spec and make sure that a image is only rendered to once, and
|
||||||
|
allows the runtime to perform special optimizations on the image.
|
|
@ -1332,6 +1332,8 @@ struct oxr_swapchain
|
||||||
int index;
|
int index;
|
||||||
} released;
|
} released;
|
||||||
|
|
||||||
|
// Is this a static swapchain, needed for acquire semantics.
|
||||||
|
bool is_static;
|
||||||
|
|
||||||
|
|
||||||
XrResult (*destroy)(struct oxr_logger *, struct oxr_swapchain *);
|
XrResult (*destroy)(struct oxr_logger *, struct oxr_swapchain *);
|
||||||
|
|
|
@ -31,6 +31,11 @@ oxr_swapchain_acquire_image(struct oxr_logger *log,
|
||||||
" all images have been acquired");
|
" all images have been acquired");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sc->is_static && (sc->released.yes || sc->waited.yes)) {
|
||||||
|
return oxr_error(log, XR_ERROR_CALL_ORDER_INVALID,
|
||||||
|
"Can only acquire once on a static swapchain");
|
||||||
|
}
|
||||||
|
|
||||||
struct xrt_swapchain *xsc = (struct xrt_swapchain *)sc->swapchain;
|
struct xrt_swapchain *xsc = (struct xrt_swapchain *)sc->swapchain;
|
||||||
if (!xsc->acquire_image(xsc, &index)) {
|
if (!xsc->acquire_image(xsc, &index)) {
|
||||||
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
|
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
|
||||||
|
@ -198,6 +203,8 @@ oxr_create_swapchain(struct oxr_logger *log,
|
||||||
sc->acquire_image = oxr_swapchain_acquire_image;
|
sc->acquire_image = oxr_swapchain_acquire_image;
|
||||||
sc->wait_image = oxr_swapchain_wait_image;
|
sc->wait_image = oxr_swapchain_wait_image;
|
||||||
sc->release_image = oxr_swapchain_release_image;
|
sc->release_image = oxr_swapchain_release_image;
|
||||||
|
sc->is_static = (createInfo->createFlags &
|
||||||
|
XR_SWAPCHAIN_CREATE_STATIC_IMAGE_BIT) != 0;
|
||||||
|
|
||||||
*out_swapchain = sc;
|
*out_swapchain = sc;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue