summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-05-30 08:40:19 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:34 +0200
commit916ca7432474e891864524dcbc6c879d5cdbfb72 (patch)
tree07ff6cc3f9737b20b4e65786f94cabe1dd3b254f
parentbuffer_cache: Mark uniform buffers as dirty if any enable bit changes (diff)
downloadyuzu-916ca7432474e891864524dcbc6c879d5cdbfb72.tar
yuzu-916ca7432474e891864524dcbc6c879d5cdbfb72.tar.gz
yuzu-916ca7432474e891864524dcbc6c879d5cdbfb72.tar.bz2
yuzu-916ca7432474e891864524dcbc6c879d5cdbfb72.tar.lz
yuzu-916ca7432474e891864524dcbc6c879d5cdbfb72.tar.xz
yuzu-916ca7432474e891864524dcbc6c879d5cdbfb72.tar.zst
yuzu-916ca7432474e891864524dcbc6c879d5cdbfb72.zip
Diffstat (limited to '')
-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
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp2
-rw-r--r--src/video_core/renderer_vulkan/vk_pipeline_cache.cpp7
6 files changed, 18 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
index, index);
}
}
- for (size_t index = 0; index < info.stores_frag_color.size(); ++index) {
- if (!info.stores_frag_color[index]) {
- continue;
- }
- if (index == 0) {
- Add("OUTPUT frag_color0=result.color;");
- } else {
+ if (stage == Stage::Fragment) {
+ Add("OUTPUT frag_color0=result.color;");
+ for (size_t index = 1; index < info.stores_frag_color.size(); ++index) {
Add("OUTPUT frag_color{}=result.color[{}];", index, index);
}
}
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,
if (stage == Stage::Fragment && runtime_info.force_early_z != 0) {
header += "OPTION NV_early_fragment_tests;";
}
- const auto non_zero_frag_colors{info.stores_frag_color | std::views::drop(1)};
- if (std::ranges::find(non_zero_frag_colors, true) != non_zero_frag_colors.end()) {
+ if (stage == Stage::Fragment) {
header += "OPTION ARB_draw_buffers;";
}
}
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) {
break;
case Stage::Fragment:
for (u32 index = 0; index < 8; ++index) {
- if (!info.stores_frag_color[index]) {
+ if (!info.stores_frag_color[index] && !profile.need_declared_frag_colors) {
continue;
}
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 {
bool support_int64_atomics{};
bool warp_size_potentially_larger_than_guest{};
+
bool lower_left_origin_mode{};
+ /// Fragment outputs have to be declared even if they are not written to avoid undefined values.
+ /// See Ori and the Blind Forest's main menu for reference.
+ bool need_declared_frag_colors{};
/// OpFClamp is broken and OpFMax + OpFMin should be used instead
bool has_broken_spirv_clamp{};
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index 7d2ec4efa..6ea7c0ee8 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -276,7 +276,9 @@ ShaderCache::ShaderCache(RasterizerOpenGL& rasterizer_, Core::Frontend::EmuWindo
.support_int64_atomics = false,
.warp_size_potentially_larger_than_guest = true,
+
.lower_left_origin_mode = true,
+ .need_declared_frag_colors = true,
.has_broken_spirv_clamp = true,
.has_broken_unsigned_image_offsets = true,
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
index b6998e37c..cec51cc77 100644
--- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
@@ -274,9 +274,16 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, Tegra::Engines::Maxw
.support_typeless_image_loads = device.IsFormatlessImageLoadSupported(),
.support_demote_to_helper_invocation = true,
.support_int64_atomics = device.IsExtShaderAtomicInt64Supported(),
+
.warp_size_potentially_larger_than_guest = device.IsWarpSizePotentiallyBiggerThanGuest(),
+
+ .lower_left_origin_mode = false,
+ .need_declared_frag_colors = false,
+
.has_broken_spirv_clamp = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS_KHR,
.has_broken_unsigned_image_offsets = false,
+ .has_broken_signed_operations = false,
+ .ignore_nan_fp_comparisons = false,
};
}