c/client: Add support for cube, cylinder and equirect layers

This commit is contained in:
Jakob Bornecrantz 2020-08-13 12:57:51 +01:00 committed by Jakob Bornecrantz
parent 4754dcd11b
commit 1292173b5e
2 changed files with 108 additions and 0 deletions

View file

@ -188,6 +188,57 @@ client_gl_compositor_layer_quad(struct xrt_compositor *xc,
return xrt_comp_layer_quad(&c->xcn->base, xdev, xscfb, data);
}
static xrt_result_t
client_gl_compositor_layer_cube(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
struct xrt_layer_data *data)
{
struct client_gl_compositor *c = client_gl_compositor(xc);
struct xrt_swapchain *xscfb;
assert(data->type == XRT_LAYER_CUBE);
xscfb = &client_gl_swapchain(xsc)->xscn->base;
data->flip_y = true;
return xrt_comp_layer_cube(&c->xcn->base, xdev, xscfb, data);
}
static xrt_result_t
client_gl_compositor_layer_cylinder(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
struct xrt_layer_data *data)
{
struct client_gl_compositor *c = client_gl_compositor(xc);
struct xrt_swapchain *xscfb;
assert(data->type == XRT_LAYER_CYLINDER);
xscfb = &client_gl_swapchain(xsc)->xscn->base;
data->flip_y = true;
return xrt_comp_layer_cylinder(&c->xcn->base, xdev, xscfb, data);
}
static xrt_result_t
client_gl_compositor_layer_equirect(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
struct xrt_layer_data *data)
{
struct client_gl_compositor *c = client_gl_compositor(xc);
struct xrt_swapchain *xscfb;
assert(data->type == XRT_LAYER_EQUIRECT);
xscfb = &client_gl_swapchain(xsc)->xscn->base;
data->flip_y = true;
return xrt_comp_layer_equirect(&c->xcn->base, xdev, xscfb, data);
}
static xrt_result_t
client_gl_compositor_layer_commit(struct xrt_compositor *xc, int64_t frame_id)
{
@ -341,6 +392,9 @@ client_gl_compositor_init(struct client_gl_compositor *c,
c->base.base.layer_stereo_projection =
client_gl_compositor_layer_stereo_projection;
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;
c->base.base.layer_equirect = client_gl_compositor_layer_equirect;
c->base.base.layer_commit = client_gl_compositor_layer_commit;
c->base.base.destroy = client_gl_compositor_destroy;
c->base.base.poll_events = client_gl_compositor_poll_events;

View file

@ -276,6 +276,57 @@ client_vk_compositor_layer_quad(struct xrt_compositor *xc,
return xrt_comp_layer_quad(&c->xcn->base, xdev, xscfb, data);
}
static xrt_result_t
client_vk_compositor_layer_cube(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
struct xrt_layer_data *data)
{
struct client_vk_compositor *c = client_vk_compositor(xc);
struct xrt_swapchain *xscfb;
assert(data->type == XRT_LAYER_CUBE);
xscfb = &client_vk_swapchain(xsc)->xscn->base;
data->flip_y = false;
return xrt_comp_layer_cube(&c->xcn->base, xdev, xscfb, data);
}
static xrt_result_t
client_vk_compositor_layer_cylinder(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
struct xrt_layer_data *data)
{
struct client_vk_compositor *c = client_vk_compositor(xc);
struct xrt_swapchain *xscfb;
assert(data->type == XRT_LAYER_CYLINDER);
xscfb = &client_vk_swapchain(xsc)->xscn->base;
data->flip_y = false;
return xrt_comp_layer_cylinder(&c->xcn->base, xdev, xscfb, data);
}
static xrt_result_t
client_vk_compositor_layer_equirect(struct xrt_compositor *xc,
struct xrt_device *xdev,
struct xrt_swapchain *xsc,
struct xrt_layer_data *data)
{
struct client_vk_compositor *c = client_vk_compositor(xc);
struct xrt_swapchain *xscfb;
assert(data->type == XRT_LAYER_EQUIRECT);
xscfb = &client_vk_swapchain(xsc)->xscn->base;
data->flip_y = false;
return xrt_comp_layer_equirect(&c->xcn->base, xdev, xscfb, data);
}
static xrt_result_t
client_vk_compositor_layer_commit(struct xrt_compositor *xc, int64_t frame_id)
{
@ -468,6 +519,9 @@ client_vk_compositor_create(struct xrt_compositor_native *xcn,
c->base.base.layer_stereo_projection =
client_vk_compositor_layer_stereo_projection;
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;
c->base.base.layer_equirect = client_vk_compositor_layer_equirect;
c->base.base.layer_commit = client_vk_compositor_layer_commit;
c->base.base.destroy = client_vk_compositor_destroy;
c->base.base.poll_events = client_vk_compositor_poll_events;