Ask for XR_FB_composition_layer_depth_test and XR_KHR_composition_layer_depth

Enable depth testing between GUI and lobby

Use reversed-Z, prefer floating point depth buffer
This commit is contained in:
Guillaume Meunier
2024-11-01 11:40:33 +01:00
parent 16a1a7f0bf
commit 6c10a9ee95
18 changed files with 310 additions and 174 deletions
+18 -1
View File
@@ -25,10 +25,27 @@ xr::swapchain::swapchain(xr::session & s, vk::raii::Device & device, vk::Format
{
assert(sample_count == 1);
XrSwapchainUsageFlags usage_flags;
switch (format)
{
case vk::Format::eD16Unorm:
case vk::Format::eD16UnormS8Uint:
case vk::Format::eD24UnormS8Uint:
case vk::Format::eX8D24UnormPack32:
case vk::Format::eD32Sfloat:
case vk::Format::eD32SfloatS8Uint:
usage_flags = XR_SWAPCHAIN_USAGE_SAMPLED_BIT | XR_SWAPCHAIN_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
break;
default:
usage_flags = XR_SWAPCHAIN_USAGE_SAMPLED_BIT | XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT;
break;
}
XrSwapchainCreateInfo create_info{
.type = XR_TYPE_SWAPCHAIN_CREATE_INFO,
.createFlags = 0,
.usageFlags = XR_SWAPCHAIN_USAGE_SAMPLED_BIT | XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT,
.usageFlags = usage_flags,
.format = static_cast<VkFormat>(format),
.sampleCount = (uint32_t)sample_count,
.width = (uint32_t)width,