mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-09 20:23:14 +00:00
Devtools IV (#1910)
* devtools: fix popen in non-windows environment * devtools: fix frame crash assertion when hidden * devtools: add search to shader list * devtools: add copy name to shader list * devtools: frame dump: search by shader name
This commit is contained in:
parent
0bb1c05aff
commit
edc027a8bc
14 changed files with 159 additions and 55 deletions
|
@ -497,7 +497,7 @@ vk::ShaderModule PipelineCache::CompileModule(Shader::Info& info, Shader::Runtim
|
|||
module = CompileSPV(spv, instance.GetDevice());
|
||||
}
|
||||
|
||||
const auto name = fmt::format("{}_{:#018x}_{}", info.stage, info.pgm_hash, perm_idx);
|
||||
const auto name = GetShaderName(info.stage, info.pgm_hash, perm_idx);
|
||||
Vulkan::SetObjectName(instance.GetDevice(), module, name);
|
||||
if (Config::collectShadersForDebug()) {
|
||||
DebugState.CollectShader(name, info.l_stage, module, spv, code,
|
||||
|
@ -572,6 +572,14 @@ std::optional<vk::ShaderModule> PipelineCache::ReplaceShader(vk::ShaderModule mo
|
|||
return new_module;
|
||||
}
|
||||
|
||||
std::string PipelineCache::GetShaderName(Shader::Stage stage, u64 hash,
|
||||
std::optional<size_t> perm) {
|
||||
if (perm) {
|
||||
return fmt::format("{}_{:#018x}_{}", stage, hash, *perm);
|
||||
}
|
||||
return fmt::format("{}_{:#018x}", stage, hash);
|
||||
}
|
||||
|
||||
void PipelineCache::DumpShader(std::span<const u32> code, u64 hash, Shader::Stage stage,
|
||||
size_t perm_idx, std::string_view ext) {
|
||||
if (!Config::dumpShaders()) {
|
||||
|
@ -583,7 +591,7 @@ void PipelineCache::DumpShader(std::span<const u32> code, u64 hash, Shader::Stag
|
|||
if (!std::filesystem::exists(dump_dir)) {
|
||||
std::filesystem::create_directories(dump_dir);
|
||||
}
|
||||
const auto filename = fmt::format("{}_{:#018x}_{}.{}", stage, hash, perm_idx, ext);
|
||||
const auto filename = fmt::format("{}.{}", GetShaderName(stage, hash, perm_idx), ext);
|
||||
const auto file = IOFile{dump_dir / filename, FileAccessMode::Write};
|
||||
file.WriteSpan(code);
|
||||
}
|
||||
|
@ -597,7 +605,7 @@ std::optional<std::vector<u32>> PipelineCache::GetShaderPatch(u64 hash, Shader::
|
|||
if (!std::filesystem::exists(patch_dir)) {
|
||||
std::filesystem::create_directories(patch_dir);
|
||||
}
|
||||
const auto filename = fmt::format("{}_{:#018x}_{}.{}", stage, hash, perm_idx, ext);
|
||||
const auto filename = fmt::format("{}.{}", GetShaderName(stage, hash, perm_idx), ext);
|
||||
const auto filepath = patch_dir / filename;
|
||||
if (!std::filesystem::exists(filepath)) {
|
||||
return {};
|
||||
|
|
|
@ -65,6 +65,9 @@ public:
|
|||
std::optional<vk::ShaderModule> ReplaceShader(vk::ShaderModule module,
|
||||
std::span<const u32> spv_code);
|
||||
|
||||
static std::string GetShaderName(Shader::Stage stage, u64 hash,
|
||||
std::optional<size_t> perm = {});
|
||||
|
||||
private:
|
||||
bool RefreshGraphicsKey();
|
||||
bool RefreshComputeKey();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue