The open source OpenXR runtime

a/vk: Make it possible to select vk format in readback pool

+18 -9
+9 -6
src/xrt/auxiliary/vk/vk_image_readback_to_xf_pool.c
··· 21 21 int num_images; 22 22 struct vk_image_readback_to_xf images[READBACK_POOL_NUM_FRAMES]; 23 23 VkExtent2D extent; 24 - enum xrt_format desired_format; 24 + VkFormat vk_format; 25 + enum xrt_format xrt_format; 25 26 }; 26 27 27 28 static void ··· 61 62 VkResult res = vk_create_image_advanced( // 62 63 vk, // 63 64 extent, // 64 - VK_FORMAT_R8G8B8A8_SRGB, // 65 + pool->vk_format, // 65 66 VK_IMAGE_TILING_LINEAR, // 66 67 usage, // 67 68 memory_property_flags, // ··· 115 116 im->base_frame.width = extent.width; 116 117 im->base_frame.height = extent.height; 117 118 im->base_frame.size = stride * extent.height; 118 - im->base_frame.format = pool->desired_format; 119 + im->base_frame.format = pool->xrt_format; 119 120 } 120 121 121 122 /* ··· 176 177 vk_image_readback_to_xf_pool_create(struct vk_bundle *vk, 177 178 VkExtent2D extent, 178 179 struct vk_image_readback_to_xf_pool **out_pool, 179 - enum xrt_format desired_format) 180 + enum xrt_format xrt_format, 181 + VkFormat vk_format) 180 182 { 181 183 struct vk_image_readback_to_xf_pool *pool = U_TYPED_CALLOC(struct vk_image_readback_to_xf_pool); 182 - assert(desired_format == XRT_FORMAT_R8G8B8X8 || desired_format == XRT_FORMAT_R8G8B8A8); 184 + assert(xrt_format == XRT_FORMAT_R8G8B8X8 || xrt_format == XRT_FORMAT_R8G8B8A8); 183 185 int ret = os_mutex_init(&pool->mutex); 184 186 if (ret != 0) { 185 187 assert(false); 186 188 } 187 189 pool->extent = extent; 188 190 pool->num_images = 0; 189 - pool->desired_format = desired_format; 191 + pool->xrt_format = xrt_format; 192 + pool->vk_format = vk_format; 190 193 191 194 *out_pool = pool; 192 195 }
+2 -1
src/xrt/auxiliary/vk/vk_image_readback_to_xf_pool.h
··· 60 60 vk_image_readback_to_xf_pool_create(struct vk_bundle *vk, 61 61 VkExtent2D extent, 62 62 struct vk_image_readback_to_xf_pool **out_pool, 63 - enum xrt_format desired_format); 63 + enum xrt_format xrt_format, 64 + VkFormat vk_format); 64 65 65 66 void 66 67 vk_image_readback_to_xf_pool_destroy(struct vk_bundle *vk, struct vk_image_readback_to_xf_pool **pool_ptr);
+7 -2
src/xrt/compositor/main/comp_renderer.c
··· 591 591 592 592 struct vk_bundle *vk = &r->c->base.vk; 593 593 594 - vk_image_readback_to_xf_pool_create(vk, r->mirror_to_debug_gui.image_extent, &r->mirror_to_debug_gui.pool, 595 - XRT_FORMAT_R8G8B8X8); 594 + vk_image_readback_to_xf_pool_create( // 595 + vk, // 596 + r->mirror_to_debug_gui.image_extent, // 597 + &r->mirror_to_debug_gui.pool, // 598 + XRT_FORMAT_R8G8B8X8, // 599 + VK_FORMAT_R8G8B8A8_SRGB); // 600 + 596 601 VkResult ret = vk_cmd_pool_init(vk, &r->mirror_to_debug_gui.cmd_pool, VK_COMMAND_POOL_CREATE_TRANSIENT_BIT); 597 602 if (ret != VK_SUCCESS) { 598 603 COMP_ERROR(c, "vk_cmd_pool_init: %s", vk_result_string(ret));