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

rsx: Discard color mask writes with reserved bits

This commit is contained in:
Eladash 2023-08-24 16:27:24 +03:00 committed by Elad Ashkenazi
parent 8772219492
commit 5fde96d563
4 changed files with 36 additions and 4 deletions

View File

@ -167,7 +167,11 @@ void RSXDisAsm::Write(std::string_view str, s32 count, bool is_non_inc, u32 id)
{ {
last_opcode.clear(); last_opcode.clear();
if (count >= 0) if (count == 1 && !is_non_inc)
{
fmt::append(last_opcode, "[%08x] ( )", dump_pc);
}
else if (count >= 0)
{ {
fmt::append(last_opcode, "[%08x] (%s%u)", dump_pc, is_non_inc ? "+" : "", count); fmt::append(last_opcode, "[%08x] (%s%u)", dump_pc, is_non_inc ? "+" : "", count);
} }

View File

@ -1592,7 +1592,7 @@ struct registers_decoder<NV4097_SET_SURFACE_ZETA_OFFSET>
static void dump(std::string& out, const decoded_type& decoded) static void dump(std::string& out, const decoded_type& decoded)
{ {
fmt::append(out, "Surface: Z offset: %u", decoded.surface_z_offset()); fmt::append(out, "Surface: Z offset: 0x%x", decoded.surface_z_offset());
} }
}; };
@ -3040,10 +3040,21 @@ struct registers_decoder<NV4097_SET_COLOR_MASK>
{ {
return value != 0; return value != 0;
} }
u32 is_invalid() const
{
return (value & 0xfefefefe) ? value : 0;
}
}; };
static void dump(std::string& out, const decoded_type& decoded) static void dump(std::string& out, const decoded_type& decoded)
{ {
if (u32 invalid_value = decoded.is_invalid())
{
fmt::append(out, "Surface: color mask: invalid = 0x%08x", invalid_value);
return;
}
fmt::append(out, "Surface: color mask A = %s R = %s G = %s B = %s" fmt::append(out, "Surface: color mask A = %s R = %s G = %s B = %s"
, print_boolean(decoded.color_a()), print_boolean(decoded.color_r()), print_boolean(decoded.color_g()), print_boolean(decoded.color_b())); , print_boolean(decoded.color_a()), print_boolean(decoded.color_r()), print_boolean(decoded.color_g()), print_boolean(decoded.color_b()));
} }

View File

@ -849,6 +849,23 @@ namespace rsx
} }
} }
void set_color_mask(thread* rsx, u32 reg, u32 arg)
{
if (arg == method_registers.register_previous_value)
{
return;
}
if (method_registers.decode<NV4097_SET_COLOR_MASK>(arg).is_invalid()) [[ unlikely ]]
{
method_registers.decode(reg, method_registers.register_previous_value);
}
else
{
set_surface_options_dirty_bit(rsx, reg, arg);
}
}
void set_stencil_op(thread* rsx, u32 reg, u32 arg) void set_stencil_op(thread* rsx, u32 reg, u32 arg)
{ {
if (arg == method_registers.register_previous_value) if (arg == method_registers.register_previous_value)
@ -3550,7 +3567,7 @@ namespace rsx
bind(NV4097_SET_DEPTH_TEST_ENABLE, nv4097::set_surface_options_dirty_bit); bind(NV4097_SET_DEPTH_TEST_ENABLE, nv4097::set_surface_options_dirty_bit);
bind(NV4097_SET_DEPTH_FUNC, nv4097::set_surface_options_dirty_bit); bind(NV4097_SET_DEPTH_FUNC, nv4097::set_surface_options_dirty_bit);
bind(NV4097_SET_DEPTH_MASK, nv4097::set_surface_options_dirty_bit); bind(NV4097_SET_DEPTH_MASK, nv4097::set_surface_options_dirty_bit);
bind(NV4097_SET_COLOR_MASK, nv4097::set_surface_options_dirty_bit); bind(NV4097_SET_COLOR_MASK, nv4097::set_color_mask);
bind(NV4097_SET_COLOR_MASK_MRT, nv4097::set_surface_options_dirty_bit); bind(NV4097_SET_COLOR_MASK_MRT, nv4097::set_surface_options_dirty_bit);
bind(NV4097_SET_TWO_SIDED_STENCIL_TEST_ENABLE, nv4097::set_surface_options_dirty_bit); bind(NV4097_SET_TWO_SIDED_STENCIL_TEST_ENABLE, nv4097::set_surface_options_dirty_bit);
bind(NV4097_SET_STENCIL_TEST_ENABLE, nv4097::set_surface_options_dirty_bit); bind(NV4097_SET_STENCIL_TEST_ENABLE, nv4097::set_surface_options_dirty_bit);

View File

@ -67,7 +67,7 @@ LogHighlighter::LogHighlighter(QTextDocument* parent) : Highlighter(parent)
AsmHighlighter::AsmHighlighter(QTextDocument *parent) : Highlighter(parent) AsmHighlighter::AsmHighlighter(QTextDocument *parent) : Highlighter(parent)
{ {
addRule("^\b[A-Z0-9]+\b", Qt::darkBlue); // Instructions addRule("^\\b[A-Z0-9]+\\b", Qt::darkBlue); // Instructions
addRule("-?R\\d[^,;\\s]*", Qt::darkRed); // -R0.* addRule("-?R\\d[^,;\\s]*", Qt::darkRed); // -R0.*
addRule("-?H\\d[^,;\\s]*", Qt::red); // -H1.* addRule("-?H\\d[^,;\\s]*", Qt::red); // -H1.*
addRule("-?v\\[\\d\\]*[^,;\\s]*", Qt::darkCyan); // -v[xyz].* addRule("-?v\\[\\d\\]*[^,;\\s]*", Qt::darkCyan); // -v[xyz].*