mirror of https://github.com/AxioDL/boo.git
Fix subtract blending mode
This commit is contained in:
parent
5b62fcd826
commit
c314730d51
|
@ -616,9 +616,9 @@ class D3D11ShaderPipeline : public GraphicsDataNode<IShaderPipeline>
|
|||
blDesc.RenderTarget[0].BlendEnable = (dstFac != BlendFactor::Zero);
|
||||
if (srcFac == BlendFactor::Subtract || dstFac == BlendFactor::Subtract)
|
||||
{
|
||||
blDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_DEST_COLOR;
|
||||
blDesc.RenderTarget[0].DestBlend = D3D11_BLEND_SRC_COLOR;
|
||||
blDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_SUBTRACT;
|
||||
blDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
|
||||
blDesc.RenderTarget[0].DestBlend = D3D11_BLEND_ONE;
|
||||
blDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_REV_SUBTRACT;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -748,9 +748,9 @@ class D3D12ShaderPipeline : public GraphicsDataNode<IShaderPipeline>
|
|||
desc.BlendState.RenderTarget[0].BlendEnable = true;
|
||||
if (srcFac == BlendFactor::Subtract || dstFac == BlendFactor::Subtract)
|
||||
{
|
||||
desc.BlendState.RenderTarget[0].SrcBlend = D3D12_BLEND_DEST_COLOR;
|
||||
desc.BlendState.RenderTarget[0].DestBlend = D3D12_BLEND_SRC_COLOR;
|
||||
desc.BlendState.RenderTarget[0].BlendOp = D3D12_BLEND_OP_SUBTRACT;
|
||||
desc.BlendState.RenderTarget[0].SrcBlend = D3D12_BLEND_SRC_ALPHA;
|
||||
desc.BlendState.RenderTarget[0].DestBlend = D3D12_BLEND_ONE;
|
||||
desc.BlendState.RenderTarget[0].BlendOp = D3D12_BLEND_OP_REV_SUBTRACT;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -741,7 +741,7 @@ public:
|
|||
glEnable(GL_BLEND);
|
||||
glBlendFuncSeparate(m_sfactor, m_dfactor, GL_ONE, GL_ZERO);
|
||||
if (m_subtractBlend)
|
||||
glBlendEquation(GL_FUNC_SUBTRACT);
|
||||
glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
|
||||
else
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
}
|
||||
|
@ -904,8 +904,8 @@ ObjToken<IShaderPipeline> GLDataFactory::Context::newShaderPipeline
|
|||
|
||||
if (srcFac == BlendFactor::Subtract || dstFac == BlendFactor::Subtract)
|
||||
{
|
||||
shader.m_sfactor = GL_DST_COLOR;
|
||||
shader.m_dfactor = GL_SRC_COLOR;
|
||||
shader.m_sfactor = GL_SRC_ALPHA;
|
||||
shader.m_dfactor = GL_ONE;
|
||||
shader.m_subtractBlend = true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -909,9 +909,9 @@ class MetalShaderPipeline : public GraphicsDataNode<IShaderPipeline>
|
|||
desc.colorAttachments[0].blendingEnabled = dstFac != BlendFactor::Zero;
|
||||
if (srcFac == BlendFactor::Subtract || dstFac == BlendFactor::Subtract)
|
||||
{
|
||||
desc.colorAttachments[0].sourceRGBBlendFactor = MTLBlendFactorDestinationColor;
|
||||
desc.colorAttachments[0].destinationRGBBlendFactor = MTLBlendFactorSourceColor;
|
||||
desc.colorAttachments[0].rgbBlendOperation = MTLBlendOperationSubtract;
|
||||
desc.colorAttachments[0].sourceRGBBlendFactor = MTLBlendFactorSourceAlpha;
|
||||
desc.colorAttachments[0].destinationRGBBlendFactor = MTLBlendFactorOne;
|
||||
desc.colorAttachments[0].rgbBlendOperation = MTLBlendOperationReverseSubtract;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2305,9 +2305,9 @@ public:
|
|||
colorAttachment.blendEnable = m_dstFac != BlendFactor::Zero;
|
||||
if (m_srcFac == BlendFactor::Subtract || m_dstFac == BlendFactor::Subtract)
|
||||
{
|
||||
colorAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_DST_COLOR;
|
||||
colorAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_SRC_COLOR;
|
||||
colorAttachment.colorBlendOp = VK_BLEND_OP_SUBTRACT;
|
||||
colorAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
|
||||
colorAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE;
|
||||
colorAttachment.colorBlendOp = VK_BLEND_OP_REVERSE_SUBTRACT;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue