comp: Fix OpenGL flipping of subimage coordinates

In the process of flipping OpenGL subimage coordinates (in accordance
with the specification of the XR_KHR_opengl_enable extension), Monado
was incorrectly assuming a subimage height of 1.0.

When the height of the subimage was reduced below 1.0 this was making
Monado clip the bottom instead of the top of the swapchain (as if the
origin was the top-left), and when the subimage Y offset was increased
Monado would show a black bar at the top where the coordinates went out
of range of the swapchain.

Fix this in both the compute and graphics compositor, effectively
replacing the assumed height of 1 with the original subimage height
before negation.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2250>
This commit is contained in:
James Hogan 2024-06-13 17:03:05 +01:00
parent 47ff8dfff3
commit 9422aca625
2 changed files with 2 additions and 2 deletions

View file

@ -425,8 +425,8 @@ do_cs_distortion_for_layer(struct render_compute *crc,
src_image_view = get_image_view(image, data->flags, array_index);
if (data->flip_y) {
src_norm_rect.y += src_norm_rect.h;
src_norm_rect.h = -src_norm_rect.h;
src_norm_rect.y = 1 + src_norm_rect.y;
}
// Fill in data.

View file

@ -774,8 +774,8 @@ do_mesh_from_proj(struct render_gfx *rr,
const VkImageView src_image_view = get_image_view(image, data->flags, array_index);
if (data->flip_y) {
src_norm_rect.y += src_norm_rect.h;
src_norm_rect.h = -src_norm_rect.h;
src_norm_rect.y = 1 + src_norm_rect.y;
}
gfx_mesh_add_view( //