diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl.cpp b/src/shader_recompiler/backend/glsl/emit_glsl.cpp index f467d978c..bfc42e1b4 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl.cpp | |||
| @@ -180,13 +180,15 @@ void DefineVariables(const EmitContext& ctx, std::string& header) { | |||
| 180 | const auto type{static_cast<GlslVarType>(i)}; | 180 | const auto type{static_cast<GlslVarType>(i)}; |
| 181 | const auto& tracker{ctx.var_alloc.GetUseTracker(type)}; | 181 | const auto& tracker{ctx.var_alloc.GetUseTracker(type)}; |
| 182 | const auto type_name{ctx.var_alloc.GetGlslType(type)}; | 182 | const auto type_name{ctx.var_alloc.GetGlslType(type)}; |
| 183 | const auto precise{ | ||
| 184 | (type == GlslVarType::PrecF32 || type == GlslVarType::PrecF64) ? "precise " : ""}; | ||
| 183 | // Temps/return types that are never used are stored at index 0 | 185 | // Temps/return types that are never used are stored at index 0 |
| 184 | if (tracker.uses_temp) { | 186 | if (tracker.uses_temp) { |
| 185 | header += fmt::format("{}{}={}(0);", type_name, ctx.var_alloc.Representation(0, type), | 187 | header += fmt::format("{}{} {}={}(0);", precise, type_name, |
| 186 | type_name); | 188 | ctx.var_alloc.Representation(0, type), type_name); |
| 187 | } | 189 | } |
| 188 | for (u32 index = 1; index <= tracker.num_used; ++index) { | 190 | for (u32 index = 1; index <= tracker.num_used; ++index) { |
| 189 | header += fmt::format("{}{}={}(0);", type_name, | 191 | header += fmt::format("{}{} {}={}(0);", precise, type_name, |
| 190 | ctx.var_alloc.Representation(index, type), type_name); | 192 | ctx.var_alloc.Representation(index, type), type_name); |
| 191 | } | 193 | } |
| 192 | } | 194 | } |
| @@ -198,7 +200,7 @@ std::string EmitGLSL(const Profile& profile, const RuntimeInfo& runtime_info, IR | |||
| 198 | EmitContext ctx{program, bindings, profile, runtime_info}; | 200 | EmitContext ctx{program, bindings, profile, runtime_info}; |
| 199 | Precolor(program); | 201 | Precolor(program); |
| 200 | EmitCode(ctx, program); | 202 | EmitCode(ctx, program); |
| 201 | const std::string version{fmt::format("#version 450{}\n", GlslVersionSpecifier(ctx))}; | 203 | const std::string version{fmt::format("#version 460{}\n", GlslVersionSpecifier(ctx))}; |
| 202 | ctx.header.insert(0, version); | 204 | ctx.header.insert(0, version); |
| 203 | if (program.local_memory_size > 0) { | 205 | if (program.local_memory_size > 0) { |
| 204 | ctx.header += fmt::format("uint lmem[{}];", program.local_memory_size / 4); | 206 | ctx.header += fmt::format("uint lmem[{}];", program.local_memory_size / 4); |
| @@ -206,7 +208,7 @@ std::string EmitGLSL(const Profile& profile, const RuntimeInfo& runtime_info, IR | |||
| 206 | if (program.shared_memory_size > 0) { | 208 | if (program.shared_memory_size > 0) { |
| 207 | ctx.header += fmt::format("shared uint smem[{}];", program.shared_memory_size / 4); | 209 | ctx.header += fmt::format("shared uint smem[{}];", program.shared_memory_size / 4); |
| 208 | } | 210 | } |
| 209 | ctx.header += "void main(){\n"; | 211 | ctx.header += "\nvoid main(){\n"; |
| 210 | if (program.stage == Stage::VertexA || program.stage == Stage::VertexB) { | 212 | if (program.stage == Stage::VertexA || program.stage == Stage::VertexB) { |
| 211 | ctx.header += "gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);"; | 213 | ctx.header += "gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);"; |
| 212 | // TODO: Properly resolve attribute issues | 214 | // TODO: Properly resolve attribute issues |