From 7bd1dba1d8370ea3353628198f38531de119e019 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 20 Jun 2021 16:20:05 +0100 Subject: [PATCH] xrt: Add normalized sub-image offset and size in layer data This makes the compositor not have to care about texture size. --- doc/changes/xrt/mr.847.md | 2 ++ src/xrt/include/xrt/xrt_compositor.h | 2 ++ src/xrt/include/xrt/xrt_defines.h | 10 ++++++++++ 3 files changed, 14 insertions(+) create mode 100644 doc/changes/xrt/mr.847.md diff --git a/doc/changes/xrt/mr.847.md b/doc/changes/xrt/mr.847.md new file mode 100644 index 000000000..6f43e0be3 --- /dev/null +++ b/doc/changes/xrt/mr.847.md @@ -0,0 +1,2 @@ +Send down sub-image offsets and sizes in normalised form, this makes it so that +compositor does not need to track the size of swapchains. diff --git a/src/xrt/include/xrt/xrt_compositor.h b/src/xrt/include/xrt/xrt_compositor.h index eea69758a..1add40ff2 100644 --- a/src/xrt/include/xrt/xrt_compositor.h +++ b/src/xrt/include/xrt/xrt_compositor.h @@ -141,6 +141,8 @@ struct xrt_sub_image uint32_t array_index; //! The rectangle in the image to use struct xrt_rect rect; + //! Normalized sub image coordinates and size. + struct xrt_normalized_rect norm_rect; }; /*! diff --git a/src/xrt/include/xrt/xrt_defines.h b/src/xrt/include/xrt/xrt_defines.h index e400fb1a9..2902f6569 100644 --- a/src/xrt/include/xrt/xrt_defines.h +++ b/src/xrt/include/xrt/xrt_defines.h @@ -311,6 +311,16 @@ struct xrt_rect struct xrt_size extent; }; +/*! + * Normalized image rectangle, coordinates and size in 0 .. 1 range. + * + * @ingroup xrt_iface math + */ +struct xrt_normalized_rect +{ + float x, y, w, h; +}; + /*! * A pose composed of a position and orientation. *