The open source OpenXR runtime
0
fork

Configure Feed

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

c/main: Create render pass and targets for scratch images

+32 -1
+32 -1
src/xrt/compositor/main/comp_renderer.c
··· 89 89 90 90 //! Scratch images used for layer squasher. 91 91 struct render_scratch_images scratch; 92 + 93 + //! Render pass for graphics pipeline rendering to the scratch buffer. 94 + struct render_gfx_render_pass scratch_render_pass; 95 + 96 + //! Targets for rendering to the scratch buffer. 97 + struct render_gfx_target_resources scratch_targets[2]; 98 + 92 99 //! @} 93 100 94 101 //! @name Image-dependent members ··· 467 474 } 468 475 469 476 VkExtent2D extent = r->scratch.extent; 470 - r->lr = comp_layer_renderer_create(vk, &r->c->shaders, extent, VK_FORMAT_B8G8R8A8_SRGB); 477 + r->lr = comp_layer_renderer_create(vk, &r->c->shaders, extent, VK_FORMAT_R8G8B8A8_SRGB); 471 478 if (layer_count != 0) { 472 479 comp_layer_renderer_allocate_layers(r->lr, layer_count); 473 480 } ··· 571 578 assert(false && "Whelp, can't return an error. But should never really fail."); 572 579 } 573 580 581 + render_gfx_render_pass_init( // 582 + &r->scratch_render_pass, // rgrp 583 + &r->c->nr, // r 584 + VK_FORMAT_R8G8B8A8_SRGB, // format 585 + VK_ATTACHMENT_LOAD_OP_CLEAR, // load_op 586 + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); // final_layout 587 + 588 + for (uint32_t i = 0; i < ARRAY_SIZE(r->scratch_targets); i++) { 589 + render_gfx_target_resources_init( // 590 + &r->scratch_targets[i], // 591 + &r->c->nr, // 592 + &r->scratch_render_pass, // 593 + r->scratch.color[i].srgb_view, // 594 + scratch_extent); // 595 + } 596 + 574 597 // Try to early-allocate these, in case we can. 575 598 renderer_ensure_images_and_renderings(r, false); 576 599 ··· 832 855 833 856 // Do this after the mirror struct. 834 857 comp_layer_renderer_destroy(&(r->lr)); 858 + 859 + // Do this after the layer renderer. 860 + for (uint32_t i = 0; i < ARRAY_SIZE(r->scratch_targets); i++) { 861 + render_gfx_target_resources_close(&r->scratch_targets[i]); 862 + } 863 + 864 + // Do this after the layer renderer and targert resources. 865 + render_gfx_render_pass_close(&r->scratch_render_pass); 835 866 836 867 // Destroy any scratch images created. 837 868 render_scratch_images_close(&r->c->nr, &r->scratch);