| 655 | } |
| 656 | |
| 657 | static VkResult CreateDepthStencilTexture(VulkanContext* context, VkFormat vk_depth_format, VkImageTiling vk_depth_tiling, |
| 658 | uint32_t width, uint32_t height, VkSampleCountFlagBits vk_sample_count, VkImageAspectFlags vk_aspect_flags, VulkanTexture* depth_stencil_texture_out) |
| 659 | { |
| 660 | const VkPhysicalDevice vk_physical_device = context->m_PhysicalDevice.m_Device; |
| 661 | const VkDevice vk_device = context->m_LogicalDevice.m_Device; |
| 662 | VkImageUsageFlags vk_usage_flags = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | depth_stencil_texture_out->m_UsageFlags; |
| 663 | VkMemoryPropertyFlags vk_memory_type = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; |
| 664 | |
| 665 | if (IsTextureMemoryless(depth_stencil_texture_out)) |
| 666 | { |
| 667 | vk_memory_type |= VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT; |
| 668 | } |
| 669 | |
| 670 | VkResult res = CreateTexture( |
| 671 | vk_physical_device, vk_device, |
| 672 | width, height, 1, 1, 1, |
| 673 | vk_sample_count, vk_depth_format, vk_depth_tiling, |
| 674 | vk_usage_flags, |
| 675 | vk_memory_type, |
| 676 | vk_aspect_flags, |
| 677 | depth_stencil_texture_out); |
| 678 | CHECK_VK_ERROR(res); |
| 679 | |
| 680 | if (res == VK_SUCCESS) |
| 681 | { |
| 682 | res = TransitionImageLayout(vk_device, |
| 683 | context->m_LogicalDevice.m_CommandPool, |
| 684 | context->m_LogicalDevice.m_GraphicsQueue, |
| 685 | depth_stencil_texture_out, |
| 686 | vk_aspect_flags, |
| 687 | VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL); |
| 688 | CHECK_VK_ERROR(res); |
| 689 | } |
| 690 | |
| 691 | return res; |
| 692 | } |
| 693 | |
| 694 | VkResult CreateMainFrameBuffers(VulkanContext* context) |
| 695 | { |
no test coverage detected