summaryrefslogtreecommitdiff
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorGravatar bunnei2019-04-16 22:15:17 -0400
committerGravatar GitHub2019-04-16 22:15:17 -0400
commit1b83f255c290fd83562502f019799ad86a85b8a8 (patch)
tree07fc355ae298cc71153d2653283723137ce9c958 /src/video_core/renderer_vulkan
parentMerge pull request #2376 from lioncash/const (diff)
parentshader_ir: Implement STG, keep track of global memory usage and flush (diff)
downloadyuzu-1b83f255c290fd83562502f019799ad86a85b8a8.tar.gz
yuzu-1b83f255c290fd83562502f019799ad86a85b8a8.tar.xz
yuzu-1b83f255c290fd83562502f019799ad86a85b8a8.zip
Merge pull request #2092 from ReinUsesLisp/stg
shader/memory: Implement STG and global memory flushing
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/vk_shader_decompiler.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
index e0a6f5e87..25500f9a3 100644
--- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
+++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
@@ -191,8 +191,9 @@ public:
191 for (const auto& cbuf : ir.GetConstantBuffers()) { 191 for (const auto& cbuf : ir.GetConstantBuffers()) {
192 entries.const_buffers.emplace_back(cbuf.second, cbuf.first); 192 entries.const_buffers.emplace_back(cbuf.second, cbuf.first);
193 } 193 }
194 for (const auto& gmem : ir.GetGlobalMemoryBases()) { 194 for (const auto& gmem_pair : ir.GetGlobalMemory()) {
195 entries.global_buffers.emplace_back(gmem.cbuf_index, gmem.cbuf_offset); 195 const auto& [base, usage] = gmem_pair;
196 entries.global_buffers.emplace_back(base.cbuf_index, base.cbuf_offset);
196 } 197 }
197 for (const auto& sampler : ir.GetSamplers()) { 198 for (const auto& sampler : ir.GetSamplers()) {
198 entries.samplers.emplace_back(sampler); 199 entries.samplers.emplace_back(sampler);
@@ -225,7 +226,7 @@ private:
225 return current_binding; 226 return current_binding;
226 }; 227 };
227 const_buffers_base_binding = Allocate(ir.GetConstantBuffers().size()); 228 const_buffers_base_binding = Allocate(ir.GetConstantBuffers().size());
228 global_buffers_base_binding = Allocate(ir.GetGlobalMemoryBases().size()); 229 global_buffers_base_binding = Allocate(ir.GetGlobalMemory().size());
229 samplers_base_binding = Allocate(ir.GetSamplers().size()); 230 samplers_base_binding = Allocate(ir.GetSamplers().size());
230 231
231 ASSERT_MSG(binding_iterator - binding_base < STAGE_BINDING_STRIDE, 232 ASSERT_MSG(binding_iterator - binding_base < STAGE_BINDING_STRIDE,
@@ -390,14 +391,15 @@ private:
390 391
391 void DeclareGlobalBuffers() { 392 void DeclareGlobalBuffers() {
392 u32 binding = global_buffers_base_binding; 393 u32 binding = global_buffers_base_binding;
393 for (const auto& entry : ir.GetGlobalMemoryBases()) { 394 for (const auto& entry : ir.GetGlobalMemory()) {
395 const auto [base, usage] = entry;
394 const Id id = OpVariable(t_gmem_ssbo, spv::StorageClass::StorageBuffer); 396 const Id id = OpVariable(t_gmem_ssbo, spv::StorageClass::StorageBuffer);
395 AddGlobalVariable( 397 AddGlobalVariable(
396 Name(id, fmt::format("gmem_{}_{}", entry.cbuf_index, entry.cbuf_offset))); 398 Name(id, fmt::format("gmem_{}_{}", base.cbuf_index, base.cbuf_offset)));
397 399
398 Decorate(id, spv::Decoration::Binding, binding++); 400 Decorate(id, spv::Decoration::Binding, binding++);
399 Decorate(id, spv::Decoration::DescriptorSet, DESCRIPTOR_SET); 401 Decorate(id, spv::Decoration::DescriptorSet, DESCRIPTOR_SET);
400 global_buffers.emplace(entry, id); 402 global_buffers.emplace(base, id);
401 } 403 }
402 } 404 }
403 405