diff --git a/doc/changes/compositor/mr.394.2.md b/doc/changes/compositor/mr.394.2.md new file mode 100644 index 0000000000000000000000000000000000000000..b26dd7121d51e4032b4e9b6dd3fdc66d616e8356 --- /dev/null +++ b/doc/changes/compositor/mr.394.2.md @@ -0,0 +1,2 @@ +layer_rendering: Use the visibility flags on quad to correctly show the layers +in each eye. diff --git a/src/xrt/compositor/main/comp_layer.c b/src/xrt/compositor/main/comp_layer.c index d444f6f33bdf885fe2a11ed79ddd863913e6861d..fffa2b028a46b088293d7a7ddf5b2c2f66a4097d 100644 --- a/src/xrt/compositor/main/comp_layer.c +++ b/src/xrt/compositor/main/comp_layer.c @@ -161,8 +161,8 @@ _init(struct comp_render_layer *self, self->type = type; - self->visible = true; self->view_space = true; + self->visibility = XRT_LAYER_EYE_VISIBILITY_BOTH; math_matrix_4x4_identity(&self->model_matrix); @@ -206,8 +206,15 @@ comp_layer_draw(struct comp_render_layer *self, const struct xrt_matrix_4x4 *vp_world, const struct xrt_matrix_4x4 *vp_eye) { - if (!self->visible) + if (eye == 0 && + (self->visibility & XRT_LAYER_EYE_VISIBILITY_LEFT_BIT) == 0) { return; + } + + if (eye == 1 && + (self->visibility & XRT_LAYER_EYE_VISIBILITY_RIGHT_BIT) == 0) { + return; + } self->vk->vkCmdBindPipeline(cmd_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); diff --git a/src/xrt/compositor/main/comp_layer.h b/src/xrt/compositor/main/comp_layer.h index c2a60ac1e8d44661b3fbd0b6d179890462542558..d7ea7351306f91dda171b5aead510b172073b68b 100644 --- a/src/xrt/compositor/main/comp_layer.h +++ b/src/xrt/compositor/main/comp_layer.h @@ -22,7 +22,7 @@ struct comp_render_layer { struct vk_bundle *vk; - bool visible; + enum xrt_layer_eye_visibility visibility; bool view_space; enum xrt_layer_type type; diff --git a/src/xrt/compositor/main/comp_renderer.c b/src/xrt/compositor/main/comp_renderer.c index c99bf3d05254ede3956e14ea099a16681ad6a190..862e6e2bd3cce65ab6cc6036f88e9a9791a51f83 100644 --- a/src/xrt/compositor/main/comp_renderer.c +++ b/src/xrt/compositor/main/comp_renderer.c @@ -502,6 +502,7 @@ comp_renderer_set_quad_layer(struct comp_renderer *r, comp_layer_set_flip_y(r->lr->layers[layer], data->flip_y); r->lr->layers[layer]->type = XRT_LAYER_QUAD; + r->lr->layers[layer]->visibility = data->quad.visibility; r->lr->layers[layer]->view_space = (data->flags & XRT_LAYER_COMPOSITION_VIEW_SPACE_BIT) != 0;