summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_arb_decompiler.cpp
diff options
context:
space:
mode:
authorRodrigo Locatti <reinuseslisp@airmail.cc>2020-07-21 09:51:05 +0200
committerGitHub <noreply@github.com>2020-07-21 09:51:05 +0200
commit7278c59d70dc1fdd8755f60a878da6d42825c7a0 (patch)
treeea37c477caeec1747ac8b8b1f775da40dd175fa6 /src/video_core/renderer_opengl/gl_arb_decompiler.cpp
parentMerge pull request #4360 from ReinUsesLisp/glasm-bar (diff)
parentrenderer_{opengl,vulkan}: Clamp shared memory to host's limit (diff)
downloadyuzu-7278c59d70dc1fdd8755f60a878da6d42825c7a0.tar
yuzu-7278c59d70dc1fdd8755f60a878da6d42825c7a0.tar.gz
yuzu-7278c59d70dc1fdd8755f60a878da6d42825c7a0.tar.bz2
yuzu-7278c59d70dc1fdd8755f60a878da6d42825c7a0.tar.lz
yuzu-7278c59d70dc1fdd8755f60a878da6d42825c7a0.tar.xz
yuzu-7278c59d70dc1fdd8755f60a878da6d42825c7a0.tar.zst
yuzu-7278c59d70dc1fdd8755f60a878da6d42825c7a0.zip
Diffstat (limited to 'src/video_core/renderer_opengl/gl_arb_decompiler.cpp')
-rw-r--r--src/video_core/renderer_opengl/gl_arb_decompiler.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_arb_decompiler.cpp b/src/video_core/renderer_opengl/gl_arb_decompiler.cpp
index c06e838f7..3b61c9e21 100644
--- a/src/video_core/renderer_opengl/gl_arb_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_arb_decompiler.cpp
@@ -913,11 +913,19 @@ void ARBDecompiler::DeclareCompute() {
const ComputeInfo& info = registry.GetComputeInfo();
AddLine("GROUP_SIZE {} {} {};", info.workgroup_size[0], info.workgroup_size[1],
info.workgroup_size[2]);
- if (info.shared_memory_size_in_words > 0) {
- const u32 size_in_bytes = info.shared_memory_size_in_words * 4;
- AddLine("SHARED_MEMORY {};", size_in_bytes);
- AddLine("SHARED shared_mem[] = {{program.sharedmem}};");
+ if (info.shared_memory_size_in_words == 0) {
+ return;
+ }
+ const u32 limit = device.GetMaxComputeSharedMemorySize();
+ u32 size_in_bytes = info.shared_memory_size_in_words * 4;
+ if (size_in_bytes > limit) {
+ LOG_ERROR(Render_OpenGL, "Shared memory size {} is clamped to host's limit {}",
+ size_in_bytes, limit);
+ size_in_bytes = limit;
}
+
+ AddLine("SHARED_MEMORY {};", size_in_bytes);
+ AddLine("SHARED shared_mem[] = {{program.sharedmem}};");
}
void ARBDecompiler::DeclareInputAttributes() {