xbzk/gpu-logging_qt-controls_android-fix (#4018)

5af7771f83-Bugfix: Made gpu_log_level global-only (was per-game switchable). Fixed Android non-determinism where a per-game profile silently overrode the global to Off and trapped GPULogger::Initialize() in a dead state, making shader dumps fail invisibly. Android per-game UI now hides the whole GPU logging block; Qt UI is untouched (global-only anyway).

bf4aabe8ab-Refactor/Cleanup: Removed gpu_logging_enabled master toggle as redundant with gpu_log_level == Off. Introduced GPU::Logging::IsActive() helper, replaced 14 call sites across vk_*.cpp. Refactored LogShaderCompilation() to be text-only and extracted SPIR-V dumping into a standalone GPU::Logging::DumpSpirvShader() free function. No singleton dependency, gated only by gpu_log_shader_dumps. Now gpu_log_level and gpu_log_shader_dumps are fully orthogonal. Cleaned up Android (BooleanSetting, SettingsItem, presenter, 7 locale string files).

865a1c5027-Refactor: Renamed dump_shaders → dump_guest_shaders to disambiguate from gpu_log_shader_dumps. Updated Qt label to "Dump Guest (Maxwell) Shaders" and rewrote the tooltip to mention .ash, the DumpDir/shaders/ location, and nvdisasm.

7cab456fdf-Feature: Added Qt UI control for GPU log level in the Logging session. Added gpu_log_shader_dumps checkbox to the Graphics column right below dump_guest_shaders.

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4018
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
This commit is contained in:
xbzk 2026-06-27 02:52:13 +02:00 committed by crueter
parent 629ebf1bde
commit 09b6b3b71e
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
29 changed files with 335 additions and 194 deletions

View file

@ -18,6 +18,7 @@
#include "common/fs/fs.h"
#include "common/fs/path_util.h"
#include "common/logging.h"
#include "common/settings.h"
#include <ranges>
#include "shader_recompiler/environment.h"
#include "video_core/engines/kepler_compute.h"
@ -73,36 +74,36 @@ static Shader::TexturePixelFormat ConvertTexturePixelFormat(const Tegra::Texture
static std::string_view StageToPrefix(Shader::Stage stage) {
switch (stage) {
case Shader::Stage::VertexB:
return "VB";
return "vs";
case Shader::Stage::TessellationControl:
return "TC";
return "tc";
case Shader::Stage::TessellationEval:
return "TE";
return "te";
case Shader::Stage::Geometry:
return "GS";
return "gs";
case Shader::Stage::Fragment:
return "FS";
return "fs";
case Shader::Stage::Compute:
return "CS";
return "cs";
case Shader::Stage::VertexA:
return "VA";
return "va";
default:
return "UK";
return "uk";
}
}
static void DumpImpl(u64 pipeline_hash, u64 shader_hash, std::span<const u64> code,
static void DumpImpl(u64 /*pipeline_hash*/, u64 shader_hash, std::span<const u64> code,
[[maybe_unused]] u32 read_highest, [[maybe_unused]] u32 read_lowest,
u32 initial_offset, Shader::Stage stage) {
const auto shader_dir{Common::FS::GetEdenPath(Common::FS::EdenPath::DumpDir)};
const auto base_dir{shader_dir / "shaders"};
if (!Common::FS::CreateDir(shader_dir) || !Common::FS::CreateDir(base_dir)) {
LOG_ERROR(Common_Filesystem, "Failed to create shader dump directories");
const auto dump_dir{Common::FS::GetEdenPath(Common::FS::EdenPath::DumpDir)};
if (!Common::FS::CreateDir(dump_dir)) {
LOG_ERROR(Common_Filesystem, "Failed to create dump directory");
return;
}
const auto prefix = StageToPrefix(stage);
const auto name{base_dir /
fmt::format("{:016x}_{}_{:016x}.ash", pipeline_hash, prefix, shader_hash)};
const auto name{dump_dir /
fmt::format("{:016x}_{:016x}_{}.ash",
Settings::GetCurrentProgramID(), shader_hash, prefix)};
std::fstream shader_file(name, std::ios::out | std::ios::binary);
ASSERT(initial_offset % sizeof(u64) == 0);
const size_t jump_index = initial_offset / sizeof(u64);