VERY experimental Nintendo Switch 2 emulator
C++
HACK glsl: Write defaults to unused generic attributes
ameerj1cc3be213555
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cppindex 788679f40a..8de33b582d 100644--- a/src/shader_recompiler/backend/glsl/emit_context.cpp+++ b/src/shader_recompiler/backend/glsl/emit_context.cpp@@ -110,8 +110,11 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profileheader += fmt::format("layout(location={})out vec4 frag_color{};", index, index);}for (size_t index = 0; index < info.stores_generics.size(); ++index) {- if (info.stores_generics[index]) {- header += fmt::format("layout(location={}) out vec4 out_attr{};", index, index);+ // TODO: Properly resolve attribute issues+ const auto declaration{+ fmt::format("layout(location={}) out vec4 out_attr{};", index, index)};+ if (info.stores_generics[index] || stage == Stage::VertexA || stage == Stage::VertexB) {+ header += declaration;}}DefineConstantBuffers(bindings);diff --git a/src/shader_recompiler/backend/glsl/emit_glsl.cpp b/src/shader_recompiler/backend/glsl/emit_glsl.cppindex f0257db7f8..19cf4e46b9 100644--- a/src/shader_recompiler/backend/glsl/emit_glsl.cpp+++ b/src/shader_recompiler/backend/glsl/emit_glsl.cpp@@ -209,6 +209,12 @@ std::string EmitGLSL(const Profile& profile, const RuntimeInfo& runtime_info, IRctx.header += "void main(){\n";if (program.stage == Stage::VertexA || program.stage == Stage::VertexB) {ctx.header += "gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);";+ // TODO: Properly resolve attribute issues+ for (size_t index = 0; index < program.info.stores_generics.size() / 2; ++index) {+ if (!program.info.stores_generics[index]) {+ ctx.header += fmt::format("out_attr{}=vec4(0,0,0,1);", index);+ }+ }}DefineVariables(ctx, ctx.header);if (ctx.uses_cc_carry) {