diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-12-03 22:27:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-03 22:27:07 +0100 |
commit | 6da830177333e418ec5f468226b7715948955022 (patch) | |
tree | 4bc294031911f460d6252d35b476c16b0def4f0b /src/shader_recompiler/backend/glsl | |
parent | Merge pull request #12263 from liamwhite/null-romfs (diff) | |
parent | GLSL: Prefer known used cbuf sizes (diff) | |
download | yuzu-6da830177333e418ec5f468226b7715948955022.tar yuzu-6da830177333e418ec5f468226b7715948955022.tar.gz yuzu-6da830177333e418ec5f468226b7715948955022.tar.bz2 yuzu-6da830177333e418ec5f468226b7715948955022.tar.lz yuzu-6da830177333e418ec5f468226b7715948955022.tar.xz yuzu-6da830177333e418ec5f468226b7715948955022.tar.zst yuzu-6da830177333e418ec5f468226b7715948955022.zip |
Diffstat (limited to 'src/shader_recompiler/backend/glsl')
-rw-r--r-- | src/shader_recompiler/backend/glsl/glsl_emit_context.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp b/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp index fd9a99449..b2ceeefc4 100644 --- a/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp +++ b/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "common/div_ceil.h" #include "shader_recompiler/backend/bindings.h" #include "shader_recompiler/backend/glsl/glsl_emit_context.h" #include "shader_recompiler/frontend/ir/program.h" @@ -431,9 +432,11 @@ void EmitContext::DefineConstantBuffers(Bindings& bindings) { } for (const auto& desc : info.constant_buffer_descriptors) { const auto cbuf_type{profile.has_gl_cbuf_ftou_bug ? "uvec4" : "vec4"}; + const u32 cbuf_used_size{Common::DivCeil(info.constant_buffer_used_sizes[desc.index], 16U)}; + const u32 cbuf_binding_size{info.uses_global_memory ? 0x1000U : cbuf_used_size}; header += fmt::format("layout(std140,binding={}) uniform {}_cbuf_{}{{{} {}_cbuf{}[{}];}};", bindings.uniform_buffer, stage_name, desc.index, cbuf_type, - stage_name, desc.index, 4 * 1024); + stage_name, desc.index, cbuf_binding_size); bindings.uniform_buffer += desc.count; } } |