diff options
author | Fernando S <fsahmkow27@gmail.com> | 2022-04-07 12:40:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-07 12:40:59 +0200 |
commit | 4d5900aaa1776b01ec666a14480018aa86e02e6f (patch) | |
tree | 6564d65d194725e528fb525dadad3300b58197fa /src/shader_recompiler/backend/glsl/glsl_emit_context.cpp | |
parent | Merge pull request #8164 from liamwhite/jit-stub (diff) | |
parent | shader_recompiler: Decrease indirect cbuf limit to match hardware (diff) | |
download | yuzu-4d5900aaa1776b01ec666a14480018aa86e02e6f.tar yuzu-4d5900aaa1776b01ec666a14480018aa86e02e6f.tar.gz yuzu-4d5900aaa1776b01ec666a14480018aa86e02e6f.tar.bz2 yuzu-4d5900aaa1776b01ec666a14480018aa86e02e6f.tar.lz yuzu-4d5900aaa1776b01ec666a14480018aa86e02e6f.tar.xz yuzu-4d5900aaa1776b01ec666a14480018aa86e02e6f.tar.zst yuzu-4d5900aaa1776b01ec666a14480018aa86e02e6f.zip |
Diffstat (limited to 'src/shader_recompiler/backend/glsl/glsl_emit_context.cpp')
-rw-r--r-- | src/shader_recompiler/backend/glsl/glsl_emit_context.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp b/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp index e816a93ec..17266f40d 100644 --- a/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp +++ b/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp @@ -359,6 +359,7 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile header += "layout(location=0) uniform vec4 scaling;"; } DefineConstantBuffers(bindings); + DefineConstantBufferIndirect(); DefineStorageBuffers(bindings); SetupImages(bindings); SetupTextures(bindings); @@ -436,6 +437,24 @@ void EmitContext::DefineConstantBuffers(Bindings& bindings) { } } +void EmitContext::DefineConstantBufferIndirect() { + if (!info.uses_cbuf_indirect) { + return; + } + + header += profile.has_gl_cbuf_ftou_bug ? "uvec4 " : "vec4 "; + header += "GetCbufIndirect(uint binding, uint offset){" + "switch(binding){" + "default:"; + + for (const auto& desc : info.constant_buffer_descriptors) { + header += + fmt::format("case {}:return {}_cbuf{}[offset];", desc.index, stage_name, desc.index); + } + + header += "}}"; +} + void EmitContext::DefineStorageBuffers(Bindings& bindings) { if (info.storage_buffers_descriptors.empty()) { return; |