Skip to content
Permalink
Browse files

gsdx-d3d11: Add rgba channel selection/support to StretchRect.

  • Loading branch information...
lightningterror committed Jun 19, 2019
1 parent e9825dc commit 40929a472853209433e114d50fa5da24594d36bf
Showing with 21 additions and 1 deletion.
  1. +20 −1 plugins/GSdx/Renderers/DX11/GSDevice11.cpp
  2. +1 −0 plugins/GSdx/Renderers/DX11/GSDevice11.h
@@ -783,7 +783,26 @@ void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture*
StretchRect(sTex, sRect, dTex, dRect, ps, ps_cb, m_convert.bs, linear);
}

void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, ID3D11BlendState* bs, bool linear)
void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, bool red, bool green, bool blue, bool alpha)
{
D3D11_BLEND_DESC bd = {};
CComPtr<ID3D11BlendState> bs;

uint8 write_mask = 0;

if (red) write_mask |= D3D11_COLOR_WRITE_ENABLE_RED;
if (green) write_mask |= D3D11_COLOR_WRITE_ENABLE_GREEN;
if (blue) write_mask |= D3D11_COLOR_WRITE_ENABLE_BLUE;
if (alpha) write_mask |= D3D11_COLOR_WRITE_ENABLE_ALPHA;

bd.RenderTarget[0].RenderTargetWriteMask = write_mask;

m_dev->CreateBlendState(&bd, &bs);

StretchRect(sTex, sRect, dTex, dRect, m_convert.ps[ShaderConvert_COPY], nullptr, bs, false);
}

void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, ID3D11BlendState* bs , bool linear)
{
if(!sTex || !dTex)
{
@@ -513,6 +513,7 @@ class GSDevice11 final : public GSDevice

void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, int shader = 0, bool linear = true) final;
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, bool linear = true);
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, bool red, bool green, bool blue, bool alpha);
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, ID3D11BlendState* bs, bool linear = true);

void SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm);

0 comments on commit 40929a4

Please sign in to comment.
You can’t perform that action at this time.