d3d12: Add LogicOp

This commit is contained in:
raven02 2015-05-30 04:43:53 +08:00 committed by Vincent Lejeune
parent f382ba0319
commit d8f76f5aee
2 changed files with 48 additions and 4 deletions

View File

@ -551,14 +551,12 @@ void D3D12GSRender::ExecCMD(u32 cmd)
m_commandQueueGraphic->ExecuteCommandLists(1, (ID3D12CommandList**) &commandList);
}
static
D3D12_BLEND_OP getBlendOp()
static D3D12_BLEND_OP getBlendOp()
{
return D3D12_BLEND_OP_ADD;
}
static
D3D12_BLEND getBlendFactor(u16 glFactor)
static D3D12_BLEND getBlendFactor(u16 glFactor)
{
switch (glFactor)
{
@ -577,6 +575,29 @@ D3D12_BLEND getBlendFactor(u16 glFactor)
}
}
static D3D12_LOGIC_OP getLogicOp(u32 op)
{
switch (op)
{
default: LOG_WARNING(RSX, "Unsupported Logic Op %d", op);
case CELL_GCM_CLEAR: return D3D12_LOGIC_OP_CLEAR;
case CELL_GCM_AND: return D3D12_LOGIC_OP_AND;
case CELL_GCM_AND_REVERSE: return D3D12_LOGIC_OP_AND_REVERSE;
case CELL_GCM_COPY: return D3D12_LOGIC_OP_COPY;
case CELL_GCM_AND_INVERTED: return D3D12_LOGIC_OP_AND_INVERTED;
case CELL_GCM_NOOP: return D3D12_LOGIC_OP_NOOP;
case CELL_GCM_XOR: return D3D12_LOGIC_OP_XOR;
case CELL_GCM_OR: return D3D12_LOGIC_OP_OR;
case CELL_GCM_NOR: return D3D12_LOGIC_OP_NOR;
case CELL_GCM_EQUIV: return D3D12_LOGIC_OP_EQUIV;
case CELL_GCM_INVERT: return D3D12_LOGIC_OP_INVERT;
case CELL_GCM_OR_REVERSE: return D3D12_LOGIC_OP_OR_REVERSE;
case CELL_GCM_COPY_INVERTED: return D3D12_LOGIC_OP_COPY_INVERTED;
case CELL_GCM_OR_INVERTED: return D3D12_LOGIC_OP_OR_INVERTED;
case CELL_GCM_NAND: return D3D12_LOGIC_OP_NAND;
}
}
bool D3D12GSRender::LoadProgram()
{
if (!m_cur_fragment_prog)
@ -649,6 +670,12 @@ bool D3D12GSRender::LoadProgram()
prop.Blend.RenderTarget[0].BlendOpAlpha = D3D12_BLEND_OP_ADD;
}
if (m_set_logic_op)
{
prop.Blend.RenderTarget[0].LogicOpEnable = true;
prop.Blend.RenderTarget[0].LogicOp = getLogicOp(m_logic_op);
}
if (m_set_blend_color)
{
// glBlendColor(m_blend_color_r, m_blend_color_g, m_blend_color_b, m_blend_color_a);

View File

@ -134,6 +134,23 @@ enum
CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP_TO_EDGE = 6,
CELL_GCM_TEXTURE_MIRROR_ONCE_BORDER = 7,
CELL_GCM_TEXTURE_MIRROR_ONCE_CLAMP = 8,
// Logic Op
CELL_GCM_CLEAR = 1,
CELL_GCM_AND = 2,
CELL_GCM_AND_REVERSE = 3,
CELL_GCM_COPY = 4,
CELL_GCM_AND_INVERTED = 5,
CELL_GCM_NOOP = 6,
CELL_GCM_XOR = 7,
CELL_GCM_OR = 8,
CELL_GCM_NOR = 9,
CELL_GCM_EQUIV = 10,
CELL_GCM_INVERT = 11,
CELL_GCM_OR_REVERSE = 12,
CELL_GCM_COPY_INVERTED = 13,
CELL_GCM_OR_INVERTED = 14,
CELL_GCM_NAND = 15,
};
// GCM Surface