瀏覽代碼

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.
jp9000 11 年之前
父節點
當前提交
a8d4774eef
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      libobs-d3d11/d3d11-subsystem.cpp

+ 4 - 2
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;
 	}