The open source OpenXR runtime
0
fork

Configure Feed

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

u/system_helpers: Make system devices easier to embed

+24 -9
+14 -9
src/xrt/auxiliary/util/u_system_helpers.c
··· 26 26 static void 27 27 destroy(struct xrt_system_devices *xsysd) 28 28 { 29 - struct u_system_devices *usysd = u_system_devices(xsysd); 30 - 31 - for (uint32_t i = 0; i < ARRAY_SIZE(usysd->base.xdevs); i++) { 32 - xrt_device_destroy(&usysd->base.xdevs[i]); 33 - } 34 - 35 - xrt_frame_context_destroy_nodes(&usysd->xfctx); 36 - 37 - free(usysd); 29 + u_system_devices_close(xsysd); 30 + free(xsysd); 38 31 } 39 32 40 33 ··· 51 44 usysd->base.destroy = destroy; 52 45 53 46 return usysd; 47 + } 48 + 49 + void 50 + u_system_devices_close(struct xrt_system_devices *xsysd) 51 + { 52 + struct u_system_devices *usysd = u_system_devices(xsysd); 53 + 54 + for (uint32_t i = 0; i < ARRAY_SIZE(usysd->base.xdevs); i++) { 55 + xrt_device_destroy(&usysd->base.xdevs[i]); 56 + } 57 + 58 + xrt_frame_context_destroy_nodes(&usysd->xfctx); 54 59 } 55 60 56 61 xrt_result_t
+10
src/xrt/auxiliary/util/u_system_helpers.h
··· 62 62 u_system_devices_allocate(void); 63 63 64 64 /*! 65 + * Destroys all devices and clears out the frame context, doesn't free the 66 + * struct itself, useful for code embedding the system devices struct into 67 + * other objects where it's not the first member or C++ classes. 68 + * 69 + * @ingroup aux_util 70 + */ 71 + void 72 + u_system_devices_close(struct xrt_system_devices *xsysd); 73 + 74 + /*! 65 75 * Takes a @ref xrt_instance, gets the prober from it and then uses the prober 66 76 * to allocate a filled in @ref u_system_devices. 67 77 *