glsl: Declare local memory in main

master
ameerj 2021-06-24 20:14:31 +07:00
parent f7352411f0
commit 00fa09dc45
1 changed files with 3 additions and 3 deletions

@ -217,14 +217,14 @@ std::string EmitGLSL(const Profile& profile, const RuntimeInfo& runtime_info, IR
EmitCode(ctx, program);
const std::string version{fmt::format("#version 450{}\n", GlslVersionSpecifier(ctx))};
ctx.header.insert(0, version);
if (program.local_memory_size > 0) {
ctx.header += fmt::format("uint lmem[{}];", Common::AlignUp(program.local_memory_size, 4));
}
if (program.shared_memory_size > 0) {
ctx.header +=
fmt::format("shared uint smem[{}];", Common::AlignUp(program.shared_memory_size, 4));
}
ctx.header += "void main(){\n";
if (program.local_memory_size > 0) {
ctx.header += fmt::format("uint lmem[{}];", Common::AlignUp(program.local_memory_size, 4));
}
DefineVariables(ctx, ctx.header);
if (ctx.uses_cc_carry) {
ctx.header += "uint carry;";