Instance a VkAttachmentDescription.
Write in data.
Instance a VkClearValue.
Instance a VkPipelineColorBlendAttachmentState.
Get layers.
Instance a VkAttachmentReference.
2800 {
2802
2806 VkAttachmentDescription attachmentDescription{};
2807 attachmentDescription.format =
m_Renderer->
m_Device->GetSwapChainSupport().format.format;
2808 attachmentDescription.samples = VK_SAMPLE_COUNT_1_BIT;
2809 attachmentDescription.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
2810 attachmentDescription.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
2811 attachmentDescription.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
2812 attachmentDescription.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
2813 attachmentDescription.initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
2814 attachmentDescription.finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
2815
2821 bool isEnableBlend = false;
2822 func(isEnableBlend, attachmentDescription);
2823
2827 VkClearValue clearValue{};
2828 clearValue.color = { 0.0f, 0.0f, 0.0f, 1.0f };
2829
2833 VkPipelineColorBlendAttachmentState colorBlend{};
2834 colorBlend.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
2835 VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
2836 if (!isEnableBlend)
2837 {
2838 colorBlend.blendEnable = VK_FALSE;
2839 colorBlend.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
2840 colorBlend.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO;
2841 colorBlend.colorBlendOp = VK_BLEND_OP_ADD;
2842 colorBlend.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
2843 colorBlend.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
2844 colorBlend.alphaBlendOp = VK_BLEND_OP_ADD;
2845 }
2846 else
2847 {
2848 colorBlend.blendEnable = VK_TRUE;
2849 colorBlend.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
2850 colorBlend.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
2851 colorBlend.colorBlendOp = VK_BLEND_OP_ADD;
2852 colorBlend.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
2853 colorBlend.dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
2854 colorBlend.alphaBlendOp = VK_BLEND_OP_ADD;
2855 }
2856
2860 RendererResourceCreateInfo Info;
2861 Info.name = attachmentName;
2862 Info.type = type;
2863 Info.description = attachmentDescription;
2866
2868
2872 uint32_t layers = 1;
2873 switch (type)
2874 {
2877 break;
2879 layers = 6;
2880 break;
2881 default:
2882 break;
2883 }
2884
2885 uint32_t index =
m_Renderer->
m_Pass->AddAttachment(attachmentName, attachmentDescription, clearValue, layers, view);
2886
2890 VkAttachmentReference attachmentRef{};
2891 attachmentRef.attachment = index;
2892 attachmentRef.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
2893
2895
2896 return *this;
2897 }
#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.