mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-03-04 05:36:58 +00:00
c/render: Tidy mesh shader
This commit is contained in:
parent
0064989e8b
commit
95e95ba9b5
src/xrt/compositor
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2019, Collabora, Ltd.
|
||||
// Copyright 2019-2021, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
|
@ -265,12 +265,11 @@ renderer_build_rendering(struct comp_renderer *r, struct comp_rendering *rr, uin
|
|||
|
||||
|
||||
struct comp_mesh_ubo_data l_data = {
|
||||
.rot = l_v->rot,
|
||||
.flip_y = false,
|
||||
.vertex_rot = l_v->rot,
|
||||
};
|
||||
|
||||
if (pre_rotate) {
|
||||
math_matrix_2x2_multiply(&l_v->rot, &rotation_90_cw, &l_data.rot);
|
||||
math_matrix_2x2_multiply(&l_v->rot, &rotation_90_cw, &l_data.vertex_rot);
|
||||
}
|
||||
|
||||
struct xrt_view *r_v = &r->c->xdev->hmd->views[1];
|
||||
|
@ -294,12 +293,11 @@ renderer_build_rendering(struct comp_renderer *r, struct comp_rendering *rr, uin
|
|||
}
|
||||
|
||||
struct comp_mesh_ubo_data r_data = {
|
||||
.rot = r_v->rot,
|
||||
.flip_y = false,
|
||||
.vertex_rot = r_v->rot,
|
||||
};
|
||||
|
||||
if (pre_rotate) {
|
||||
math_matrix_2x2_multiply(&r_v->rot, &rotation_90_cw, &r_data.rot);
|
||||
math_matrix_2x2_multiply(&r_v->rot, &rotation_90_cw, &r_data.vertex_rot);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -276,8 +276,7 @@ struct comp_viewport_data
|
|||
*/
|
||||
struct comp_mesh_ubo_data
|
||||
{
|
||||
struct xrt_matrix_2x2 rot;
|
||||
int flip_y;
|
||||
struct xrt_matrix_2x2 vertex_rot;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// Copyright 2019, Collabora, Ltd.
|
||||
// Copyright 2019-2021, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
// Author: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
|
||||
// Author: Pete Black <pete.black@collabora.com>
|
||||
// Author: Jakob Bornecrantz <jakob@collabora.com>
|
||||
|
||||
#version 450
|
||||
|
||||
layout (binding = 1, std140) uniform ubo
|
||||
{
|
||||
vec4 rot;
|
||||
bool flip_y;
|
||||
vec4 vertex_rot;
|
||||
} ubo_vp;
|
||||
|
||||
layout (location = 0) in vec4 in_pos_ruv;
|
||||
|
@ -26,8 +26,8 @@ out gl_PerVertex
|
|||
void main()
|
||||
{
|
||||
mat2x2 rot = {
|
||||
ubo_vp.rot.xy,
|
||||
ubo_vp.rot.zw,
|
||||
ubo_vp.vertex_rot.xy,
|
||||
ubo_vp.vertex_rot.zw,
|
||||
};
|
||||
|
||||
vec2 pos = rot * in_pos_ruv.xy;
|
||||
|
@ -35,11 +35,5 @@ void main()
|
|||
out_guv = in_guv_buv.xy;
|
||||
out_buv = in_guv_buv.zw;
|
||||
|
||||
if (ubo_vp.flip_y) {
|
||||
out_ruv.y = 1.0 - out_ruv.y;
|
||||
out_guv.y = 1.0 - out_guv.y;
|
||||
out_buv.y = 1.0 - out_buv.y;
|
||||
}
|
||||
|
||||
gl_Position = vec4(pos, 0.0f, 1.0f);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue