xrt: Pass the flip y on layer per layer basis.

st/oxr: Adopt to flip y in layers change.
c/client: Adapt to flip y in layers change.
Set true for GL and false for Vulkan.
This commit is contained in:
Lubosz Sarnecki 2020-05-22 16:01:41 +02:00 committed by Jakob Bornecrantz
parent e445f60ccf
commit 9c8d0ae3cc
4 changed files with 26 additions and 16 deletions

View file

@ -152,7 +152,8 @@ client_gl_compositor_layer_stereo_projection(
struct xrt_rect *r_rect,
uint32_t r_array_index,
struct xrt_fov *r_fov,
struct xrt_pose *r_pose)
struct xrt_pose *r_pose,
bool flip_y)
{
struct client_gl_compositor *c = client_gl_compositor(xc);
struct xrt_swapchain *l_xscfd, *r_xscfd;
@ -163,7 +164,7 @@ client_gl_compositor_layer_stereo_projection(
xrt_comp_layer_stereo_projection(
&c->xcfd->base, timestamp, xdev, name, layer_flags, l_xscfd,
l_image_index, l_rect, l_array_index, l_fov, l_pose, r_xscfd,
r_image_index, r_rect, r_array_index, r_fov, r_pose);
r_image_index, r_rect, r_array_index, r_fov, r_pose, true);
}
static void
@ -178,7 +179,8 @@ client_gl_compositor_layer_quad(struct xrt_compositor *xc,
struct xrt_rect *rect,
uint32_t array_index,
struct xrt_pose *pose,
struct xrt_vec2 *size)
struct xrt_vec2 *size,
bool flip_y)
{
struct client_gl_compositor *c = client_gl_compositor(xc);
struct xrt_swapchain *xscfb;
@ -187,7 +189,7 @@ client_gl_compositor_layer_quad(struct xrt_compositor *xc,
xrt_comp_layer_quad(&c->xcfd->base, timestamp, xdev, name, layer_flags,
visibility, xscfb, image_index, rect, array_index,
pose, size);
pose, size, true);
}
static void

View file

@ -170,7 +170,8 @@ client_vk_compositor_layer_stereo_projection(
struct xrt_rect *r_rect,
uint32_t r_array_index,
struct xrt_fov *r_fov,
struct xrt_pose *r_pose)
struct xrt_pose *r_pose,
bool flip_y)
{
struct client_vk_compositor *c = client_vk_compositor(xc);
struct xrt_swapchain *l_xscfd, *r_xscfd;
@ -181,7 +182,7 @@ client_vk_compositor_layer_stereo_projection(
xrt_comp_layer_stereo_projection(
&c->xcfd->base, timestamp, xdev, name, layer_flags, l_xscfd,
l_image_index, l_rect, l_array_index, l_fov, l_pose, r_xscfd,
r_image_index, r_rect, r_array_index, r_fov, r_pose);
r_image_index, r_rect, r_array_index, r_fov, r_pose, false);
}
static void
@ -196,7 +197,8 @@ client_vk_compositor_layer_quad(struct xrt_compositor *xc,
struct xrt_rect *rect,
uint32_t array_index,
struct xrt_pose *pose,
struct xrt_vec2 *size)
struct xrt_vec2 *size,
bool flip_y)
{
struct client_vk_compositor *c = client_vk_compositor(xc);
struct xrt_swapchain *xscfb;
@ -205,7 +207,7 @@ client_vk_compositor_layer_quad(struct xrt_compositor *xc,
xrt_comp_layer_quad(&c->xcfd->base, timestamp, xdev, name, layer_flags,
visibility, xscfb, image_index, rect, array_index,
pose, size);
pose, size, false);
}
static void

View file

@ -273,6 +273,7 @@ struct xrt_compositor
* @param r_array_index Right array index.
* @param r_fov Right fov the left projection rendered with.
* @param r_pose Right pose the left projection rendered with.
* @param flip_y Flip Y texture coordinates.
*/
void (*layer_stereo_projection)(
struct xrt_compositor *xc,
@ -291,7 +292,8 @@ struct xrt_compositor
struct xrt_rect *r_rect,
uint32_t r_array_index,
struct xrt_fov *r_fov,
struct xrt_pose *r_pose);
struct xrt_pose *r_pose,
bool flip_y);
/*!
* Adds a quad layer for submission, the center of the quad is specified
@ -308,6 +310,7 @@ struct xrt_compositor
* @param array_index Array index.
* @param pose Pose the left projection rendered with.
* @param size Size of the quad in meters.
* @param flip_y Flip Y texture coordinates.
*/
void (*layer_quad)(struct xrt_compositor *xc,
uint64_t timestamp,
@ -320,7 +323,8 @@ struct xrt_compositor
struct xrt_rect *rect,
uint32_t array_index,
struct xrt_pose *pose,
struct xrt_vec2 *size);
struct xrt_vec2 *size,
bool flip_y);
/*!
* Commits all of the submitted layers, it's from this on that the
@ -472,12 +476,13 @@ xrt_comp_layer_stereo_projection(struct xrt_compositor *xc,
struct xrt_rect *r_rect,
uint32_t r_array_index,
struct xrt_fov *r_fov,
struct xrt_pose *r_pose)
struct xrt_pose *r_pose,
bool flip_y)
{
xc->layer_stereo_projection(xc, timestamp, xdev, name, layer_flags,
l_sc, l_image_index, l_rect, l_array_index,
l_fov, l_pose, r_sc, r_image_index, r_rect,
r_array_index, r_fov, r_pose);
r_array_index, r_fov, r_pose, flip_y);
}
/*!
@ -497,10 +502,11 @@ xrt_comp_layer_quad(struct xrt_compositor *xc,
struct xrt_rect *rect,
uint32_t array_index,
struct xrt_pose *pose,
struct xrt_vec2 *size)
struct xrt_vec2 *size,
bool flip_y)
{
xc->layer_quad(xc, timestamp, xdev, name, layer_flags, visibility, sc,
image_index, rect, array_index, pose, size);
image_index, rect, array_index, pose, size, flip_y);
}
/*!

View file

@ -553,7 +553,7 @@ submit_quad_layer(struct xrt_compositor *xc,
(enum xrt_layer_eye_visibility)quad->eyeVisibility, sc->swapchain,
sc->released_index, (struct xrt_rect *)&quad->subImage.imageRect,
quad->subImage.imageArrayIndex, (struct xrt_pose *)&quad->pose,
(struct xrt_vec2 *)&quad->size);
(struct xrt_vec2 *)&quad->size, false);
}
static void
@ -586,7 +586,7 @@ submit_projection_layer(struct xrt_compositor *xc,
(struct xrt_rect *)&proj->views[1].subImage.imageRect,
proj->views[1].subImage.imageArrayIndex,
(struct xrt_fov *)&proj->views[1].fov,
(struct xrt_pose *)&proj->views[1].pose);
(struct xrt_pose *)&proj->views[1].pose, false);
}
XrResult