Browse Source

fix crash

pull/3296/head
lizzie 3 weeks ago
parent
commit
eae02d8b6b
  1. 46
      src/video_core/engines/maxwell_3d.cpp

46
src/video_core/engines/maxwell_3d.cpp

@ -30,6 +30,9 @@ Maxwell3D::Maxwell3D(Core::System& system_, MemoryManager& memory_manager_)
memory_manager{memory_manager_}, macro_engine{GetMacroEngine(*this)}, upload_state{memory_manager, regs.upload} {
dirty.flags.flip();
InitializeRegisterDefaults();
execution_mask.reset();
for (size_t i = 0; i < execution_mask.size(); i++)
execution_mask[i] = IsMethodExecutable(u32(i));
}
Maxwell3D::~Maxwell3D() = default;
@ -288,43 +291,32 @@ u32 Maxwell3D::ProcessShadowRam(u32 method, u32 argument) {
}
void Maxwell3D::ConsumeSinkImpl() {
SCOPE_EXIT {
method_sink.clear();
};
const auto control = shadow_state.shadow_ram_control;
if (control == Regs::ShadowRamControl::Track ||
control == Regs::ShadowRamControl::TrackWithFilter) {
if (control == Regs::ShadowRamControl::Track || control == Regs::ShadowRamControl::TrackWithFilter) {
for (auto [method, value] : method_sink) {
shadow_state.reg_array[method] = value;
ProcessDirtyRegisters(method, value);
}
return;
}
if (control == Regs::ShadowRamControl::Replay) {
for (auto [method, value] : method_sink) {
} else if (control == Regs::ShadowRamControl::Replay) {
for (auto [method, value] : method_sink)
ProcessDirtyRegisters(method, shadow_state.reg_array[method]);
}
return;
}
for (auto [method, value] : method_sink) {
ProcessDirtyRegisters(method, value);
} else {
for (auto [method, value] : method_sink)
ProcessDirtyRegisters(method, value);
}
method_sink.clear();
}
void Maxwell3D::ProcessDirtyRegisters(u32 method, u32 argument) {
if (regs.reg_array[method] == argument) {
return;
}
regs.reg_array[method] = argument;
const auto& table0 = dirty.tables[0];
const auto& table1 = dirty.tables[1];
const u8 flag0 = table0[method];
const u8 flag1 = table1[method];
dirty.flags[flag0] = true;
if (flag1 != flag0) {
dirty.flags[flag1] = true;
if (regs.reg_array[method] != argument) {
regs.reg_array[method] = argument;
auto const& table0 = dirty.tables[0];
auto const& table1 = dirty.tables[1];
u8 const flag0 = table0[method];
u8 const flag1 = table1[method];
dirty.flags[flag0] = true;
if (flag1 != flag0)
dirty.flags[flag1] = true;
}
}

Loading…
Cancel
Save