improved font rendering

This commit is contained in:
2026-05-26 01:29:26 +03:00
parent f127ac3801
commit 5fdb17b773
21 changed files with 217 additions and 158 deletions

View File

@@ -27,9 +27,9 @@ void CVkShader::SetTopology( ETopologyMode eTopology )
}
void CVkShader::AddOutputImage( int iImageIndex, EImageFormat eFormat )
void CVkShader::AddOutputImage( int iImageIndex, EImageFormat eFormat, bool bBlendingEnabled )
{
m_eFormats.AppendTail(CVkImage::GetImageFormat(eFormat));
m_formats.AppendTail({CVkImage::GetImageFormat(eFormat), bBlendingEnabled});
}
void CVkShader::SetDepthImage( EImageFormat eFormat )
@@ -68,6 +68,7 @@ void CVkShader::Build()
};
VkPipelineLayoutCreateInfo stPipelineLayout = {};
CUtlVector<CUtlVector<VkDescriptorSetLayoutBinding>> bindings = {};
CUtlVector<VkFormat> formats = {};
// TODO: Filter by vulkan shaders at some points
stages.Resize(m_shader.m_objects.GetSize());
@@ -163,10 +164,13 @@ void CVkShader::Build()
msaa.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
msaa.rasterizationSamples = CVkImage::GetMultisampling(m_eMultiSampling);
formats.Resize(m_formats.GetSize());
for ( uint32_t i = 0; i < m_formats.GetSize(); i++ )
formats[i] = m_formats[i].m_eFormat;
render.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO;
render.colorAttachmentCount = m_eFormats.GetSize();
render.pColorAttachmentFormats = m_eFormats.GetData();
render.colorAttachmentCount = formats.GetSize();
render.pColorAttachmentFormats = formats.GetData();
depthStencil.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
if (m_eDepthFormat == VK_FORMAT_D32_SFLOAT)
@@ -177,11 +181,23 @@ void CVkShader::Build()
render.depthAttachmentFormat = m_eDepthFormat;
}
for ( auto e: m_eFormats )
for ( auto e: m_formats )
{
VkPipelineColorBlendAttachmentState a = {};
a.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
a.blendEnable = VK_FALSE;
if (e.m_bIsBlendingEnabled)
{
a.blendEnable = VK_TRUE;
a.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
a.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
a.colorBlendOp = VK_BLEND_OP_ADD;
a.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
a.dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
a.alphaBlendOp = VK_BLEND_OP_ADD;
}
else
a.blendEnable = VK_FALSE;
attachments.AppendTail(a);
}