The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

st/oxr: Swapchain destroy was the same for all APIs

+37 -91
+29
src/xrt/state_trackers/oxr/oxr_swapchain.c
··· 174 174 } 175 175 176 176 static XrResult 177 + destroy(struct oxr_logger *log, struct oxr_swapchain *sc) 178 + { 179 + // Release any waited image. 180 + if (sc->waited.yes) { 181 + sc->release_image(log, sc, NULL); 182 + } 183 + 184 + // Release any acquired images. 185 + XrSwapchainImageWaitInfo waitInfo = {0}; 186 + while (!u_index_fifo_is_empty(&sc->acquired.fifo)) { 187 + sc->wait_image(log, sc, &waitInfo); 188 + sc->release_image(log, sc, NULL); 189 + } 190 + 191 + // Drop our reference, does NULL checking. 192 + xrt_swapchain_reference(&sc->swapchain, NULL); 193 + 194 + return XR_SUCCESS; 195 + } 196 + 197 + 198 + /* 199 + * 200 + * Handle function. 201 + * 202 + */ 203 + 204 + static XrResult 177 205 destroy_handle(struct oxr_logger *log, struct oxr_handle_base *hb) 178 206 { 179 207 struct oxr_swapchain *sc = (struct oxr_swapchain *)hb; ··· 236 264 sc->acquire_image = acquire_image; 237 265 sc->wait_image = wait_image; 238 266 sc->release_image = release_image; 267 + sc->destroy = destroy; 239 268 sc->is_static = (createInfo->createFlags & XR_SWAPCHAIN_CREATE_STATIC_IMAGE_BIT) != 0; 240 269 241 270 *out_swapchain = sc;
+2 -23
src/xrt/state_trackers/oxr/oxr_swapchain_d3d11.c
··· 1 - // Copyright 2019-2021, Collabora, Ltd. 1 + // Copyright 2019-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 19 19 20 20 21 21 static XrResult 22 - oxr_swapchain_d3d11_destroy(struct oxr_logger *log, struct oxr_swapchain *sc) 23 - { 24 - // Release any waited image. 25 - if (sc->waited.yes) { 26 - sc->release_image(log, sc, NULL); 27 - } 28 - 29 - // Release any acquired images. 30 - XrSwapchainImageWaitInfo waitInfo = {0}; 31 - while (!u_index_fifo_is_empty(&sc->acquired.fifo)) { 32 - sc->wait_image(log, sc, &waitInfo); 33 - sc->release_image(log, sc, NULL); 34 - } 35 - 36 - // Drop our reference, does NULL checking. 37 - xrt_swapchain_reference(&sc->swapchain, NULL); 38 - 39 - return XR_SUCCESS; 40 - } 41 - 42 - static XrResult 43 22 oxr_swapchain_d3d11_enumerate_images(struct oxr_logger *log, 44 23 struct oxr_swapchain *sc, 45 24 uint32_t count, ··· 69 48 return ret; 70 49 } 71 50 72 - sc->destroy = oxr_swapchain_d3d11_destroy; 51 + // Set our API specific function(s). 73 52 sc->enumerate_images = oxr_swapchain_d3d11_enumerate_images; 74 53 75 54 *out_swapchain = sc;
+2 -23
src/xrt/state_trackers/oxr/oxr_swapchain_d3d12.c
··· 1 - // Copyright 2019-2022, Collabora, Ltd. 1 + // Copyright 2019-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 20 20 21 21 22 22 static XrResult 23 - oxr_swapchain_d3d12_destroy(struct oxr_logger *log, struct oxr_swapchain *sc) 24 - { 25 - // Release any waited image. 26 - if (sc->waited.yes) { 27 - sc->release_image(log, sc, NULL); 28 - } 29 - 30 - // Release any acquired images. 31 - XrSwapchainImageWaitInfo waitInfo = {0}; 32 - while (!u_index_fifo_is_empty(&sc->acquired.fifo)) { 33 - sc->wait_image(log, sc, &waitInfo); 34 - sc->release_image(log, sc, NULL); 35 - } 36 - 37 - // Drop our reference, does NULL checking. 38 - xrt_swapchain_reference(&sc->swapchain, NULL); 39 - 40 - return XR_SUCCESS; 41 - } 42 - 43 - static XrResult 44 23 oxr_swapchain_d3d12_enumerate_images(struct oxr_logger *log, 45 24 struct oxr_swapchain *sc, 46 25 uint32_t count, ··· 77 56 return ret; 78 57 } 79 58 80 - sc->destroy = oxr_swapchain_d3d12_destroy; 59 + // Set our API specific function(s). 81 60 sc->enumerate_images = oxr_swapchain_d3d12_enumerate_images; 82 61 83 62 *out_swapchain = sc;
+2 -22
src/xrt/state_trackers/oxr/oxr_swapchain_gl.c
··· 1 - // Copyright 2019-2022, Collabora, Ltd. 1 + // Copyright 2019-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 19 19 20 20 #if defined(XR_USE_GRAPHICS_API_OPENGL) || defined(XR_USE_GRAPHICS_API_OPENGL_ES) 21 21 22 - static XrResult 23 - oxr_swapchain_gl_destroy(struct oxr_logger *log, struct oxr_swapchain *sc) 24 - { 25 - // Release any waited image. 26 - if (sc->waited.yes) { 27 - sc->release_image(log, sc, NULL); 28 - } 29 - 30 - // Release any acquired images. 31 - XrSwapchainImageWaitInfo waitInfo = {0}; 32 - while (!u_index_fifo_is_empty(&sc->acquired.fifo)) { 33 - sc->wait_image(log, sc, &waitInfo); 34 - sc->release_image(log, sc, NULL); 35 - } 36 - 37 - // Drop our reference, does NULL checking. 38 - xrt_swapchain_reference(&sc->swapchain, NULL); 39 - 40 - return XR_SUCCESS; 41 - } 42 22 43 23 #if defined(XR_USE_GRAPHICS_API_OPENGL) 44 24 static XrResult ··· 113 93 return ret; 114 94 } 115 95 116 - sc->destroy = oxr_swapchain_gl_destroy; 96 + // Set our API specific function(s). 117 97 sc->enumerate_images = oxr_swapchain_gl_enumerate_images; 118 98 119 99 *out_swapchain = sc;
+2 -23
src/xrt/state_trackers/oxr/oxr_swapchain_vk.c
··· 1 - // Copyright 2019-2022, Collabora, Ltd. 1 + // Copyright 2019-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 17 17 18 18 19 19 static XrResult 20 - oxr_swapchain_vk_destroy(struct oxr_logger *log, struct oxr_swapchain *sc) 21 - { 22 - // Release any waited image. 23 - if (sc->waited.yes) { 24 - sc->release_image(log, sc, NULL); 25 - } 26 - 27 - // Release any acquired images. 28 - XrSwapchainImageWaitInfo waitInfo = {0}; 29 - while (!u_index_fifo_is_empty(&sc->acquired.fifo)) { 30 - sc->wait_image(log, sc, &waitInfo); 31 - sc->release_image(log, sc, NULL); 32 - } 33 - 34 - // Drop our reference, does NULL checking. 35 - xrt_swapchain_reference(&sc->swapchain, NULL); 36 - 37 - return XR_SUCCESS; 38 - } 39 - 40 - static XrResult 41 20 oxr_swapchain_vk_enumerate_images(struct oxr_logger *log, 42 21 struct oxr_swapchain *sc, 43 22 uint32_t count, ··· 67 46 return ret; 68 47 } 69 48 70 - sc->destroy = oxr_swapchain_vk_destroy; 49 + // Set our API specific function(s). 71 50 sc->enumerate_images = oxr_swapchain_vk_enumerate_images; 72 51 73 52 *out_swapchain = sc;