diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-12 08:03:25 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:40 +0200 |
commit | 94af0a00f67c9f28fcaf170458e55b7a95de76bf (patch) | |
tree | 82028b10b54dc4483a7b1e76003c4efa44f7938a /src/shader_recompiler/backend/glsl/emit_glsl.cpp | |
parent | gl_shader_cache: Properly implement asynchronous shaders (diff) | |
download | yuzu-94af0a00f67c9f28fcaf170458e55b7a95de76bf.tar yuzu-94af0a00f67c9f28fcaf170458e55b7a95de76bf.tar.gz yuzu-94af0a00f67c9f28fcaf170458e55b7a95de76bf.tar.bz2 yuzu-94af0a00f67c9f28fcaf170458e55b7a95de76bf.tar.lz yuzu-94af0a00f67c9f28fcaf170458e55b7a95de76bf.tar.xz yuzu-94af0a00f67c9f28fcaf170458e55b7a95de76bf.tar.zst yuzu-94af0a00f67c9f28fcaf170458e55b7a95de76bf.zip |
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl.cpp')
-rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl.cpp b/src/shader_recompiler/backend/glsl/emit_glsl.cpp index ffdc6dbba..c5e819a0a 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl.cpp @@ -218,8 +218,15 @@ std::string EmitGLSL(const Profile& profile, const RuntimeInfo& runtime_info, IR const std::string version{fmt::format("#version 450{}\n", GlslVersionSpecifier(ctx))}; ctx.header.insert(0, version); if (program.shared_memory_size > 0) { - ctx.header += - fmt::format("shared uint smem[{}];", Common::DivCeil(program.shared_memory_size, 4U)); + const auto requested_size{program.shared_memory_size}; + const auto max_size{profile.gl_max_compute_smem_size}; + const bool needs_clamp{requested_size > max_size}; + if (needs_clamp) { + LOG_WARNING(Shader_GLSL, "Requested shared memory size ({}) exceeds device limit ({})", + requested_size, max_size); + } + const auto smem_size{needs_clamp ? max_size : requested_size}; + ctx.header += fmt::format("shared uint smem[{}];", Common::DivCeil(smem_size, 4U)); } ctx.header += "void main(){\n"; if (program.local_memory_size > 0) { |