diff --git a/inc/hgl/graph/vulkan/VKRenderPass.h b/inc/hgl/graph/vulkan/VKRenderPass.h index 9dc9e23f..e3d966da 100644 --- a/inc/hgl/graph/vulkan/VKRenderPass.h +++ b/inc/hgl/graph/vulkan/VKRenderPass.h @@ -42,6 +42,7 @@ public: operator VkRenderPass(){return render_pass;} + const uint GetColorCount()const{return color_formats.GetCount();} const List & GetColorFormat()const{return color_formats;} const VkFormat GetDepthFormat()const{return depth_format;} };//class RenderPass diff --git a/src/RenderDevice/Vulkan/VKPipeline.cpp b/src/RenderDevice/Vulkan/VKPipeline.cpp index d08270a8..a85a616a 100644 --- a/src/RenderDevice/Vulkan/VKPipeline.cpp +++ b/src/RenderDevice/Vulkan/VKPipeline.cpp @@ -145,7 +145,7 @@ PipelineCreater::PipelineCreater(Device *dev,const Material *material,RenderPass cba.srcAlphaBlendFactor = VK_BLEND_FACTOR_ZERO; cba.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO; - colorBlendAttachments.Add(cba); + colorBlendAttachments.Add(cba,rp->GetColorCount()); //这个需要和subpass中的color attachment数量相等,所以添加多份 alpha_blend=false;