summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-05-21 23:27:37 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:33 +0200
commit84feabac881443d27f84f8fec5eba6dc3b13b620 (patch)
tree7b3dd78d2753a0d73e358182d989d65836026303
parentglasm: Set transform feedback state (diff)
downloadyuzu-84feabac881443d27f84f8fec5eba6dc3b13b620.tar
yuzu-84feabac881443d27f84f8fec5eba6dc3b13b620.tar.gz
yuzu-84feabac881443d27f84f8fec5eba6dc3b13b620.tar.bz2
yuzu-84feabac881443d27f84f8fec5eba6dc3b13b620.tar.lz
yuzu-84feabac881443d27f84f8fec5eba6dc3b13b620.tar.xz
yuzu-84feabac881443d27f84f8fec5eba6dc3b13b620.tar.zst
yuzu-84feabac881443d27f84f8fec5eba6dc3b13b620.zip
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm.cpp8
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp4
2 files changed, 8 insertions, 4 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
index edff04a44..0c2bbf284 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
@@ -261,7 +261,8 @@ void EmitCode(EmitContext& ctx, const IR::Program& program) {
}
}
-void SetupOptions(const IR::Program& program, const Profile& profile, std::string& header) {
+void SetupOptions(const IR::Program& program, const Profile& profile,
+ const RuntimeInfo& runtime_info, std::string& header) {
const Info& info{program.info};
const Stage stage{program.stage};
@@ -296,6 +297,9 @@ void SetupOptions(const IR::Program& program, const Profile& profile, std::strin
header += "OPTION NV_viewport_array2;";
}
}
+ 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()) {
header += "OPTION ARB_draw_buffers;";
@@ -380,7 +384,7 @@ std::string EmitGLASM(const Profile& profile, const RuntimeInfo& runtime_info, I
Precolor(ctx, program);
EmitCode(ctx, program);
std::string header{StageHeader(program.stage)};
- SetupOptions(program, profile, header);
+ SetupOptions(program, profile, runtime_info, header);
switch (program.stage) {
case Stage::TessellationControl:
header += fmt::format("VERTICES_OUT {};", program.invocations);
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index 0a0f1324f..e678b4bb2 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -219,8 +219,8 @@ Shader::RuntimeInfo MakeRuntimeInfo(const GraphicsProgramKey& key,
return Shader::TessSpacing::Equal;
}();
break;
- case Shader::Stage::Geometry:
-
+ case Shader::Stage::Fragment:
+ info.force_early_z = key.early_z != 0;
break;
default:
break;