summaryrefslogtreecommitdiff
path: root/src/shader_recompiler
diff options
context:
space:
mode:
authorGravatar ameerj2021-06-25 16:34:40 -0400
committerGravatar ameerj2021-07-22 21:51:39 -0400
commit65daec8b75dafb96296c6066db9c1d696948e7fe (patch)
tree69695dc79a6d467e2ce6340af69d2379ee8cec6c /src/shader_recompiler
parentopengl: Implement LOP.CC (diff)
downloadyuzu-65daec8b75dafb96296c6066db9c1d696948e7fe.tar.gz
yuzu-65daec8b75dafb96296c6066db9c1d696948e7fe.tar.xz
yuzu-65daec8b75dafb96296c6066db9c1d696948e7fe.zip
glsl: Fix shared and local memory declarations
account for the fact that program.*memory_size is in units of bytes.
Diffstat (limited to 'src/shader_recompiler')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl.cpp b/src/shader_recompiler/backend/glsl/emit_glsl.cpp
index 46d72963d..ffdc6dbba 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl.cpp
@@ -5,7 +5,7 @@
5#include <ranges> 5#include <ranges>
6#include <string> 6#include <string>
7 7
8#include "common/alignment.h" 8#include "common/div_ceil.h"
9#include "common/settings.h" 9#include "common/settings.h"
10#include "shader_recompiler/backend/glsl/emit_context.h" 10#include "shader_recompiler/backend/glsl/emit_context.h"
11#include "shader_recompiler/backend/glsl/emit_glsl.h" 11#include "shader_recompiler/backend/glsl/emit_glsl.h"
@@ -219,11 +219,11 @@ std::string EmitGLSL(const Profile& profile, const RuntimeInfo& runtime_info, IR
219 ctx.header.insert(0, version); 219 ctx.header.insert(0, version);
220 if (program.shared_memory_size > 0) { 220 if (program.shared_memory_size > 0) {
221 ctx.header += 221 ctx.header +=
222 fmt::format("shared uint smem[{}];", Common::AlignUp(program.shared_memory_size, 4)); 222 fmt::format("shared uint smem[{}];", Common::DivCeil(program.shared_memory_size, 4U));
223 } 223 }
224 ctx.header += "void main(){\n"; 224 ctx.header += "void main(){\n";
225 if (program.local_memory_size > 0) { 225 if (program.local_memory_size > 0) {
226 ctx.header += fmt::format("uint lmem[{}];", Common::AlignUp(program.local_memory_size, 4)); 226 ctx.header += fmt::format("uint lmem[{}];", Common::DivCeil(program.local_memory_size, 4U));
227 } 227 }
228 DefineVariables(ctx, ctx.header); 228 DefineVariables(ctx, ctx.header);
229 if (ctx.uses_cc_carry) { 229 if (ctx.uses_cc_carry) {