mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
st/oxr: Swapchain destroy was the same for all APIs
This commit is contained in:
parent
a56caf762e
commit
52f790289d
|
@ -173,6 +173,34 @@ release_image(struct oxr_logger *log, struct oxr_swapchain *sc, const XrSwapchai
|
|||
return oxr_session_success_result(sc->sess);
|
||||
}
|
||||
|
||||
static XrResult
|
||||
destroy(struct oxr_logger *log, struct oxr_swapchain *sc)
|
||||
{
|
||||
// Release any waited image.
|
||||
if (sc->waited.yes) {
|
||||
sc->release_image(log, sc, NULL);
|
||||
}
|
||||
|
||||
// Release any acquired images.
|
||||
XrSwapchainImageWaitInfo waitInfo = {0};
|
||||
while (!u_index_fifo_is_empty(&sc->acquired.fifo)) {
|
||||
sc->wait_image(log, sc, &waitInfo);
|
||||
sc->release_image(log, sc, NULL);
|
||||
}
|
||||
|
||||
// Drop our reference, does NULL checking.
|
||||
xrt_swapchain_reference(&sc->swapchain, NULL);
|
||||
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Handle function.
|
||||
*
|
||||
*/
|
||||
|
||||
static XrResult
|
||||
destroy_handle(struct oxr_logger *log, struct oxr_handle_base *hb)
|
||||
{
|
||||
|
@ -236,6 +264,7 @@ oxr_create_swapchain(struct oxr_logger *log,
|
|||
sc->acquire_image = acquire_image;
|
||||
sc->wait_image = wait_image;
|
||||
sc->release_image = release_image;
|
||||
sc->destroy = destroy;
|
||||
sc->is_static = (createInfo->createFlags & XR_SWAPCHAIN_CREATE_STATIC_IMAGE_BIT) != 0;
|
||||
|
||||
*out_swapchain = sc;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2019-2021, Collabora, Ltd.
|
||||
// Copyright 2019-2023, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
|
@ -18,27 +18,6 @@
|
|||
#include "oxr_logger.h"
|
||||
|
||||
|
||||
static XrResult
|
||||
oxr_swapchain_d3d11_destroy(struct oxr_logger *log, struct oxr_swapchain *sc)
|
||||
{
|
||||
// Release any waited image.
|
||||
if (sc->waited.yes) {
|
||||
sc->release_image(log, sc, NULL);
|
||||
}
|
||||
|
||||
// Release any acquired images.
|
||||
XrSwapchainImageWaitInfo waitInfo = {0};
|
||||
while (!u_index_fifo_is_empty(&sc->acquired.fifo)) {
|
||||
sc->wait_image(log, sc, &waitInfo);
|
||||
sc->release_image(log, sc, NULL);
|
||||
}
|
||||
|
||||
// Drop our reference, does NULL checking.
|
||||
xrt_swapchain_reference(&sc->swapchain, NULL);
|
||||
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
static XrResult
|
||||
oxr_swapchain_d3d11_enumerate_images(struct oxr_logger *log,
|
||||
struct oxr_swapchain *sc,
|
||||
|
@ -69,7 +48,7 @@ oxr_swapchain_d3d11_create(struct oxr_logger *log,
|
|||
return ret;
|
||||
}
|
||||
|
||||
sc->destroy = oxr_swapchain_d3d11_destroy;
|
||||
// Set our API specific function(s).
|
||||
sc->enumerate_images = oxr_swapchain_d3d11_enumerate_images;
|
||||
|
||||
*out_swapchain = sc;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2019-2022, Collabora, Ltd.
|
||||
// Copyright 2019-2023, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
|
@ -19,27 +19,6 @@
|
|||
#include "oxr_api_verify.h"
|
||||
|
||||
|
||||
static XrResult
|
||||
oxr_swapchain_d3d12_destroy(struct oxr_logger *log, struct oxr_swapchain *sc)
|
||||
{
|
||||
// Release any waited image.
|
||||
if (sc->waited.yes) {
|
||||
sc->release_image(log, sc, NULL);
|
||||
}
|
||||
|
||||
// Release any acquired images.
|
||||
XrSwapchainImageWaitInfo waitInfo = {0};
|
||||
while (!u_index_fifo_is_empty(&sc->acquired.fifo)) {
|
||||
sc->wait_image(log, sc, &waitInfo);
|
||||
sc->release_image(log, sc, NULL);
|
||||
}
|
||||
|
||||
// Drop our reference, does NULL checking.
|
||||
xrt_swapchain_reference(&sc->swapchain, NULL);
|
||||
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
static XrResult
|
||||
oxr_swapchain_d3d12_enumerate_images(struct oxr_logger *log,
|
||||
struct oxr_swapchain *sc,
|
||||
|
@ -77,7 +56,7 @@ oxr_swapchain_d3d12_create(struct oxr_logger *log,
|
|||
return ret;
|
||||
}
|
||||
|
||||
sc->destroy = oxr_swapchain_d3d12_destroy;
|
||||
// Set our API specific function(s).
|
||||
sc->enumerate_images = oxr_swapchain_d3d12_enumerate_images;
|
||||
|
||||
*out_swapchain = sc;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2019-2022, Collabora, Ltd.
|
||||
// Copyright 2019-2023, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
|
@ -19,26 +19,6 @@
|
|||
|
||||
#if defined(XR_USE_GRAPHICS_API_OPENGL) || defined(XR_USE_GRAPHICS_API_OPENGL_ES)
|
||||
|
||||
static XrResult
|
||||
oxr_swapchain_gl_destroy(struct oxr_logger *log, struct oxr_swapchain *sc)
|
||||
{
|
||||
// Release any waited image.
|
||||
if (sc->waited.yes) {
|
||||
sc->release_image(log, sc, NULL);
|
||||
}
|
||||
|
||||
// Release any acquired images.
|
||||
XrSwapchainImageWaitInfo waitInfo = {0};
|
||||
while (!u_index_fifo_is_empty(&sc->acquired.fifo)) {
|
||||
sc->wait_image(log, sc, &waitInfo);
|
||||
sc->release_image(log, sc, NULL);
|
||||
}
|
||||
|
||||
// Drop our reference, does NULL checking.
|
||||
xrt_swapchain_reference(&sc->swapchain, NULL);
|
||||
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
#if defined(XR_USE_GRAPHICS_API_OPENGL)
|
||||
static XrResult
|
||||
|
@ -113,7 +93,7 @@ oxr_swapchain_gl_create(struct oxr_logger *log,
|
|||
return ret;
|
||||
}
|
||||
|
||||
sc->destroy = oxr_swapchain_gl_destroy;
|
||||
// Set our API specific function(s).
|
||||
sc->enumerate_images = oxr_swapchain_gl_enumerate_images;
|
||||
|
||||
*out_swapchain = sc;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2019-2022, Collabora, Ltd.
|
||||
// Copyright 2019-2023, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
|
@ -16,27 +16,6 @@
|
|||
#include "oxr_logger.h"
|
||||
|
||||
|
||||
static XrResult
|
||||
oxr_swapchain_vk_destroy(struct oxr_logger *log, struct oxr_swapchain *sc)
|
||||
{
|
||||
// Release any waited image.
|
||||
if (sc->waited.yes) {
|
||||
sc->release_image(log, sc, NULL);
|
||||
}
|
||||
|
||||
// Release any acquired images.
|
||||
XrSwapchainImageWaitInfo waitInfo = {0};
|
||||
while (!u_index_fifo_is_empty(&sc->acquired.fifo)) {
|
||||
sc->wait_image(log, sc, &waitInfo);
|
||||
sc->release_image(log, sc, NULL);
|
||||
}
|
||||
|
||||
// Drop our reference, does NULL checking.
|
||||
xrt_swapchain_reference(&sc->swapchain, NULL);
|
||||
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
static XrResult
|
||||
oxr_swapchain_vk_enumerate_images(struct oxr_logger *log,
|
||||
struct oxr_swapchain *sc,
|
||||
|
@ -67,7 +46,7 @@ oxr_swapchain_vk_create(struct oxr_logger *log,
|
|||
return ret;
|
||||
}
|
||||
|
||||
sc->destroy = oxr_swapchain_vk_destroy;
|
||||
// Set our API specific function(s).
|
||||
sc->enumerate_images = oxr_swapchain_vk_enumerate_images;
|
||||
|
||||
*out_swapchain = sc;
|
||||
|
|
Loading…
Reference in a new issue