From b55bb44845de762eef96c781f41241a070ffc305 Mon Sep 17 00:00:00 2001 From: Micah Elizabeth Scott Date: Wed, 1 Nov 2017 19:52:50 -0700 Subject: [PATCH] libobs-d3d11: Fix gs_enable_color It looks like the link between the gs layer rgba enable flags and the underlying D3D states never got fully implemented. This change adds the missing piece, fixing an issue I had in a plugin wherein I couldn't write a blended value to a RGBA render target without also changing the alpha of the dest pixel. Debugging that led to the missing gs_enable_color functionality. Closes jp9000/obs-studio#1064 --- libobs-d3d11/d3d11-subsystem.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libobs-d3d11/d3d11-subsystem.cpp b/libobs-d3d11/d3d11-subsystem.cpp index 1bcc6c2c5..930b2ea50 100644 --- a/libobs-d3d11/d3d11-subsystem.cpp +++ b/libobs-d3d11/d3d11-subsystem.cpp @@ -341,7 +341,10 @@ ID3D11BlendState *gs_device::AddBlendState() bd.RenderTarget[i].DestBlendAlpha = ConvertGSBlendType(blendState.destFactorA); bd.RenderTarget[i].RenderTargetWriteMask = - D3D11_COLOR_WRITE_ENABLE_ALL; + (blendState.redEnabled ? D3D11_COLOR_WRITE_ENABLE_RED : 0) | + (blendState.greenEnabled ? D3D11_COLOR_WRITE_ENABLE_GREEN : 0) | + (blendState.blueEnabled ? D3D11_COLOR_WRITE_ENABLE_BLUE : 0) | + (blendState.alphaEnabled ? D3D11_COLOR_WRITE_ENABLE_ALPHA : 0) ; } SavedBlendState savedState(blendState, bd);