MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / setup_depth_stencil

Method setup_depth_stencil

framework/hpp_api_vulkan_sample.cpp:633–651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

631}
632
633void HPPApiVulkanSample::setup_depth_stencil()
634{
635 std::tie(depth_stencil.image, depth_stencil.mem) =
636 get_device().create_image(depth_format,
637 get_render_context().get_surface_extent(),
638 1,
639 vk::ImageUsageFlagBits::eDepthStencilAttachment | vk::ImageUsageFlagBits::eTransferSrc,
640 vk::MemoryPropertyFlagBits::eDeviceLocal);
641
642 vk::ImageAspectFlags aspect_mask = vk::ImageAspectFlagBits::eDepth;
643 // Stencil aspect should only be set on depth + stencil formats
644 if ((vk::componentCount(depth_format) == 2) && (strcmp(vk::componentName(depth_format, 0), "D") == 0) &&
645 (strcmp(vk::componentName(depth_format, 1), "S") == 0))
646 {
647 aspect_mask |= vk::ImageAspectFlagBits::eStencil;
648 }
649
650 depth_stencil.view = vkb::common::create_image_view(get_device().get_handle(), depth_stencil.image, vk::ImageViewType::e2D, depth_format, aspect_mask);
651}
652
653void HPPApiVulkanSample::setup_framebuffer()
654{

Callers

nothing calls this directly

Calls 3

create_image_viewFunction · 0.85
create_imageMethod · 0.45
get_handleMethod · 0.45

Tested by

no test coverage detected