rsx: Fix unknown Blend equation

This commit is contained in:
Eladash 2020-03-14 22:47:55 +02:00 committed by kd-11
parent a0612ff4a7
commit 377e06a4a2
3 changed files with 40 additions and 12 deletions

View file

@ -695,18 +695,6 @@ rsx::stencil_op rsx::to_stencil_op(u16 in)
fmt::throw_exception("Unknown stencil op 0x%x" HERE, in);
}
enum
{
CELL_GCM_FUNC_ADD = 0x8006,
CELL_GCM_MIN = 0x8007,
CELL_GCM_MAX = 0x8008,
CELL_GCM_FUNC_SUBTRACT = 0x800A,
CELL_GCM_FUNC_REVERSE_SUBTRACT = 0x800B,
CELL_GCM_FUNC_REVERSE_SUBTRACT_SIGNED = 0x0000F005,
CELL_GCM_FUNC_ADD_SIGNED = 0x0000F006,
CELL_GCM_FUNC_REVERSE_ADD_SIGNED = 0x0000F007,
};
rsx::blend_equation rsx::to_blend_equation(u16 in)
{
switch (in)

View file

@ -516,6 +516,19 @@ enum
CELL_GCM_SURFACE_SWIZZLE = 2,
};
// GCM blend equation
enum
{
CELL_GCM_FUNC_ADD = 0x8006,
CELL_GCM_MIN = 0x8007,
CELL_GCM_MAX = 0x8008,
CELL_GCM_FUNC_SUBTRACT = 0x800A,
CELL_GCM_FUNC_REVERSE_SUBTRACT = 0x800B,
CELL_GCM_FUNC_REVERSE_SUBTRACT_SIGNED = 0x0000F005,
CELL_GCM_FUNC_ADD_SIGNED = 0x0000F006,
CELL_GCM_FUNC_REVERSE_ADD_SIGNED = 0x0000F007,
};
enum
{
CELL_GCM_TEXTURE_UNSIGNED_REMAP_NORMAL = 0,

View file

@ -747,6 +747,32 @@ namespace rsx
}
}
void set_blend_equation(thread* rsx, u32 reg, u32 arg)
{
for (u32 i = 0; i < 32u; i += 16)
{
switch ((arg >> i) & 0xffff)
{
case CELL_GCM_FUNC_ADD:
case CELL_GCM_MIN:
case CELL_GCM_MAX:
case CELL_GCM_FUNC_SUBTRACT:
case CELL_GCM_FUNC_REVERSE_SUBTRACT:
case CELL_GCM_FUNC_REVERSE_SUBTRACT_SIGNED:
case CELL_GCM_FUNC_ADD_SIGNED:
case CELL_GCM_FUNC_REVERSE_ADD_SIGNED:
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
{
@ -2997,6 +3023,7 @@ namespace rsx
bind_range<NV4097_SET_VIEWPORT_SCALE, 1, 3, nv4097::set_viewport_dirty_bit>();
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>();
//NV308A
bind_range<NV308A_COLOR, 1, 256, nv308a::color>();