Instance a VkAttachmentDescription.
Write in data.
Instance a VkClearValue. Though we reverse z depth, clear buffer with 0.0f here.
Get layers.
Instance a VkAttachmentReference.
2905 {
2907
2911 VkAttachmentDescription depthAttachment{};
2913 depthAttachment.samples = VK_SAMPLE_COUNT_1_BIT;
2914 depthAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
2915 depthAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
2916 depthAttachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
2917 depthAttachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
2918 depthAttachment.initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
2919 depthAttachment.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
2920
2925 func(depthAttachment);
2926
2931 VkClearValue clearValue{};
2932 clearValue.depthStencil = { 0.0f, 0 };
2933
2937 RendererResourceCreateInfo Info;
2938 Info.name = attachmentName;
2939 Info.type = type;
2940 Info.description = depthAttachment;
2943 Info.isDepthResource = true;
2944
2946
2950 uint32_t layers = 1;
2951 switch (type)
2952 {
2955 break;
2957 layers = 6;
2958 break;
2959 default:
2960 break;
2961 }
2962
2963 const uint32_t index =
m_Renderer->
m_Pass->AddAttachment(attachmentName, depthAttachment, clearValue, layers, view);
2964
2968 VkAttachmentReference depthAttachmentRef{};
2969 depthAttachmentRef.attachment = index;
2970 depthAttachmentRef.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
2971
2973
2974 return *this;
2975 }
#define SPICES_PROFILE_ZONE
std::shared_ptr< RendererSubPass > m_HandledRendererSubPass
Handled Sub pass.
Renderer * m_Renderer
Specific Renderer pointer. Passed while this class instanced.
std::shared_ptr< RendererPass > m_Pass
RendererPass.
std::shared_ptr< RendererResourcePool > m_RendererResourcePool
RendererResourcePool, Passed by instanced.
std::shared_ptr< VulkanDevice > m_Device
VulkanDevice , Passed by instanced.
VulkanState & m_VulkanState
This variable is passed while renderer instanced.
static VkFormat FindDepthFormat(const VkPhysicalDevice &physicalDevice)
Check whether Depth Image's Format is supported by physical device.
VkPhysicalDevice m_PhysicalDevice