diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl.cpp b/src/shader_recompiler/backend/glsl/emit_glsl.cpp index f9ad71f92..bac4b830d 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl.cpp | |||
| @@ -180,6 +180,16 @@ std::string EmitGLSL(const Profile& profile, const RuntimeInfo& runtime_info, IR | |||
| 180 | EmitCode(ctx, program); | 180 | EmitCode(ctx, program); |
| 181 | const std::string version{fmt::format("#version 450{}\n", GlslVersionSpecifier(ctx))}; | 181 | const std::string version{fmt::format("#version 450{}\n", GlslVersionSpecifier(ctx))}; |
| 182 | ctx.header.insert(0, version); | 182 | ctx.header.insert(0, version); |
| 183 | if (program.local_memory_size > 0) { | ||
| 184 | ctx.header += fmt::format("uint lmem[{}];", program.local_memory_size / 4); | ||
| 185 | } | ||
| 186 | if (program.shared_memory_size > 0) { | ||
| 187 | ctx.header += fmt::format("shared uint smem[{}];", program.shared_memory_size / 4); | ||
| 188 | } | ||
| 189 | ctx.header += "void main(){\n"; | ||
| 190 | if (program.stage == Stage::VertexA || program.stage == Stage::VertexB) { | ||
| 191 | ctx.header += "gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);"; | ||
| 192 | } | ||
| 183 | for (size_t index = 0; index < ctx.reg_alloc.num_used_registers; ++index) { | 193 | for (size_t index = 0; index < ctx.reg_alloc.num_used_registers; ++index) { |
| 184 | ctx.header += fmt::format("{} R{};", ctx.reg_alloc.reg_types[index], index); | 194 | ctx.header += fmt::format("{} R{};", ctx.reg_alloc.reg_types[index], index); |
| 185 | } | 195 | } |