diff options
| author | 2019-02-07 00:05:41 -0300 | |
|---|---|---|
| committer | 2019-04-14 00:25:32 -0300 | |
| commit | 5c280e6ff04ae36e8cd7ba81cce4ae89e0a49b80 (patch) | |
| tree | d3f411c5b0c15539bd36e86944cfdc28972fb98a /src/video_core/renderer_vulkan | |
| parent | Merge pull request #2378 from lioncash/ro (diff) | |
| download | yuzu-5c280e6ff04ae36e8cd7ba81cce4ae89e0a49b80.tar.gz yuzu-5c280e6ff04ae36e8cd7ba81cce4ae89e0a49b80.tar.xz yuzu-5c280e6ff04ae36e8cd7ba81cce4ae89e0a49b80.zip | |
shader_ir: Implement STG, keep track of global memory usage and flush
Diffstat (limited to 'src/video_core/renderer_vulkan')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | 14 |
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 | ||