Skip to content

Commit 4794d20

Browse files
committed
Skip shaders from config
1 parent 9f2355a commit 4794d20

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
@@ -78,6 +78,7 @@ static int controllerCustomColorRGB[3] = {0, 0, 255};
7878
static bool compatibilityData = false;
7979
static bool checkCompatibilityOnStartup = false;
8080
static std::string trophyKey;
81+
std::vector<u64> skipedHashes = {};
8182

8283
// Gui
8384
static bool load_game_size = true;
@@ -434,6 +435,10 @@ static void setShowLabelsUnderIcons(bool enable) {
434435
showLabelsUnderIcons = enable;
435436
}
436437

438+
std::vector<u64> hashesToSkip() {
439+
return skipedHashes;
440+
}
441+
437442
void setFullscreenMode(std::string mode) {
438443
fullscreenMode = mode;
439444
}
@@ -803,6 +808,7 @@ void load(const std::filesystem::path& path) {
803808
isFullscreen = toml::find_or<bool>(gpu, "Fullscreen", false);
804809
fullscreenMode = toml::find_or<std::string>(gpu, "FullscreenMode", "Windowed");
805810
isHDRAllowed = toml::find_or<bool>(gpu, "allowHDR", false);
811+
skipedHashes = toml::find_or<std::vector<u64>>(gpu, "skipShaders", {});
806812
}
807813

808814
if (data.contains("Vulkan")) {
@@ -986,6 +992,7 @@ void save(const std::filesystem::path& path) {
986992
data["GPU"]["Fullscreen"] = isFullscreen;
987993
data["GPU"]["FullscreenMode"] = fullscreenMode;
988994
data["GPU"]["allowHDR"] = isHDRAllowed;
995+
data["GPU"]["skipShaders"] = skipedHashes;
989996
data["Vulkan"]["gpuId"] = gpuId;
990997
data["Vulkan"]["validation"] = vkValidation;
991998
data["Vulkan"]["validation_sync"] = vkValidationSync;

src/common/config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ bool patchShaders();
7878
bool isRdocEnabled();
7979
bool fpsColor();
8080
u32 vblankDiv();
81+
std::vector<u64> hashesToSkip();
8182

8283
void setDebugDump(bool enable);
8384
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
@@ -266,6 +266,16 @@ const ComputePipeline* PipelineCache::GetComputePipeline() {
266266
return it->second.get();
267267
}
268268

269+
bool ShouldSkipShader(u64 shader_hash, const char* shader_type) {
270+
std::vector<u64> skip_hashes = Config::hashesToSkip();
271+
shader_hash = shader_hash & INT64_MAX;
272+
if (std::ranges::contains(skip_hashes, shader_hash)) {
273+
//LOG_WARNING(Render_Vulkan, "Skipped {} shader hash {:#x}.", shader_type, shader_hash);
274+
return true;
275+
}
276+
return false;
277+
}
278+
269279
bool PipelineCache::RefreshGraphicsKey() {
270280
std::memset(&graphics_key, 0, sizeof(GraphicsPipelineKey));
271281

@@ -373,6 +383,10 @@ bool PipelineCache::RefreshGraphicsKey() {
373383
return false;
374384
}
375385

386+
if (ShouldSkipShader(bininfo.shader_hash, "graphics")) {
387+
return false;
388+
}
389+
376390
auto params = Liverpool::GetParams(*pgm);
377391
std::optional<Shader::Gcn::FetchShaderData> fetch_shader_;
378392
std::tie(infos[stage_out_idx], modules[stage_out_idx], fetch_shader_,
@@ -481,6 +495,9 @@ bool PipelineCache::RefreshComputeKey() {
481495
Shader::Backend::Bindings binding{};
482496
const auto& cs_pgm = liverpool->GetCsRegs();
483497
const auto cs_params = Liverpool::GetParams(cs_pgm);
498+
if (ShouldSkipShader(cs_params.hash, "compute")) {
499+
return false;
500+
}
484501
std::tie(infos[0], modules[0], fetch_shader, compute_key.value) =
485502
GetProgram(Shader::Stage::Compute, LogicalStage::Compute, cs_params, binding);
486503
return true;

0 commit comments

Comments
 (0)