From a8d4774eefe61c26b698e93713f5407df86a4115 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Mon, 11 Aug 2014 17:40:35 -0700 Subject: [PATCH] Fix D3D11 render target blending issues The alpha source and destination blend values were always being set to one and zero, when they should have been set to the same as the color values. This caused the alpha of the source texture to always overwrite the alpha of the destination texture, rather than apply the blend function upon it. Needless to say that it seriously screwed up the render target if you rendered something with alpha on it. Thanks to paibox for pointing this issue out and yelling at me to fix it. I apologize for not getting to this sooner. --- libobs-d3d11/d3d11-subsystem.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libobs-d3d11/d3d11-subsystem.cpp b/libobs-d3d11/d3d11-subsystem.cpp index 9c475eaa3..1c5c29f33 100644 --- a/libobs-d3d11/d3d11-subsystem.cpp +++ b/libobs-d3d11/d3d11-subsystem.cpp @@ -274,12 +274,14 @@ ID3D11BlendState *gs_device::AddBlendState() bd.RenderTarget[i].BlendEnable = blendState.blendEnabled; bd.RenderTarget[i].BlendOp = D3D11_BLEND_OP_ADD; bd.RenderTarget[i].BlendOpAlpha = D3D11_BLEND_OP_ADD; - bd.RenderTarget[i].SrcBlendAlpha = D3D11_BLEND_ONE; - bd.RenderTarget[i].DestBlendAlpha = D3D11_BLEND_ZERO; bd.RenderTarget[i].SrcBlend = ConvertGSBlendType(blendState.srcFactor); bd.RenderTarget[i].DestBlend = ConvertGSBlendType(blendState.destFactor); + bd.RenderTarget[i].SrcBlendAlpha = + bd.RenderTarget[i].SrcBlend; + bd.RenderTarget[i].DestBlendAlpha = + bd.RenderTarget[i].DestBlend; bd.RenderTarget[i].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; }