Skip to content

Commit 1c8f8fe

Browse files
committed
Skip shaders from config
1 parent bf7ba2f commit 1c8f8fe

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

@@ -379,6 +389,10 @@ bool PipelineCache::RefreshGraphicsKey() {
379389
return false;
380390
}
381391

392+
if (ShouldSkipShader(bininfo.shader_hash, "graphics")) {
393+
return false;
394+
}
395+
382396
auto params = Liverpool::GetParams(*pgm);
383397
std::optional<Shader::Gcn::FetchShaderData> fetch_shader_;
384398
std::tie(infos[stage_out_idx], modules[stage_out_idx], fetch_shader_,
@@ -487,6 +501,9 @@ bool PipelineCache::RefreshComputeKey() {
487501
Shader::Backend::Bindings binding{};
488502
const auto& cs_pgm = liverpool->GetCsRegs();
489503
const auto cs_params = Liverpool::GetParams(cs_pgm);
504+
if (ShouldSkipShader(cs_params.hash, "compute")) {
505+
return false;
506+
}
490507
std::tie(infos[0], modules[0], fetch_shader, compute_key.value) =
491508
GetProgram(Shader::Stage::Compute, LogicalStage::Compute, cs_params, binding);
492509
return true;

0 commit comments

Comments
 (0)