···4040 is done with CPU work and ready to do GPU work.
4141* @ref xrt_comp_discard_frame - The frame is discarded.
4242* @ref xrt_comp_layer_begin - Called during transfers of layers.
4343-* @ref xrt_comp_layer_stereo_projection - This and other layer functions are
4343+* @ref xrt_comp_layer_projection - This and other layer functions are
4444 called to list the layers the compositor should render.
4545* @ref xrt_comp_layer_commit - The compositor starts to render the frame,
4646 trying to finish at the **present** time.
+2
src/xrt/auxiliary/util/u_device.c
···270270271271 if (alloc_hmd) {
272272 xdev->hmd = (struct xrt_hmd_parts *)(ptr + offset_hmd);
273273+ // set default view count
274274+ xdev->hmd->view_count = 2;
273275 }
274276275277 if (alloc_tracking) {
···6565 *
6666 * How many are actually used depends on the value of @p data.type
6767 */
6868- struct xrt_swapchain *xscs[4];
6868+ struct xrt_swapchain *xscs[2 * XRT_MAX_VIEWS];
69697070 /*!
7171 * All basic (trivially-serializable) data associated with a layer,
+11-10
src/xrt/compositor/multi/comp_multi_system.c
···5252do_projection_layer(struct xrt_compositor *xc, struct multi_compositor *mc, struct multi_layer_entry *layer, uint32_t i)
5353{
5454 struct xrt_device *xdev = layer->xdev;
5555- struct xrt_swapchain *l_xcs = layer->xscs[0];
5656- struct xrt_swapchain *r_xcs = layer->xscs[1];
5555+5656+ // Cast away
5757+ struct xrt_layer_data *data = (struct xrt_layer_data *)&layer->data;
57585858- if (l_xcs == NULL || r_xcs == NULL) {
5959- U_LOG_E("Invalid swap chain for projection layer #%u!", i);
6060- return;
5959+ // Do not need to copy the reference, but should verify the pointers for consistency
6060+ for (uint32_t j = 0; j < data->proj.view_count; j++) {
6161+ if (layer->xscs[j] == NULL) {
6262+ U_LOG_E("Invalid swap chain for projection layer #%u!", i);
6363+ return;
6464+ }
6165 }
62666367 if (xdev == NULL) {
···6569 return;
6670 }
67716868- // Cast away
6969- struct xrt_layer_data *data = (struct xrt_layer_data *)&layer->data;
7070-7171- xrt_comp_layer_stereo_projection(xc, xdev, l_xcs, r_xcs, data);
7272+ xrt_comp_layer_projection(xc, xdev, layer->xscs, data);
7273}
73747475static void
···282283 struct multi_layer_entry *layer = &mc->delivered.layers[i];
283284284285 switch (layer->data.type) {
285285- case XRT_LAYER_STEREO_PROJECTION: do_projection_layer(xc, mc, layer, i); break;
286286+ case XRT_LAYER_PROJECTION: do_projection_layer(xc, mc, layer, i); break;
286287 case XRT_LAYER_STEREO_PROJECTION_DEPTH: do_projection_layer_depth(xc, mc, layer, i); break;
287288 case XRT_LAYER_QUAD: do_quad_layer(xc, mc, layer, i); break;
288289 case XRT_LAYER_CUBE: do_cube_layer(xc, mc, layer, i); break;
···3333 *
3434 * Unused elements should be set to null.
3535 */
3636- struct comp_swapchain *sc_array[4];
3636+ struct comp_swapchain *sc_array[XRT_MAX_VIEWS * 2];
37373838 /*!
3939 * All basic (trivially-serializable) data associated with a layer.
···6262 bool one_projection_layer_fast_path;
63636464 //! fov as reported by device for the current submit.
6565- struct xrt_fov fovs[2];
6565+ struct xrt_fov fovs[XRT_MAX_VIEWS];
6666 //! absolute pose as reported by device for the current submit.
6767- struct xrt_pose poses[2];
6767+ struct xrt_pose poses[XRT_MAX_VIEWS];
6868};
69697070/*!
+1-2
src/xrt/compositor/util/comp_render.h
···102102 */
103103struct comp_render_dispatch_data
104104{
105105- struct comp_render_view_data views[2];
105105+ struct comp_render_view_data views[XRT_MAX_VIEWS];
106106107107 //! The number of views currently in this dispatch data.
108108 uint32_t view_count;
···324324 * layers should it not be possible to do a fast_path. Will insert barriers to
325325 * change the scratch images and target images to the needed layout.
326326 *
327327- * Currently limited to exactly two views.
328327 *
329328 * Expected layouts:
330329 * * Layer images: VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
···7575 */
7676enum xrt_layer_type
7777{
7878- XRT_LAYER_STEREO_PROJECTION,
7878+ XRT_LAYER_PROJECTION,
7979 XRT_LAYER_STEREO_PROJECTION_DEPTH,
8080 XRT_LAYER_QUAD,
8181 XRT_LAYER_CUBE,
···228228 * The @ref xrt_swapchain references and @ref xrt_device are provided outside of
229229 * this struct.
230230 */
231231-struct xrt_layer_stereo_projection_data
231231+struct xrt_layer_projection_data
232232{
233233- struct xrt_layer_projection_view_data l, r;
233233+ uint32_t view_count;
234234+ struct xrt_layer_projection_view_data v[XRT_MAX_VIEWS];
234235};
235236236237/*!
···458459 * xrt_compositor::layer_commit where this data was passed.
459460 */
460461 union {
461461- struct xrt_layer_stereo_projection_data stereo;
462462+ struct xrt_layer_projection_data proj;
462463 struct xrt_layer_stereo_projection_depth_data stereo_depth;
463464 struct xrt_layer_quad_data quad;
464465 struct xrt_layer_cube_data cube;
···12041205 *
12051206 * @param xc Self pointer
12061207 * @param xdev The device the layer is relative to.
12071207- * @param l_xsc Swapchain object containing left eye RGB data.
12081208- * @param r_xsc Swapchain object containing right eye RGB data.
12081208+ * @param xsc Swapchain object containing eye RGB data.
12091209 * @param data All of the pure data bits (not pointers/handles),
12101210 * including what parts of the supplied swapchain
12111211 * objects to use for each view.
12121212 */
12131213- xrt_result_t (*layer_stereo_projection)(struct xrt_compositor *xc,
12141214- struct xrt_device *xdev,
12151215- struct xrt_swapchain *l_xsc,
12161216- struct xrt_swapchain *r_xsc,
12171217- const struct xrt_layer_data *data);
12131213+ xrt_result_t (*layer_projection)(struct xrt_compositor *xc,
12141214+ struct xrt_device *xdev,
12151215+ struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
12161216+ const struct xrt_layer_data *data);
1218121712191218 /*!
12201219 * @brief Adds a stereo projection layer for submission, has depth information.
···16801679}
1681168016821681/*!
16831683- * @copydoc xrt_compositor::layer_stereo_projection
16821682+ * @copydoc xrt_compositor::layer_projection
16841683 *
16851684 * Helper for calling through the function pointer.
16861685 *
16871686 * @public @memberof xrt_compositor
16881687 */
16891688static inline xrt_result_t
16901690-xrt_comp_layer_stereo_projection(struct xrt_compositor *xc,
16911691- struct xrt_device *xdev,
16921692- struct xrt_swapchain *l_xsc,
16931693- struct xrt_swapchain *r_xsc,
16941694- const struct xrt_layer_data *data)
16891689+xrt_comp_layer_projection(struct xrt_compositor *xc,
16901690+ struct xrt_device *xdev,
16911691+ struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
16921692+ const struct xrt_layer_data *data)
16951693{
16961696- return xc->layer_stereo_projection(xc, xdev, l_xsc, r_xsc, data);
16941694+ return xc->layer_projection(xc, xdev, xsc, data);
16971695}
1698169616991697/*!
···22852283 uint32_t width_pixels;
22862284 uint32_t height_pixels;
22872285 uint32_t sample_count;
22882288- } max; //!< Maximums for this view.
22892289- } views[2]; //!< View configuration information.
22862286+ } max; //!< Maximums for this view.
22872287+ } views[XRT_MAX_VIEWS]; //!< View configuration information.
2290228822912289 //! Maximum number of composition layers supported, never changes.
22922290 uint32_t max_layers;
+7-5
src/xrt/include/xrt/xrt_device.h
···13131414#include "xrt/xrt_defines.h"
1515#include "xrt/xrt_visibility_mask.h"
1616-1616+#include "xrt/xrt_limits.h"
17171818#ifdef __cplusplus
1919extern "C" {
···107107 *
108108 * For now hardcoded display to two.
109109 */
110110- struct xrt_view views[2];
110110+ struct xrt_view views[XRT_MAX_VIEWS];
111111112112+ size_t view_count;
112113 /*!
113114 * Array of supported blend modes.
114115 */
···139140 //! Indices, for triangle strip.
140141 int *indices;
141142 //! Number of indices for the triangle strips (one per view).
142142- uint32_t index_counts[2];
143143+ uint32_t index_counts[XRT_MAX_VIEWS];
143144 //! Offsets for the indices (one offset per view).
144144- uint32_t index_offsets[2];
145145+ uint32_t index_offsets[XRT_MAX_VIEWS];
145146 //! Total number of elements in mesh::indices array.
146147 uint32_t index_count_total;
147148 } mesh;
148149149150 //! distortion is subject to the field of view
150150- struct xrt_fov fov[2];
151151+ struct xrt_fov fov[XRT_MAX_VIEWS];
151152 } distortion;
152153};
153154···407408 struct xrt_space_relation *out_head_relation,
408409 struct xrt_fov *out_fovs,
409410 struct xrt_pose *out_poses);
411411+410412 /**
411413 * Compute the distortion at a single point.
412414 *
+4
src/xrt/include/xrt/xrt_limits.h
···1616 * @addtogroup xrt_iface
1717 * @{
1818 */
1919+/*
2020+ * Max number of views supported by a compositor, artificial limit.
2121+ */
2222+#define XRT_MAX_VIEWS 2
19232024/*!
2125 * Maximum number of handles sent in one call.