From 390558c8024dd711fbace52be9da2a288166873c Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Thu, 4 Aug 2022 20:11:07 +0100 Subject: [PATCH] Add partial support for legacy attribute conversion We previously missed the hades pass for attribute conversion leading to crashes when games would attempt to use such an attribute. The hades pass for this isn't a proper fix however as it modifies the IR directly and will break if any of the previous stages in the pipeline change. Enable it to allow for games using them to at least have a chance at working. In the long term the pass will be reworked on the hades side to avoid modifying the IR in a way that can't be undone. --- app/src/main/cpp/skyline/gpu/shader_manager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/cpp/skyline/gpu/shader_manager.cpp b/app/src/main/cpp/skyline/gpu/shader_manager.cpp index d2c853d3..e2a02680 100644 --- a/app/src/main/cpp/skyline/gpu/shader_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/shader_manager.cpp @@ -367,6 +367,11 @@ namespace skyline::gpu { lock.unlock(); // Note: EmitSPIRV will change bindings so we explicitly have pre/post emit bindings + if (program->program.info.loads.Legacy() || program->program.info.stores.Legacy()) { + // The legacy conversion pass modifies the underlying program based on runtime state, so without making a copy of the program there may be issues if runtimeInfo changes + Logger::Warn("Shader uses legacy attributes, beware!"); + Shader::Maxwell::ConvertLegacyToGeneric(program->program, runtimeInfo); + } auto spirv{Shader::Backend::SPIRV::EmitSPIRV(profile, runtimeInfo, program->program, bindings)}; vk::ShaderModuleCreateInfo createInfo{