kepler_compute: use safe memory read

If unsafe read is done there can sometimes be corrupt data in the
KeplerCompute::ProcessLaunch qmd structure.

Fixes GPU crashes in 'Princess Peach: Showtime!' when using vulkan
renderer. Requires using "Accuracy Level High" (crashes will still
happen if using "Normal").

Tested on Radeon 6750XT, Linux 6.11.2, Mesa 24.2.5 (RADV driver).

Unsafe read was introduced in 115792158d
"VideoCore: Implement DispatchIndirect"

How did I debug this:
- Used VK_LAYER_KHRONOS_validation which found invalid vkCmdDispatch
  (along with a lot of other noise!)
- Instrumented all calls to vulkan Dispatch(), set breakpoint when
  grid_dim_x > 1024 (an obviously invalid value). Found dispatch came
  from RasterizerVulkan::DispatchCompute().
- Commented out DispatchCompute() entirely, game runs with no crashes
  but some graphics effects are missing.
- Keep going one layer up, observe corrupted `launch_description` in
  KeplerCompute::ProcessLaunch()
- Attempted safe ReadBlock (`which = VideoCommon::CacheType::All`)
  instead of ReadBlockUnsafe in KeplerCompute::ProcessLaunch(), did not
  help
- Go one layer up to DmaPusher. Switch to safe_process(). No more
  corrupt `launch_description`.
This commit is contained in:
cow 2024-10-21 23:24:41 +00:00 committed by spectranator
parent f45341ef55
commit 85dc40ad23

View File

@ -103,11 +103,6 @@ bool DmaPusher::Step() {
unsafe_process();
return true;
}
if (subchannel_type[dma_state.subchannel] == Engines::EngineTypes::KeplerCompute &&
dma_state.method == ComputeInline) {
unsafe_process();
return true;
}
safe_process();
return true;
}