mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-19 13:18:32 +00:00
c/main: Remove layer renderer integration in renderer
This commit is contained in:
parent
958d62fcab
commit
3293def0cb
|
@ -253,100 +253,6 @@ compositor_discard_frame(struct xrt_compositor *xc, int64_t frame_id)
|
||||||
return XRT_SUCCESS;
|
return XRT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
do_graphics_layers(struct comp_compositor *c)
|
|
||||||
{
|
|
||||||
// Always zero for now.
|
|
||||||
uint32_t layer_count = c->base.slot.layer_count;
|
|
||||||
|
|
||||||
comp_renderer_destroy_layers(c->r);
|
|
||||||
|
|
||||||
if (c->base.slot.one_projection_layer_fast_path) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
comp_renderer_allocate_layers(c->r, layer_count);
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < layer_count; i++) {
|
|
||||||
struct comp_layer *layer = &c->base.slot.layers[i];
|
|
||||||
struct xrt_layer_data *data = &layer->data;
|
|
||||||
|
|
||||||
COMP_SPEW(c, "LAYER_COMMIT (%d) predicted display time: %8.3fms", i, ns_to_ms(data->timestamp));
|
|
||||||
|
|
||||||
switch (data->type) {
|
|
||||||
case XRT_LAYER_QUAD: {
|
|
||||||
struct xrt_layer_quad_data *quad = &layer->data.quad;
|
|
||||||
struct comp_swapchain_image *image;
|
|
||||||
image = &layer->sc_array[0]->images[quad->sub.image_index];
|
|
||||||
comp_renderer_set_quad_layer(c->r, i, image, data);
|
|
||||||
} 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->sc_array[0]->images[stereo->l.sub.image_index];
|
|
||||||
right = &layer->sc_array[1]->images[stereo->r.sub.image_index];
|
|
||||||
|
|
||||||
comp_renderer_set_projection_layer(c->r, i, left, right, data);
|
|
||||||
} break;
|
|
||||||
case XRT_LAYER_STEREO_PROJECTION_DEPTH: {
|
|
||||||
struct xrt_layer_stereo_projection_depth_data *stereo = &data->stereo_depth;
|
|
||||||
struct comp_swapchain_image *right;
|
|
||||||
struct comp_swapchain_image *left;
|
|
||||||
left = &layer->sc_array[0]->images[stereo->l.sub.image_index];
|
|
||||||
right = &layer->sc_array[1]->images[stereo->r.sub.image_index];
|
|
||||||
|
|
||||||
//! @todo: Make use of stereo->l_d and stereo->r_d
|
|
||||||
|
|
||||||
comp_renderer_set_projection_layer(c->r, i, left, right, data);
|
|
||||||
} break;
|
|
||||||
case XRT_LAYER_CYLINDER: {
|
|
||||||
struct xrt_layer_cylinder_data *cyl = &layer->data.cylinder;
|
|
||||||
struct comp_swapchain_image *image;
|
|
||||||
image = &layer->sc_array[0]->images[cyl->sub.image_index];
|
|
||||||
comp_renderer_set_cylinder_layer(c->r, i, image, data);
|
|
||||||
} break;
|
|
||||||
#ifdef XRT_FEATURE_OPENXR_LAYER_EQUIRECT1
|
|
||||||
case XRT_LAYER_EQUIRECT1: {
|
|
||||||
struct xrt_layer_equirect1_data *eq = &layer->data.equirect1;
|
|
||||||
struct comp_swapchain_image *image;
|
|
||||||
image = &layer->sc_array[0]->images[eq->sub.image_index];
|
|
||||||
comp_renderer_set_equirect1_layer(c->r, i, image, data);
|
|
||||||
} break;
|
|
||||||
#endif
|
|
||||||
#ifdef XRT_FEATURE_OPENXR_LAYER_EQUIRECT2
|
|
||||||
case XRT_LAYER_EQUIRECT2: {
|
|
||||||
struct xrt_layer_equirect2_data *eq = &layer->data.equirect2;
|
|
||||||
struct comp_swapchain_image *image;
|
|
||||||
image = &layer->sc_array[0]->images[eq->sub.image_index];
|
|
||||||
comp_renderer_set_equirect2_layer(c->r, i, image, data);
|
|
||||||
} break;
|
|
||||||
#endif
|
|
||||||
#ifdef XRT_FEATURE_OPENXR_LAYER_CUBE
|
|
||||||
case XRT_LAYER_CUBE: {
|
|
||||||
struct xrt_layer_cube_data *cu = &layer->data.cube;
|
|
||||||
struct comp_swapchain_image *image;
|
|
||||||
image = &layer->sc_array[0]->images[cu->sub.image_index];
|
|
||||||
comp_renderer_set_cube_layer(c->r, i, image, data);
|
|
||||||
} break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef XRT_FEATURE_OPENXR_LAYER_EQUIRECT1
|
|
||||||
case XRT_LAYER_EQUIRECT1:
|
|
||||||
#endif
|
|
||||||
#ifndef XRT_FEATURE_OPENXR_LAYER_EQUIRECT2
|
|
||||||
case XRT_LAYER_EQUIRECT2:
|
|
||||||
#endif
|
|
||||||
#ifndef XRT_FEATURE_OPENXR_LAYER_CUBE
|
|
||||||
case XRT_LAYER_CUBE:
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
// Should never end up here.
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* We have a fast path for single projection layer that goes directly
|
* We have a fast path for single projection layer that goes directly
|
||||||
* to the distortion shader, so no need to use the layer renderer.
|
* to the distortion shader, so no need to use the layer renderer.
|
||||||
|
@ -389,10 +295,7 @@ compositor_layer_commit(struct xrt_compositor *xc, xrt_graphics_sync_handle_t sy
|
||||||
|
|
||||||
u_graphics_sync_unref(&sync_handle);
|
u_graphics_sync_unref(&sync_handle);
|
||||||
|
|
||||||
if (!c->settings.use_compute) {
|
// Do the drawing
|
||||||
do_graphics_layers(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
comp_renderer_draw(c->r);
|
comp_renderer_draw(c->r);
|
||||||
|
|
||||||
u_frame_times_widget_push_sample(&c->compositor_frame_times, os_monotonic_get_ns());
|
u_frame_times_widget_push_sample(&c->compositor_frame_times, os_monotonic_get_ns());
|
||||||
|
|
|
@ -130,12 +130,6 @@ struct comp_renderer
|
||||||
*/
|
*/
|
||||||
uint32_t buffer_count;
|
uint32_t buffer_count;
|
||||||
|
|
||||||
/*!
|
|
||||||
* @brief The layer renderer, which actually knows how to composite layers.
|
|
||||||
*
|
|
||||||
* Depends on the target extents.
|
|
||||||
*/
|
|
||||||
struct comp_layer_renderer *lr;
|
|
||||||
//! @}
|
//! @}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -406,30 +400,6 @@ renderer_close_renderings_and_fences(struct comp_renderer *r)
|
||||||
r->fenced_buffer = -1;
|
r->fenced_buffer = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @pre comp_target_check_ready(r->c->target)
|
|
||||||
static void
|
|
||||||
renderer_create_layer_renderer(struct comp_renderer *r)
|
|
||||||
{
|
|
||||||
struct vk_bundle *vk = &r->c->base.vk;
|
|
||||||
|
|
||||||
assert(comp_target_check_ready(r->c->target));
|
|
||||||
|
|
||||||
uint32_t layer_count = 0;
|
|
||||||
if (r->lr != NULL) {
|
|
||||||
// if we already had one, re-populate it after recreation.
|
|
||||||
layer_count = r->lr->layer_count;
|
|
||||||
comp_layer_renderer_destroy(&r->lr);
|
|
||||||
}
|
|
||||||
|
|
||||||
r->lr = comp_layer_renderer_create( //
|
|
||||||
vk, //
|
|
||||||
&r->c->shaders, //
|
|
||||||
&r->scratch_render_pass); //
|
|
||||||
if (layer_count != 0) {
|
|
||||||
comp_layer_renderer_allocate_layers(r->lr, layer_count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Ensure that target images and renderings are created, if possible.
|
* @brief Ensure that target images and renderings are created, if possible.
|
||||||
*
|
*
|
||||||
|
@ -503,7 +473,6 @@ renderer_ensure_images_and_renderings(struct comp_renderer *r, bool force_recrea
|
||||||
|
|
||||||
r->buffer_count = r->c->target->image_count;
|
r->buffer_count = r->c->target->image_count;
|
||||||
|
|
||||||
renderer_create_layer_renderer(r);
|
|
||||||
renderer_create_renderings_and_fences(r);
|
renderer_create_renderings_and_fences(r);
|
||||||
|
|
||||||
assert(r->buffer_count != 0);
|
assert(r->buffer_count != 0);
|
||||||
|
@ -764,9 +733,6 @@ renderer_fini(struct comp_renderer *r)
|
||||||
// Do before layer render just in case it holds any references.
|
// Do before layer render just in case it holds any references.
|
||||||
comp_mirror_fini(&r->mirror_to_debug_gui, vk);
|
comp_mirror_fini(&r->mirror_to_debug_gui, vk);
|
||||||
|
|
||||||
// Do this after the mirror struct.
|
|
||||||
comp_layer_renderer_destroy(&(r->lr));
|
|
||||||
|
|
||||||
// Do this after the layer renderer.
|
// Do this after the layer renderer.
|
||||||
for (uint32_t i = 0; i < ARRAY_SIZE(r->scratch_targets); i++) {
|
for (uint32_t i = 0; i < ARRAY_SIZE(r->scratch_targets); i++) {
|
||||||
render_gfx_target_resources_close(&r->scratch_targets[i]);
|
render_gfx_target_resources_close(&r->scratch_targets[i]);
|
||||||
|
@ -779,16 +745,6 @@ renderer_fini(struct comp_renderer *r)
|
||||||
render_scratch_images_close(&r->c->nr, &r->scratch);
|
render_scratch_images_close(&r->c->nr, &r->scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VkImageView
|
|
||||||
get_image_view(const struct comp_swapchain_image *image, enum xrt_layer_composition_flags flags, uint32_t array_index)
|
|
||||||
{
|
|
||||||
if (flags & XRT_LAYER_COMPOSITION_BLEND_TEXTURE_SOURCE_ALPHA_BIT) {
|
|
||||||
return image->views.alpha[array_index];
|
|
||||||
}
|
|
||||||
|
|
||||||
return image->views.no_alpha[array_index];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
@ -932,267 +888,6 @@ dispatch_compute(struct comp_renderer *r, struct render_compute *crc)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
|
||||||
comp_renderer_set_quad_layer(struct comp_renderer *r,
|
|
||||||
uint32_t layer,
|
|
||||||
struct comp_swapchain_image *image,
|
|
||||||
struct xrt_layer_data *data)
|
|
||||||
{
|
|
||||||
struct comp_render_layer *l = r->lr->layers[layer];
|
|
||||||
|
|
||||||
l->transformation_ubo_binding = r->lr->transformation_ubo_binding;
|
|
||||||
l->texture_binding = r->lr->texture_binding;
|
|
||||||
|
|
||||||
VkSampler clamp_to_edge = r->c->nr.samplers.clamp_to_edge;
|
|
||||||
VkImageView image_view = get_image_view( //
|
|
||||||
image, //
|
|
||||||
data->flags, //
|
|
||||||
data->quad.sub.array_index); //
|
|
||||||
|
|
||||||
comp_layer_update_descriptors( //
|
|
||||||
l, //
|
|
||||||
clamp_to_edge, //
|
|
||||||
image_view); //
|
|
||||||
|
|
||||||
struct xrt_vec3 s = {data->quad.size.x, data->quad.size.y, 1.0f};
|
|
||||||
struct xrt_matrix_4x4 model_matrix;
|
|
||||||
math_matrix_4x4_model(&data->quad.pose, &s, &model_matrix);
|
|
||||||
|
|
||||||
comp_layer_set_model_matrix(r->lr->layers[layer], &model_matrix);
|
|
||||||
|
|
||||||
comp_layer_set_flip_y(r->lr->layers[layer], data->flip_y);
|
|
||||||
|
|
||||||
l->type = XRT_LAYER_QUAD;
|
|
||||||
l->visibility = data->quad.visibility;
|
|
||||||
l->flags = data->flags;
|
|
||||||
l->view_space = (data->flags & XRT_LAYER_COMPOSITION_VIEW_SPACE_BIT) != 0;
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < 2; i++) {
|
|
||||||
l->transformation[i].offset = data->quad.sub.rect.offset;
|
|
||||||
l->transformation[i].extent = data->quad.sub.rect.extent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
comp_renderer_set_cylinder_layer(struct comp_renderer *r,
|
|
||||||
uint32_t layer,
|
|
||||||
struct comp_swapchain_image *image,
|
|
||||||
struct xrt_layer_data *data)
|
|
||||||
{
|
|
||||||
struct comp_render_layer *l = r->lr->layers[layer];
|
|
||||||
|
|
||||||
l->transformation_ubo_binding = r->lr->transformation_ubo_binding;
|
|
||||||
l->texture_binding = r->lr->texture_binding;
|
|
||||||
|
|
||||||
l->type = XRT_LAYER_CYLINDER;
|
|
||||||
l->visibility = data->cylinder.visibility;
|
|
||||||
l->flags = data->flags;
|
|
||||||
l->view_space = (data->flags & XRT_LAYER_COMPOSITION_VIEW_SPACE_BIT) != 0;
|
|
||||||
|
|
||||||
// skip "infinite cylinder"
|
|
||||||
if (data->cylinder.radius == 0.f || data->cylinder.aspect_ratio == INFINITY) {
|
|
||||||
/* skipping the descriptor set update means the renderer must
|
|
||||||
* entirely skip rendering of invisible layer */
|
|
||||||
l->visibility = XRT_LAYER_EYE_VISIBILITY_NONE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkSampler clamp_to_edge = r->c->nr.samplers.clamp_to_edge;
|
|
||||||
VkImageView image_view = get_image_view( //
|
|
||||||
image, //
|
|
||||||
data->flags, //
|
|
||||||
data->cylinder.sub.array_index); //
|
|
||||||
|
|
||||||
comp_layer_update_descriptors( //
|
|
||||||
r->lr->layers[layer], //
|
|
||||||
clamp_to_edge, //
|
|
||||||
image_view); //
|
|
||||||
|
|
||||||
float height = (data->cylinder.radius * data->cylinder.central_angle) / data->cylinder.aspect_ratio;
|
|
||||||
|
|
||||||
// scale unit cylinder to diameter
|
|
||||||
float diameter = data->cylinder.radius * 2;
|
|
||||||
struct xrt_vec3 scale = {diameter, height, diameter};
|
|
||||||
struct xrt_matrix_4x4 model_matrix;
|
|
||||||
math_matrix_4x4_model(&data->cylinder.pose, &scale, &model_matrix);
|
|
||||||
|
|
||||||
comp_layer_set_model_matrix(r->lr->layers[layer], &model_matrix);
|
|
||||||
|
|
||||||
comp_layer_set_flip_y(r->lr->layers[layer], data->flip_y);
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < 2; i++) {
|
|
||||||
l->transformation[i].offset = data->cylinder.sub.rect.offset;
|
|
||||||
l->transformation[i].extent = data->cylinder.sub.rect.extent;
|
|
||||||
}
|
|
||||||
|
|
||||||
comp_layer_update_cylinder_vertex_buffer(l, data->cylinder.central_angle);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
comp_renderer_set_projection_layer(struct comp_renderer *r,
|
|
||||||
uint32_t layer,
|
|
||||||
struct comp_swapchain_image *left_image,
|
|
||||||
struct comp_swapchain_image *right_image,
|
|
||||||
struct xrt_layer_data *data)
|
|
||||||
{
|
|
||||||
uint32_t left_array_index = data->stereo.l.sub.array_index;
|
|
||||||
uint32_t right_array_index = data->stereo.r.sub.array_index;
|
|
||||||
|
|
||||||
struct comp_render_layer *l = r->lr->layers[layer];
|
|
||||||
|
|
||||||
l->transformation_ubo_binding = r->lr->transformation_ubo_binding;
|
|
||||||
l->texture_binding = r->lr->texture_binding;
|
|
||||||
|
|
||||||
VkSampler clamp_to_border_black = r->c->nr.samplers.clamp_to_border_black;
|
|
||||||
|
|
||||||
VkImageView left_image_view = get_image_view( //
|
|
||||||
left_image, //
|
|
||||||
data->flags, //
|
|
||||||
left_array_index); //
|
|
||||||
|
|
||||||
VkImageView right_image_view = get_image_view( //
|
|
||||||
right_image, //
|
|
||||||
data->flags, //
|
|
||||||
right_array_index); //
|
|
||||||
|
|
||||||
comp_layer_update_stereo_descriptors( //
|
|
||||||
l, //
|
|
||||||
clamp_to_border_black, //
|
|
||||||
clamp_to_border_black, //
|
|
||||||
left_image_view, //
|
|
||||||
right_image_view); //
|
|
||||||
|
|
||||||
comp_layer_set_flip_y(l, data->flip_y);
|
|
||||||
|
|
||||||
l->type = XRT_LAYER_STEREO_PROJECTION;
|
|
||||||
l->flags = data->flags;
|
|
||||||
l->view_space = (data->flags & XRT_LAYER_COMPOSITION_VIEW_SPACE_BIT) != 0;
|
|
||||||
|
|
||||||
l->transformation[0].offset = data->stereo.l.sub.rect.offset;
|
|
||||||
l->transformation[0].extent = data->stereo.l.sub.rect.extent;
|
|
||||||
l->transformation[1].offset = data->stereo.r.sub.rect.offset;
|
|
||||||
l->transformation[1].extent = data->stereo.r.sub.rect.extent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef XRT_FEATURE_OPENXR_LAYER_EQUIRECT1
|
|
||||||
void
|
|
||||||
comp_renderer_set_equirect1_layer(struct comp_renderer *r,
|
|
||||||
uint32_t layer,
|
|
||||||
struct comp_swapchain_image *image,
|
|
||||||
struct xrt_layer_data *data)
|
|
||||||
{
|
|
||||||
|
|
||||||
struct xrt_vec3 s = {1.0f, 1.0f, 1.0f};
|
|
||||||
struct xrt_matrix_4x4 model_matrix;
|
|
||||||
math_matrix_4x4_model(&data->equirect1.pose, &s, &model_matrix);
|
|
||||||
|
|
||||||
comp_layer_set_flip_y(r->lr->layers[layer], data->flip_y);
|
|
||||||
|
|
||||||
struct comp_render_layer *l = r->lr->layers[layer];
|
|
||||||
l->type = XRT_LAYER_EQUIRECT1;
|
|
||||||
l->visibility = data->equirect1.visibility;
|
|
||||||
l->flags = data->flags;
|
|
||||||
l->view_space = (data->flags & XRT_LAYER_COMPOSITION_VIEW_SPACE_BIT) != 0;
|
|
||||||
l->transformation_ubo_binding = r->lr->transformation_ubo_binding;
|
|
||||||
l->texture_binding = r->lr->texture_binding;
|
|
||||||
|
|
||||||
VkSampler repeat = r->c->nr.samplers.repeat;
|
|
||||||
VkImageView image_view = get_image_view( //
|
|
||||||
image, //
|
|
||||||
data->flags, //
|
|
||||||
data->equirect1.sub.array_index); //
|
|
||||||
|
|
||||||
comp_layer_update_descriptors( //
|
|
||||||
l, //
|
|
||||||
repeat, //
|
|
||||||
image_view); //
|
|
||||||
|
|
||||||
comp_layer_update_equirect1_descriptor(l, &data->equirect1);
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < 2; i++) {
|
|
||||||
l->transformation[i].offset = data->equirect1.sub.rect.offset;
|
|
||||||
l->transformation[i].extent = data->equirect1.sub.rect.extent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XRT_FEATURE_OPENXR_LAYER_EQUIRECT2
|
|
||||||
void
|
|
||||||
comp_renderer_set_equirect2_layer(struct comp_renderer *r,
|
|
||||||
uint32_t layer,
|
|
||||||
struct comp_swapchain_image *image,
|
|
||||||
struct xrt_layer_data *data)
|
|
||||||
{
|
|
||||||
|
|
||||||
struct xrt_vec3 s = {1.0f, 1.0f, 1.0f};
|
|
||||||
struct xrt_matrix_4x4 model_matrix;
|
|
||||||
math_matrix_4x4_model(&data->equirect2.pose, &s, &model_matrix);
|
|
||||||
|
|
||||||
comp_layer_set_flip_y(r->lr->layers[layer], data->flip_y);
|
|
||||||
|
|
||||||
struct comp_render_layer *l = r->lr->layers[layer];
|
|
||||||
l->type = XRT_LAYER_EQUIRECT2;
|
|
||||||
l->visibility = data->equirect2.visibility;
|
|
||||||
l->flags = data->flags;
|
|
||||||
l->view_space = (data->flags & XRT_LAYER_COMPOSITION_VIEW_SPACE_BIT) != 0;
|
|
||||||
l->transformation_ubo_binding = r->lr->transformation_ubo_binding;
|
|
||||||
l->texture_binding = r->lr->texture_binding;
|
|
||||||
|
|
||||||
VkSampler repeat = r->c->nr.samplers.repeat;
|
|
||||||
VkImageView image_view = get_image_view( //
|
|
||||||
image, //
|
|
||||||
data->flags, //
|
|
||||||
data->equirect2.sub.array_index); //
|
|
||||||
|
|
||||||
comp_layer_update_descriptors( //
|
|
||||||
l, //
|
|
||||||
repeat, //
|
|
||||||
image_view); //
|
|
||||||
|
|
||||||
comp_layer_update_equirect2_descriptor(l, &data->equirect2);
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < 2; i++) {
|
|
||||||
l->transformation[i].offset = data->equirect2.sub.rect.offset;
|
|
||||||
l->transformation[i].extent = data->equirect2.sub.rect.extent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XRT_FEATURE_OPENXR_LAYER_CUBE
|
|
||||||
void
|
|
||||||
comp_renderer_set_cube_layer(struct comp_renderer *r,
|
|
||||||
uint32_t layer,
|
|
||||||
struct comp_swapchain_image *image,
|
|
||||||
struct xrt_layer_data *data)
|
|
||||||
{
|
|
||||||
|
|
||||||
struct xrt_vec3 s = {1.0f, 1.0f, 1.0f};
|
|
||||||
struct xrt_matrix_4x4 model_matrix;
|
|
||||||
math_matrix_4x4_model(&data->cube.pose, &s, &model_matrix);
|
|
||||||
|
|
||||||
comp_layer_set_flip_y(r->lr->layers[layer], data->flip_y);
|
|
||||||
|
|
||||||
struct comp_render_layer *l = r->lr->layers[layer];
|
|
||||||
l->type = XRT_LAYER_CUBE;
|
|
||||||
l->visibility = data->cube.visibility;
|
|
||||||
l->flags = data->flags;
|
|
||||||
l->view_space = (data->flags & XRT_LAYER_COMPOSITION_VIEW_SPACE_BIT) != 0;
|
|
||||||
l->transformation_ubo_binding = r->lr->transformation_ubo_binding;
|
|
||||||
l->texture_binding = r->lr->texture_binding;
|
|
||||||
|
|
||||||
VkSampler repeat = r->c->nr.samplers.repeat;
|
|
||||||
VkImageView image_view = get_image_view( //
|
|
||||||
image, //
|
|
||||||
data->flags, //
|
|
||||||
data->cube.sub.array_index); //
|
|
||||||
|
|
||||||
comp_layer_update_descriptors( //
|
|
||||||
l, //
|
|
||||||
repeat, //
|
|
||||||
image_view); //
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
comp_renderer_draw(struct comp_renderer *r)
|
comp_renderer_draw(struct comp_renderer *r)
|
||||||
{
|
{
|
||||||
|
@ -1366,22 +1061,6 @@ comp_renderer_draw(struct comp_renderer *r)
|
||||||
comp_target_update_timings(ct);
|
comp_target_update_timings(ct);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
comp_renderer_allocate_layers(struct comp_renderer *self, uint32_t layer_count)
|
|
||||||
{
|
|
||||||
COMP_TRACE_MARKER();
|
|
||||||
|
|
||||||
comp_layer_renderer_allocate_layers(self->lr, layer_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
comp_renderer_destroy_layers(struct comp_renderer *self)
|
|
||||||
{
|
|
||||||
COMP_TRACE_MARKER();
|
|
||||||
|
|
||||||
comp_layer_renderer_destroy_layers(self->lr);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct comp_renderer *
|
struct comp_renderer *
|
||||||
comp_renderer_create(struct comp_compositor *c, VkExtent2D scratch_extent)
|
comp_renderer_create(struct comp_compositor *c, VkExtent2D scratch_extent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,91 +60,6 @@ comp_renderer_destroy(struct comp_renderer **ptr_r);
|
||||||
void
|
void
|
||||||
comp_renderer_draw(struct comp_renderer *r);
|
comp_renderer_draw(struct comp_renderer *r);
|
||||||
|
|
||||||
/*!
|
|
||||||
* @public @memberof comp_renderer
|
|
||||||
* @ingroup comp_main
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
comp_renderer_set_projection_layer(struct comp_renderer *r,
|
|
||||||
uint32_t layer,
|
|
||||||
struct comp_swapchain_image *left_image,
|
|
||||||
struct comp_swapchain_image *right_image,
|
|
||||||
struct xrt_layer_data *data);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* @public @memberof comp_renderer
|
|
||||||
* @ingroup comp_main
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
comp_renderer_set_quad_layer(struct comp_renderer *r,
|
|
||||||
uint32_t layer,
|
|
||||||
struct comp_swapchain_image *image,
|
|
||||||
struct xrt_layer_data *data);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* @public @memberof comp_renderer
|
|
||||||
* @ingroup comp_main
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
comp_renderer_set_cylinder_layer(struct comp_renderer *r,
|
|
||||||
uint32_t layer,
|
|
||||||
struct comp_swapchain_image *image,
|
|
||||||
struct xrt_layer_data *data);
|
|
||||||
|
|
||||||
#ifdef XRT_FEATURE_OPENXR_LAYER_EQUIRECT1
|
|
||||||
/*!
|
|
||||||
* @public @memberof comp_renderer
|
|
||||||
* @ingroup comp_main
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
comp_renderer_set_equirect1_layer(struct comp_renderer *r,
|
|
||||||
uint32_t layer,
|
|
||||||
struct comp_swapchain_image *image,
|
|
||||||
struct xrt_layer_data *data);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XRT_FEATURE_OPENXR_LAYER_EQUIRECT2
|
|
||||||
/*!
|
|
||||||
* @public @memberof comp_renderer
|
|
||||||
* @ingroup comp_main
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
comp_renderer_set_equirect2_layer(struct comp_renderer *r,
|
|
||||||
uint32_t layer,
|
|
||||||
struct comp_swapchain_image *image,
|
|
||||||
struct xrt_layer_data *data);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XRT_FEATURE_OPENXR_LAYER_CUBE
|
|
||||||
/*!
|
|
||||||
* @public @memberof comp_renderer
|
|
||||||
* @ingroup comp_main
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
comp_renderer_set_cube_layer(struct comp_renderer *r,
|
|
||||||
uint32_t layer,
|
|
||||||
struct comp_swapchain_image *image,
|
|
||||||
struct xrt_layer_data *data);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Allocate an internal array of per-layer data with the given number of elements.
|
|
||||||
*
|
|
||||||
* @public @memberof comp_renderer
|
|
||||||
* @ingroup comp_main
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
comp_renderer_allocate_layers(struct comp_renderer *self, uint32_t layer_count);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* De-initialize and free internal array of per-layer data.
|
|
||||||
*
|
|
||||||
* @public @memberof comp_renderer
|
|
||||||
* @ingroup comp_main
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
comp_renderer_destroy_layers(struct comp_renderer *self);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
comp_renderer_add_debug_vars(struct comp_renderer *self);
|
comp_renderer_add_debug_vars(struct comp_renderer *self);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue