From ca33ac434cb8f50e1e219929c8300457aefe4eb6 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 15 Apr 2022 21:44:46 +0100 Subject: [PATCH] c/render: Correctly scale uv for compute distortion --- src/xrt/compositor/render/render_resources.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xrt/compositor/render/render_resources.c b/src/xrt/compositor/render/render_resources.c index 3a8f47036..83e691442 100644 --- a/src/xrt/compositor/render/render_resources.c +++ b/src/xrt/compositor/render/render_resources.c @@ -449,11 +449,11 @@ create_and_file_in_distortion_buffer_for_view(struct vk_bundle *vk, for (int row = 0; row < COMP_DISTORTION_IMAGE_DIMENSIONS; row++) { // This goes from 0 to 1.0 inclusive. - float v = (double)row / (double)COMP_DISTORTION_IMAGE_DIMENSIONS; + float v = (double)row / (double)(COMP_DISTORTION_IMAGE_DIMENSIONS - 1); for (int col = 0; col < COMP_DISTORTION_IMAGE_DIMENSIONS; col++) { // This goes from 0 to 1.0 inclusive. - float u = (double)col / (double)COMP_DISTORTION_IMAGE_DIMENSIONS; + float u = (double)col / (double)(COMP_DISTORTION_IMAGE_DIMENSIONS - 1); struct xrt_uv_triplet result; xrt_device_compute_distortion(xdev, view, u, v, &result);