1
0
Fork 0
forked from suyu/suyu

Merge pull request #5162 from lioncash/copy-shader

gl_shader_decompiler: Elide unnecessary copies within DeclareConstantBuffers()
This commit is contained in:
bunnei 2020-12-10 00:11:11 -08:00 committed by GitHub
commit d1a2b3fb18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -878,7 +878,7 @@ private:
} }
u32 binding = device.GetBaseBindings(stage).uniform_buffer; u32 binding = device.GetBaseBindings(stage).uniform_buffer;
for (const auto [index, info] : ir.GetConstantBuffers()) { for (const auto& [index, info] : ir.GetConstantBuffers()) {
const u32 num_elements = Common::AlignUp(info.GetSize(), 4) / 4; const u32 num_elements = Common::AlignUp(info.GetSize(), 4) / 4;
const u32 size = info.IsIndirect() ? MAX_CONSTBUFFER_ELEMENTS : num_elements; const u32 size = info.IsIndirect() ? MAX_CONSTBUFFER_ELEMENTS : num_elements;
code.AddLine("layout (std140, binding = {}) uniform {} {{", binding++, code.AddLine("layout (std140, binding = {}) uniform {} {{", binding++,