The open source OpenXR runtime

t/sdl_test: Move system init earlier

+23 -6
+11 -6
src/xrt/targets/sdl_test/sdl_instance.c
··· 80 80 assert(*out_xso == NULL); 81 81 assert(out_xsysc == NULL || *out_xsysc == NULL); 82 82 83 - // Use system helper. 84 - struct u_system *usys = u_system_create(); 85 - assert(usys != NULL); // Should never fail. 86 - 87 83 struct sdl_program *sp = from_xinst(xinst); 88 84 89 - *out_xsys = &usys->base; 85 + *out_xsys = &sp->usys->base; 90 86 *out_xsysd = &sp->xsysd_base; 91 87 *out_xso = sp->xso; 92 88 ··· 99 95 sdl_compositor_create_system(sp, &xsysc); 100 96 101 97 // Tell the system about the system compositor. 102 - u_system_set_system_compositor(usys, xsysc); 98 + u_system_set_system_compositor(sp->usys, xsysc); 103 99 104 100 *out_xsysc = xsysc; 105 101 ··· 121 117 * Exported function(s). 122 118 * 123 119 */ 120 + 121 + void 122 + sdl_system_init(struct sdl_program *sp) 123 + { 124 + struct u_system *usys = u_system_create(); 125 + assert(usys != NULL); // Should never fail. 126 + 127 + sp->usys = usys; 128 + } 124 129 125 130 void 126 131 sdl_system_devices_init(struct sdl_program *sp)
+11
src/xrt/targets/sdl_test/sdl_internal.h
··· 119 119 //! Instance base. 120 120 struct xrt_instance xinst_base; 121 121 122 + //! System, implemented for now using helper code. 123 + struct u_system *usys; 124 + 122 125 //! System devices base. 123 126 struct xrt_system_devices xsysd_base; 124 127 ··· 351 354 * sdl_instance.c 352 355 * 353 356 */ 357 + 358 + /*! 359 + * Init the @ref xrt_system (and @ref u_system) struct. 360 + * 361 + * @ingroup sdl_test 362 + */ 363 + void 364 + sdl_system_init(struct sdl_program *sp); 354 365 355 366 /*! 356 367 * Init the @ref xrt_system_devices sub struct.
+1
src/xrt/targets/sdl_test/sdl_program.cpp
··· 90 90 91 91 // Init sub components. 92 92 sdl_instance_init(&spp); 93 + sdl_system_init(&spp); 93 94 sdl_device_init(&spp); 94 95 sdl_system_devices_init(&spp); 95 96 sdl_compositor_init(&spp); // Needs the window.