The open source OpenXR runtime
0
fork

Configure Feed

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

c/util: Refactor comp_render view adding functions and struct

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2502>

+240 -190
+11 -11
src/xrt/compositor/main/comp_renderer.c
··· 945 945 &world_poses[i], // 946 946 &eye_poses[i], // 947 947 &fovs[i], // 948 - rsci_rtr, // 949 - &layer_viewport_data, // 950 - &layer_norm_rect, // 951 - rsci->image, // 952 - sample_view, // 953 - &vertex_rots[i], // 948 + rsci->image, // squash_image 949 + rsci_rtr, // squash_rtr 950 + &layer_viewport_data, // squash_viewport_data 951 + sample_view, // squash_as_src_sample_view 952 + &layer_norm_rect, // squash_as_src_norm_rect 953 + &vertex_rots[i], // target_vertex_rot 954 954 &viewport_datas[i]); // target_viewport_data 955 955 956 956 if (layer_count == 0) { ··· 1066 1066 &world_poses[i], // 1067 1067 &eye_poses[i], // 1068 1068 &fovs[i], // 1069 - &layer_viewport_data, // 1070 - &layer_norm_rect, // 1071 - rsci->image, // 1072 - sample_view, // 1073 - storage_view, // 1069 + rsci->image, // squash_image 1070 + storage_view, // squash_storage_view 1071 + &layer_viewport_data, // squash_viewport_data 1072 + sample_view, // squash_as_src_sample_view 1073 + &layer_norm_rect, // squash_as_src_norm_rect 1074 1074 &views[i]); // target_viewport_data 1075 1075 1076 1076 if (layer_count == 0) {
+156 -113
src/xrt/compositor/util/comp_render.h
··· 1 1 // Copyright 2019-2024, Collabora, Ltd. 2 + // Copyright 2025, NVIDIA CORPORATION. 2 3 // SPDX-License-Identifier: BSL-1.0 3 4 /*! 4 5 * @file ··· 83 84 struct xrt_fov fov; 84 85 85 86 /*! 86 - * The layer image for this view (aka scratch image), 87 - * used for barrier operations. 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. 88 89 */ 89 - VkImage image; 90 + struct xrt_normalized_rect pre_transform; 90 91 91 - /*! 92 - * View into layer image (aka scratch image), 93 - * used for both GFX (read/write) and CS (read) paths. 94 - */ 95 - VkImageView srgb_view; 92 + struct 93 + { 94 + /*! 95 + * The layer image for this view (aka scratch image), 96 + * used for barrier operations. 97 + */ 98 + VkImage image; 96 99 97 - /*! 98 - * Pre-view layer target viewport_data (where in the image we should 99 - * render the view). 100 - */ 101 - struct render_viewport_data layer_viewport_data; 100 + /*! 101 + * Pre-view layer target viewport_data (where in the image we 102 + * should render the view). 103 + */ 104 + struct render_viewport_data viewport_data; 102 105 103 - /*! 104 - * When sampling from the layer image (aka scratch image), how should we 105 - * transform it to get to the pixels correctly. 106 - */ 107 - struct xrt_normalized_rect layer_norm_rect; 106 + struct 107 + { 108 + //! Per-view layer target resources. 109 + struct render_gfx_target_resources *rtr; 110 + } gfx; 108 111 109 - //! Go from UV to tanangle for the target, this needs to match @p fov. 110 - struct xrt_normalized_rect target_pre_transform; 111 - 112 - // Distortion target viewport data (aka target). 113 - struct render_viewport_data target_viewport_data; 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. 114 121 115 122 struct 116 123 { 117 - //! Per-view layer target resources. 118 - struct render_gfx_target_resources *rtr; 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 + */ 131 + struct xrt_normalized_rect norm_rect; 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; 119 141 120 - //! Distortion target vertex rotation information. 121 - struct xrt_matrix_2x2 vertex_rot; 122 - } gfx; 142 + } squash_as_src; // The input to the target/distortion shaders. 123 143 124 144 struct 125 145 { 126 - //! Only used on compute path. 127 - VkImageView unorm_view; 128 - } cs; 146 + // Distortion target viewport data (aka target). 147 + struct render_viewport_data viewport_data; 148 + 149 + struct 150 + { 151 + //! Distortion target vertex rotation information. 152 + struct xrt_matrix_2x2 vertex_rot; 153 + } gfx; 154 + } target; // When used as a destination. 129 155 }; 130 156 131 157 /*! ··· 147 173 //! Very often true, can be disabled for debugging. 148 174 bool do_timewarp; 149 175 150 - //! Members used only by GFX @ref comp_render_gfx 151 176 struct 152 177 { 153 - //! The resources needed for the target. 154 - struct render_gfx_target_resources *rtr; 155 - } gfx; 178 + //! Members used only by GFX @ref comp_render_gfx 179 + struct 180 + { 181 + //! The resources needed for the target. 182 + struct render_gfx_target_resources *rtr; 183 + } gfx; 156 184 157 - //! Members used only by CS @ref comp_render_cs 158 - struct 159 - { 160 - //! Target image for distortion, used for barrier. 161 - VkImage target_image; 185 + //! Members used only by CS @ref comp_render_cs 186 + struct 187 + { 188 + //! Target image for distortion, used for barrier. 189 + VkImage image; 162 190 163 - //! Target image view for distortion. 164 - VkImageView target_unorm_view; 165 - } cs; 191 + //! Target image view for distortion. 192 + VkImageView storage_view; 193 + } cs; 194 + } target; 166 195 }; 167 196 168 197 /*! ··· 177 206 * Populates @ref comp_render_view_data::eye_pose 178 207 * @param fov Assigned to fov in the view data, and used to compute @ref comp_render_view_data::target_pre_transform 179 208 * Populates @ref comp_render_view_data::fov 180 - * @param layer_viewport_data Where in the image to render the view 181 - * Populates @ref comp_render_view_data::layer_viewport_data 182 - * @param layer_norm_rect How to transform when sampling from the scratch image. 183 - * Populates @ref comp_render_view_data::layer_norm_rect 184 - * @param image Scratch image for this view 185 - * Populates @ref comp_render_view_data::image 186 - * @param srgb_view SRGB image view into the scratch image 187 - * Populates @ref comp_render_view_data::srgb_view 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 188 217 * @param target_viewport_data Distortion target viewport data (aka target) 189 - * Populates @ref comp_render_view_data::target_viewport_data 218 + * Populates @ref comp_render_view_data::target::viewport_data 190 219 191 220 * @return Pointer to the @ref comp_render_view_data we have been populating, for additional setup. 192 221 */ ··· 195 224 const struct xrt_pose *world_pose, 196 225 const struct xrt_pose *eye_pose, 197 226 const struct xrt_fov *fov, 198 - const struct render_viewport_data *layer_viewport_data, 199 - const struct xrt_normalized_rect *layer_norm_rect, 200 - VkImage image, 201 - VkImageView srgb_view, 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, 202 231 const struct render_viewport_data *target_viewport_data) 203 232 { 204 233 uint32_t i = data->view_count++; ··· 207 236 208 237 struct comp_render_view_data *view = &data->views[i]; 209 238 210 - render_calc_uv_to_tangent_lengths_rect(fov, &view->target_pre_transform); 239 + render_calc_uv_to_tangent_lengths_rect(fov, &view->pre_transform); 211 240 241 + // Common 212 242 view->world_pose = *world_pose; 213 243 view->eye_pose = *eye_pose; 214 244 view->fov = *fov; 215 - view->image = image; 216 - view->srgb_view = srgb_view; 217 - view->layer_viewport_data = *layer_viewport_data; 218 - view->layer_norm_rect = *layer_norm_rect; 219 - view->target_viewport_data = *target_viewport_data; 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; 220 256 221 257 return view; 222 258 } ··· 246 282 * Initialize structure for use of the GFX renderer. 247 283 * 248 284 * @param[out] data Common render dispatch data. Will be zeroed and initialized. 249 - * @param rtr GFX-specific resources for the entire frameedg. Must be populated before call. 285 + * @param target_rtr GFX-specific resources for the entire framebuffer. Must be populated before call. 250 286 * @param fast_path Whether we will use the "fast path" avoiding layer squashing. 251 287 * @param do_timewarp Whether timewarp (reprojection) will be performed. 252 288 */ 253 289 static inline void 254 290 comp_render_gfx_initial_init(struct comp_render_dispatch_data *data, 255 - struct render_gfx_target_resources *rtr, 291 + struct render_gfx_target_resources *target_rtr, 256 292 bool fast_path, 257 293 bool do_timewarp) 258 294 { ··· 260 296 261 297 data->fast_path = fast_path; 262 298 data->do_timewarp = do_timewarp; 263 - data->gfx.rtr = rtr; 299 + 300 + // When writing into the target. 301 + data->target.gfx.rtr = target_rtr; 264 302 } 265 303 266 304 /*! ··· 272 310 * @param eye_pose New eye pose of this view 273 311 * Populates @ref comp_render_view_data::eye_pose 274 312 * @param fov Assigned to fov in the view data, and used to 275 - * compute @ref comp_render_view_data::target_pre_transform - also 313 + * compute @ref comp_render_view_data::pre_transform - also 276 314 * populates @ref comp_render_view_data::fov 277 - * @param rtr Will be associated with this view. GFX-specific 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 278 318 * @param layer_viewport_data Where in the image to render the view 279 - * Populates @ref comp_render_view_data::layer_viewport_data 280 - * @param layer_norm_rect How to transform when sampling from the scratch image. 281 - * Populates @ref comp_render_view_data::layer_norm_rect 282 - * @param image Scratch image for this view 283 - * Populates @ref comp_render_view_data::image 284 - * @param srgb_view SRGB image view into the scratch image 285 - * Populates @ref comp_render_view_data::srgb_view 286 - * @param vertex_rot 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 287 326 * @param target_viewport_data Distortion target viewport data (aka target) 288 - * Populates @ref comp_render_view_data::target_viewport_data 327 + * Populates @ref comp_render_view_data::target.viewport_data 289 328 */ 290 329 static inline void 291 330 comp_render_gfx_add_view(struct comp_render_dispatch_data *data, 292 331 const struct xrt_pose *world_pose, 293 332 const struct xrt_pose *eye_pose, 294 333 const struct xrt_fov *fov, 295 - struct render_gfx_target_resources *rtr, 334 + VkImage squash_image, 335 + struct render_gfx_target_resources *squash_rtr, 296 336 const struct render_viewport_data *layer_viewport_data, 297 - const struct xrt_normalized_rect *layer_norm_rect, 298 - VkImage image, 299 - VkImageView srgb_view, 300 - const struct xrt_matrix_2x2 *vertex_rot, 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, 301 340 const struct render_viewport_data *target_viewport_data) 302 341 { 303 342 struct comp_render_view_data *view = comp_render_dispatch_add_view( // ··· 305 344 world_pose, // 306 345 eye_pose, // 307 346 fov, // 347 + squash_image, // 308 348 layer_viewport_data, // 309 - layer_norm_rect, // 310 - image, // 311 - srgb_view, // 349 + squash_as_src_sample_view, // 350 + squash_as_src_norm_rect, // 312 351 target_viewport_data); 313 352 314 - // TODO why is the one in data not used instead 315 - view->gfx.rtr = rtr; 316 - view->gfx.vertex_rot = *vertex_rot; 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; 317 358 } 318 359 319 360 /*! ··· 417 458 * 418 459 * @param data Common render dispatch data. Will be zeroed and initialized. 419 460 * @param target_image Image to render into 420 - * @param target_unorm_view Corresponding image view 461 + * @param target_storage_view Corresponding image view 421 462 * @param fast_path Whether we will use the "fast path" avoiding layer squashing. 422 463 * @param do_timewarp Whether timewarp (reprojection) will be performed. 423 464 */ 424 465 static inline void 425 466 comp_render_cs_initial_init(struct comp_render_dispatch_data *data, 426 467 VkImage target_image, 427 - VkImageView target_unorm_view, 468 + VkImageView target_storage_view, 428 469 bool fast_path, 429 470 bool do_timewarp) 430 471 { ··· 433 474 data->fast_path = fast_path; 434 475 data->do_timewarp = do_timewarp; 435 476 436 - data->cs.target_image = target_image; 437 - data->cs.target_unorm_view = target_unorm_view; 477 + // When writing into the target. 478 + data->target.cs.image = target_image; 479 + data->target.cs.storage_view = target_storage_view; 438 480 } 439 481 440 482 /*! ··· 445 487 * Populates @ref comp_render_view_data::world_pose 446 488 * @param eye_pose New eye pose of this view 447 489 * Populates @ref comp_render_view_data::eye_pose 448 - * @param fov Assigned to fov in the view data, and used to compute @ref comp_render_view_data::target_pre_transform 490 + * @param fov Assigned to fov in the view data, and used to compute @ref comp_render_view_data::pre_transform. 449 491 * Populates @ref comp_render_view_data::fov 450 - * @param layer_viewport_data Where in the image to render the view 451 - * Populates @ref comp_render_view_data::layer_viewport_data 452 - * @param layer_norm_rect How to transform when sampling from the scratch image. 453 - * Populates @ref comp_render_view_data::layer_norm_rect 454 - * @param image Scratch image for this view 455 - * Populates @ref comp_render_view_data::image 456 - * @param srgb_view SRGB image view into the scratch image 457 - * Populates @ref comp_render_view_data::srgb_view 458 - * @param unorm_view UNORM image view into the scratch image, CS specific 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 459 501 * @param target_viewport_data Distortion target viewport data (aka target) 460 - * Populates @ref comp_render_view_data::target_viewport_data 502 + * Populates @ref comp_render_view_data::target::viewport_data 461 503 */ 462 504 static inline void 463 505 comp_render_cs_add_view(struct comp_render_dispatch_data *data, 464 506 const struct xrt_pose *world_pose, 465 507 const struct xrt_pose *eye_pose, 466 508 const struct xrt_fov *fov, 467 - const struct render_viewport_data *layer_viewport_data, 468 - const struct xrt_normalized_rect *layer_norm_rect, 469 - VkImage image, 470 - VkImageView srgb_view, 471 - VkImageView unorm_view, 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, 472 514 const struct render_viewport_data *target_viewport_data) 473 515 { 474 516 struct comp_render_view_data *view = comp_render_dispatch_add_view( // ··· 476 518 world_pose, // 477 519 eye_pose, // 478 520 fov, // 479 - layer_viewport_data, // 480 - layer_norm_rect, // 481 - image, // 482 - srgb_view, // 483 - target_viewport_data); 521 + squash_image, // 522 + squash_viewport_data, // 523 + squash_as_src_sample_view, // 524 + squash_as_src_norm_rect, // 525 + target_viewport_data); // 484 526 485 - view->cs.unorm_view = unorm_view; 527 + // When writing into the squash (aka scratch) image. 528 + view->squash.cs.storage_view = squash_storage_view; 486 529 } 487 530 488 531 /*!
+43 -42
src/xrt/compositor/util/comp_render_cs.c
··· 1 1 // Copyright 2019-2024, Collabora, Ltd. 2 + // Copyright 2025, NVIDIA CORPORATION. 2 3 // SPDX-License-Identifier: BSL-1.0 3 4 /*! 4 5 * @file ··· 339 340 340 341 struct render_viewport_data target_viewport_datas[XRT_MAX_VIEWS]; 341 342 for (uint32_t i = 0; i < d->view_count; ++i) { 342 - target_viewport_datas[i] = d->views[i].target_viewport_data; 343 + target_viewport_datas[i] = d->views[i].target.viewport_data; 343 344 } 344 345 345 346 346 - render_compute_clear( // 347 - render, // 348 - d->cs.target_image, // 349 - d->cs.target_unorm_view, // target_image_view 350 - target_viewport_datas); // views 347 + render_compute_clear( // 348 + render, // 349 + d->target.cs.image, // 350 + d->target.cs.storage_view, // target_image_view 351 + target_viewport_datas); // views 351 352 } 352 353 353 354 /* ··· 380 381 struct xrt_normalized_rect src_norm_rect; 381 382 382 383 // Gather data. 383 - src_image_view = d->views[i].srgb_view; // Read with gamma curve. 384 - src_norm_rect = d->views[i].layer_norm_rect; 385 - viewport_data = d->views[i].target_viewport_data; 384 + src_image_view = d->views[i].squash_as_src.sample_view; 385 + src_norm_rect = d->views[i].squash_as_src.norm_rect; 386 + viewport_data = d->views[i].target.viewport_data; 386 387 387 388 // Fill in data. 388 389 src_image_views[i] = src_image_view; ··· 391 392 target_viewport_datas[i] = viewport_data; 392 393 } 393 394 394 - render_compute_projection( // 395 - render, // 396 - src_samplers, // 397 - src_image_views, // 398 - src_norm_rects, // 399 - d->cs.target_image, // 400 - d->cs.target_unorm_view, // target_image_view 401 - target_viewport_datas); // views 395 + render_compute_projection( // 396 + render, // 397 + src_samplers, // 398 + src_image_views, // 399 + src_norm_rects, // 400 + d->target.cs.image, // 401 + d->target.cs.storage_view, // target_image_view 402 + target_viewport_datas); // views 402 403 } 403 404 404 405 /// Fast path ··· 442 443 // Gather data. 443 444 src_image_view = get_image_view(image, data->flags, array_index); 444 445 src_norm_rect = vds[i]->sub.norm_rect; 445 - viewport_data = d->views[i].target_viewport_data; 446 + viewport_data = d->views[i].target.viewport_data; 446 447 src_fov = vds[i]->fov; 447 448 src_pose = vds[i]->pose; 448 449 world_pose = d->views[i].world_pose; ··· 464 465 } 465 466 466 467 if (!d->do_timewarp) { 467 - render_compute_projection( // 468 - render, // 469 - src_samplers, // 470 - src_image_views, // 471 - src_norm_rects, // 472 - d->cs.target_image, // 473 - d->cs.target_unorm_view, // 474 - target_viewport_datas); // 468 + render_compute_projection( // 469 + render, // 470 + src_samplers, // 471 + src_image_views, // 472 + src_norm_rects, // 473 + d->target.cs.image, // 474 + d->target.cs.storage_view, // 475 + target_viewport_datas); // 475 476 } else { 476 477 render_compute_projection_timewarp( // 477 478 render, // ··· 481 482 src_poses, // 482 483 src_fovs, // 483 484 world_poses, // 484 - d->cs.target_image, // 485 - d->cs.target_unorm_view, // 485 + d->target.cs.image, // 486 + d->target.cs.storage_view, // 486 487 target_viewport_datas); // 487 488 } 488 489 } ··· 672 673 const struct comp_render_dispatch_data *d, 673 674 VkImageLayout transition_to) 674 675 { 675 - cmd_barrier_view_images( // 676 + cmd_barrier_view_squash_images( // 676 677 render->r->vk, // 677 678 d, // 678 679 render->r->cmd, // cmd ··· 686 687 for (uint32_t view_index = 0; view_index < d->view_count; view_index++) { 687 688 const struct comp_render_view_data *view = &d->views[view_index]; 688 689 689 - comp_render_cs_layer( // 690 - render, // 691 - view_index, // 692 - layers, // 693 - layer_count, // 694 - &view->target_pre_transform, // 695 - &view->world_pose, // 696 - &view->eye_pose, // 697 - view->image, // 698 - view->cs.unorm_view, // 699 - &view->layer_viewport_data, // 700 - d->do_timewarp); // 690 + comp_render_cs_layer( // 691 + render, // 692 + view_index, // 693 + layers, // 694 + layer_count, // 695 + &view->pre_transform, // 696 + &view->world_pose, // 697 + &view->eye_pose, // 698 + view->squash.image, // 699 + view->squash.cs.storage_view, // 700 + &view->squash.viewport_data, // 701 + d->do_timewarp); // 701 702 } 702 703 703 - cmd_barrier_view_images( // 704 + cmd_barrier_view_squash_images( // 704 705 render->r->vk, // 705 706 d, // 706 707 render->r->cmd, // cmd
+14 -13
src/xrt/compositor/util/comp_render_gfx.c
··· 1 1 // Copyright 2023-2024, Collabora, Ltd. 2 + // Copyright 2025, NVIDIA CORPORATION. 2 3 // SPDX-License-Identifier: BSL-1.0 3 4 /*! 4 5 * @file ··· 489 490 { 490 491 render_gfx_begin_target( // 491 492 render, // 492 - d->gfx.rtr, // 493 + d->target.gfx.rtr, // 493 494 &background_color_idle); // 494 495 495 496 render_gfx_end_target(render); ··· 522 523 for (uint32_t i = 0; i < d->view_count; i++) { 523 524 524 525 struct render_gfx_mesh_ubo_data data = { 525 - .vertex_rot = d->views[i].gfx.vertex_rot, 526 + .vertex_rot = d->views[i].target.gfx.vertex_rot, 526 527 .post_transform = md->views[i].src_norm_rect, 527 528 }; 528 529 529 530 // Extra arguments for timewarp. 530 531 if (do_timewarp) { 531 - data.pre_transform = d->views[i].target_pre_transform; 532 + data.pre_transform = d->views[i].pre_transform; 532 533 533 534 render_calc_time_warp_matrix( // 534 535 &md->views[i].src_pose, // ··· 555 556 556 557 render_gfx_begin_target( // 557 558 render, // 558 - d->gfx.rtr, // 559 + d->target.gfx.rtr, // 559 560 &background_color_active); // 560 561 561 562 for (uint32_t i = 0; i < d->view_count; i++) { 562 563 // Convenience. 563 - const struct render_viewport_data *viewport_data = &d->views[i].target_viewport_data; 564 + const struct render_viewport_data *viewport_data = &d->views[i].target.viewport_data; 564 565 565 566 render_gfx_begin_view( // 566 567 render, // ··· 597 598 for (uint32_t i = 0; i < d->view_count; i++) { 598 599 struct xrt_pose src_pose = d->views[i].world_pose; 599 600 struct xrt_fov src_fov = d->views[i].fov; 600 - VkImageView src_image_view = d->views[i].srgb_view; 601 - struct xrt_normalized_rect src_norm_rect = d->views[i].layer_norm_rect; 601 + VkImageView src_image_view = d->views[i].squash_as_src.sample_view; 602 + struct xrt_normalized_rect src_norm_rect = d->views[i].squash_as_src.norm_rect; 602 603 603 604 gfx_mesh_add_view( // 604 605 &md, // ··· 807 808 for (uint32_t view = 0; view < d->view_count; view++) { 808 809 809 810 // Convenience. 810 - const struct render_viewport_data *viewport_data = &d->views[view].layer_viewport_data; 811 + const struct render_viewport_data *viewport_data = &d->views[view].squash.viewport_data; 811 812 812 - render_gfx_begin_target( // 813 - render, // 814 - d->views[view].gfx.rtr, // 815 - color); // 813 + render_gfx_begin_target( // 814 + render, // 815 + d->views[view].squash.gfx.rtr, // 816 + color); // 816 817 817 818 render_gfx_begin_view( // 818 819 render, // ··· 859 860 } 860 861 861 862 862 - cmd_barrier_view_images( // 863 + cmd_barrier_view_squash_images( // 863 864 render->r->vk, // 864 865 d, // 865 866 render->r->cmd, // cmd
+16 -11
src/xrt/compositor/util/comp_render_helpers.h
··· 1 1 // Copyright 2023-2024, Collabora, Ltd. 2 + // Copyright 2025, NVIDIA CORPORATION. 2 3 // SPDX-License-Identifier: BSL-1.0 3 4 /*! 4 5 * @file ··· 138 139 * 139 140 */ 140 141 142 + /*! 143 + * This inserts a barrier operation that effects all views[X].squash.image 144 + * fields (which are VkImages). 145 + */ 141 146 static inline void 142 - cmd_barrier_view_images(struct vk_bundle *vk, 143 - const struct comp_render_dispatch_data *d, 144 - VkCommandBuffer cmd, 145 - VkAccessFlags src_access_mask, 146 - VkAccessFlags dst_access_mask, 147 - VkImageLayout transition_from, 148 - VkImageLayout transition_to, 149 - VkPipelineStageFlags src_stage_mask, 150 - VkPipelineStageFlags dst_stage_mask) 147 + cmd_barrier_view_squash_images(struct vk_bundle *vk, 148 + const struct comp_render_dispatch_data *d, 149 + VkCommandBuffer cmd, 150 + VkAccessFlags src_access_mask, 151 + VkAccessFlags dst_access_mask, 152 + VkImageLayout transition_from, 153 + VkImageLayout transition_to, 154 + VkPipelineStageFlags src_stage_mask, 155 + VkPipelineStageFlags dst_stage_mask) 151 156 { 152 157 VkImageSubresourceRange first_color_level_subresource_range = { 153 158 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, ··· 160 165 for (uint32_t i = 0; i < d->view_count; i++) { 161 166 bool already_barriered = false; 162 167 163 - VkImage image = d->views[i].image; 168 + VkImage image = d->views[i].squash.image; 164 169 165 170 uint32_t k = i; 166 171 while (k > 0) { 167 172 k--; // k is always greater then zero. 168 173 169 - if (d->views[k].image == image) { 174 + if (d->views[k].squash.image == image) { 170 175 already_barriered = true; 171 176 break; 172 177 }