1 #include <kiba/renderer/vulkan/depth.h>
3 #include <kiba/renderer/vulkan/image.h>
6 VkFormat candidates[] = {
8 VK_FORMAT_D32_SFLOAT_S8_UINT,
9 VK_FORMAT_D24_UNORM_S8_UINT,
11 return vulkan_image_fitting_format(context,
13 sizeof(candidates) /
sizeof(candidates[0]),
14 VK_IMAGE_TILING_OPTIMAL,
15 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT);
23 const VkFormat format = vulkan_depth_fitting_format(context);
24 if (!vulkan_image_create(context,
25 context->swap_chain.extent.width,
26 context->swap_chain.extent.height,
28 VK_IMAGE_TILING_OPTIMAL,
29 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
30 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
31 &context->depth.image)) {
32 KB_ERROR(
"cannot create image for depth attachment");
35 if (!vulkan_image_view_create(context,
36 context->depth.image.image,
38 VK_IMAGE_ASPECT_DEPTH_BIT,
39 &context->depth.view)) {
40 KB_ERROR(
"cannot create image view for depth attachment");
46 vulkan_image_view_destroy(context, &context->depth.view);
47 vulkan_image_destroy(context, &context->depth.image);
#define KB_ERROR(...)
Log entry with error log level.