mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-30 18:38:32 +00:00
xrt: Introduce xrt_sub_image and xrt_layer_projection_view_data
This commit is contained in:
parent
259bd52dbd
commit
45c977d199
src/xrt
compositor/main
include/xrt
ipc
state_trackers/oxr
|
@ -356,22 +356,25 @@ compositor_layer_commit(struct xrt_compositor *xc)
|
|||
case XRT_LAYER_QUAD: {
|
||||
struct xrt_layer_quad_data *quad = &layer->data.quad;
|
||||
struct comp_swapchain_image *image;
|
||||
image = &layer->scs[0]->images[quad->image_index];
|
||||
image = &layer->scs[0]->images[quad->sub.image_index];
|
||||
comp_renderer_set_quad_layer(c->r, image, &quad->pose,
|
||||
&quad->size, data->flip_y,
|
||||
i, quad->array_index);
|
||||
i, quad->sub.array_index);
|
||||
} break;
|
||||
case XRT_LAYER_STEREO_PROJECTION: {
|
||||
struct xrt_layer_stereo_projection_data *stereo =
|
||||
&data->stereo;
|
||||
struct comp_swapchain_image *right;
|
||||
struct comp_swapchain_image *left;
|
||||
left = &layer->scs[0]->images[stereo->l.image_index];
|
||||
right = &layer->scs[1]->images[stereo->r.image_index];
|
||||
left =
|
||||
&layer->scs[0]->images[stereo->l.sub.image_index];
|
||||
right =
|
||||
&layer->scs[1]->images[stereo->r.sub.image_index];
|
||||
|
||||
comp_renderer_set_projection_layer(
|
||||
c->r, left, right, data->flip_y, i,
|
||||
stereo->l.array_index, stereo->r.array_index);
|
||||
stereo->l.sub.array_index,
|
||||
stereo->r.sub.array_index);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,6 +106,18 @@ enum xrt_layer_eye_visibility
|
|||
XRT_LAYER_EYE_VISIBILITY_BOTH = 0x3,
|
||||
};
|
||||
|
||||
/*!
|
||||
* Specifies a sub-image in a layer.
|
||||
*
|
||||
* @ingroup xrt_iface
|
||||
*/
|
||||
struct xrt_sub_image
|
||||
{
|
||||
uint32_t image_index;
|
||||
uint32_t array_index;
|
||||
struct xrt_rect rect;
|
||||
};
|
||||
|
||||
/*!
|
||||
* All the pure data bits of a quad layer, the @ref xrt_swapchains and
|
||||
* @ref xrt_device are provided outside of this struct.
|
||||
|
@ -116,14 +128,25 @@ struct xrt_layer_quad_data
|
|||
{
|
||||
enum xrt_layer_eye_visibility visibility;
|
||||
|
||||
uint32_t image_index;
|
||||
uint32_t array_index;
|
||||
struct xrt_sub_image sub;
|
||||
|
||||
struct xrt_rect rect;
|
||||
struct xrt_pose pose;
|
||||
struct xrt_vec2 size;
|
||||
};
|
||||
|
||||
/*!
|
||||
* All of the pure data bits for a single view in a projection layer.
|
||||
*
|
||||
* @ingroup xrt_iface
|
||||
*/
|
||||
struct xrt_layer_projection_view_data
|
||||
{
|
||||
struct xrt_sub_image sub;
|
||||
|
||||
struct xrt_fov fov;
|
||||
struct xrt_pose pose;
|
||||
};
|
||||
|
||||
/*!
|
||||
* All the pure data bits of a stereo projection layer, the @ref xrt_swapchains
|
||||
* and @ref xrt_device are provided outside of this struct.
|
||||
|
@ -132,15 +155,7 @@ struct xrt_layer_quad_data
|
|||
*/
|
||||
struct xrt_layer_stereo_projection_data
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32_t image_index;
|
||||
uint32_t array_index;
|
||||
|
||||
struct xrt_rect rect;
|
||||
struct xrt_fov fov;
|
||||
struct xrt_pose pose;
|
||||
} l, r;
|
||||
struct xrt_layer_projection_view_data l, r;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
|
@ -115,22 +115,22 @@ ipc_handle_compositor_layer_sync(volatile struct ipc_client_state *cs,
|
|||
case XRT_LAYER_STEREO_PROJECTION:
|
||||
rl->stereo.l.swapchain_index = sl->swapchain_ids[0];
|
||||
rl->stereo.l.image_index =
|
||||
sl->data.stereo.l.image_index;
|
||||
sl->data.stereo.l.sub.image_index;
|
||||
rl->stereo.r.swapchain_index = sl->swapchain_ids[1];
|
||||
rl->stereo.r.image_index =
|
||||
sl->data.stereo.r.image_index;
|
||||
sl->data.stereo.r.sub.image_index;
|
||||
rl->stereo.l.array_index =
|
||||
sl->data.stereo.l.array_index;
|
||||
sl->data.stereo.l.sub.array_index;
|
||||
rl->stereo.r.array_index =
|
||||
sl->data.stereo.r.array_index;
|
||||
sl->data.stereo.r.sub.array_index;
|
||||
|
||||
break;
|
||||
case XRT_LAYER_QUAD:
|
||||
rl->quad.swapchain_index = sl->swapchain_ids[0];
|
||||
rl->quad.image_index = sl->data.quad.image_index;
|
||||
rl->quad.image_index = sl->data.quad.sub.image_index;
|
||||
rl->quad.pose = sl->data.quad.pose;
|
||||
rl->quad.size = sl->data.quad.size;
|
||||
rl->quad.array_index = sl->data.quad.array_index;
|
||||
rl->quad.array_index = sl->data.quad.sub.array_index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -791,9 +791,9 @@ submit_quad_layer(struct xrt_compositor *xc,
|
|||
struct xrt_rect *rect = (struct xrt_rect *)&quad->subImage.imageRect;
|
||||
|
||||
data.quad.visibility = convert_eye_visibility(quad->eyeVisibility);
|
||||
data.quad.image_index = sc->released.index;
|
||||
data.quad.array_index = quad->subImage.imageArrayIndex;
|
||||
data.quad.rect = *rect;
|
||||
data.quad.sub.image_index = sc->released.index;
|
||||
data.quad.sub.array_index = quad->subImage.imageArrayIndex;
|
||||
data.quad.sub.rect = *rect;
|
||||
data.quad.pose = pose;
|
||||
data.quad.size = *size;
|
||||
|
||||
|
@ -841,15 +841,15 @@ submit_projection_layer(struct xrt_compositor *xc,
|
|||
data.timestamp = timestamp;
|
||||
data.flags = flags;
|
||||
|
||||
data.stereo.l.image_index = scs[0]->released.index;
|
||||
data.stereo.l.array_index = proj->views[0].subImage.imageArrayIndex;
|
||||
data.stereo.l.rect = *l_rect;
|
||||
data.stereo.l.sub.image_index = scs[0]->released.index;
|
||||
data.stereo.l.sub.array_index = proj->views[0].subImage.imageArrayIndex;
|
||||
data.stereo.l.sub.rect = *l_rect;
|
||||
data.stereo.l.fov = *l_fov;
|
||||
data.stereo.l.pose = pose[0];
|
||||
|
||||
data.stereo.r.image_index = scs[1]->released.index;
|
||||
data.stereo.r.array_index = proj->views[1].subImage.imageArrayIndex;
|
||||
data.stereo.r.rect = *r_rect;
|
||||
data.stereo.r.sub.image_index = scs[1]->released.index;
|
||||
data.stereo.r.sub.array_index = proj->views[1].subImage.imageArrayIndex;
|
||||
data.stereo.r.sub.rect = *r_rect;
|
||||
data.stereo.r.fov = *r_fov;
|
||||
data.stereo.r.pose = pose[1];
|
||||
|
||||
|
|
Loading…
Reference in a new issue