diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-01-05 05:00:06 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-01-30 04:11:02 +0100 |
commit | 52c326c301c2df30833efd85f14b03bc75f92bdb (patch) | |
tree | 765adbfe1b677d01d8148b5e1888ff6e1d571de7 /src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |
parent | Merge pull request #1960 from ReinUsesLisp/shader-ir-ldg (diff) | |
download | yuzu-52c326c301c2df30833efd85f14b03bc75f92bdb.tar yuzu-52c326c301c2df30833efd85f14b03bc75f92bdb.tar.gz yuzu-52c326c301c2df30833efd85f14b03bc75f92bdb.tar.bz2 yuzu-52c326c301c2df30833efd85f14b03bc75f92bdb.tar.lz yuzu-52c326c301c2df30833efd85f14b03bc75f92bdb.tar.xz yuzu-52c326c301c2df30833efd85f14b03bc75f92bdb.tar.zst yuzu-52c326c301c2df30833efd85f14b03bc75f92bdb.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index e072216f0..004245431 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -374,7 +374,8 @@ private: void DeclareConstantBuffers() { for (const auto& entry : ir.GetConstantBuffers()) { const auto [index, size] = entry; - code.AddLine("layout (std140) uniform " + GetConstBufferBlock(index) + " {"); + code.AddLine("layout (std140, binding = CBUF_BINDING_" + std::to_string(index) + + ") uniform " + GetConstBufferBlock(index) + " {"); code.AddLine(" vec4 " + GetConstBuffer(index) + "[MAX_CONSTBUFFER_ELEMENTS];"); code.AddLine("};"); code.AddNewLine(); @@ -383,7 +384,10 @@ private: void DeclareGlobalMemory() { for (const auto& entry : ir.GetGlobalMemoryBases()) { - code.AddLine("layout (std430) buffer " + GetGlobalMemoryBlock(entry) + " {"); + const std::string binding = + fmt::format("GMEM_BINDING_{}_{}", entry.cbuf_index, entry.cbuf_offset); + code.AddLine("layout (std430, binding = " + binding + ") buffer " + + GetGlobalMemoryBlock(entry) + " {"); code.AddLine(" float " + GetGlobalMemory(entry) + "[MAX_GLOBALMEMORY_ELEMENTS];"); code.AddLine("};"); code.AddNewLine(); @@ -413,7 +417,8 @@ private: if (sampler.IsShadow()) sampler_type += "Shadow"; - code.AddLine("uniform " + sampler_type + ' ' + GetSampler(sampler) + ';'); + code.AddLine("layout (binding = SAMPLER_BINDING_" + std::to_string(sampler.GetIndex()) + + ") uniform " + sampler_type + ' ' + GetSampler(sampler) + ';'); } if (!samplers.empty()) code.AddNewLine(); |