The open source OpenXR runtime
0
fork

Configure Feed

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

st/oxr: Refactor format skipping code

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

+36 -2
+36 -2
src/xrt/state_trackers/oxr/oxr_session.c
··· 1 1 // Copyright 2018-2024, Collabora, Ltd. 2 + // Copyright 2024-2025, NVIDIA CORPORATION. 2 3 // SPDX-License-Identifier: BSL-1.0 3 4 /*! 4 5 * @file ··· 63 64 * Helpers. 64 65 * 65 66 */ 67 + 68 + static bool 69 + should_skip_format_vk_1_and_2(const struct oxr_instance *inst, uint64_t format) 70 + { 71 + bool skip_depth_stencil = inst->quirks.disable_vulkan_format_depth_stencil; 72 + bool skip_stencil = false; 73 + bool skip_depth = false; 74 + 75 + // Access to Vulkan headers are not guaranteed. 76 + switch (format) { 77 + case 124: /* VK_FORMAT_D16_UNORM */ return skip_depth; 78 + case 125: /* VK_FORMAT_X8_D24_UNORM_PACK32*/ return skip_depth; 79 + case 126: /* VK_FORMAT_D32_SFLOAT */ return skip_depth; 80 + case 127: /* VK_FORMAT_S8_UINT */ return skip_stencil; 81 + case 129: /* VK_FORMAT_D24_UNORM_S8_UINT */ return skip_depth_stencil; 82 + case 130: /* VK_FORMAT_D32_SFLOAT_S8_UINT */ return skip_depth_stencil; 83 + default: return false; 84 + } 85 + } 86 + 87 + static bool 88 + should_skip_format(const struct oxr_instance *inst, const struct oxr_session *sess, uint64_t format) 89 + { 90 + if (sess->gfx_ext == OXR_SESSION_GRAPHICS_EXT_VULKAN) { 91 + /* 92 + * Hello future computer whisperer, if we split the graphics 93 + * extension enum into Vulkan1 and Vulkan2, make sure we call this 94 + * function for both, kthx. 95 + */ 96 + return should_skip_format_vk_1_and_2(inst, format); 97 + } else { 98 + return false; 99 + } 100 + } 66 101 67 102 static bool 68 103 should_render(XrSessionState state) ··· 224 259 for (uint32_t i = 0; i < xc->info.format_count; i++) { 225 260 int64_t format = xc->info.formats[i]; 226 261 227 - if (inst->quirks.disable_vulkan_format_depth_stencil && 228 - format == 130 /* VK_FORMAT_D32_SFLOAT_S8_UINT */) { 262 + if (should_skip_format(inst, sess, format)) { 229 263 continue; 230 264 } 231 265