Skip to content

Commit 5f105db

Browse files
committed
Skip shaders from config
1 parent 579fc7a commit 5f105db

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/common/config.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ static bool vkCrashDiagnostic = false;
6464
static s16 cursorState = HideCursorState::Idle;
6565
static int cursorHideTimeout = 5; // 5 seconds (default)
6666
static bool separateupdatefolder = false;
67+
std::vector<u64> skipedHashes = {};
6768

6869
// Gui
6970
std::vector<std::filesystem::path> settings_install_dirs = {};
@@ -280,6 +281,10 @@ void setVblankDiv(u32 value) {
280281
vblankDivider = value;
281282
}
282283

284+
std::vector<u64> hashesToSkip() {
285+
return skipedHashes;
286+
}
287+
283288
void setFullscreenMode(bool enable) {
284289
isFullscreen = enable;
285290
}
@@ -562,6 +567,7 @@ void load(const std::filesystem::path& path) {
562567
shouldDumpShaders = toml::find_or<bool>(gpu, "dumpShaders", false);
563568
shouldPatchShaders = toml::find_or<bool>(gpu, "patchShaders", true);
564569
vblankDivider = toml::find_or<int>(gpu, "vblankDivider", 1);
570+
skipedHashes = toml::find_or<std::vector<u64>>(gpu, "skipShaders", {});
565571
}
566572

567573
if (data.contains("Vulkan")) {
@@ -664,6 +670,7 @@ void save(const std::filesystem::path& path) {
664670
data["GPU"]["dumpShaders"] = shouldDumpShaders;
665671
data["GPU"]["patchShaders"] = shouldPatchShaders;
666672
data["GPU"]["vblankDivider"] = vblankDivider;
673+
data["GPU"]["skipShaders"] = skipedHashes;
667674
data["Vulkan"]["gpuId"] = gpuId;
668675
data["Vulkan"]["validation"] = vkValidation;
669676
data["Vulkan"]["validation_sync"] = vkValidationSync;

src/common/config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ bool dumpShaders();
4646
bool patchShaders();
4747
bool isRdocEnabled();
4848
u32 vblankDiv();
49+
std::vector<u64> hashesToSkip();
4950

5051
void setDebugDump(bool enable);
5152
void setCollectShaderForDebug(bool enable);

src/video_core/renderer_vulkan/vk_pipeline_cache.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,16 @@ const ComputePipeline* PipelineCache::GetComputePipeline() {
207207
return it->second;
208208
}
209209

210+
bool ShouldSkipShader(u64 shader_hash, const char* shader_type) {
211+
std::vector<u64> skip_hashes = Config::hashesToSkip();
212+
shader_hash = shader_hash & INT64_MAX;
213+
if (std::ranges::contains(skip_hashes, shader_hash)) {
214+
//LOG_WARNING(Render_Vulkan, "Skipped {} shader hash {:#x}.", shader_type, shader_hash);
215+
return true;
216+
}
217+
return false;
218+
}
219+
210220
bool PipelineCache::RefreshGraphicsKey() {
211221
std::memset(&graphics_key, 0, sizeof(GraphicsPipelineKey));
212222

@@ -308,6 +318,10 @@ bool PipelineCache::RefreshGraphicsKey() {
308318
return false;
309319
}
310320

321+
if (ShouldSkipShader(bininfo.shader_hash, "graphics")) {
322+
return false;
323+
}
324+
311325
auto params = Liverpool::GetParams(*pgm);
312326
std::optional<Shader::Gcn::FetchShaderData> fetch_shader_;
313327
std::tie(infos[stage_out_idx], modules[stage_out_idx], fetch_shader_,
@@ -401,6 +415,9 @@ bool PipelineCache::RefreshComputeKey() {
401415
Shader::Backend::Bindings binding{};
402416
const auto* cs_pgm = &liverpool->regs.cs_program;
403417
const auto cs_params = Liverpool::GetParams(*cs_pgm);
418+
if (ShouldSkipShader(cs_params.hash, "compute")) {
419+
return false;
420+
}
404421
std::tie(infos[0], modules[0], fetch_shader, compute_key) =
405422
GetProgram(Shader::Stage::Compute, cs_params, binding);
406423
return true;

0 commit comments

Comments
 (0)