mono: depth layer supporting mono

This commit is contained in:
Meng Jiao 2024-03-04 10:56:49 +08:00
parent a802960684
commit e154fd4513
19 changed files with 233 additions and 270 deletions

View file

@ -564,7 +564,7 @@ client_d3d11_compositor_layer_projection(struct xrt_compositor *xc,
assert(data->type == XRT_LAYER_PROJECTION);
struct xrt_swapchain *xscn[XRT_MAX_VIEWS];
for (uint32_t i = 0; i < data->proj.view_count; ++i) {
for (uint32_t i = 0; i < data->view_count; ++i) {
xscn[i] = as_client_d3d11_swapchain(xsc[i])->xsc.get();
}
@ -573,25 +573,24 @@ client_d3d11_compositor_layer_projection(struct xrt_compositor *xc,
}
static xrt_result_t
client_d3d11_compositor_layer_stereo_projection_depth(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *l_xsc,
struct xrt_swapchain *r_xsc,
struct xrt_swapchain *l_d_xsc,
struct xrt_swapchain *r_d_xsc,
const struct xrt_layer_data *data)
client_d3d11_compositor_layer_projection_depth(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS],
const struct xrt_layer_data *data)
{
struct client_d3d11_compositor *c = as_client_d3d11_compositor(xc);
assert(data->type == XRT_LAYER_STEREO_PROJECTION_DEPTH);
struct xrt_swapchain *l_xscn = as_client_d3d11_swapchain(l_xsc)->xsc.get();
struct xrt_swapchain *r_xscn = as_client_d3d11_swapchain(r_xsc)->xsc.get();
struct xrt_swapchain *l_d_xscn = as_client_d3d11_swapchain(l_d_xsc)->xsc.get();
struct xrt_swapchain *r_d_xscn = as_client_d3d11_swapchain(r_d_xsc)->xsc.get();
assert(data->type == XRT_LAYER_PROJECTION_DEPTH);
struct xrt_swapchain *xscn[XRT_MAX_VIEWS];
struct xrt_swapchain *d_xscn[XRT_MAX_VIEWS];
for (uint32_t i = 0; i < data->view_count; ++i) {
xscn[i] = as_client_d3d11_swapchain(xsc[i])->xsc.get();
d_xscn[i] = as_client_d3d11_swapchain(d_xsc[i])->xsc.get();
}
// No flip required: D3D11 swapchain image convention matches Vulkan.
return xrt_comp_layer_stereo_projection_depth(&c->xcn->base, xdev, l_xscn, r_xscn, l_d_xscn, r_d_xscn, data);
return xrt_comp_layer_projection_depth(&c->xcn->base, xdev, xscn, d_xscn, data);
}
static xrt_result_t
@ -881,7 +880,7 @@ try {
c->base.base.discard_frame = client_d3d11_compositor_discard_frame;
c->base.base.layer_begin = client_d3d11_compositor_layer_begin;
c->base.base.layer_projection = client_d3d11_compositor_layer_projection;
c->base.base.layer_stereo_projection_depth = client_d3d11_compositor_layer_stereo_projection_depth;
c->base.base.layer_projection_depth = client_d3d11_compositor_layer_projection_depth;
c->base.base.layer_quad = client_d3d11_compositor_layer_quad;
c->base.base.layer_cube = client_d3d11_compositor_layer_cube;
c->base.base.layer_cylinder = client_d3d11_compositor_layer_cylinder;

View file

@ -792,7 +792,7 @@ client_d3d12_compositor_layer_projection(struct xrt_compositor *xc,
assert(data->type == XRT_LAYER_PROJECTION);
struct xrt_swapchain *xscn[XRT_MAX_VIEWS];
for (uint32_t i = 0; i < data->proj.view_count; ++i) {
for (uint32_t i = 0; i < data->view_count; ++i) {
xscn[i] = as_client_d3d12_swapchain(xsc[i])->xsc.get();
}
struct xrt_layer_data d = *data;
@ -802,31 +802,30 @@ client_d3d12_compositor_layer_projection(struct xrt_compositor *xc,
}
static xrt_result_t
client_d3d12_compositor_layer_stereo_projection_depth(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *l_xsc,
struct xrt_swapchain *r_xsc,
struct xrt_swapchain *l_d_xsc,
struct xrt_swapchain *r_d_xsc,
const struct xrt_layer_data *data)
client_d3d12_compositor_layer_projection_depth(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS],
const struct xrt_layer_data *data)
{
struct client_d3d12_compositor *c = as_client_d3d12_compositor(xc);
assert(data->type == XRT_LAYER_STEREO_PROJECTION_DEPTH);
assert(data->type == XRT_LAYER_PROJECTION_DEPTH);
struct xrt_swapchain *l_xscn = as_client_d3d12_swapchain(l_xsc)->xsc.get();
struct xrt_swapchain *r_xscn = as_client_d3d12_swapchain(r_xsc)->xsc.get();
struct xrt_swapchain *l_d_xscn = as_client_d3d12_swapchain(l_d_xsc)->xsc.get();
struct xrt_swapchain *r_d_xscn = as_client_d3d12_swapchain(r_d_xsc)->xsc.get();
struct xrt_swapchain *xscn[XRT_MAX_VIEWS];
struct xrt_swapchain *d_xscn[XRT_MAX_VIEWS];
for (uint32_t i = 0; i < data->view_count; ++i) {
xscn[i] = as_client_d3d12_swapchain(xsc[i])->xsc.get();
d_xscn[i] = as_client_d3d12_swapchain(d_xsc[i])->xsc.get();
}
struct xrt_layer_data d = *data;
client_d3d12_swapchain_scale_rect(l_xsc, &d.stereo_depth.l.sub.norm_rect);
client_d3d12_swapchain_scale_rect(r_xsc, &d.stereo_depth.r.sub.norm_rect);
client_d3d12_swapchain_scale_rect(l_d_xsc, &d.stereo_depth.l_d.sub.norm_rect);
client_d3d12_swapchain_scale_rect(r_d_xsc, &d.stereo_depth.r_d.sub.norm_rect);
for (uint32_t i = 0; i < data->view_count; ++i) {
client_d3d12_swapchain_scale_rect(xsc[i], &d.depth.v[i].sub.norm_rect);
client_d3d12_swapchain_scale_rect(d_xsc[i], &d.depth.d[i].sub.norm_rect);
}
// No flip required: D3D12 swapchain image convention matches Vulkan.
return xrt_comp_layer_stereo_projection_depth(&c->xcn->base, xdev, l_xscn, r_xscn, l_d_xscn, r_d_xscn, &d);
return xrt_comp_layer_projection_depth(&c->xcn->base, xdev, xscn, d_xscn, &d);
}
static xrt_result_t
@ -1136,7 +1135,7 @@ try {
c->base.base.discard_frame = client_d3d12_compositor_discard_frame;
c->base.base.layer_begin = client_d3d12_compositor_layer_begin;
c->base.base.layer_projection = client_d3d12_compositor_layer_projection;
c->base.base.layer_stereo_projection_depth = client_d3d12_compositor_layer_stereo_projection_depth;
c->base.base.layer_projection_depth = client_d3d12_compositor_layer_projection_depth;
c->base.base.layer_quad = client_d3d12_compositor_layer_quad;
c->base.base.layer_cube = client_d3d12_compositor_layer_cube;
c->base.base.layer_cylinder = client_d3d12_compositor_layer_cylinder;

View file

@ -239,7 +239,7 @@ client_gl_compositor_layer_projection(struct xrt_compositor *xc,
xcn = to_native_compositor(xc);
assert(data->type == XRT_LAYER_PROJECTION);
for (uint32_t i = 0; i < data->proj.view_count; ++i) {
for (uint32_t i = 0; i < data->view_count; ++i) {
xscn[i] = &client_gl_swapchain(xsc[i])->xscn->base;
}
struct xrt_layer_data d = *data;
@ -249,32 +249,28 @@ client_gl_compositor_layer_projection(struct xrt_compositor *xc,
}
static xrt_result_t
client_gl_compositor_layer_stereo_projection_depth(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *l_xsc,
struct xrt_swapchain *r_xsc,
struct xrt_swapchain *l_d_xsc,
struct xrt_swapchain *r_d_xsc,
const struct xrt_layer_data *data)
client_gl_compositor_layer_projection_depth(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS],
const struct xrt_layer_data *data)
{
struct xrt_compositor *xcn;
struct xrt_swapchain *l_xscn;
struct xrt_swapchain *r_xscn;
struct xrt_swapchain *l_d_xscn;
struct xrt_swapchain *r_d_xscn;
struct xrt_swapchain *xscn[XRT_MAX_VIEWS];
struct xrt_swapchain *d_xscn[XRT_MAX_VIEWS];
assert(data->type == XRT_LAYER_STEREO_PROJECTION_DEPTH);
assert(data->type == XRT_LAYER_PROJECTION_DEPTH);
xcn = to_native_compositor(xc);
l_xscn = to_native_swapchain(l_xsc);
r_xscn = to_native_swapchain(r_xsc);
l_d_xscn = to_native_swapchain(l_d_xsc);
r_d_xscn = to_native_swapchain(r_d_xsc);
for (uint32_t i = 0; i < data->view_count; ++i) {
xscn[i] = to_native_swapchain(xsc[i]);
d_xscn[i] = to_native_swapchain(d_xsc[i]);
}
struct xrt_layer_data d = *data;
d.flip_y = !d.flip_y;
return xrt_comp_layer_stereo_projection_depth(xcn, xdev, l_xscn, r_xscn, l_d_xscn, r_d_xscn, &d);
return xrt_comp_layer_projection_depth(xcn, xdev, xscn, d_xscn, &d);
}
static xrt_result_t
@ -611,7 +607,7 @@ client_gl_compositor_init(struct client_gl_compositor *c,
c->base.base.discard_frame = client_gl_compositor_discard_frame;
c->base.base.layer_begin = client_gl_compositor_layer_begin;
c->base.base.layer_projection = client_gl_compositor_layer_projection;
c->base.base.layer_stereo_projection_depth = client_gl_compositor_layer_stereo_projection_depth;
c->base.base.layer_projection_depth = client_gl_compositor_layer_projection_depth;
c->base.base.layer_quad = client_gl_compositor_layer_quad;
c->base.base.layer_cube = client_gl_compositor_layer_cube;
c->base.base.layer_cylinder = client_gl_compositor_layer_cylinder;

View file

@ -483,7 +483,7 @@ client_vk_compositor_layer_projection(struct xrt_compositor *xc,
struct xrt_swapchain *xscn[XRT_MAX_VIEWS];
assert(data->type == XRT_LAYER_PROJECTION);
for (uint32_t i = 0; i < data->proj.view_count; ++i) {
for (uint32_t i = 0; i < data->view_count; ++i) {
xscn[i] = &client_vk_swapchain(xsc[i])->xscn->base;
}
@ -496,27 +496,24 @@ client_vk_compositor_layer_projection(struct xrt_compositor *xc,
static xrt_result_t
client_vk_compositor_layer_stereo_projection_depth(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *l_xsc,
struct xrt_swapchain *r_xsc,
struct xrt_swapchain *l_d_xsc,
struct xrt_swapchain *r_d_xsc,
struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS],
const struct xrt_layer_data *data)
{
struct xrt_compositor *xcn;
struct xrt_swapchain *l_xscn;
struct xrt_swapchain *r_xscn;
struct xrt_swapchain *l_d_xscn;
struct xrt_swapchain *r_d_xscn;
assert(data->type == XRT_LAYER_STEREO_PROJECTION_DEPTH);
struct xrt_swapchain *xscn[XRT_MAX_VIEWS];
struct xrt_swapchain *d_xscn[XRT_MAX_VIEWS];
assert(data->type == XRT_LAYER_PROJECTION_DEPTH);
xcn = to_native_compositor(xc);
l_xscn = to_native_swapchain(l_xsc);
r_xscn = to_native_swapchain(r_xsc);
l_d_xscn = to_native_swapchain(l_d_xsc);
r_d_xscn = to_native_swapchain(r_d_xsc);
for (uint32_t i = 0; i < data->view_count; ++i) {
xscn[i] = to_native_swapchain(xsc[i]);
d_xscn[i] = to_native_swapchain(d_xsc[i]);
}
return xrt_comp_layer_stereo_projection_depth(xcn, xdev, l_xscn, r_xscn, l_d_xscn, r_d_xscn, data);
return xrt_comp_layer_projection_depth(xcn, xdev, xscn, d_xscn, data);
}
static xrt_result_t
@ -842,7 +839,7 @@ client_vk_compositor_create(struct xrt_compositor_native *xcn,
c->base.base.discard_frame = client_vk_compositor_discard_frame;
c->base.base.layer_begin = client_vk_compositor_layer_begin;
c->base.base.layer_projection = client_vk_compositor_layer_projection;
c->base.base.layer_stereo_projection_depth = client_vk_compositor_layer_stereo_projection_depth;
c->base.base.layer_projection_depth = client_vk_compositor_layer_stereo_projection_depth;
c->base.base.layer_quad = client_vk_compositor_layer_quad;
c->base.base.layer_cube = client_vk_compositor_layer_cube;
c->base.base.layer_cylinder = client_vk_compositor_layer_cylinder;

View file

@ -273,7 +273,7 @@ can_do_one_projection_layer_fast_path(struct comp_compositor *c)
// Handled by the distortion shader.
if (type != XRT_LAYER_PROJECTION && //
type != XRT_LAYER_STEREO_PROJECTION_DEPTH) {
type != XRT_LAYER_PROJECTION_DEPTH) {
return false;
}

View file

@ -189,7 +189,7 @@ mock_create_native_compositor()
// mc->base.base.discard_frame = mock_compositor_discard_frame;
// mc->base.base.layer_begin = mock_compositor_layer_begin;
// mc->base.base.layer_projection = mock_compositor_layer_projection;
// mc->base.base.layer_stereo_projection_depth = mock_compositor_layer_stereo_projection_depth;
// mc->base.base.layer_projection_depth = mock_compositor_layer_projection_depth;
// mc->base.base.layer_quad = mock_compositor_layer_quad;
// mc->base.base.layer_cube = mock_compositor_layer_cube;
// mc->base.base.layer_cylinder = mock_compositor_layer_cylinder;

View file

@ -164,15 +164,15 @@ struct mock_compositor
/*!
* Optional function pointer for mock compositor, called during @ref
* xrt_comp_layer_stereo_projection_depth
* xrt_comp_layer_projection_depth
*/
xrt_result_t (*layer_stereo_projection_depth)(struct mock_compositor *mc,
struct xrt_device *xdev,
struct xrt_swapchain *l_xsc,
struct xrt_swapchain *r_xsc,
struct xrt_swapchain *l_d_xsc,
struct xrt_swapchain *r_d_xsc,
const struct xrt_layer_data *data);
xrt_result_t (*layer_projection_depth)(struct mock_compositor *mc,
struct xrt_device *xdev,
struct xrt_swapchain *l_xsc,
struct xrt_swapchain *r_xsc,
struct xrt_swapchain *l_d_xsc,
struct xrt_swapchain *r_d_xsc,
const struct xrt_layer_data *data);
/*!
* Optional function pointer for mock compositor, called during @ref xrt_comp_layer_quad

View file

@ -655,7 +655,7 @@ multi_compositor_layer_projection(struct xrt_compositor *xc,
size_t index = mc->progress.layer_count++;
mc->progress.layers[index].xdev = xdev;
for (uint32_t i = 0; i < data->proj.view_count; ++i) {
for (uint32_t i = 0; i < data->view_count; ++i) {
xrt_swapchain_reference(&mc->progress.layers[index].xscs[i], xsc[i]);
}
mc->progress.layers[index].data = *data;
@ -664,22 +664,21 @@ multi_compositor_layer_projection(struct xrt_compositor *xc,
}
static xrt_result_t
multi_compositor_layer_stereo_projection_depth(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *l_xsc,
struct xrt_swapchain *r_xsc,
struct xrt_swapchain *l_d_xsc,
struct xrt_swapchain *r_d_xsc,
const struct xrt_layer_data *data)
multi_compositor_layer_projection_depth(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS],
const struct xrt_layer_data *data)
{
struct multi_compositor *mc = multi_compositor(xc);
size_t index = mc->progress.layer_count++;
mc->progress.layers[index].xdev = xdev;
xrt_swapchain_reference(&mc->progress.layers[index].xscs[0], l_xsc);
xrt_swapchain_reference(&mc->progress.layers[index].xscs[1], r_xsc);
xrt_swapchain_reference(&mc->progress.layers[index].xscs[2], l_d_xsc);
xrt_swapchain_reference(&mc->progress.layers[index].xscs[3], r_d_xsc);
for (uint32_t i = 0; i < data->view_count; ++i) {
xrt_swapchain_reference(&mc->progress.layers[index].xscs[i], xsc[i]);
xrt_swapchain_reference(&mc->progress.layers[index].xscs[i + data->view_count], d_xsc[i]);
}
mc->progress.layers[index].data = *data;
return XRT_SUCCESS;
@ -970,7 +969,7 @@ multi_compositor_create(struct multi_system_compositor *msc,
mc->base.base.discard_frame = multi_compositor_discard_frame;
mc->base.base.layer_begin = multi_compositor_layer_begin;
mc->base.base.layer_projection = multi_compositor_layer_projection;
mc->base.base.layer_stereo_projection_depth = multi_compositor_layer_stereo_projection_depth;
mc->base.base.layer_projection_depth = multi_compositor_layer_projection_depth;
mc->base.base.layer_quad = multi_compositor_layer_quad;
mc->base.base.layer_cube = multi_compositor_layer_cube;
mc->base.base.layer_cylinder = multi_compositor_layer_cylinder;

View file

@ -57,7 +57,7 @@ do_projection_layer(struct xrt_compositor *xc, struct multi_compositor *mc, stru
struct xrt_layer_data *data = (struct xrt_layer_data *)&layer->data;
// Do not need to copy the reference, but should verify the pointers for consistency
for (uint32_t j = 0; j < data->proj.view_count; j++) {
for (uint32_t j = 0; j < data->view_count; j++) {
if (layer->xscs[j] == NULL) {
U_LOG_E("Invalid swap chain for projection layer #%u!", i);
return;
@ -79,14 +79,20 @@ do_projection_layer_depth(struct xrt_compositor *xc,
uint32_t i)
{
struct xrt_device *xdev = layer->xdev;
struct xrt_swapchain *l_xcs = layer->xscs[0];
struct xrt_swapchain *r_xcs = layer->xscs[1];
struct xrt_swapchain *l_d_xcs = layer->xscs[2];
struct xrt_swapchain *r_d_xcs = layer->xscs[3];
if (l_xcs == NULL || r_xcs == NULL || l_d_xcs == NULL || r_d_xcs == NULL) {
U_LOG_E("Invalid swap chain for projection layer #%u!", i);
return;
struct xrt_swapchain *xsc[XRT_MAX_VIEWS];
struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS];
// Cast away
struct xrt_layer_data *data = (struct xrt_layer_data *)&layer->data;
for (uint32_t j = 0; j < data->view_count; j++) {
xsc[j] = layer->xscs[j];
d_xsc[j] = layer->xscs[j + data->view_count];
if (xsc[j] == NULL || d_xsc[j] == NULL) {
U_LOG_E("Invalid swap chain for projection layer #%u!", i);
return;
}
}
if (xdev == NULL) {
@ -94,10 +100,8 @@ do_projection_layer_depth(struct xrt_compositor *xc,
return;
}
// Cast away
struct xrt_layer_data *data = (struct xrt_layer_data *)&layer->data;
xrt_comp_layer_stereo_projection_depth(xc, xdev, l_xcs, r_xcs, l_d_xcs, r_d_xcs, data);
xrt_comp_layer_projection_depth(xc, xdev, xsc, d_xsc, data);
}
static bool
@ -284,7 +288,7 @@ transfer_layers_locked(struct multi_system_compositor *msc, uint64_t display_tim
switch (layer->data.type) {
case XRT_LAYER_PROJECTION: do_projection_layer(xc, mc, layer, i); break;
case XRT_LAYER_STEREO_PROJECTION_DEPTH: do_projection_layer_depth(xc, mc, layer, i); break;
case XRT_LAYER_PROJECTION_DEPTH: do_projection_layer_depth(xc, mc, layer, i); break;
case XRT_LAYER_QUAD: do_quad_layer(xc, mc, layer, i); break;
case XRT_LAYER_CUBE: do_cube_layer(xc, mc, layer, i); break;
case XRT_LAYER_CYLINDER: do_cylinder_layer(xc, mc, layer, i); break;

View file

@ -10,7 +10,7 @@
//! @todo should this be a spcialization const?
#define XRT_LAYER_PROJECTION 0
#define XRT_LAYER_STEREO_PROJECTION_DEPTH 1
#define XRT_LAYER_PROJECTION_DEPTH 1
#define XRT_LAYER_QUAD 2
#define XRT_LAYER_CUBE 3
#define XRT_LAYER_CYLINDER 4
@ -465,7 +465,7 @@ vec4 do_layers(vec2 view_uv)
rgba = do_equirect2(view_uv, layer);
break;
case XRT_LAYER_PROJECTION:
case XRT_LAYER_STEREO_PROJECTION_DEPTH:
case XRT_LAYER_PROJECTION_DEPTH:
rgba = do_projection(view_uv, layer);
break;
case XRT_LAYER_QUAD:

View file

@ -125,8 +125,8 @@ base_layer_projection(struct xrt_compositor *xc,
uint32_t layer_id = cb->slot.layer_count;
struct comp_layer *layer = &cb->slot.layers[layer_id];
assert(ARRAY_SIZE(layer->sc_array) >= data->proj.view_count);
for (uint32_t i = 0; i < data->proj.view_count; ++i) {
assert(ARRAY_SIZE(layer->sc_array) >= data->view_count);
for (uint32_t i = 0; i < data->view_count; ++i) {
layer->sc_array[i] = comp_swapchain(xsc[i]);
}
layer->data = *data;
@ -137,23 +137,21 @@ base_layer_projection(struct xrt_compositor *xc,
}
static xrt_result_t
base_layer_stereo_projection_depth(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *l_xsc,
struct xrt_swapchain *r_xsc,
struct xrt_swapchain *l_d_xsc,
struct xrt_swapchain *r_d_xsc,
const struct xrt_layer_data *data)
base_layer_projection_depth(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS],
const struct xrt_layer_data *data)
{
struct comp_base *cb = comp_base(xc);
uint32_t layer_id = cb->slot.layer_count;
struct comp_layer *layer = &cb->slot.layers[layer_id];
layer->sc_array[0] = comp_swapchain(l_xsc);
layer->sc_array[1] = comp_swapchain(r_xsc);
layer->sc_array[2] = comp_swapchain(l_d_xsc);
layer->sc_array[3] = comp_swapchain(r_d_xsc);
for (uint32_t i = 0; i < data->view_count; ++i) {
layer->sc_array[i] = comp_swapchain(xsc[i]);
layer->sc_array[i + data->view_count] = comp_swapchain(d_xsc[i]);
}
layer->data = *data;
cb->slot.layer_count++;
@ -258,7 +256,7 @@ comp_base_init(struct comp_base *cb)
cb->base.base.import_fence = base_import_fence;
cb->base.base.layer_begin = base_layer_begin;
cb->base.base.layer_projection = base_layer_projection;
cb->base.base.layer_stereo_projection_depth = base_layer_stereo_projection_depth;
cb->base.base.layer_projection_depth = base_layer_projection_depth;
cb->base.base.layer_quad = base_layer_quad;
cb->base.base.layer_cube = base_layer_cube;
cb->base.base.layer_cylinder = base_layer_cylinder;

View file

@ -131,7 +131,7 @@ do_cs_projection_layer(const struct xrt_layer_data *data,
ubo_data->images_samplers[cur_layer + 0].images[0] = cur_image++;
// Depth
if (data->type == XRT_LAYER_STEREO_PROJECTION_DEPTH) {
if (data->type == XRT_LAYER_PROJECTION_DEPTH) {
uint32_t d_array_index = dvd->sub.array_index;
const struct comp_swapchain_image *d_image =
&layer->sc_array[sc_array_index + 2]->images[dvd->sub.image_index];
@ -324,7 +324,7 @@ do_cs_clear(struct render_compute *crc, const struct comp_render_dispatch_data *
}
struct render_viewport_data target_viewport_datas[XRT_MAX_VIEWS];
for (uint32_t i = 0; i < crc->r->view_count; ++i) {
for (uint32_t i = 0; i < d->view_count; ++i) {
target_viewport_datas[i] = d->views[i].target_viewport_data;
}
@ -525,7 +525,7 @@ comp_render_cs_layer(struct render_compute *crc,
case XRT_LAYER_CYLINDER: required_image_samplers = 1; break;
case XRT_LAYER_EQUIRECT2: required_image_samplers = 1; break;
case XRT_LAYER_PROJECTION: required_image_samplers = 1; break;
case XRT_LAYER_STEREO_PROJECTION_DEPTH: required_image_samplers = 2; break;
case XRT_LAYER_PROJECTION_DEPTH: required_image_samplers = 2; break;
case XRT_LAYER_QUAD: required_image_samplers = 1; break;
default:
VK_ERROR(crc->r->vk, "Skipping layer #%u, unknown type: %u", c_layer_i, data->type);
@ -570,7 +570,7 @@ comp_render_cs_layer(struct render_compute *crc,
ubo_data, // ubo_data
&cur_image); // out_cur_image
break;
case XRT_LAYER_STEREO_PROJECTION_DEPTH:
case XRT_LAYER_PROJECTION_DEPTH:
case XRT_LAYER_PROJECTION: {
do_cs_projection_layer( //
data, // data
@ -711,7 +711,7 @@ comp_render_cs_dispatch(struct render_compute *crc,
const struct comp_layer *layer = &layers[i];
const struct xrt_layer_projection_data *proj = &layer->data.proj;
const struct xrt_layer_projection_view_data *vds[XRT_MAX_VIEWS];
for (uint32_t view = 0; view < crc->r->view_count; ++view) {
for (uint32_t view = 0; view < d->view_count; ++view) {
vds[view] = &proj->v[view];
}
do_cs_distortion_for_layer( //
@ -719,13 +719,14 @@ comp_render_cs_dispatch(struct render_compute *crc,
layer, // layer
vds, // vds
d); // d
} else if (fast_path && layers[0].data.type == XRT_LAYER_STEREO_PROJECTION_DEPTH) {
} else if (fast_path && layers[0].data.type == XRT_LAYER_PROJECTION_DEPTH) {
int i = 0;
const struct comp_layer *layer = &layers[i];
const struct xrt_layer_stereo_projection_depth_data *stereo = &layer->data.stereo_depth;
const struct xrt_layer_projection_view_data *vds[2];
vds[0] = &stereo->l;
vds[1] = &stereo->r;
const struct xrt_layer_projection_depth_data *depth = &layer->data.depth;
const struct xrt_layer_projection_view_data *vds[XRT_MAX_VIEWS];
for (uint32_t view = 0; view < d->view_count; ++view) {
vds[view] = &depth->v[view];
}
do_cs_distortion_for_layer( //
crc, // crc
layer, // layer

View file

@ -562,7 +562,7 @@ do_layers(struct render_gfx *rr,
VK_CHK_WITH_GOTO(ret, "do_equirect2_layer", err_layer);
break;
case XRT_LAYER_PROJECTION:
case XRT_LAYER_STEREO_PROJECTION_DEPTH:
case XRT_LAYER_PROJECTION_DEPTH:
ret = do_projection_layer( //
rr, // rr
&layers[i], // layer
@ -627,7 +627,7 @@ do_layers(struct render_gfx *rr,
state->descriptor_sets[i]); //
break;
case XRT_LAYER_PROJECTION:
case XRT_LAYER_STEREO_PROJECTION_DEPTH:
case XRT_LAYER_PROJECTION_DEPTH:
render_gfx_layer_projection( //
rr, //
state->premultiplied_alphas[i], //
@ -827,12 +827,13 @@ comp_render_gfx_dispatch(struct render_gfx *rr,
layer, //
vds); //
} else if (fast_path && layer->data.type == XRT_LAYER_STEREO_PROJECTION_DEPTH) {
} else if (fast_path && layer->data.type == XRT_LAYER_PROJECTION_DEPTH) {
// Fast path.
const struct xrt_layer_stereo_projection_depth_data *stereo = &layer->data.stereo_depth;
const struct xrt_layer_projection_view_data *vds[2];
vds[0] = &stereo->l;
vds[1] = &stereo->r;
const struct xrt_layer_projection_depth_data *depth = &layer->data.depth;
const struct xrt_layer_projection_view_data *vds[XRT_MAX_VIEWS];
for (uint32_t view = 0; view < d->view_count; ++view) {
vds[view] = &depth->v[view];
}
do_mesh_from_proj( //
rr, //
d, //

View file

@ -52,12 +52,7 @@ view_index_to_projection_data(uint32_t view_index,
const struct xrt_layer_projection_view_data **out_vd)
{
const struct xrt_layer_projection_data *proj = &data->proj;
if (is_view_index_right(view_index)) {
*out_vd = &proj->v[view_index];
} else {
*out_vd = &proj->v[view_index];
}
*out_vd = &proj->v[view_index];
}
static inline void
@ -66,15 +61,9 @@ view_index_to_depth_data(uint32_t view_index,
const struct xrt_layer_projection_view_data **out_vd,
const struct xrt_layer_depth_data **out_dvd)
{
const struct xrt_layer_stereo_projection_depth_data *stereo = &data->stereo_depth;
if (is_view_index_right(view_index)) {
*out_vd = &stereo->r;
*out_dvd = &stereo->r_d;
} else {
*out_vd = &stereo->l;
*out_dvd = &stereo->l_d;
}
const struct xrt_layer_projection_depth_data *depth = &data->depth;
*out_vd = &depth->v[view_index];
*out_dvd = &depth->d[view_index];
}
@ -95,7 +84,7 @@ is_layer_view_visible(const struct xrt_layer_data *data, uint32_t view_index)
case XRT_LAYER_EQUIRECT2: visibility = data->equirect2.visibility; break;
case XRT_LAYER_QUAD: visibility = data->quad.visibility; break;
case XRT_LAYER_PROJECTION:
case XRT_LAYER_STEREO_PROJECTION_DEPTH: return true;
case XRT_LAYER_PROJECTION_DEPTH: return true;
default: return false;
};

View file

@ -76,7 +76,7 @@ typedef uint64_t VkDeviceMemory;
enum xrt_layer_type
{
XRT_LAYER_PROJECTION,
XRT_LAYER_STEREO_PROJECTION_DEPTH,
XRT_LAYER_PROJECTION_DEPTH,
XRT_LAYER_QUAD,
XRT_LAYER_CUBE,
XRT_LAYER_CYLINDER,
@ -223,14 +223,13 @@ struct xrt_layer_projection_view_data
};
/*!
* All the pure data values associated with a stereo projection layer.
* All the pure data values associated with a projection layer.
*
* The @ref xrt_swapchain references and @ref xrt_device are provided outside of
* this struct.
*/
struct xrt_layer_projection_data
{
uint32_t view_count;
struct xrt_layer_projection_view_data v[XRT_MAX_VIEWS];
};
@ -258,17 +257,17 @@ struct xrt_layer_depth_test_data
};
/*!
* All the pure data values associated with a stereo projection layer with depth
* All the pure data values associated with a projection layer with depth
* swapchain attached.
*
* The @ref xrt_swapchain references and @ref xrt_device are provided outside of
* this struct.
*/
struct xrt_layer_stereo_projection_depth_data
struct xrt_layer_projection_depth_data
{
struct xrt_layer_projection_view_data l, r;
struct xrt_layer_projection_view_data v[XRT_MAX_VIEWS];
struct xrt_layer_depth_data l_d, r_d;
struct xrt_layer_depth_data d[XRT_MAX_VIEWS];
};
/*!
@ -460,7 +459,7 @@ struct xrt_layer_data
*/
union {
struct xrt_layer_projection_data proj;
struct xrt_layer_stereo_projection_depth_data stereo_depth;
struct xrt_layer_projection_depth_data depth;
struct xrt_layer_quad_data quad;
struct xrt_layer_cube_data cube;
struct xrt_layer_cylinder_data cylinder;
@ -468,6 +467,7 @@ struct xrt_layer_data
struct xrt_layer_equirect2_data equirect2;
struct xrt_layer_passthrough_data passthrough;
};
uint32_t view_count;
};
/*!
@ -1197,7 +1197,7 @@ struct xrt_compositor
xrt_result_t (*layer_begin)(struct xrt_compositor *xc, const struct xrt_layer_frame_data *data);
/*!
* @brief Adds a stereo projection layer for submissions.
* @brief Adds a projection layer for submissions.
*
* Note that e.g. the same swapchain object may be passed as both
* @p l_xsc and @p r_xsc - the parameters in @p data identify
@ -1216,7 +1216,7 @@ struct xrt_compositor
const struct xrt_layer_data *data);
/*!
* @brief Adds a stereo projection layer for submission, has depth information.
* @brief Adds a projection layer for submission, has depth information.
*
* Note that e.g. the same swapchain object may be passed as both
* @p l_xsc and @p r_xsc - the parameters in @p data identify
@ -1234,13 +1234,11 @@ struct xrt_compositor
* including what parts of the supplied swapchain
* objects to use for each view.
*/
xrt_result_t (*layer_stereo_projection_depth)(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *l_xsc,
struct xrt_swapchain *r_xsc,
struct xrt_swapchain *l_d_xsc,
struct xrt_swapchain *r_d_xsc,
const struct xrt_layer_data *data);
xrt_result_t (*layer_projection_depth)(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS],
const struct xrt_layer_data *data);
/*!
* Adds a quad layer for submission, the center of the quad is specified
@ -1695,22 +1693,20 @@ xrt_comp_layer_projection(struct xrt_compositor *xc,
}
/*!
* @copydoc xrt_compositor::layer_stereo_projection_depth
* @copydoc xrt_compositor::layer_projection_depth
*
* Helper for calling through the function pointer.
*
* @public @memberof xrt_compositor
*/
static inline xrt_result_t
xrt_comp_layer_stereo_projection_depth(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *l_xsc,
struct xrt_swapchain *r_xsc,
struct xrt_swapchain *l_d_xsc,
struct xrt_swapchain *r_d_xsc,
const struct xrt_layer_data *data)
xrt_comp_layer_projection_depth(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS],
const struct xrt_layer_data *data)
{
return xc->layer_stereo_projection_depth(xc, xdev, l_xsc, r_xsc, l_d_xsc, r_d_xsc, data);
return xc->layer_projection_depth(xc, xdev, xsc, d_xsc, data);
}
/*!

View file

@ -595,7 +595,7 @@ ipc_compositor_layer_projection(struct xrt_compositor *xc,
struct ipc_layer_entry *layer = &slot->layers[icc->layers.layer_count];
layer->xdev_id = 0; //! @todo Real id.
layer->data = *data;
for (uint32_t i = 0; i < data->proj.view_count; ++i) {
for (uint32_t i = 0; i < data->view_count; ++i) {
struct ipc_client_swapchain *ics = ipc_client_swapchain(xsc[i]);
layer->swapchain_ids[i] = ics->id;
}
@ -606,31 +606,31 @@ ipc_compositor_layer_projection(struct xrt_compositor *xc,
}
static xrt_result_t
ipc_compositor_layer_stereo_projection_depth(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *l_xsc,
struct xrt_swapchain *r_xsc,
struct xrt_swapchain *l_d_xsc,
struct xrt_swapchain *r_d_xsc,
const struct xrt_layer_data *data)
ipc_compositor_layer_projection_depth(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS],
const struct xrt_layer_data *data)
{
struct ipc_client_compositor *icc = ipc_client_compositor(xc);
assert(data->type == XRT_LAYER_STEREO_PROJECTION_DEPTH);
assert(data->type == XRT_LAYER_PROJECTION_DEPTH);
struct ipc_shared_memory *ism = icc->ipc_c->ism;
struct ipc_layer_slot *slot = &ism->slots[icc->layers.slot_id];
struct ipc_layer_entry *layer = &slot->layers[icc->layers.layer_count];
struct ipc_client_swapchain *l = ipc_client_swapchain(l_xsc);
struct ipc_client_swapchain *r = ipc_client_swapchain(r_xsc);
struct ipc_client_swapchain *l_d = ipc_client_swapchain(l_d_xsc);
struct ipc_client_swapchain *r_d = ipc_client_swapchain(r_d_xsc);
struct ipc_client_swapchain *xscn[XRT_MAX_VIEWS];
struct ipc_client_swapchain *d_xscn[XRT_MAX_VIEWS];
for (uint32_t i = 0; i < data->view_count; ++i) {
xscn[i] = ipc_client_swapchain(xsc[i]);
d_xscn[i] = ipc_client_swapchain(d_xsc[i]);
layer->swapchain_ids[i] = xscn[i]->id;
layer->swapchain_ids[i + data->view_count] = d_xscn[i]->id;
}
layer->xdev_id = 0; //! @todo Real id.
layer->swapchain_ids[0] = l->id;
layer->swapchain_ids[1] = r->id;
layer->swapchain_ids[2] = l_d->id;
layer->swapchain_ids[3] = r_d->id;
layer->data = *data;
// Increment the number of layers.
@ -885,7 +885,7 @@ ipc_compositor_init(struct ipc_client_compositor *icc, struct xrt_compositor_nat
icc->base.base.discard_frame = ipc_compositor_discard_frame;
icc->base.base.layer_begin = ipc_compositor_layer_begin;
icc->base.base.layer_projection = ipc_compositor_layer_projection;
icc->base.base.layer_stereo_projection_depth = ipc_compositor_layer_stereo_projection_depth;
icc->base.base.layer_projection_depth = ipc_compositor_layer_projection_depth;
icc->base.base.layer_quad = ipc_compositor_layer_quad;
icc->base.base.layer_cube = ipc_compositor_layer_cube;
icc->base.base.layer_cylinder = ipc_compositor_layer_cylinder;

View file

@ -775,35 +775,32 @@ _update_projection_layer_depth(struct xrt_compositor *xc,
{
// xdev
uint32_t xdevi = layer->xdev_id;
// left
uint32_t l_xsci = layer->swapchain_ids[0];
// right
uint32_t r_xsci = layer->swapchain_ids[1];
// left
uint32_t l_d_xsci = layer->swapchain_ids[2];
// right
uint32_t r_d_xsci = layer->swapchain_ids[3];
// Cast away volatile.
struct xrt_layer_data *data = (struct xrt_layer_data *)&layer->data;
struct xrt_device *xdev = get_xdev(ics, xdevi);
struct xrt_swapchain *l_xcs = ics->xscs[l_xsci];
struct xrt_swapchain *r_xcs = ics->xscs[r_xsci];
struct xrt_swapchain *l_d_xcs = ics->xscs[l_d_xsci];
struct xrt_swapchain *r_d_xcs = ics->xscs[r_d_xsci];
if (l_xcs == NULL || r_xcs == NULL || l_d_xcs == NULL || r_d_xcs == NULL) {
U_LOG_E("Invalid swap chain for projection layer #%u!", i);
return false;
}
if (xdev == NULL) {
U_LOG_E("Invalid xdev for projection layer #%u!", i);
return false;
}
// Cast away volatile.
struct xrt_layer_data *data = (struct xrt_layer_data *)&layer->data;
struct xrt_swapchain *xcs[XRT_MAX_VIEWS];
struct xrt_swapchain *d_xcs[XRT_MAX_VIEWS];
xrt_comp_layer_stereo_projection_depth(xc, xdev, l_xcs, r_xcs, l_d_xcs, r_d_xcs, data);
for (uint32_t j = 0; j < data->view_count; j++) {
int xsci = layer->swapchain_ids[j];
int d_xsci = layer->swapchain_ids[j + data->view_count];
xcs[j] = ics->xscs[xsci];
d_xcs[j] = ics->xscs[d_xsci];
if (xcs[j] == NULL || d_xcs[j] == NULL) {
U_LOG_E("Invalid swap chain for projection layer #%u!", i);
return false;
}
}
xrt_comp_layer_projection_depth(xc, xdev, xcs, d_xcs, data);
return true;
}
@ -977,7 +974,7 @@ _update_layers(volatile struct ipc_client_state *ics, struct xrt_compositor *xc,
return false;
}
break;
case XRT_LAYER_STEREO_PROJECTION_DEPTH:
case XRT_LAYER_PROJECTION_DEPTH:
if (!_update_projection_layer_depth(xc, ics, layer, i)) {
return false;
}

View file

@ -694,7 +694,7 @@ verify_projection_layer(struct oxr_session *sess,
}
#ifdef OXR_HAVE_KHR_composition_layer_depth
if (depth_layer_count > 0 && depth_layer_count != proj->viewCount && proj->viewCount != 2) {
if (depth_layer_count > 0 && depth_layer_count != proj->viewCount) {
return oxr_error(
log, XR_ERROR_VALIDATION_FAILURE,
"(frameEndInfo->layers[%u] projection layer must have %u depth layers or none, but has: %u)",
@ -1258,11 +1258,12 @@ submit_projection_layer(struct oxr_session *sess,
uint64_t xrt_timestamp)
{
struct oxr_space *spc = XRT_CAST_OXR_HANDLE_TO_PTR(struct oxr_space *, proj->space);
struct oxr_swapchain *d_scs[2] = {NULL, NULL};
struct oxr_swapchain *d_scs[XRT_MAX_VIEWS];
struct oxr_swapchain *scs[XRT_MAX_VIEWS];
struct xrt_pose *pose_ptr;
struct xrt_pose pose[XRT_MAX_VIEWS];
struct xrt_swapchain *swapchains[XRT_MAX_VIEWS];
struct xrt_swapchain *d_swapchains[XRT_MAX_VIEWS];
enum xrt_layer_composition_flags flags = convert_layer_flags(proj->layerFlags);
@ -1286,7 +1287,7 @@ submit_projection_layer(struct oxr_session *sess,
data.name = XRT_INPUT_GENERIC_HEAD_POSE;
data.timestamp = xrt_timestamp;
data.flags = flags;
data.proj.view_count = proj->viewCount;
data.view_count = proj->viewCount;
for (size_t i = 0; i < proj->viewCount; ++i) {
struct xrt_fov *fov = (struct xrt_fov *)&proj->views[i].fov;
data.proj.v[i].fov = *fov;
@ -1299,58 +1300,44 @@ submit_projection_layer(struct oxr_session *sess,
fill_in_blend_factors(sess, (XrCompositionLayerBaseHeader *)proj, &data);
fill_in_layer_settings(sess, (XrCompositionLayerBaseHeader *)proj, &data);
#ifdef OXR_HAVE_KHR_composition_layer_depth
if (proj->viewCount == 2) {
const XrCompositionLayerDepthInfoKHR *d_l = OXR_GET_INPUT_FROM_CHAIN(
&proj->views[0], XR_TYPE_COMPOSITION_LAYER_DEPTH_INFO_KHR, XrCompositionLayerDepthInfoKHR);
if (d_l) {
data.stereo_depth.l_d.far_z = d_l->farZ;
data.stereo_depth.l_d.near_z = d_l->nearZ;
data.stereo_depth.l_d.max_depth = d_l->maxDepth;
data.stereo_depth.l_d.min_depth = d_l->minDepth;
// number of depth layers must be 0 or proj->viewCount
const XrCompositionLayerDepthInfoKHR *d_is[XRT_MAX_VIEWS];
for (uint32_t i = 0; i < proj->viewCount; ++i) {
d_scs[i] = NULL;
d_is[i] = OXR_GET_INPUT_FROM_CHAIN(&proj->views[i], XR_TYPE_COMPOSITION_LAYER_DEPTH_INFO_KHR,
XrCompositionLayerDepthInfoKHR);
if (d_is[i]) {
data.depth.d[i].far_z = d_is[i]->farZ;
data.depth.d[i].near_z = d_is[i]->nearZ;
data.depth.d[i].max_depth = d_is[i]->maxDepth;
data.depth.d[i].min_depth = d_is[i]->minDepth;
struct oxr_swapchain *sc =
XRT_CAST_OXR_HANDLE_TO_PTR(struct oxr_swapchain *, d_l->subImage.swapchain);
fill_in_sub_image(sc, &d_l->subImage, &data.stereo_depth.l_d.sub);
// Need to pass this in.
d_scs[0] = sc;
}
const XrCompositionLayerDepthInfoKHR *d_r = OXR_GET_INPUT_FROM_CHAIN(
&proj->views[1], XR_TYPE_COMPOSITION_LAYER_DEPTH_INFO_KHR, XrCompositionLayerDepthInfoKHR);
if (d_r) {
data.stereo_depth.r_d.far_z = d_r->farZ;
data.stereo_depth.r_d.near_z = d_r->nearZ;
data.stereo_depth.r_d.max_depth = d_r->maxDepth;
data.stereo_depth.r_d.min_depth = d_r->minDepth;
struct oxr_swapchain *sc =
XRT_CAST_OXR_HANDLE_TO_PTR(struct oxr_swapchain *, d_r->subImage.swapchain);
fill_in_sub_image(sc, &d_r->subImage, &data.stereo_depth.r_d.sub);
// Need to pass this in.
d_scs[1] = sc;
XRT_CAST_OXR_HANDLE_TO_PTR(struct oxr_swapchain *, d_is[i]->subImage.swapchain);
fill_in_sub_image(sc, &d_is[i]->subImage, &data.depth.d[i].sub);
d_scs[i] = sc;
d_swapchains[i] = sc->swapchain;
}
}
#endif // OXR_HAVE_KHR_composition_layer_depth
if (d_scs[0] != NULL && d_scs[1] != NULL) {
bool d_scs_valid = true;
for (uint32_t i = 0; i < proj->viewCount; i++) {
if (d_scs[i] == NULL) {
d_scs_valid = false;
break;
}
}
if (d_scs_valid) {
#ifdef OXR_HAVE_KHR_composition_layer_depth
fill_in_depth_test(sess, (XrCompositionLayerBaseHeader *)proj, &data);
data.type = XRT_LAYER_STEREO_PROJECTION_DEPTH;
xrt_result_t xret = xrt_comp_layer_stereo_projection_depth( //
xc, // compositor
head, // xdev
scs[0]->swapchain, // left
scs[1]->swapchain, // right
d_scs[0]->swapchain, // left
d_scs[1]->swapchain, // right
&data); // data
OXR_CHECK_XRET(log, sess, xret, xrt_comp_layer_stereo_projection_depth);
data.type = XRT_LAYER_PROJECTION_DEPTH;
xrt_result_t xret = xrt_comp_layer_projection_depth( //
xc, // compositor
head, // xdev
swapchains, // swapchains
d_swapchains, // depth swapchains
&data); // data
OXR_CHECK_XRET(log, sess, xret, xrt_comp_layer_projection_depth);
#else
assert(false && "Should not get here");
#endif // OXR_HAVE_KHR_composition_layer_depth

View file

@ -116,7 +116,7 @@ sdl_program_plus_render(struct sdl_program_plus *spp_ptr)
glClearColor(0.2f, 0.2f, 0.2f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
} else if (spp.c.base.slot.layers[0].data.type == XRT_LAYER_PROJECTION ||
spp.c.base.slot.layers[0].data.type == XRT_LAYER_STEREO_PROJECTION_DEPTH) {
spp.c.base.slot.layers[0].data.type == XRT_LAYER_PROJECTION_DEPTH) {
auto &l = spp.c.base.slot.layers[0];
auto &ssc = *(sdl_swapchain *)l.sc_array[0];