mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-21 19:51:27 +00:00
Update backend to use ColorBlendAttachmentBuilder
This commit is contained in:
parent
58acf528bf
commit
9ff1193dab
2 changed files with 16 additions and 6 deletions
|
@ -319,10 +319,15 @@ std::unique_ptr<VulkanPipeline> VkRenderPassSetup::CreatePipeline(const VkPipeli
|
|||
// main.vp addresses this by patching up gl_Position.z, which has the side effect of flipping the sign of the front face calculations.
|
||||
builder.Cull(key.CullMode == Cull_None ? VK_CULL_MODE_NONE : VK_CULL_MODE_BACK_BIT, key.CullMode == Cull_CW ? VK_FRONT_FACE_COUNTER_CLOCKWISE : VK_FRONT_FACE_CLOCKWISE);
|
||||
|
||||
builder.ColorWriteMask((VkColorComponentFlags)key.ColorMask);
|
||||
builder.Stencil(VK_STENCIL_OP_KEEP, op2vk[key.StencilPassOp], VK_STENCIL_OP_KEEP, VK_COMPARE_OP_EQUAL, 0xffffffff, 0xffffffff, 0);
|
||||
BlendMode(builder, key.RenderStyle);
|
||||
builder.SubpassColorAttachmentCount(PassKey.DrawBuffers);
|
||||
|
||||
ColorBlendAttachmentBuilder blendbuilder;
|
||||
blendbuilder.ColorWriteMask((VkColorComponentFlags)key.ColorMask);
|
||||
BlendMode(blendbuilder, key.RenderStyle);
|
||||
|
||||
for (int i = 0; i < PassKey.DrawBuffers; i++)
|
||||
builder.AddColorBlendAttachment(blendbuilder.Create());
|
||||
|
||||
builder.RasterizationSamples((VkSampleCountFlagBits)PassKey.Samples);
|
||||
|
||||
builder.Layout(fb->GetRenderPassManager()->GetPipelineLayout(key.NumTextureLayers));
|
||||
|
@ -389,7 +394,11 @@ void VkPPRenderPassSetup::CreatePipeline(const VkPPRenderPassKey& key)
|
|||
builder.Stencil(VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_COMPARE_OP_EQUAL, 0xffffffff, 0xffffffff, 0);
|
||||
}
|
||||
builder.Topology(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP);
|
||||
BlendMode(builder, key.BlendMode);
|
||||
|
||||
ColorBlendAttachmentBuilder blendbuilder;
|
||||
BlendMode(blendbuilder, key.BlendMode);
|
||||
builder.AddColorBlendAttachment(blendbuilder.Create());
|
||||
|
||||
builder.RasterizationSamples(key.Samples);
|
||||
builder.Layout(PipelineLayout.get());
|
||||
builder.RenderPass(RenderPass.get());
|
||||
|
@ -447,7 +456,7 @@ void VkPPRenderPassSetup::CreateRenderPass(const VkPPRenderPassKey& key)
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GraphicsPipelineBuilder& BlendMode(GraphicsPipelineBuilder& builder, const FRenderStyle& style)
|
||||
ColorBlendAttachmentBuilder& BlendMode(ColorBlendAttachmentBuilder& builder, const FRenderStyle& style)
|
||||
{
|
||||
// Just in case Vulkan doesn't do this optimization itself
|
||||
if (style.BlendOp == STYLEOP_Add && style.SrcAlpha == STYLEALPHA_One && style.DestAlpha == STYLEALPHA_Zero && style.Flags == 0)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
class VulkanRenderDevice;
|
||||
class VkPPShader;
|
||||
class GraphicsPipelineBuilder;
|
||||
class ColorBlendAttachmentBuilder;
|
||||
|
||||
class VkPipelineKey
|
||||
{
|
||||
|
@ -118,7 +119,7 @@ private:
|
|||
VulkanRenderDevice* fb = nullptr;
|
||||
};
|
||||
|
||||
GraphicsPipelineBuilder& BlendMode(GraphicsPipelineBuilder& builder, const FRenderStyle& style);
|
||||
ColorBlendAttachmentBuilder& BlendMode(ColorBlendAttachmentBuilder& builder, const FRenderStyle& style);
|
||||
|
||||
class VkRenderPassManager
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue