diff --git a/patches/apply.sh b/patches/apply.sh index 53d51a24..13679c3d 100755 --- a/patches/apply.sh +++ b/patches/apply.sh @@ -1,4 +1,12 @@ #!/bin/sh + +if [ -d ".git" ] ; then + git config user.email > /dev/null || git config user.email "git-am@invalid" + git config user.name > /dev/null || git config user.name "no name" + git checkout . + exec git am "$@"/* +fi + # There is no reliable way to apply a patch and succeed if it was # already applied. Just ignore errors... for f in "$@"/* ; do diff --git a/patches/monado/2305-prevent-moire-artefacts.patch b/patches/monado/0004-c-compute-Prevent-moire-artefacts-in-distortion.patch similarity index 91% rename from patches/monado/2305-prevent-moire-artefacts.patch rename to patches/monado/0004-c-compute-Prevent-moire-artefacts-in-distortion.patch index 2df0dfb0..0858404d 100644 --- a/patches/monado/2305-prevent-moire-artefacts.patch +++ b/patches/monado/0004-c-compute-Prevent-moire-artefacts-in-distortion.patch @@ -1,8 +1,28 @@ +From 27ead38036b39cae803fa03008e8d08b0ff73fb8 Mon Sep 17 00:00:00 2001 +From: Patrick Nicolas +Date: Sun, 11 Aug 2024 18:37:48 +0200 +Subject: [PATCH] c/compute: Prevent moire artefacts in distortion + +If distortion shrinks some areas too much, the shader will only sample a +few pixels and cause moire. +Change the shader so that it averages values between samples. +This is similar to what mipmaps would do, except that creating mipmaps +on a compute queue is not trivial, and accessing them in compute shaders +may be complex too. +--- + src/xrt/compositor/main/comp_renderer.c | 3 + + src/xrt/compositor/render/render_compute.c | 6 ++ + src/xrt/compositor/render/render_interface.h | 3 + + src/xrt/compositor/shaders/distortion.comp | 87 ++++++++++++++++---- + src/xrt/compositor/util/comp_render.h | 2 + + src/xrt/compositor/util/comp_render_cs.c | 8 ++ + 6 files changed, 91 insertions(+), 18 deletions(-) + diff --git a/src/xrt/compositor/main/comp_renderer.c b/src/xrt/compositor/main/comp_renderer.c -index 1b295a324..baabd2a0c 100644 +index 4716c8a71..a39e4275e 100644 --- a/src/xrt/compositor/main/comp_renderer.c +++ b/src/xrt/compositor/main/comp_renderer.c -@@ -1037,6 +1037,9 @@ dispatch_compute(struct comp_renderer *r, +@@ -1038,6 +1038,9 @@ dispatch_compute(struct comp_renderer *r, // Scratch image covers the whole image. struct xrt_normalized_rect layer_norm_rect = {.x = 0.0f, .y = 0.0f, .w = 1.0f, .h = 1.0f}; @@ -277,3 +297,6 @@ index 8201407ae..ea9d1f258 100644 src_poses, // src_fovs, // world_poses, // +-- +2.46.0 + diff --git a/patches/monado/0006-distortion-images.patch b/patches/monado/0005-distortion-images.patch similarity index 80% rename from patches/monado/0006-distortion-images.patch rename to patches/monado/0005-distortion-images.patch index c6702d9c..948b4807 100644 --- a/patches/monado/0006-distortion-images.patch +++ b/patches/monado/0005-distortion-images.patch @@ -1,3 +1,7 @@ +From 1f781690a7d24551c18a6696f8c6a141cc3565c0 Mon Sep 17 00:00:00 2001 +From: galister <3123227-galister@users.noreply.gitlab.com> +Date: Mon, 19 Aug 2024 18:51:45 +0900 +Subject: [PATCH] c/render: Add storage usage to distortion mesh diff --git a/src/xrt/compositor/render/render_distortion.c b/src/xrt/compositor/render/render_distortion.c index 031f74ad5..1255f2616 100644 --- a/src/xrt/compositor/render/render_distortion.c diff --git a/patches/monado/2310-pass-requested-time-for-FB_face_tracking2.patch b/patches/monado/0007-pass-requested-time-for-FB_face_tracking2.patch similarity index 100% rename from patches/monado/2310-pass-requested-time-for-FB_face_tracking2.patch rename to patches/monado/0007-pass-requested-time-for-FB_face_tracking2.patch