summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/glsl/emit_glsl.cpp
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-06-08 00:04:01 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:37 +0200
commit258106038e921de6863d3e871a82fb7a0c77f10d (patch)
tree31079d1db5089646912fed49b4e075dbaaaa3b25 /src/shader_recompiler/backend/glsl/emit_glsl.cpp
parentglsl: Implement barriers (diff)
downloadyuzu-258106038e921de6863d3e871a82fb7a0c77f10d.tar
yuzu-258106038e921de6863d3e871a82fb7a0c77f10d.tar.gz
yuzu-258106038e921de6863d3e871a82fb7a0c77f10d.tar.bz2
yuzu-258106038e921de6863d3e871a82fb7a0c77f10d.tar.lz
yuzu-258106038e921de6863d3e871a82fb7a0c77f10d.tar.xz
yuzu-258106038e921de6863d3e871a82fb7a0c77f10d.tar.zst
yuzu-258106038e921de6863d3e871a82fb7a0c77f10d.zip
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl.cpp b/src/shader_recompiler/backend/glsl/emit_glsl.cpp
index 7b57c1e91..b189f6c11 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl.cpp
@@ -172,19 +172,28 @@ std::string GlslVersionSpecifier(const EmitContext& ctx) {
return "";
}
+bool IsPreciseType(GlslVarType type) {
+ switch (type) {
+ case GlslVarType::PrecF32:
+ case GlslVarType::PrecF64:
+ return true;
+ default:
+ return false;
+ }
+}
+
void DefineVariables(const EmitContext& ctx, std::string& header) {
for (u32 i = 0; i < static_cast<u32>(GlslVarType::Void); ++i) {
const auto type{static_cast<GlslVarType>(i)};
const auto& tracker{ctx.var_alloc.GetUseTracker(type)};
const auto type_name{ctx.var_alloc.GetGlslType(type)};
- const auto precise{
- (type == GlslVarType::PrecF32 || type == GlslVarType::PrecF64) ? "precise " : ""};
+ const auto precise{IsPreciseType(type) ? "precise " : ""};
// Temps/return types that are never used are stored at index 0
if (tracker.uses_temp) {
- header += fmt::format("{}{} {}={}(0);", precise, type_name,
+ header += fmt::format("{}{} t{}={}(0);", precise, type_name,
ctx.var_alloc.Representation(0, type), type_name);
}
- for (u32 index = 1; index <= tracker.num_used; ++index) {
+ for (u32 index = 0; index < tracker.num_used; ++index) {
header += fmt::format("{}{} {}={}(0);", precise, type_name,
ctx.var_alloc.Representation(index, type), type_name);
}