The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

c/render: Tidy mesh shader

authored by

Jakob Bornecrantz and committed by
Jakob Bornecrantz
95e95ba9 0064989e

+11 -20
+5 -7
src/xrt/compositor/main/comp_renderer.c
··· 1 - // Copyright 2019, Collabora, Ltd. 1 + // Copyright 2019-2021, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 265 265 266 266 267 267 struct comp_mesh_ubo_data l_data = { 268 - .rot = l_v->rot, 269 - .flip_y = false, 268 + .vertex_rot = l_v->rot, 270 269 }; 271 270 272 271 if (pre_rotate) { 273 - math_matrix_2x2_multiply(&l_v->rot, &rotation_90_cw, &l_data.rot); 272 + math_matrix_2x2_multiply(&l_v->rot, &rotation_90_cw, &l_data.vertex_rot); 274 273 } 275 274 276 275 struct xrt_view *r_v = &r->c->xdev->hmd->views[1]; ··· 294 293 } 295 294 296 295 struct comp_mesh_ubo_data r_data = { 297 - .rot = r_v->rot, 298 - .flip_y = false, 296 + .vertex_rot = r_v->rot, 299 297 }; 300 298 301 299 if (pre_rotate) { 302 - math_matrix_2x2_multiply(&r_v->rot, &rotation_90_cw, &r_data.rot); 300 + math_matrix_2x2_multiply(&r_v->rot, &rotation_90_cw, &r_data.vertex_rot); 303 301 } 304 302 305 303 /*
+1 -2
src/xrt/compositor/render/comp_render.h
··· 276 276 */ 277 277 struct comp_mesh_ubo_data 278 278 { 279 - struct xrt_matrix_2x2 rot; 280 - int flip_y; 279 + struct xrt_matrix_2x2 vertex_rot; 281 280 }; 282 281 283 282 /*!
+5 -11
src/xrt/compositor/shaders/mesh.vert
··· 1 - // Copyright 2019, Collabora, Ltd. 1 + // Copyright 2019-2021, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 // Author: Lubosz Sarnecki <lubosz.sarnecki@collabora.com> 4 4 // Author: Pete Black <pete.black@collabora.com> 5 + // Author: Jakob Bornecrantz <jakob@collabora.com> 5 6 6 7 #version 450 7 8 8 9 layout (binding = 1, std140) uniform ubo 9 10 { 10 - vec4 rot; 11 - bool flip_y; 11 + vec4 vertex_rot; 12 12 } ubo_vp; 13 13 14 14 layout (location = 0) in vec4 in_pos_ruv; ··· 26 26 void main() 27 27 { 28 28 mat2x2 rot = { 29 - ubo_vp.rot.xy, 30 - ubo_vp.rot.zw, 29 + ubo_vp.vertex_rot.xy, 30 + ubo_vp.vertex_rot.zw, 31 31 }; 32 32 33 33 vec2 pos = rot * in_pos_ruv.xy; 34 34 out_ruv = in_pos_ruv.zw; 35 35 out_guv = in_guv_buv.xy; 36 36 out_buv = in_guv_buv.zw; 37 - 38 - if (ubo_vp.flip_y) { 39 - out_ruv.y = 1.0 - out_ruv.y; 40 - out_guv.y = 1.0 - out_guv.y; 41 - out_buv.y = 1.0 - out_buv.y; 42 - } 43 37 44 38 gl_Position = vec4(pos, 0.0f, 1.0f); 45 39 }