diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 779163cfc..508ad6de3 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -269,6 +269,8 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) { LoadDiskCacheProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0); + system.GPU().ApplyPerProgramSettings(program_id); + std::unique_ptr cpu_context; system.GPU().Renderer().Rasterizer()->LoadDefaultDiskResources(stop_run, &LoadDiskCacheProgress); diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index b1ed314e4..e13fc48b7 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -18,6 +18,7 @@ #include "core/3ds.h" #include "core/core.h" #include "core/frontend/framebuffer_layout.h" +#include "core/loader/loader.h" #include "core/perf_stats.h" #include "input_common/keyboard.h" #include "input_common/main.h" @@ -78,6 +79,10 @@ void EmuThread::run() { emit LoadProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0); + u64 program_id{}; + system.GetAppLoader().ReadProgramId(program_id); + system.GPU().ApplyPerProgramSettings(program_id); + system.GPU().Renderer().Rasterizer()->LoadDefaultDiskResources( stop_run, [this](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) { emit LoadProgress(stage, value, total); diff --git a/src/citra_sdl/citra_sdl.cpp b/src/citra_sdl/citra_sdl.cpp index 82f775377..9c0f4470a 100644 --- a/src/citra_sdl/citra_sdl.cpp +++ b/src/citra_sdl/citra_sdl.cpp @@ -474,6 +474,10 @@ int LaunchSdlFrontend(int argc, char** argv) { } }); + u64 program_id{}; + system.GetAppLoader().ReadProgramId(program_id); + system.GPU().ApplyPerProgramSettings(program_id); + std::atomic_bool stop_run; system.GPU().Renderer().Rasterizer()->LoadDefaultDiskResources( stop_run, [](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) { diff --git a/src/core/core.cpp b/src/core/core.cpp index 1622f3941..2140e3ddb 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -403,8 +403,6 @@ System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::st kernel->UpdateCPUAndMemoryState(program_id, app_mem_mode, app_n3ds_hw_capabilities); - gpu->ReportLoadingProgramID(program_id); - // Restore any parameters that should be carried through a reset. if (auto apt = Service::APT::GetModule(*this)) { if (restore_deliver_arg.has_value()) { @@ -902,13 +900,15 @@ void System::serialize(Archive& ar, const unsigned int file_version) { gpu->SetInterruptHandler( [gsp](Service::GSP::InterruptId interrupt_id) { gsp->SignalInterrupt(interrupt_id); }); - // Switch the shader cache to the title running when the savestate was created + // Apply per program settings and switch the shader cache to the title running when the + // savestate was created. const u32 thread_id = gsp->GetActiveClientThreadId(); if (thread_id != std::numeric_limits::max()) { const auto thread = kernel->GetThreadByID(thread_id); if (thread) { const std::shared_ptr process = thread->owner_process.lock(); if (process) { + gpu->ApplyPerProgramSettings(process->codeset->program_id); gpu->Renderer().Rasterizer()->SwitchDiskResources(process->codeset->program_id); } } diff --git a/src/core/hle/service/gsp/gsp_gpu.cpp b/src/core/hle/service/gsp/gsp_gpu.cpp index 4692e62fd..39d10f2d3 100644 --- a/src/core/hle/service/gsp/gsp_gpu.cpp +++ b/src/core/hle/service/gsp/gsp_gpu.cpp @@ -693,6 +693,7 @@ Result GSP_GPU::AcquireGpuRight(const Kernel::HLERequestContext& ctx, Common::Hacks::HackAllowMode::DISALLOW) != Common::Hacks::HackAllowMode::DISALLOW; auto& gpu = system.GPU(); + gpu.ApplyPerProgramSettings(process->codeset->program_id); gpu.GetRightEyeDisabler().SetEnabled(right_eye_disable_allow); gpu.PicaCore().vs_setup.requires_fixup = requires_shader_fixup; gpu.PicaCore().gs_setup.requires_fixup = requires_shader_fixup; diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 11516e5d6..37272d4ad 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -311,7 +311,7 @@ GraphicsDebugger& GPU::Debugger() { return impl->gpu_debugger; } -void GPU::ReportLoadingProgramID(u64 program_ID) { +void GPU::ApplyPerProgramSettings(u64 program_ID) { auto hack = Common::Hacks::hack_manager.GetHack( Common::Hacks::HackType::ACCURATE_MULTIPLICATION, program_ID); bool use_accurate_mul = Settings::values.shaders_accurate_mul.GetValue(); diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index c2d344a2c..1b326a067 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h @@ -94,7 +94,7 @@ public: return *right_eye_disabler; } - void ReportLoadingProgramID(u64 program_ID); + void ApplyPerProgramSettings(u64 program_ID); private: void SubmitCmdList(u32 index);