d3d12: Fix color masking

Wasn't using the correct PSO state variable
This commit is contained in:
vlj 2015-06-08 19:33:41 +02:00 committed by Vincent Lejeune
parent 724159c8b4
commit dc1a57e71c
2 changed files with 11 additions and 6 deletions

View File

@ -275,9 +275,15 @@ bool D3D12GSRender::LoadProgram()
}
if (m_set_color_mask)
prop.SampleMask = m_color_mask_r | (m_color_mask_g << 1) | (m_color_mask_b << 2) | (m_color_mask_a << 3);
else
prop.SampleMask = UINT_MAX;
{
UINT8 mask = 0;
mask |= m_color_mask_r ? D3D12_COLOR_WRITE_ENABLE_RED : 0;
mask |= m_color_mask_g ? D3D12_COLOR_WRITE_ENABLE_GREEN : 0;
mask |= m_color_mask_b ? D3D12_COLOR_WRITE_ENABLE_BLUE : 0;
mask |= m_color_mask_a ? D3D12_COLOR_WRITE_ENABLE_ALPHA : 0;
for (unsigned i = 0; i < prop.numMRT; i++)
prop.Blend.RenderTarget[i].RenderTargetWriteMask = mask;
}
prop.IASet = m_IASet;

View File

@ -20,7 +20,6 @@ struct D3D12PipelineProperties
unsigned numMRT : 3;
D3D12_DEPTH_STENCIL_DESC DepthStencil;
D3D12_RASTERIZER_DESC Rasterization;
UINT SampleMask;
bool operator==(const D3D12PipelineProperties &in) const
{
@ -47,7 +46,7 @@ struct D3D12PipelineProperties
return false;
if (memcmp(&Rasterization, &in.Rasterization, sizeof(D3D12_RASTERIZER_DESC)))
return false;
return Topology == in.Topology && DepthStencilFormat == in.DepthStencilFormat && numMRT == in.numMRT && SampleMask == in.SampleMask && RenderTargetsFormat == in.RenderTargetsFormat;
return Topology == in.Topology && DepthStencilFormat == in.DepthStencilFormat && numMRT == in.numMRT && RenderTargetsFormat == in.RenderTargetsFormat;
}
};
@ -162,7 +161,7 @@ struct D3D12Traits
graphicPipelineStateDesc.InputLayout.pInputElementDescs = pipelineProperties.IASet.data();
graphicPipelineStateDesc.InputLayout.NumElements = (UINT)pipelineProperties.IASet.size();
graphicPipelineStateDesc.SampleDesc.Count = 1;
graphicPipelineStateDesc.SampleMask = pipelineProperties.SampleMask;
graphicPipelineStateDesc.SampleMask = UINT_MAX;
graphicPipelineStateDesc.NodeMask = 1;
extraData.first->CreateGraphicsPipelineState(&graphicPipelineStateDesc, IID_PPV_ARGS(&result->first));