1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 12:12:50 +01:00

rsx: Validate blend factors according to hardware testing

This commit is contained in:
kd-11 2020-06-22 21:38:26 +03:00 committed by kd-11
parent a14e0a0104
commit 628cb1c779
3 changed files with 51 additions and 17 deletions

View File

@ -711,23 +711,6 @@ rsx::blend_equation rsx::to_blend_equation(u16 in)
fmt::throw_exception("Unknown blend eq 0x%x" HERE, in);
}
enum
{
CELL_GCM_SRC_COLOR = 0x0300,
CELL_GCM_ONE_MINUS_SRC_COLOR = 0x0301,
CELL_GCM_SRC_ALPHA = 0x0302,
CELL_GCM_ONE_MINUS_SRC_ALPHA = 0x0303,
CELL_GCM_DST_ALPHA = 0x0304,
CELL_GCM_ONE_MINUS_DST_ALPHA = 0x0305,
CELL_GCM_DST_COLOR = 0x0306,
CELL_GCM_ONE_MINUS_DST_COLOR = 0x0307,
CELL_GCM_SRC_ALPHA_SATURATE = 0x0308,
CELL_GCM_CONSTANT_COLOR = 0x8001,
CELL_GCM_ONE_MINUS_CONSTANT_COLOR = 0x8002,
CELL_GCM_CONSTANT_ALPHA = 0x8003,
CELL_GCM_ONE_MINUS_CONSTANT_ALPHA = 0x8004,
};
rsx::blend_factor rsx::to_blend_factor(u16 in)
{
switch (in)

View File

@ -529,6 +529,24 @@ enum
CELL_GCM_FUNC_REVERSE_ADD_SIGNED = 0x0000F007,
};
// GCM blend factor
enum
{
CELL_GCM_SRC_COLOR = 0x0300,
CELL_GCM_ONE_MINUS_SRC_COLOR = 0x0301,
CELL_GCM_SRC_ALPHA = 0x0302,
CELL_GCM_ONE_MINUS_SRC_ALPHA = 0x0303,
CELL_GCM_DST_ALPHA = 0x0304,
CELL_GCM_ONE_MINUS_DST_ALPHA = 0x0305,
CELL_GCM_DST_COLOR = 0x0306,
CELL_GCM_ONE_MINUS_DST_COLOR = 0x0307,
CELL_GCM_SRC_ALPHA_SATURATE = 0x0308,
CELL_GCM_CONSTANT_COLOR = 0x8001,
CELL_GCM_ONE_MINUS_CONSTANT_COLOR = 0x8002,
CELL_GCM_CONSTANT_ALPHA = 0x8003,
CELL_GCM_ONE_MINUS_CONSTANT_ALPHA = 0x8004,
};
enum
{
CELL_GCM_TEXTURE_UNSIGNED_REMAP_NORMAL = 0,

View File

@ -829,6 +829,37 @@ namespace rsx
}
}
void set_blend_factor(thread* rsx, u32 reg, u32 arg)
{
for (u32 i = 0; i < 32u; i += 16)
{
switch ((arg >> i) & 0xffff)
{
case CELL_GCM_ZERO:
case CELL_GCM_ONE:
case CELL_GCM_SRC_COLOR:
case CELL_GCM_ONE_MINUS_SRC_COLOR:
case CELL_GCM_SRC_ALPHA:
case CELL_GCM_ONE_MINUS_SRC_ALPHA:
case CELL_GCM_DST_ALPHA:
case CELL_GCM_ONE_MINUS_DST_ALPHA:
case CELL_GCM_DST_COLOR:
case CELL_GCM_ONE_MINUS_DST_COLOR:
case CELL_GCM_SRC_ALPHA_SATURATE:
case CELL_GCM_CONSTANT_COLOR:
case CELL_GCM_ONE_MINUS_CONSTANT_COLOR:
case CELL_GCM_CONSTANT_ALPHA:
case CELL_GCM_ONE_MINUS_CONSTANT_ALPHA:
break;
default:
// Ignore invalid values as a whole
method_registers.decode(reg, method_registers.register_previous_value);
return;
}
}
}
template<u32 index>
struct set_texture_dirty_bit
{
@ -3157,6 +3188,8 @@ namespace rsx
bind_range<NV4097_SET_VIEWPORT_OFFSET, 1, 3, nv4097::set_viewport_dirty_bit>();
bind<NV4097_SET_INDEX_ARRAY_DMA, nv4097::check_index_array_dma>();
bind<NV4097_SET_BLEND_EQUATION, nv4097::set_blend_equation>();
bind<NV4097_SET_BLEND_FUNC_SFACTOR, nv4097::set_blend_factor>();
bind<NV4097_SET_BLEND_FUNC_DFACTOR, nv4097::set_blend_factor>();
bind<NV4097_SET_POLYGON_STIPPLE, nv4097::notify_state_changed<fragment_state_dirty>>();
bind_array<NV4097_SET_POLYGON_STIPPLE_PATTERN, 1, 32, nv4097::notify_state_changed<polygon_stipple_pattern_dirty>>();