DX12 : add remaining constant color/alpha blending (#1834)

This commit is contained in:
raven02 2016-06-27 20:40:53 +08:00 committed by GitHub
parent 028277bd2d
commit 2c10348408

View File

@ -38,10 +38,13 @@ D3D12_BLEND get_blend_factor(u16 factor)
case CELL_GCM_DST_COLOR: return D3D12_BLEND_DEST_COLOR;
case CELL_GCM_ONE_MINUS_DST_COLOR: return D3D12_BLEND_INV_DEST_COLOR;
case CELL_GCM_SRC_ALPHA_SATURATE: return D3D12_BLEND_SRC_ALPHA_SAT;
// The following constant color/alpha blending are hack/wrong since it is no matching one in D3D12
// therefore we workaround using approx one until we find better solution .
case CELL_GCM_CONSTANT_COLOR: return D3D12_BLEND_DEST_COLOR;
case CELL_GCM_ONE_MINUS_CONSTANT_COLOR: return D3D12_BLEND_INV_DEST_COLOR;
case CELL_GCM_CONSTANT_ALPHA:
case CELL_GCM_ONE_MINUS_CONSTANT_ALPHA:
case CELL_GCM_CONSTANT_ALPHA: return D3D12_BLEND_DEST_ALPHA;
case CELL_GCM_ONE_MINUS_CONSTANT_ALPHA: return D3D12_BLEND_INV_DEST_ALPHA;
break;
}
throw EXCEPTION("Invalid or unsupported blend factor (0x%x)", factor);
@ -62,10 +65,13 @@ D3D12_BLEND get_blend_factor_alpha(u16 factor)
case CELL_GCM_DST_COLOR: return D3D12_BLEND_DEST_ALPHA;
case CELL_GCM_ONE_MINUS_DST_COLOR: return D3D12_BLEND_INV_DEST_ALPHA;
case CELL_GCM_SRC_ALPHA_SATURATE: return D3D12_BLEND_SRC_ALPHA_SAT;
case CELL_GCM_CONSTANT_COLOR:
case CELL_GCM_ONE_MINUS_CONSTANT_COLOR:
case CELL_GCM_CONSTANT_ALPHA:
case CELL_GCM_ONE_MINUS_CONSTANT_ALPHA:
// The following constant color/alpha blending are hack/wrong since it is no matching one in D3D12
// therefore we workaround using approx one until we find better solution .
case CELL_GCM_CONSTANT_COLOR: return D3D12_BLEND_DEST_ALPHA;
case CELL_GCM_ONE_MINUS_CONSTANT_COLOR: return D3D12_BLEND_INV_DEST_ALPHA;
case CELL_GCM_CONSTANT_ALPHA: return D3D12_BLEND_DEST_ALPHA;
case CELL_GCM_ONE_MINUS_CONSTANT_ALPHA: return D3D12_BLEND_INV_DEST_ALPHA;
break;
}
throw EXCEPTION("Invalid or unsupported blend alpha factor (0x%x)", factor);