summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-11-21 14:21:42 -0300
committerGravatar ReinUsesLisp2019-11-22 21:28:49 -0300
commit36d9b409fc8793b617c4ce5525d8dc297cb4d579 (patch)
tree33e3f8cd5a039acdacbf16c80436cbd8ff3461f6 /src
parentgl_rasterizer: Add missing cbuf counter reset on compute (diff)
downloadyuzu-36d9b409fc8793b617c4ce5525d8dc297cb4d579.tar.gz
yuzu-36d9b409fc8793b617c4ce5525d8dc297cb4d579.tar.xz
yuzu-36d9b409fc8793b617c4ce5525d8dc297cb4d579.zip
gl_shader_decompiler: Normalize cbuf bindings
Stage and compute shaders were using a different binding counter. Normalize these.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp4
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp12
2 files changed, 6 insertions, 10 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index f2494e0e2..de7b7ce93 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -857,13 +857,13 @@ bool RasterizerOpenGL::AccelerateDisplay(const Tegra::FramebufferConfig& config,
857 857
858void RasterizerOpenGL::SetupDrawConstBuffers(std::size_t stage_index, const Shader& shader) { 858void RasterizerOpenGL::SetupDrawConstBuffers(std::size_t stage_index, const Shader& shader) {
859 MICROPROFILE_SCOPE(OpenGL_UBO); 859 MICROPROFILE_SCOPE(OpenGL_UBO);
860 const u32 base_binding = device.GetBaseBindings(stage_index).uniform_buffer;
861 const auto& stages = system.GPU().Maxwell3D().state.shader_stages; 860 const auto& stages = system.GPU().Maxwell3D().state.shader_stages;
862 const auto& shader_stage = stages[stage_index]; 861 const auto& shader_stage = stages[stage_index];
863 862
863 u32 binding = device.GetBaseBindings(stage_index).uniform_buffer;
864 for (const auto& entry : shader->GetShaderEntries().const_buffers) { 864 for (const auto& entry : shader->GetShaderEntries().const_buffers) {
865 const auto& buffer = shader_stage.const_buffers[entry.GetIndex()]; 865 const auto& buffer = shader_stage.const_buffers[entry.GetIndex()];
866 SetupConstBuffer(base_binding + entry.GetIndex(), buffer, entry); 866 SetupConstBuffer(binding++, buffer, entry);
867 } 867 }
868} 868}
869 869
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 5ad285c25..040370c83 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -619,10 +619,9 @@ private:
619 } 619 }
620 620
621 void DeclareConstantBuffers() { 621 void DeclareConstantBuffers() {
622 for (const auto& entry : ir.GetConstantBuffers()) { 622 u32 binding = device.GetBaseBindings(stage).uniform_buffer;
623 const auto [index, size] = entry; 623 for (const auto& [index, cbuf] : ir.GetConstantBuffers()) {
624 const u32 binding = device.GetBaseBindings(stage).uniform_buffer + index; 624 code.AddLine("layout (std140, binding = {}) uniform {} {{", binding++,
625 code.AddLine("layout (std140, binding = {}) uniform {} {{", binding,
626 GetConstBufferBlock(index)); 625 GetConstBufferBlock(index));
627 code.AddLine(" uvec4 {}[{}];", GetConstBuffer(index), MAX_CONSTBUFFER_ELEMENTS); 626 code.AddLine(" uvec4 {}[{}];", GetConstBuffer(index), MAX_CONSTBUFFER_ELEMENTS);
628 code.AddLine("}};"); 627 code.AddLine("}};");
@@ -632,10 +631,7 @@ private:
632 631
633 void DeclareGlobalMemory() { 632 void DeclareGlobalMemory() {
634 u32 binding = device.GetBaseBindings(stage).shader_storage_buffer; 633 u32 binding = device.GetBaseBindings(stage).shader_storage_buffer;
635 634 for (const auto& [base, usage] : ir.GetGlobalMemory()) {
636 for (const auto& gmem : ir.GetGlobalMemory()) {
637 const auto& [base, usage] = gmem;
638
639 // Since we don't know how the shader will use the shader, hint the driver to disable as 635 // Since we don't know how the shader will use the shader, hint the driver to disable as
640 // much optimizations as possible 636 // much optimizations as possible
641 std::string qualifier = "coherent volatile"; 637 std::string qualifier = "coherent volatile";