mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-06 07:06:10 +00:00
xrt: Move layer enum to xrt namespace.
This commit is contained in:
parent
435f6c5c89
commit
b1d39e7f07
|
@ -328,7 +328,7 @@ compositor_layer_stereo_projection(struct xrt_compositor *xc,
|
||||||
|
|
||||||
layer->flags = layer_flags;
|
layer->flags = layer_flags;
|
||||||
layer->flip_y = flip_y;
|
layer->flip_y = flip_y;
|
||||||
layer->type = COMP_LAYER_STEREO_PROJECTION;
|
layer->type = XRT_LAYER_STEREO_PROJECTION;
|
||||||
|
|
||||||
c->slots[slot_id].num_layers++;
|
c->slots[slot_id].num_layers++;
|
||||||
return XRT_SUCCESS;
|
return XRT_SUCCESS;
|
||||||
|
@ -366,7 +366,7 @@ compositor_layer_quad(struct xrt_compositor *xc,
|
||||||
|
|
||||||
layer->flags = layer_flags;
|
layer->flags = layer_flags;
|
||||||
layer->flip_y = flip_y;
|
layer->flip_y = flip_y;
|
||||||
layer->type = COMP_LAYER_QUAD;
|
layer->type = XRT_LAYER_QUAD;
|
||||||
|
|
||||||
c->slots[slot_id].num_layers++;
|
c->slots[slot_id].num_layers++;
|
||||||
return XRT_SUCCESS;
|
return XRT_SUCCESS;
|
||||||
|
@ -389,7 +389,7 @@ compositor_layer_commit(struct xrt_compositor *xc)
|
||||||
for (uint32_t i = 0; i < num_layers; i++) {
|
for (uint32_t i = 0; i < num_layers; i++) {
|
||||||
struct comp_layer *layer = &c->slots[slot_id].layers[i];
|
struct comp_layer *layer = &c->slots[slot_id].layers[i];
|
||||||
switch (layer->type) {
|
switch (layer->type) {
|
||||||
case COMP_LAYER_QUAD: {
|
case XRT_LAYER_QUAD: {
|
||||||
struct comp_layer_quad *quad = &layer->quad;
|
struct comp_layer_quad *quad = &layer->quad;
|
||||||
struct comp_swapchain_image *image;
|
struct comp_swapchain_image *image;
|
||||||
image = &quad->sc->images[quad->image_index];
|
image = &quad->sc->images[quad->image_index];
|
||||||
|
@ -397,7 +397,7 @@ compositor_layer_commit(struct xrt_compositor *xc)
|
||||||
&quad->size, layer->flip_y,
|
&quad->size, layer->flip_y,
|
||||||
i, quad->array_index);
|
i, quad->array_index);
|
||||||
} break;
|
} break;
|
||||||
case COMP_LAYER_STEREO_PROJECTION: {
|
case XRT_LAYER_STEREO_PROJECTION: {
|
||||||
struct comp_layer_stereo *stereo = &layer->stereo;
|
struct comp_layer_stereo *stereo = &layer->stereo;
|
||||||
struct comp_swapchain_image *right;
|
struct comp_swapchain_image *right;
|
||||||
struct comp_swapchain_image *left;
|
struct comp_swapchain_image *left;
|
||||||
|
|
|
@ -77,16 +77,6 @@ struct comp_swapchain
|
||||||
*/
|
*/
|
||||||
struct u_index_fifo fifo;
|
struct u_index_fifo fifo;
|
||||||
};
|
};
|
||||||
/*!
|
|
||||||
* Tag for distinguishing the union contents of @ref comp_layer.
|
|
||||||
*/
|
|
||||||
enum comp_layer_type
|
|
||||||
{
|
|
||||||
//! comp_layer::stereo is initialized
|
|
||||||
COMP_LAYER_STEREO_PROJECTION,
|
|
||||||
//! comp_layer::quad is initialized
|
|
||||||
COMP_LAYER_QUAD,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* A quad layer.
|
* A quad layer.
|
||||||
|
@ -131,7 +121,7 @@ struct comp_layer
|
||||||
{
|
{
|
||||||
int64_t timestamp;
|
int64_t timestamp;
|
||||||
enum xrt_layer_composition_flags flags;
|
enum xrt_layer_composition_flags flags;
|
||||||
enum comp_layer_type type;
|
enum xrt_layer_type type;
|
||||||
bool flip_y;
|
bool flip_y;
|
||||||
union {
|
union {
|
||||||
struct comp_layer_quad quad;
|
struct comp_layer_quad quad;
|
||||||
|
|
|
@ -154,7 +154,7 @@ comp_layer_update_stereo_descriptors(struct comp_render_layer *self,
|
||||||
static bool
|
static bool
|
||||||
_init(struct comp_render_layer *self,
|
_init(struct comp_render_layer *self,
|
||||||
struct vk_bundle *vk,
|
struct vk_bundle *vk,
|
||||||
enum comp_layer_type type,
|
enum xrt_layer_type type,
|
||||||
VkDescriptorSetLayout *layout)
|
VkDescriptorSetLayout *layout)
|
||||||
{
|
{
|
||||||
self->vk = vk;
|
self->vk = vk;
|
||||||
|
@ -211,10 +211,10 @@ comp_layer_draw(struct comp_render_layer *self,
|
||||||
pipeline);
|
pipeline);
|
||||||
|
|
||||||
switch (self->type) {
|
switch (self->type) {
|
||||||
case COMP_LAYER_STEREO_PROJECTION:
|
case XRT_LAYER_STEREO_PROJECTION:
|
||||||
_update_mvp_matrix(self, eye, &proj_scale);
|
_update_mvp_matrix(self, eye, &proj_scale);
|
||||||
break;
|
break;
|
||||||
case COMP_LAYER_QUAD: _update_mvp_matrix(self, eye, vp); break;
|
case XRT_LAYER_QUAD: _update_mvp_matrix(self, eye, vp); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->vk->vkCmdBindDescriptorSets(
|
self->vk->vkCmdBindDescriptorSets(
|
||||||
|
@ -230,7 +230,7 @@ comp_layer_draw(struct comp_render_layer *self,
|
||||||
|
|
||||||
struct comp_render_layer *
|
struct comp_render_layer *
|
||||||
comp_layer_create(struct vk_bundle *vk,
|
comp_layer_create(struct vk_bundle *vk,
|
||||||
enum comp_layer_type type,
|
enum xrt_layer_type type,
|
||||||
VkDescriptorSetLayout *layout)
|
VkDescriptorSetLayout *layout)
|
||||||
{
|
{
|
||||||
struct comp_render_layer *q = U_TYPED_CALLOC(struct comp_render_layer);
|
struct comp_render_layer *q = U_TYPED_CALLOC(struct comp_render_layer);
|
||||||
|
|
|
@ -24,7 +24,7 @@ struct comp_render_layer
|
||||||
|
|
||||||
bool visible;
|
bool visible;
|
||||||
|
|
||||||
enum comp_layer_type type;
|
enum xrt_layer_type type;
|
||||||
|
|
||||||
struct layer_transformation transformation[2];
|
struct layer_transformation transformation[2];
|
||||||
struct vk_buffer transformation_ubos[2];
|
struct vk_buffer transformation_ubos[2];
|
||||||
|
@ -37,7 +37,7 @@ struct comp_render_layer
|
||||||
|
|
||||||
struct comp_render_layer *
|
struct comp_render_layer *
|
||||||
comp_layer_create(struct vk_bundle *vk,
|
comp_layer_create(struct vk_bundle *vk,
|
||||||
enum comp_layer_type type,
|
enum xrt_layer_type type,
|
||||||
VkDescriptorSetLayout *layout);
|
VkDescriptorSetLayout *layout);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -451,7 +451,7 @@ comp_layer_renderer_allocate_layers(struct comp_layer_renderer *self,
|
||||||
|
|
||||||
for (uint32_t i = 0; i < self->num_layers; i++) {
|
for (uint32_t i = 0; i < self->num_layers; i++) {
|
||||||
self->layers[i] = comp_layer_create(
|
self->layers[i] = comp_layer_create(
|
||||||
vk, COMP_LAYER_QUAD, &self->descriptor_set_layout);
|
vk, XRT_LAYER_QUAD, &self->descriptor_set_layout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -489,7 +489,7 @@ comp_renderer_set_quad_layer(struct comp_renderer *r,
|
||||||
|
|
||||||
comp_layer_set_model_matrix(r->lr->layers[layer], &model_matrix);
|
comp_layer_set_model_matrix(r->lr->layers[layer], &model_matrix);
|
||||||
|
|
||||||
r->lr->layers[layer]->type = COMP_LAYER_QUAD;
|
r->lr->layers[layer]->type = XRT_LAYER_QUAD;
|
||||||
comp_layer_set_flip_y(r->lr->layers[layer], flip_y);
|
comp_layer_set_flip_y(r->lr->layers[layer], flip_y);
|
||||||
|
|
||||||
r->c->vk.vkDeviceWaitIdle(r->c->vk.device);
|
r->c->vk.vkDeviceWaitIdle(r->c->vk.device);
|
||||||
|
@ -511,7 +511,7 @@ comp_renderer_set_projection_layer(struct comp_renderer *r,
|
||||||
|
|
||||||
comp_layer_set_flip_y(r->lr->layers[layer], flip_y);
|
comp_layer_set_flip_y(r->lr->layers[layer], flip_y);
|
||||||
|
|
||||||
r->lr->layers[layer]->type = COMP_LAYER_STEREO_PROJECTION;
|
r->lr->layers[layer]->type = XRT_LAYER_STEREO_PROJECTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -69,6 +69,17 @@ enum xrt_view_type
|
||||||
XRT_VIEW_TYPE_STEREO = 2,
|
XRT_VIEW_TYPE_STEREO = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Layer type.
|
||||||
|
*
|
||||||
|
* @ingroup xrt_iface
|
||||||
|
*/
|
||||||
|
enum xrt_layer_type
|
||||||
|
{
|
||||||
|
XRT_LAYER_STEREO_PROJECTION,
|
||||||
|
XRT_LAYER_QUAD,
|
||||||
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @interface xrt_swapchain
|
* @interface xrt_swapchain
|
||||||
* Common swapchain interface/base.
|
* Common swapchain interface/base.
|
||||||
|
|
|
@ -387,7 +387,7 @@ ipc_compositor_layer_stereo_projection(
|
||||||
|
|
||||||
layer->flip_y = flip_y;
|
layer->flip_y = flip_y;
|
||||||
|
|
||||||
layer->type = IPC_LAYER_STEREO_PROJECTION;
|
layer->type = XRT_LAYER_STEREO_PROJECTION;
|
||||||
|
|
||||||
// Increment the number of layers.
|
// Increment the number of layers.
|
||||||
icc->layers.num_layers++;
|
icc->layers.num_layers++;
|
||||||
|
@ -430,7 +430,7 @@ ipc_compositor_layer_quad(struct xrt_compositor *xc,
|
||||||
quad->size = *size;
|
quad->size = *size;
|
||||||
|
|
||||||
layer->flip_y = flip_y;
|
layer->flip_y = flip_y;
|
||||||
layer->type = IPC_LAYER_QUAD;
|
layer->type = XRT_LAYER_QUAD;
|
||||||
|
|
||||||
// Increment the number of layers.
|
// Increment the number of layers.
|
||||||
icc->layers.num_layers++;
|
icc->layers.num_layers++;
|
||||||
|
|
|
@ -108,15 +108,9 @@ struct ipc_layer_quad
|
||||||
struct xrt_vec2 size;
|
struct xrt_vec2 size;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ipc_layer_type
|
|
||||||
{
|
|
||||||
IPC_LAYER_STEREO_PROJECTION,
|
|
||||||
IPC_LAYER_QUAD,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ipc_layer_entry
|
struct ipc_layer_entry
|
||||||
{
|
{
|
||||||
enum ipc_layer_type type;
|
enum xrt_layer_type type;
|
||||||
bool flip_y;
|
bool flip_y;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
|
|
|
@ -107,7 +107,7 @@ struct ipc_stereo_projection_render_state
|
||||||
|
|
||||||
struct ipc_layer_render_state
|
struct ipc_layer_render_state
|
||||||
{
|
{
|
||||||
enum ipc_layer_type type;
|
enum xrt_layer_type type;
|
||||||
bool flip_y;
|
bool flip_y;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
|
|
|
@ -112,7 +112,7 @@ ipc_handle_compositor_layer_sync(volatile struct ipc_client_state *cs,
|
||||||
rl->flip_y = sl->flip_y;
|
rl->flip_y = sl->flip_y;
|
||||||
|
|
||||||
switch (slot->layers[i].type) {
|
switch (slot->layers[i].type) {
|
||||||
case IPC_LAYER_STEREO_PROJECTION:
|
case XRT_LAYER_STEREO_PROJECTION:
|
||||||
rl->stereo.l.swapchain_index =
|
rl->stereo.l.swapchain_index =
|
||||||
sl->stereo.l.swapchain_id;
|
sl->stereo.l.swapchain_id;
|
||||||
rl->stereo.l.image_index = sl->stereo.l.image_index;
|
rl->stereo.l.image_index = sl->stereo.l.image_index;
|
||||||
|
@ -123,7 +123,7 @@ ipc_handle_compositor_layer_sync(volatile struct ipc_client_state *cs,
|
||||||
rl->stereo.r.array_index = sl->stereo.r.array_index;
|
rl->stereo.r.array_index = sl->stereo.r.array_index;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case IPC_LAYER_QUAD:
|
case XRT_LAYER_QUAD:
|
||||||
rl->quad.swapchain_index = sl->quad.swapchain_id;
|
rl->quad.swapchain_index = sl->quad.swapchain_id;
|
||||||
rl->quad.image_index = sl->quad.image_index;
|
rl->quad.image_index = sl->quad.image_index;
|
||||||
rl->quad.pose = sl->quad.pose;
|
rl->quad.pose = sl->quad.pose;
|
||||||
|
|
|
@ -590,13 +590,13 @@ _update_layers(struct comp_compositor *c,
|
||||||
volatile struct ipc_layer_render_state *layer =
|
volatile struct ipc_layer_render_state *layer =
|
||||||
&render_state->layers[i];
|
&render_state->layers[i];
|
||||||
switch (layer->type) {
|
switch (layer->type) {
|
||||||
case IPC_LAYER_STEREO_PROJECTION: {
|
case XRT_LAYER_STEREO_PROJECTION: {
|
||||||
if (!_update_projection_layer(c, active_client, layer,
|
if (!_update_projection_layer(c, active_client, layer,
|
||||||
i))
|
i))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPC_LAYER_QUAD: {
|
case XRT_LAYER_QUAD: {
|
||||||
if (!_update_quad_layer(c, active_client, layer, i))
|
if (!_update_quad_layer(c, active_client, layer, i))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue