Monado OpenXR Runtime
comp_render.h
Go to the documentation of this file.
1// Copyright 2019-2024, Collabora, Ltd.
2// Copyright 2025, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief Compositor render implementation.
7 * @author Jakob Bornecrantz <jakob@collabora.com>
8 * @author Rylie Pavlik <rylie.pavlik@collabora.com>
9 * @ingroup comp_util
10 */
11
12#pragma once
13
14#include "xrt/xrt_defines.h"
15#include "xrt/xrt_vulkan_includes.h" // IWYU pragma: keep
16
18#include "util/u_misc.h"
19
20#include <assert.h>
21
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27struct comp_layer;
28struct render_compute;
29struct render_gfx;
31
32
33/*!
34 * @defgroup comp_render
35 * @brief Renders, aka "layer squashers" and distortion application.
36 *
37 * Two parallel implementations of the render module exist:
38 *
39 * - one uses graphics shaders (aka GFX, @ref comp_render_gfx, @ref comp_render_gfx.c)
40 * - the other uses compute shaders (aka CS, @ref comp_render_cs, @ref comp_render_cs.c)
41 *
42 * Their abilities are effectively equivalent, although the graphics version disregards depth
43 * data, while the compute shader does use it somewhat.
44 *
45 * @note In general this module requires that swapchains in your supplied @ref comp_layer layers
46 * implement @ref comp_swapchain in addition to just @ref xrt_swapchain.
47 */
48
49/*
50 *
51 * Input data struct.
52 *
53 */
54
55/*!
56 * @name Input data structs
57 * @{
58 */
59
60/*!
61 * The input data needed for a single view, shared between both GFX and CS
62 * paths.
63 *
64 * To fully render a single view two "rendering" might be needed, the
65 * first being the layer squashing, and the second is the distortion step. The
66 * target for the layer squashing is referred to as "layer" or "scratch" and
67 * prefixed with `layer` if needs be. The other final step is referred to as
68 * "distortion target" or just "target", and is prefixed with `target`.
69 *
70 * @ingroup comp_render
71 */
73{
74 //! New world pose of this view.
76
77 //! New eye pose of this view.
79
80 /*!
81 * New fov of this view, used for the layer scratch image. Needs to
82 * match distortion parameters if distortion is used.
83 */
84 struct xrt_fov fov;
85
86 /*!
87 * Go from UV to tanangle for both the target and layer image since
88 * they share the same fov, this needs to match @p fov.
89 */
91
92 struct
93 {
94 /*!
95 * The layer image for this view (aka scratch image),
96 * used for barrier operations.
97 */
98 VkImage image;
99
100 /*!
101 * Pre-view layer target viewport_data (where in the image we
102 * should render the view).
103 */
105
106 struct
107 {
108 //! Per-view layer target resources.
110 } gfx;
111
112 struct
113 {
114 /*!
115 * View into layer image (aka scratch image), for used
116 * as a storage tagert of the CS (write) path.
117 */
118 VkImageView storage_view;
119 } cs;
120 } squash; // When used as a destination.
121
122 struct
123 {
124 /*!
125 * When sampling from the layer image (aka scratch image), how
126 * should we transform it to get to the pixels correctly.
127 *
128 * Ignored when doing a fast path and reading directly from
129 * the app projection layer.
130 */
132
133 /*!
134 * View into layer image (aka scratch image) when sampling the
135 * image, used for both GFX (read) and CS (read) paths.
136 *
137 * Ignored when doing a fast path and reading directly from
138 * the app projection layer.
139 */
140 VkImageView sample_view;
141
142 } squash_as_src; // The input to the target/distortion shaders.
143
144 struct
145 {
146 // Distortion target viewport data (aka target).
148
149 struct
150 {
151 //! Distortion target vertex rotation information.
153 } gfx;
154 } target; // When used as a destination.
155};
156
157/*!
158 * The input data needed for a complete layer squashing distortion rendering
159 * to a target. This struct is shared between GFX and CS paths.
160 *
161 * @ingroup comp_render
162 */
164{
165 struct comp_render_view_data views[XRT_MAX_VIEWS];
166
167 //! The number of views currently in this dispatch data.
168 uint32_t view_count;
169
170 //! Fast path can be disabled for mirroing so needs to be an argument.
172
173 //! Very often true, can be disabled for debugging.
175
176 struct
177 {
178 //! Members used only by GFX @ref comp_render_gfx
179 struct
180 {
181 //! The resources needed for the target.
184
185 //! Members used only by CS @ref comp_render_cs
186 struct
187 {
188 //! Target image for distortion, used for barrier.
189 VkImage image;
190
191 //! Target image view for distortion.
192 VkImageView storage_view;
193 } cs;
194 } target;
195};
196
197/*!
198 * Shared implementation setting up common view params between GFX and CS.
199 *
200 * Private implementation method, do not use outside of more-specific add_view calls!
201 *
202 * @param data Common render dispatch data, will be updated
203 * @param world_pose New world pose of this view.
204 * Populates @ref comp_render_view_data::world_pose
205 * @param eye_pose New eye pose of this view
206 * Populates @ref comp_render_view_data::eye_pose
207 * @param fov Assigned to fov in the view data, and used to compute @ref comp_render_view_data::target_pre_transform
208 * Populates @ref comp_render_view_data::fov
209 * @param squash_image Scratch image for this view
210 * Populates @ref comp_render_view_data::squash::image
211 * @param squash_viewport_data Where in the image to render the view
212 * Populates @ref comp_render_view_data::squash::viewport_data
213 * @param squash_as_src_sample_view The image view into the scratch image for sampling.
214 * Populates @ref comp_render_view_data::squash_as_src::sample_view
215 * @param squash_as_src_norm_rect How to transform when sampling from the scratch image.
216 * Populates @ref comp_render_view_data::squash_as_src::norm_rect
217 * @param target_viewport_data Distortion target viewport data (aka target)
218 * Populates @ref comp_render_view_data::target::viewport_data
219
220 * @return Pointer to the @ref comp_render_view_data we have been populating, for additional setup.
221 */
222static inline struct comp_render_view_data *
224 const struct xrt_pose *world_pose,
225 const struct xrt_pose *eye_pose,
226 const struct xrt_fov *fov,
227 VkImage squash_image,
228 const struct render_viewport_data *squash_viewport_data,
229 VkImageView squash_as_src_sample_view,
230 const struct xrt_normalized_rect *squash_as_src_norm_rect,
231 const struct render_viewport_data *target_viewport_data)
232{
233 uint32_t i = data->view_count++;
234
235 assert(i < ARRAY_SIZE(data->views));
236
237 struct comp_render_view_data *view = &data->views[i];
238
240
241 // Common
242 view->world_pose = *world_pose;
243 view->eye_pose = *eye_pose;
244 view->fov = *fov;
245
246 // When writing into the squash (aka scratch) image.
247 view->squash.image = squash_image;
248 view->squash.viewport_data = *squash_viewport_data;
249
250 // When using the squash (aka scratch) image as a source.
251 view->squash_as_src.sample_view = squash_as_src_sample_view;
252 view->squash_as_src.norm_rect = *squash_as_src_norm_rect;
253
254 // When writing into the target.
255 view->target.viewport_data = *target_viewport_data;
256
257 return view;
258}
259
260/*! @} */
261
262/*
263 *
264 * Gfx functions.
265 *
266 */
267
268/*!
269 *
270 * @defgroup comp_render_gfx
271 *
272 * GFX renderer control and dispatch - uses graphics shaders.
273 *
274 * Depends on the common @ref comp_render_dispatch_data, as well as the resources
275 * @ref render_gfx_target_resources (often called `rtr`), and @ref render_gfx.
276 *
277 * @ingroup comp_render
278 * @{
279 */
280
281/*!
282 * Initialize structure for use of the GFX renderer.
283 *
284 * @param[out] data Common render dispatch data. Will be zeroed and initialized.
285 * @param target_rtr GFX-specific resources for the entire framebuffer. Must be populated before call.
286 * @param fast_path Whether we will use the "fast path" avoiding layer squashing.
287 * @param do_timewarp Whether timewarp (reprojection) will be performed.
288 */
289static inline void
291 struct render_gfx_target_resources *target_rtr,
292 bool fast_path,
293 bool do_timewarp)
294{
295 U_ZERO(data);
296
297 data->fast_path = fast_path;
298 data->do_timewarp = do_timewarp;
299
300 // When writing into the target.
301 data->target.gfx.rtr = target_rtr;
302}
303
304/*!
305 * Add view to the common data, as required by the GFX renderer.
306 *
307 * @param[in,out] data Common render dispatch data, will be updated
308 * @param world_pose New world pose of this view.
309 * Populates @ref comp_render_view_data::world_pose
310 * @param eye_pose New eye pose of this view
311 * Populates @ref comp_render_view_data::eye_pose
312 * @param fov Assigned to fov in the view data, and used to
313 * compute @ref comp_render_view_data::pre_transform - also
314 * populates @ref comp_render_view_data::fov
315 * @param layer_image Scratch image for this view
316 * Populates @ref comp_render_view_data::squash::image
317 * @param later_rtr Will be associated with this view. GFX-specific
318 * @param layer_viewport_data Where in the image to render the view
319 * Populates @ref comp_render_view_data::squash::viewport_data
320 * @param squash_as_src_norm_rect How to transform when sampling from the scratch image.
321 * Populates @ref comp_render_view_data::squash_as_src::norm_rect
322 * @param squash_as_src_sample_view The image view into the scratch image for sampling.
323 * Populates @ref comp_render_view_data::squash_as_src::sample_view
324 * @param target_vertex_rot
325 * Populates @ref comp_render_view_data::target.gfx.vertex_rot
326 * @param target_viewport_data Distortion target viewport data (aka target)
327 * Populates @ref comp_render_view_data::target.viewport_data
328 */
329static inline void
331 const struct xrt_pose *world_pose,
332 const struct xrt_pose *eye_pose,
333 const struct xrt_fov *fov,
334 VkImage squash_image,
335 struct render_gfx_target_resources *squash_rtr,
336 const struct render_viewport_data *layer_viewport_data,
337 VkImageView squash_as_src_sample_view,
338 const struct xrt_normalized_rect *squash_as_src_norm_rect,
339 const struct xrt_matrix_2x2 *target_vertex_rot,
340 const struct render_viewport_data *target_viewport_data)
341{
343 data, //
344 world_pose, //
345 eye_pose, //
346 fov, //
347 squash_image, //
348 layer_viewport_data, //
349 squash_as_src_sample_view, //
350 squash_as_src_norm_rect, //
351 target_viewport_data);
352
353 // When writing into the squash (aka scratch) image.
354 view->squash.gfx.rtr = squash_rtr;
355
356 // When writing into the target.
357 view->target.gfx.vertex_rot = *target_vertex_rot;
358}
359
360/*!
361 * Dispatch the (graphics pipeline) layer squasher, on any number of views.
362 *
363 * All source layer images needs to be in the correct image layout, no barrier
364 * is inserted for them. The target images are barriered from undefined to general
365 * so they can be written to, then to the layout defined by @p transition_to.
366 *
367 * Expected layouts:
368 *
369 * - Layer images: `VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL`
370 * - Target images: Any
371 *
372 * After call layouts:
373 *
374 * - Layer images: `VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL`
375 * - Target images: @p transition_to
376 *
377 * @note Swapchains in the @p layers must implement @ref comp_swapchain in
378 * addition to just @ref xrt_swapchain, as this function downcasts to @ref comp_swapchain !
379 *
380 * @param render Graphics renderer object
381 * @param[in] layers Layers to render, see note.
382 * @param[in] layer_count Number of elements in @p layers array.
383 * @param[in] d Common render dispatch data
384 * @param[in] transition_to Desired image layout for target images
385 */
386void
388 const struct comp_layer *layers,
389 uint32_t layer_count,
390 const struct comp_render_dispatch_data *d,
391 VkImageLayout transition_to);
392
393/*!
394 * Writes the needed commands to the @ref render_gfx to do a full composition with distortion.
395 *
396 * Takes a set of layers, new device poses, scratch
397 * images with associated @ref render_gfx_target_resources and writes the needed
398 * commands to the @ref render_gfx to do a full composition with distortion.
399 * The scratch images are optionally used to squash layers should it not be
400 * possible to do a @p comp_render_dispatch_data::fast_path. Will use the render
401 * passes of the targets which set the layout.
402 *
403 * The render passes of @p comp_render_dispatch_data::views::rtr must be created
404 * with a final_layout of `VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL` or there will
405 * be validation errors.
406 *
407 * Expected layouts:
408 *
409 * - Layer images: `VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL`
410 * - Scratch images: Any (as per the @ref render_gfx_render_pass)
411 * - Target image: Any (as per the @ref render_gfx_render_pass)
412 *
413 * After call layouts:
414 *
415 * - Layer images: `VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL`
416 * - Scratch images: `VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL`
417 * - Target image: What the render pass of @p rtr specifies.
418 *
419 * @note Swapchains in the @p layers must implement @ref comp_swapchain in
420 * addition to just @ref xrt_swapchain, as this function downcasts to @ref comp_swapchain !
421 *
422 * @param render GFX render object
423 * @param[in] layers Layers to render, see note.
424 * @param[in] layer_count Number of elements in @p layers array.
425 * @param[in] d Common render dispatch data
426 */
427void
429 const struct comp_layer *layers,
430 const uint32_t layer_count,
431 const struct comp_render_dispatch_data *d);
432
433/* end of comp_render_gfx group */
434
435/*! @} */
436
437
438/*
439 *
440 * CS functions.
441 *
442 */
443
444/*!
445 *
446 * @defgroup comp_render_cs
447 *
448 * CS renderer control and dispatch - uses compute shaders
449 *
450 * Depends on @ref render_compute
451 *
452 * @ingroup comp_render
453 * @{
454 */
455
456/*!
457 * Initialize structure for use of the CS renderer.
458 *
459 * @param data Common render dispatch data. Will be zeroed and initialized.
460 * @param target_image Image to render into
461 * @param target_storage_view Corresponding image view
462 * @param fast_path Whether we will use the "fast path" avoiding layer squashing.
463 * @param do_timewarp Whether timewarp (reprojection) will be performed.
464 */
465static inline void
467 VkImage target_image,
468 VkImageView target_storage_view,
469 bool fast_path,
470 bool do_timewarp)
471{
472 U_ZERO(data);
473
474 data->fast_path = fast_path;
475 data->do_timewarp = do_timewarp;
476
477 // When writing into the target.
478 data->target.cs.image = target_image;
479 data->target.cs.storage_view = target_storage_view;
480}
481
482/*!
483 * Add view to the common data, as required by the CS renderer.
484 *
485 * @param[in,out] data Common render dispatch data, will be updated
486 * @param world_pose New world pose of this view.
487 * Populates @ref comp_render_view_data::world_pose
488 * @param eye_pose New eye pose of this view
489 * Populates @ref comp_render_view_data::eye_pose
490 * @param fov Assigned to fov in the view data, and used to compute @ref comp_render_view_data::pre_transform.
491 * Populates @ref comp_render_view_data::fov
492 * @param squash_image Scratch image for this view
493 * Populates @ref comp_render_view_data::squash::image
494 * @param squash_storage_view Image view into the scratch image for storage, CS specific
495 * @param squash_viewport_data Where in the image to render the view
496 * Populates @ref comp_render_view_data::squash::viewport_data
497 * @param squash_as_src_sample_view The image view into the scratch image for sampling.
498 * Populates @ref comp_render_view_data::squash_as_src::sample_view
499 * @param squash_as_src_norm_rect How to transform when sampling from the scratch image.
500 * Populates @ref comp_render_view_data::squash_as_src::norm_rect
501 * @param target_viewport_data Distortion target viewport data (aka target)
502 * Populates @ref comp_render_view_data::target::viewport_data
503 */
504static inline void
506 const struct xrt_pose *world_pose,
507 const struct xrt_pose *eye_pose,
508 const struct xrt_fov *fov,
509 VkImage squash_image,
510 VkImageView squash_storage_view,
511 const struct render_viewport_data *squash_viewport_data,
512 VkImageView squash_as_src_sample_view,
513 const struct xrt_normalized_rect *squash_as_src_norm_rect,
514 const struct render_viewport_data *target_viewport_data)
515{
517 data, //
518 world_pose, //
519 eye_pose, //
520 fov, //
521 squash_image, //
522 squash_viewport_data, //
523 squash_as_src_sample_view, //
524 squash_as_src_norm_rect, //
525 target_viewport_data); //
526
527 // When writing into the squash (aka scratch) image.
528 view->squash.cs.storage_view = squash_storage_view;
529}
530
531/*!
532 * Dispatch the layer squasher for a single view.
533 *
534 * All source layer images and target image needs to be in the correct image
535 * layout, no barrier is inserted at all. The @p view_index argument is needed
536 * to grab a pre-allocated UBO from the @ref render_resources and to correctly
537 * select left/right data from various layers.
538 *
539 * Expected layouts:
540 *
541 * - Layer images: `VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL`
542 * - Target images: `VK_IMAGE_LAYOUT_GENERAL`
543 *
544 * @note Swapchains in the @p layers must implement @ref comp_swapchain in
545 * addition to just @ref xrt_swapchain, as this function downcasts to @ref comp_swapchain !
546 *
547 * @param render Compute renderer object
548 * @param view_index Index of the view
549 * @param layers Layers to render, see note.
550 * @param layer_count Number of elements in @p layers array.
551 * @param pre_transform
552 * @param world_pose
553 * @param eye_pose
554 * @param target_image
555 * @param target_image_view
556 * @param target_view
557 * @param do_timewarp
558 */
559void
561 uint32_t view_index,
562 const struct comp_layer *layers,
563 const uint32_t layer_count,
565 const struct xrt_pose *world_pose,
566 const struct xrt_pose *eye_pose,
567 const VkImage target_image,
568 const VkImageView target_image_view,
569 const struct render_viewport_data *target_view,
570 bool do_timewarp);
571
572/*!
573 * Dispatch the layer squasher, on any number of views.
574 *
575 * All source layer images needs to be in the correct image layout, no barrier
576 * is inserted for them. The target images are barriered from undefined to general
577 * so they can be written to, then to the layout defined by @p transition_to.
578 *
579 * Expected layouts:
580 *
581 * - Layer images: `VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL`
582 * - Target images: Any
583 *
584 * After call layouts:
585 *
586 * - Layer images: `VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL`
587 * - Target images: @p transition_to
588 *
589 * @note Swapchains in the @p layers must implement @ref comp_swapchain in
590 * addition to just @ref xrt_swapchain, as this function downcasts to @ref comp_swapchain !
591 *
592 * @param render Compute renderer object
593 * @param[in] layers Layers to render, see note.
594 * @param[in] layer_count Number of elements in @p layers array.
595 * @param[in] d Common render dispatch data
596 * @param[in] transition_to Desired image layout for target images
597 */
598void
600 const struct comp_layer *layers,
601 const uint32_t layer_count,
602 const struct comp_render_dispatch_data *d,
603 VkImageLayout transition_to);
604
605/*!
606 * Write commands to @p render to do a full composition with distortion.
607 *
608 * Helper function that takes a set of layers, new device poses, a scratch
609 * images and writes the needed commands to the @ref render_compute to do a full
610 * composition with distortion. The scratch images are optionally used to squash
611 * layers should it not be possible to do a fast_path. Will insert barriers to
612 * change the scratch images and target images to the needed layout.
613 *
614 *
615 * Expected layouts:
616 *
617 * - Layer images: `VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL`
618 * - Scratch images: Any
619 * - Target image: Any
620 *
621 * After call layouts:
622 *
623 * - Layer images: `VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL`
624 * - Scratch images: `VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL`
625 * - Target image: `VK_IMAGE_LAYOUT_PRESENT_SRC_KHR`
626 *
627 * @note Swapchains in the @p layers must implement @ref comp_swapchain in
628 * addition to just @ref xrt_swapchain, as this function downcasts to @ref comp_swapchain !
629 *
630 * @param render Compute renderer object
631 * @param[in] layers Layers to render, see note.
632 * @param[in] layer_count Number of elements in @p layers array.
633 * @param[in] d Common render dispatch data
634 *
635 */
636void
638 const struct comp_layer *layers,
639 const uint32_t layer_count,
640 const struct comp_render_dispatch_data *d);
641
642/* end of comp_render_cs group */
643/*! @} */
644
645#ifdef __cplusplus
646}
647#endif
static struct comp_render_view_data * comp_render_dispatch_add_view(struct comp_render_dispatch_data *data, const struct xrt_pose *world_pose, const struct xrt_pose *eye_pose, const struct xrt_fov *fov, VkImage squash_image, const struct render_viewport_data *squash_viewport_data, VkImageView squash_as_src_sample_view, const struct xrt_normalized_rect *squash_as_src_norm_rect, const struct render_viewport_data *target_viewport_data)
Shared implementation setting up common view params between GFX and CS.
Definition: comp_render.h:223
#define U_ZERO(PTR)
Zeroes the correct amount of memory based on the type pointed-to by the argument.
Definition: u_misc.h:68
void comp_render_cs_layers(struct render_compute *render, const struct comp_layer *layers, const uint32_t layer_count, const struct comp_render_dispatch_data *d, VkImageLayout transition_to)
Dispatch the layer squasher, on any number of views.
Definition: comp_render_cs.c:670
static void comp_render_cs_initial_init(struct comp_render_dispatch_data *data, VkImage target_image, VkImageView target_storage_view, bool fast_path, bool do_timewarp)
Initialize structure for use of the CS renderer.
Definition: comp_render.h:466
void comp_render_cs_dispatch(struct render_compute *render, const struct comp_layer *layers, const uint32_t layer_count, const struct comp_render_dispatch_data *d)
Write commands to render to do a full composition with distortion.
Definition: comp_render_cs.c:717
void comp_render_cs_layer(struct render_compute *render, uint32_t view_index, const struct comp_layer *layers, const uint32_t layer_count, const struct xrt_normalized_rect *pre_transform, const struct xrt_pose *world_pose, const struct xrt_pose *eye_pose, const VkImage target_image, const VkImageView target_image_view, const struct render_viewport_data *target_view, bool do_timewarp)
Dispatch the layer squasher for a single view.
Definition: comp_render_cs.c:499
static void comp_render_cs_add_view(struct comp_render_dispatch_data *data, const struct xrt_pose *world_pose, const struct xrt_pose *eye_pose, const struct xrt_fov *fov, VkImage squash_image, VkImageView squash_storage_view, const struct render_viewport_data *squash_viewport_data, VkImageView squash_as_src_sample_view, const struct xrt_normalized_rect *squash_as_src_norm_rect, const struct render_viewport_data *target_viewport_data)
Add view to the common data, as required by the CS renderer.
Definition: comp_render.h:505
void comp_render_gfx_dispatch(struct render_gfx *render, const struct comp_layer *layers, const uint32_t layer_count, const struct comp_render_dispatch_data *d)
Writes the needed commands to the render_gfx to do a full composition with distortion.
Definition: comp_render_gfx.c:884
void comp_render_gfx_layers(struct render_gfx *render, const struct comp_layer *layers, uint32_t layer_count, const struct comp_render_dispatch_data *d, VkImageLayout transition_to)
Dispatch the (graphics pipeline) layer squasher, on any number of views.
Definition: comp_render_gfx.c:678
static void comp_render_gfx_add_view(struct comp_render_dispatch_data *data, const struct xrt_pose *world_pose, const struct xrt_pose *eye_pose, const struct xrt_fov *fov, VkImage squash_image, struct render_gfx_target_resources *squash_rtr, const struct render_viewport_data *layer_viewport_data, VkImageView squash_as_src_sample_view, const struct xrt_normalized_rect *squash_as_src_norm_rect, const struct xrt_matrix_2x2 *target_vertex_rot, const struct render_viewport_data *target_viewport_data)
Add view to the common data, as required by the GFX renderer.
Definition: comp_render.h:330
static void comp_render_gfx_initial_init(struct comp_render_dispatch_data *data, struct render_gfx_target_resources *target_rtr, bool fast_path, bool do_timewarp)
Initialize structure for use of the GFX renderer.
Definition: comp_render.h:290
void render_calc_uv_to_tangent_lengths_rect(const struct xrt_fov *fov, struct xrt_normalized_rect *out_rect)
This function constructs a transformation in the form of a normalized rect that lets you go from a UV...
Definition: render_util.c:127
The NEW compositor rendering code header.
A single layer in a comp_layer_accum.
Definition: comp_layer_accum.h:36
The input data needed for a complete layer squashing distortion rendering to a target.
Definition: comp_render.h:164
VkImageView storage_view
Target image view for distortion.
Definition: comp_render.h:192
uint32_t view_count
The number of views currently in this dispatch data.
Definition: comp_render.h:168
struct render_gfx_target_resources * rtr
The resources needed for the target.
Definition: comp_render.h:182
bool do_timewarp
Very often true, can be disabled for debugging.
Definition: comp_render.h:174
VkImage image
Target image for distortion, used for barrier.
Definition: comp_render.h:189
struct comp_render_dispatch_data::@114::@115 gfx
Members used only by GFX Comp_render_gfx.
struct comp_render_dispatch_data::@114::@116 cs
Members used only by CS Comp_render_cs.
bool fast_path
Fast path can be disabled for mirroing so needs to be an argument.
Definition: comp_render.h:171
The input data needed for a single view, shared between both GFX and CS paths.
Definition: comp_render.h:73
VkImageView storage_view
View into layer image (aka scratch image), for used as a storage tagert of the CS (write) path.
Definition: comp_render.h:118
struct xrt_fov fov
New fov of this view, used for the layer scratch image.
Definition: comp_render.h:84
struct xrt_normalized_rect norm_rect
When sampling from the layer image (aka scratch image), how should we transform it to get to the pixe...
Definition: comp_render.h:131
struct xrt_matrix_2x2 vertex_rot
Distortion target vertex rotation information.
Definition: comp_render.h:152
VkImageView sample_view
View into layer image (aka scratch image) when sampling the image, used for both GFX (read) and CS (r...
Definition: comp_render.h:140
struct xrt_pose world_pose
New world pose of this view.
Definition: comp_render.h:75
struct render_gfx_target_resources * rtr
Per-view layer target resources.
Definition: comp_render.h:109
struct xrt_pose eye_pose
New eye pose of this view.
Definition: comp_render.h:78
VkImage image
The layer image for this view (aka scratch image), used for barrier operations.
Definition: comp_render.h:98
struct render_viewport_data viewport_data
Pre-view layer target viewport_data (where in the image we should render the view).
Definition: comp_render.h:104
struct xrt_normalized_rect pre_transform
Go from UV to tanangle for both the target and layer image since they share the same fov,...
Definition: comp_render.h:90
The semi-low level resources and operations required to squash layers and/or apply distortion for a s...
Definition: render_interface.h:1166
Each rendering (render_gfx) render to one or more targets (render_gfx_target_resources),...
Definition: render_interface.h:785
The low-level resources and operations to perform layer squashing and/or mesh distortion for a single...
Definition: render_interface.h:848
The pure data information about a view that the renderer is rendering to.
Definition: render_interface.h:687
Describes a projection matrix fov.
Definition: xrt_defines.h:483
A tightly packed 2x2 matrix of floats.
Definition: xrt_defines.h:510
Normalized image rectangle, coordinates and size in 0 .
Definition: xrt_defines.h:451
A pose composed of a position and orientation.
Definition: xrt_defines.h:463
Very small misc utils.
#define ARRAY_SIZE(a)
Array size helper.
Definition: xrt_compiler.h:56
Common defines and enums for XRT.
Include all of the Vulkan headers in one place, and cope with any "messy" includes implied by it.