summaryrefslogtreecommitdiff
path: root/src/shader_recompiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_context.cpp10
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm.cpp3
-rw-r--r--src/shader_recompiler/backend/spirv/emit_context.cpp2
-rw-r--r--src/shader_recompiler/profile.h4
4 files changed, 9 insertions, 10 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_context.cpp b/src/shader_recompiler/backend/glasm/emit_context.cpp
index e18526816..08918a5c2 100644
--- a/src/shader_recompiler/backend/glasm/emit_context.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_context.cpp
@@ -117,13 +117,9 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
117 index, index); 117 index, index);
118 } 118 }
119 } 119 }
120 for (size_t index = 0; index < info.stores_frag_color.size(); ++index) { 120 if (stage == Stage::Fragment) {
121 if (!info.stores_frag_color[index]) { 121 Add("OUTPUT frag_color0=result.color;");
122 continue; 122 for (size_t index = 1; index < info.stores_frag_color.size(); ++index) {
123 }
124 if (index == 0) {
125 Add("OUTPUT frag_color0=result.color;");
126 } else {
127 Add("OUTPUT frag_color{}=result.color[{}];", index, index); 123 Add("OUTPUT frag_color{}=result.color[{}];", index, index);
128 } 124 }
129 } 125 }
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
index e23208d2c..70ca6f621 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
@@ -298,8 +298,7 @@ void SetupOptions(const IR::Program& program, const Profile& profile,
298 if (stage == Stage::Fragment && runtime_info.force_early_z != 0) { 298 if (stage == Stage::Fragment && runtime_info.force_early_z != 0) {
299 header += "OPTION NV_early_fragment_tests;"; 299 header += "OPTION NV_early_fragment_tests;";
300 } 300 }
301 const auto non_zero_frag_colors{info.stores_frag_color | std::views::drop(1)}; 301 if (stage == Stage::Fragment) {
302 if (std::ranges::find(non_zero_frag_colors, true) != non_zero_frag_colors.end()) {
303 header += "OPTION ARB_draw_buffers;"; 302 header += "OPTION ARB_draw_buffers;";
304 } 303 }
305} 304}
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp
index 3e8899f53..7c618125e 100644
--- a/src/shader_recompiler/backend/spirv/emit_context.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_context.cpp
@@ -1320,7 +1320,7 @@ void EmitContext::DefineOutputs(const IR::Program& program) {
1320 break; 1320 break;
1321 case Stage::Fragment: 1321 case Stage::Fragment:
1322 for (u32 index = 0; index < 8; ++index) { 1322 for (u32 index = 0; index < 8; ++index) {
1323 if (!info.stores_frag_color[index]) { 1323 if (!info.stores_frag_color[index] && !profile.need_declared_frag_colors) {
1324 continue; 1324 continue;
1325 } 1325 }
1326 frag_color[index] = DefineOutput(*this, F32[4], std::nullopt); 1326 frag_color[index] = DefineOutput(*this, F32[4], std::nullopt);
diff --git a/src/shader_recompiler/profile.h b/src/shader_recompiler/profile.h
index f8913bf14..f059e3b26 100644
--- a/src/shader_recompiler/profile.h
+++ b/src/shader_recompiler/profile.h
@@ -84,7 +84,11 @@ struct Profile {
84 bool support_int64_atomics{}; 84 bool support_int64_atomics{};
85 85
86 bool warp_size_potentially_larger_than_guest{}; 86 bool warp_size_potentially_larger_than_guest{};
87
87 bool lower_left_origin_mode{}; 88 bool lower_left_origin_mode{};
89 /// Fragment outputs have to be declared even if they are not written to avoid undefined values.
90 /// See Ori and the Blind Forest's main menu for reference.
91 bool need_declared_frag_colors{};
88 92
89 /// OpFClamp is broken and OpFMax + OpFMin should be used instead 93 /// OpFClamp is broken and OpFMax + OpFMin should be used instead
90 bool has_broken_spirv_clamp{}; 94 bool has_broken_spirv_clamp{};