diff options
| author | 2021-11-05 15:52:31 +0100 | |
|---|---|---|
| committer | 2022-10-06 21:00:51 +0200 | |
| commit | 139ea93512aeead8a4aee3910a3de86eb109a838 (patch) | |
| tree | 857643fc08617b7035656a51728c399f30c8c2cb /src/video_core/buffer_cache | |
| parent | NVASGPU: Fix Remap. (diff) | |
| download | yuzu-139ea93512aeead8a4aee3910a3de86eb109a838.tar.gz yuzu-139ea93512aeead8a4aee3910a3de86eb109a838.tar.xz yuzu-139ea93512aeead8a4aee3910a3de86eb109a838.zip | |
VideoCore: implement channels on gpu caches.
Diffstat (limited to 'src/video_core/buffer_cache')
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 103 |
1 files changed, 40 insertions, 63 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index f015dae56..6b6764d72 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | 5 | ||
| 6 | #include <algorithm> | 6 | #include <algorithm> |
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <deque> | ||
| 9 | #include <memory> | 8 | #include <memory> |
| 10 | #include <mutex> | 9 | #include <mutex> |
| 11 | #include <numeric> | 10 | #include <numeric> |
| @@ -23,6 +22,7 @@ | |||
| 23 | #include "common/settings.h" | 22 | #include "common/settings.h" |
| 24 | #include "core/memory.h" | 23 | #include "core/memory.h" |
| 25 | #include "video_core/buffer_cache/buffer_base.h" | 24 | #include "video_core/buffer_cache/buffer_base.h" |
| 25 | #include "video_core/control/channel_state_cache.h" | ||
| 26 | #include "video_core/delayed_destruction_ring.h" | 26 | #include "video_core/delayed_destruction_ring.h" |
| 27 | #include "video_core/dirty_flags.h" | 27 | #include "video_core/dirty_flags.h" |
| 28 | #include "video_core/engines/kepler_compute.h" | 28 | #include "video_core/engines/kepler_compute.h" |
| @@ -56,7 +56,7 @@ using UniformBufferSizes = std::array<std::array<u32, NUM_GRAPHICS_UNIFORM_BUFFE | |||
| 56 | using ComputeUniformBufferSizes = std::array<u32, NUM_COMPUTE_UNIFORM_BUFFERS>; | 56 | using ComputeUniformBufferSizes = std::array<u32, NUM_COMPUTE_UNIFORM_BUFFERS>; |
| 57 | 57 | ||
| 58 | template <typename P> | 58 | template <typename P> |
| 59 | class BufferCache { | 59 | class BufferCache : public VideoCommon::ChannelSetupCaches<VideoCommon::ChannelInfo> { |
| 60 | 60 | ||
| 61 | // Page size for caching purposes. | 61 | // Page size for caching purposes. |
| 62 | // This is unrelated to the CPU page size and it can be changed as it seems optimal. | 62 | // This is unrelated to the CPU page size and it can be changed as it seems optimal. |
| @@ -116,10 +116,7 @@ public: | |||
| 116 | static constexpr u32 DEFAULT_SKIP_CACHE_SIZE = static_cast<u32>(4_KiB); | 116 | static constexpr u32 DEFAULT_SKIP_CACHE_SIZE = static_cast<u32>(4_KiB); |
| 117 | 117 | ||
| 118 | explicit BufferCache(VideoCore::RasterizerInterface& rasterizer_, | 118 | explicit BufferCache(VideoCore::RasterizerInterface& rasterizer_, |
| 119 | Tegra::Engines::Maxwell3D& maxwell3d_, | 119 | Core::Memory::Memory& cpu_memory_, Runtime& runtime_); |
| 120 | Tegra::Engines::KeplerCompute& kepler_compute_, | ||
| 121 | Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_, | ||
| 122 | Runtime& runtime_); | ||
| 123 | 120 | ||
| 124 | void TickFrame(); | 121 | void TickFrame(); |
| 125 | 122 | ||
| @@ -367,9 +364,6 @@ private: | |||
| 367 | void ClearDownload(IntervalType subtract_interval); | 364 | void ClearDownload(IntervalType subtract_interval); |
| 368 | 365 | ||
| 369 | VideoCore::RasterizerInterface& rasterizer; | 366 | VideoCore::RasterizerInterface& rasterizer; |
| 370 | Tegra::Engines::Maxwell3D& maxwell3d; | ||
| 371 | Tegra::Engines::KeplerCompute& kepler_compute; | ||
| 372 | Tegra::MemoryManager& gpu_memory; | ||
| 373 | Core::Memory::Memory& cpu_memory; | 367 | Core::Memory::Memory& cpu_memory; |
| 374 | 368 | ||
| 375 | SlotVector<Buffer> slot_buffers; | 369 | SlotVector<Buffer> slot_buffers; |
| @@ -444,12 +438,8 @@ private: | |||
| 444 | 438 | ||
| 445 | template <class P> | 439 | template <class P> |
| 446 | BufferCache<P>::BufferCache(VideoCore::RasterizerInterface& rasterizer_, | 440 | BufferCache<P>::BufferCache(VideoCore::RasterizerInterface& rasterizer_, |
| 447 | Tegra::Engines::Maxwell3D& maxwell3d_, | 441 | Core::Memory::Memory& cpu_memory_, Runtime& runtime_) |
| 448 | Tegra::Engines::KeplerCompute& kepler_compute_, | 442 | : runtime{runtime_}, rasterizer{rasterizer_}, cpu_memory{cpu_memory_} { |
| 449 | Tegra::MemoryManager& gpu_memory_, Core::Memory::Memory& cpu_memory_, | ||
| 450 | Runtime& runtime_) | ||
| 451 | : runtime{runtime_}, rasterizer{rasterizer_}, maxwell3d{maxwell3d_}, | ||
| 452 | kepler_compute{kepler_compute_}, gpu_memory{gpu_memory_}, cpu_memory{cpu_memory_} { | ||
| 453 | // Ensure the first slot is used for the null buffer | 443 | // Ensure the first slot is used for the null buffer |
| 454 | void(slot_buffers.insert(runtime, NullBufferParams{})); | 444 | void(slot_buffers.insert(runtime, NullBufferParams{})); |
| 455 | common_ranges.clear(); | 445 | common_ranges.clear(); |
| @@ -552,8 +542,8 @@ void BufferCache<P>::ClearDownload(IntervalType subtract_interval) { | |||
| 552 | 542 | ||
| 553 | template <class P> | 543 | template <class P> |
| 554 | bool BufferCache<P>::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 amount) { | 544 | bool BufferCache<P>::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 amount) { |
| 555 | const std::optional<VAddr> cpu_src_address = gpu_memory.GpuToCpuAddress(src_address); | 545 | const std::optional<VAddr> cpu_src_address = gpu_memory->GpuToCpuAddress(src_address); |
| 556 | const std::optional<VAddr> cpu_dest_address = gpu_memory.GpuToCpuAddress(dest_address); | 546 | const std::optional<VAddr> cpu_dest_address = gpu_memory->GpuToCpuAddress(dest_address); |
| 557 | if (!cpu_src_address || !cpu_dest_address) { | 547 | if (!cpu_src_address || !cpu_dest_address) { |
| 558 | return false; | 548 | return false; |
| 559 | } | 549 | } |
| @@ -611,7 +601,7 @@ bool BufferCache<P>::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 am | |||
| 611 | 601 | ||
| 612 | template <class P> | 602 | template <class P> |
| 613 | bool BufferCache<P>::DMAClear(GPUVAddr dst_address, u64 amount, u32 value) { | 603 | bool BufferCache<P>::DMAClear(GPUVAddr dst_address, u64 amount, u32 value) { |
| 614 | const std::optional<VAddr> cpu_dst_address = gpu_memory.GpuToCpuAddress(dst_address); | 604 | const std::optional<VAddr> cpu_dst_address = gpu_memory->GpuToCpuAddress(dst_address); |
| 615 | if (!cpu_dst_address) { | 605 | if (!cpu_dst_address) { |
| 616 | return false; | 606 | return false; |
| 617 | } | 607 | } |
| @@ -635,7 +625,7 @@ bool BufferCache<P>::DMAClear(GPUVAddr dst_address, u64 amount, u32 value) { | |||
| 635 | template <class P> | 625 | template <class P> |
| 636 | void BufferCache<P>::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, | 626 | void BufferCache<P>::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, |
| 637 | u32 size) { | 627 | u32 size) { |
| 638 | const std::optional<VAddr> cpu_addr = gpu_memory.GpuToCpuAddress(gpu_addr); | 628 | const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr); |
| 639 | const Binding binding{ | 629 | const Binding binding{ |
| 640 | .cpu_addr = *cpu_addr, | 630 | .cpu_addr = *cpu_addr, |
| 641 | .size = size, | 631 | .size = size, |
| @@ -673,7 +663,7 @@ void BufferCache<P>::BindHostGeometryBuffers(bool is_indexed) { | |||
| 673 | if (is_indexed) { | 663 | if (is_indexed) { |
| 674 | BindHostIndexBuffer(); | 664 | BindHostIndexBuffer(); |
| 675 | } else if constexpr (!HAS_FULL_INDEX_AND_PRIMITIVE_SUPPORT) { | 665 | } else if constexpr (!HAS_FULL_INDEX_AND_PRIMITIVE_SUPPORT) { |
| 676 | const auto& regs = maxwell3d.regs; | 666 | const auto& regs = maxwell3d->regs; |
| 677 | if (regs.draw.topology == Maxwell::PrimitiveTopology::Quads) { | 667 | if (regs.draw.topology == Maxwell::PrimitiveTopology::Quads) { |
| 678 | runtime.BindQuadArrayIndexBuffer(regs.vertex_buffer.first, regs.vertex_buffer.count); | 668 | runtime.BindQuadArrayIndexBuffer(regs.vertex_buffer.first, regs.vertex_buffer.count); |
| 679 | } | 669 | } |
| @@ -733,7 +723,7 @@ void BufferCache<P>::BindGraphicsStorageBuffer(size_t stage, size_t ssbo_index, | |||
| 733 | enabled_storage_buffers[stage] |= 1U << ssbo_index; | 723 | enabled_storage_buffers[stage] |= 1U << ssbo_index; |
| 734 | written_storage_buffers[stage] |= (is_written ? 1U : 0U) << ssbo_index; | 724 | written_storage_buffers[stage] |= (is_written ? 1U : 0U) << ssbo_index; |
| 735 | 725 | ||
| 736 | const auto& cbufs = maxwell3d.state.shader_stages[stage]; | 726 | const auto& cbufs = maxwell3d->state.shader_stages[stage]; |
| 737 | const GPUVAddr ssbo_addr = cbufs.const_buffers[cbuf_index].address + cbuf_offset; | 727 | const GPUVAddr ssbo_addr = cbufs.const_buffers[cbuf_index].address + cbuf_offset; |
| 738 | storage_buffers[stage][ssbo_index] = StorageBufferBinding(ssbo_addr); | 728 | storage_buffers[stage][ssbo_index] = StorageBufferBinding(ssbo_addr); |
| 739 | } | 729 | } |
| @@ -770,7 +760,7 @@ void BufferCache<P>::BindComputeStorageBuffer(size_t ssbo_index, u32 cbuf_index, | |||
| 770 | enabled_compute_storage_buffers |= 1U << ssbo_index; | 760 | enabled_compute_storage_buffers |= 1U << ssbo_index; |
| 771 | written_compute_storage_buffers |= (is_written ? 1U : 0U) << ssbo_index; | 761 | written_compute_storage_buffers |= (is_written ? 1U : 0U) << ssbo_index; |
| 772 | 762 | ||
| 773 | const auto& launch_desc = kepler_compute.launch_description; | 763 | const auto& launch_desc = kepler_compute->launch_description; |
| 774 | ASSERT(((launch_desc.const_buffer_enable_mask >> cbuf_index) & 1) != 0); | 764 | ASSERT(((launch_desc.const_buffer_enable_mask >> cbuf_index) & 1) != 0); |
| 775 | 765 | ||
| 776 | const auto& cbufs = launch_desc.const_buffer_config; | 766 | const auto& cbufs = launch_desc.const_buffer_config; |
| @@ -991,19 +981,19 @@ void BufferCache<P>::BindHostIndexBuffer() { | |||
| 991 | const u32 size = index_buffer.size; | 981 | const u32 size = index_buffer.size; |
| 992 | SynchronizeBuffer(buffer, index_buffer.cpu_addr, size); | 982 | SynchronizeBuffer(buffer, index_buffer.cpu_addr, size); |
| 993 | if constexpr (HAS_FULL_INDEX_AND_PRIMITIVE_SUPPORT) { | 983 | if constexpr (HAS_FULL_INDEX_AND_PRIMITIVE_SUPPORT) { |
| 994 | const u32 new_offset = offset + maxwell3d.regs.index_array.first * | 984 | const u32 new_offset = offset + maxwell3d->regs.index_array.first * |
| 995 | maxwell3d.regs.index_array.FormatSizeInBytes(); | 985 | maxwell3d->regs.index_array.FormatSizeInBytes(); |
| 996 | runtime.BindIndexBuffer(buffer, new_offset, size); | 986 | runtime.BindIndexBuffer(buffer, new_offset, size); |
| 997 | } else { | 987 | } else { |
| 998 | runtime.BindIndexBuffer(maxwell3d.regs.draw.topology, maxwell3d.regs.index_array.format, | 988 | runtime.BindIndexBuffer(maxwell3d->regs.draw.topology, maxwell3d->regs.index_array.format, |
| 999 | maxwell3d.regs.index_array.first, maxwell3d.regs.index_array.count, | 989 | maxwell3d->regs.index_array.first, |
| 1000 | buffer, offset, size); | 990 | maxwell3d->regs.index_array.count, buffer, offset, size); |
| 1001 | } | 991 | } |
| 1002 | } | 992 | } |
| 1003 | 993 | ||
| 1004 | template <class P> | 994 | template <class P> |
| 1005 | void BufferCache<P>::BindHostVertexBuffers() { | 995 | void BufferCache<P>::BindHostVertexBuffers() { |
| 1006 | auto& flags = maxwell3d.dirty.flags; | 996 | auto& flags = maxwell3d->dirty.flags; |
| 1007 | for (u32 index = 0; index < NUM_VERTEX_BUFFERS; ++index) { | 997 | for (u32 index = 0; index < NUM_VERTEX_BUFFERS; ++index) { |
| 1008 | const Binding& binding = vertex_buffers[index]; | 998 | const Binding& binding = vertex_buffers[index]; |
| 1009 | Buffer& buffer = slot_buffers[binding.buffer_id]; | 999 | Buffer& buffer = slot_buffers[binding.buffer_id]; |
| @@ -1014,7 +1004,7 @@ void BufferCache<P>::BindHostVertexBuffers() { | |||
| 1014 | } | 1004 | } |
| 1015 | flags[Dirty::VertexBuffer0 + index] = false; | 1005 | flags[Dirty::VertexBuffer0 + index] = false; |
| 1016 | 1006 | ||
| 1017 | const u32 stride = maxwell3d.regs.vertex_array[index].stride; | 1007 | const u32 stride = maxwell3d->regs.vertex_array[index].stride; |
| 1018 | const u32 offset = buffer.Offset(binding.cpu_addr); | 1008 | const u32 offset = buffer.Offset(binding.cpu_addr); |
| 1019 | runtime.BindVertexBuffer(index, buffer, offset, binding.size, stride); | 1009 | runtime.BindVertexBuffer(index, buffer, offset, binding.size, stride); |
| 1020 | } | 1010 | } |
| @@ -1154,7 +1144,7 @@ void BufferCache<P>::BindHostGraphicsTextureBuffers(size_t stage) { | |||
| 1154 | 1144 | ||
| 1155 | template <class P> | 1145 | template <class P> |
| 1156 | void BufferCache<P>::BindHostTransformFeedbackBuffers() { | 1146 | void BufferCache<P>::BindHostTransformFeedbackBuffers() { |
| 1157 | if (maxwell3d.regs.tfb_enabled == 0) { | 1147 | if (maxwell3d->regs.tfb_enabled == 0) { |
| 1158 | return; | 1148 | return; |
| 1159 | } | 1149 | } |
| 1160 | for (u32 index = 0; index < NUM_TRANSFORM_FEEDBACK_BUFFERS; ++index) { | 1150 | for (u32 index = 0; index < NUM_TRANSFORM_FEEDBACK_BUFFERS; ++index) { |
| @@ -1262,8 +1252,8 @@ template <class P> | |||
| 1262 | void BufferCache<P>::UpdateIndexBuffer() { | 1252 | void BufferCache<P>::UpdateIndexBuffer() { |
| 1263 | // We have to check for the dirty flags and index count | 1253 | // We have to check for the dirty flags and index count |
| 1264 | // The index count is currently changed without updating the dirty flags | 1254 | // The index count is currently changed without updating the dirty flags |
| 1265 | const auto& index_array = maxwell3d.regs.index_array; | 1255 | const auto& index_array = maxwell3d->regs.index_array; |
| 1266 | auto& flags = maxwell3d.dirty.flags; | 1256 | auto& flags = maxwell3d->dirty.flags; |
| 1267 | if (!flags[Dirty::IndexBuffer] && last_index_count == index_array.count) { | 1257 | if (!flags[Dirty::IndexBuffer] && last_index_count == index_array.count) { |
| 1268 | return; | 1258 | return; |
| 1269 | } | 1259 | } |
| @@ -1272,7 +1262,7 @@ void BufferCache<P>::UpdateIndexBuffer() { | |||
| 1272 | 1262 | ||
| 1273 | const GPUVAddr gpu_addr_begin = index_array.StartAddress(); | 1263 | const GPUVAddr gpu_addr_begin = index_array.StartAddress(); |
| 1274 | const GPUVAddr gpu_addr_end = index_array.EndAddress(); | 1264 | const GPUVAddr gpu_addr_end = index_array.EndAddress(); |
| 1275 | const std::optional<VAddr> cpu_addr = gpu_memory.GpuToCpuAddress(gpu_addr_begin); | 1265 | const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr_begin); |
| 1276 | const u32 address_size = static_cast<u32>(gpu_addr_end - gpu_addr_begin); | 1266 | const u32 address_size = static_cast<u32>(gpu_addr_end - gpu_addr_begin); |
| 1277 | const u32 draw_size = (index_array.count + index_array.first) * index_array.FormatSizeInBytes(); | 1267 | const u32 draw_size = (index_array.count + index_array.first) * index_array.FormatSizeInBytes(); |
| 1278 | const u32 size = std::min(address_size, draw_size); | 1268 | const u32 size = std::min(address_size, draw_size); |
| @@ -1289,8 +1279,8 @@ void BufferCache<P>::UpdateIndexBuffer() { | |||
| 1289 | 1279 | ||
| 1290 | template <class P> | 1280 | template <class P> |
| 1291 | void BufferCache<P>::UpdateVertexBuffers() { | 1281 | void BufferCache<P>::UpdateVertexBuffers() { |
| 1292 | auto& flags = maxwell3d.dirty.flags; | 1282 | auto& flags = maxwell3d->dirty.flags; |
| 1293 | if (!maxwell3d.dirty.flags[Dirty::VertexBuffers]) { | 1283 | if (!maxwell3d->dirty.flags[Dirty::VertexBuffers]) { |
| 1294 | return; | 1284 | return; |
| 1295 | } | 1285 | } |
| 1296 | flags[Dirty::VertexBuffers] = false; | 1286 | flags[Dirty::VertexBuffers] = false; |
| @@ -1302,28 +1292,15 @@ void BufferCache<P>::UpdateVertexBuffers() { | |||
| 1302 | 1292 | ||
| 1303 | template <class P> | 1293 | template <class P> |
| 1304 | void BufferCache<P>::UpdateVertexBuffer(u32 index) { | 1294 | void BufferCache<P>::UpdateVertexBuffer(u32 index) { |
| 1305 | if (!maxwell3d.dirty.flags[Dirty::VertexBuffer0 + index]) { | 1295 | if (!maxwell3d->dirty.flags[Dirty::VertexBuffer0 + index]) { |
| 1306 | return; | 1296 | return; |
| 1307 | } | 1297 | } |
| 1308 | const auto& array = maxwell3d.regs.vertex_array[index]; | 1298 | const auto& array = maxwell3d->regs.vertex_array[index]; |
| 1309 | const auto& limit = maxwell3d.regs.vertex_array_limit[index]; | 1299 | const auto& limit = maxwell3d->regs.vertex_array_limit[index]; |
| 1310 | const GPUVAddr gpu_addr_begin = array.StartAddress(); | 1300 | const GPUVAddr gpu_addr_begin = array.StartAddress(); |
| 1311 | const GPUVAddr gpu_addr_end = limit.LimitAddress() + 1; | 1301 | const GPUVAddr gpu_addr_end = limit.LimitAddress() + 1; |
| 1312 | const std::optional<VAddr> cpu_addr = gpu_memory.GpuToCpuAddress(gpu_addr_begin); | 1302 | const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr_begin); |
| 1313 | u32 address_size = static_cast<u32>(gpu_addr_end - gpu_addr_begin); | 1303 | const u32 address_size = static_cast<u32>(gpu_addr_end - gpu_addr_begin); |
| 1314 | if (address_size >= 64_MiB) { | ||
| 1315 | // Reported vertex buffer size is very large, cap to mapped buffer size | ||
| 1316 | GPUVAddr submapped_addr_end = gpu_addr_begin; | ||
| 1317 | |||
| 1318 | const auto ranges{gpu_memory.GetSubmappedRange(gpu_addr_begin, address_size)}; | ||
| 1319 | if (ranges.size() > 0) { | ||
| 1320 | const auto& [addr, size] = *ranges.begin(); | ||
| 1321 | submapped_addr_end = addr + size; | ||
| 1322 | } | ||
| 1323 | |||
| 1324 | address_size = | ||
| 1325 | std::min(address_size, static_cast<u32>(submapped_addr_end - gpu_addr_begin)); | ||
| 1326 | } | ||
| 1327 | const u32 size = address_size; // TODO: Analyze stride and number of vertices | 1304 | const u32 size = address_size; // TODO: Analyze stride and number of vertices |
| 1328 | if (array.enable == 0 || size == 0 || !cpu_addr) { | 1305 | if (array.enable == 0 || size == 0 || !cpu_addr) { |
| 1329 | vertex_buffers[index] = NULL_BINDING; | 1306 | vertex_buffers[index] = NULL_BINDING; |
| @@ -1382,7 +1359,7 @@ void BufferCache<P>::UpdateTextureBuffers(size_t stage) { | |||
| 1382 | 1359 | ||
| 1383 | template <class P> | 1360 | template <class P> |
| 1384 | void BufferCache<P>::UpdateTransformFeedbackBuffers() { | 1361 | void BufferCache<P>::UpdateTransformFeedbackBuffers() { |
| 1385 | if (maxwell3d.regs.tfb_enabled == 0) { | 1362 | if (maxwell3d->regs.tfb_enabled == 0) { |
| 1386 | return; | 1363 | return; |
| 1387 | } | 1364 | } |
| 1388 | for (u32 index = 0; index < NUM_TRANSFORM_FEEDBACK_BUFFERS; ++index) { | 1365 | for (u32 index = 0; index < NUM_TRANSFORM_FEEDBACK_BUFFERS; ++index) { |
| @@ -1392,10 +1369,10 @@ void BufferCache<P>::UpdateTransformFeedbackBuffers() { | |||
| 1392 | 1369 | ||
| 1393 | template <class P> | 1370 | template <class P> |
| 1394 | void BufferCache<P>::UpdateTransformFeedbackBuffer(u32 index) { | 1371 | void BufferCache<P>::UpdateTransformFeedbackBuffer(u32 index) { |
| 1395 | const auto& binding = maxwell3d.regs.tfb_bindings[index]; | 1372 | const auto& binding = maxwell3d->regs.tfb_bindings[index]; |
| 1396 | const GPUVAddr gpu_addr = binding.Address() + binding.buffer_offset; | 1373 | const GPUVAddr gpu_addr = binding.Address() + binding.buffer_offset; |
| 1397 | const u32 size = binding.buffer_size; | 1374 | const u32 size = binding.buffer_size; |
| 1398 | const std::optional<VAddr> cpu_addr = gpu_memory.GpuToCpuAddress(gpu_addr); | 1375 | const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr); |
| 1399 | if (binding.buffer_enable == 0 || size == 0 || !cpu_addr) { | 1376 | if (binding.buffer_enable == 0 || size == 0 || !cpu_addr) { |
| 1400 | transform_feedback_buffers[index] = NULL_BINDING; | 1377 | transform_feedback_buffers[index] = NULL_BINDING; |
| 1401 | return; | 1378 | return; |
| @@ -1414,10 +1391,10 @@ void BufferCache<P>::UpdateComputeUniformBuffers() { | |||
| 1414 | ForEachEnabledBit(enabled_compute_uniform_buffer_mask, [&](u32 index) { | 1391 | ForEachEnabledBit(enabled_compute_uniform_buffer_mask, [&](u32 index) { |
| 1415 | Binding& binding = compute_uniform_buffers[index]; | 1392 | Binding& binding = compute_uniform_buffers[index]; |
| 1416 | binding = NULL_BINDING; | 1393 | binding = NULL_BINDING; |
| 1417 | const auto& launch_desc = kepler_compute.launch_description; | 1394 | const auto& launch_desc = kepler_compute->launch_description; |
| 1418 | if (((launch_desc.const_buffer_enable_mask >> index) & 1) != 0) { | 1395 | if (((launch_desc.const_buffer_enable_mask >> index) & 1) != 0) { |
| 1419 | const auto& cbuf = launch_desc.const_buffer_config[index]; | 1396 | const auto& cbuf = launch_desc.const_buffer_config[index]; |
| 1420 | const std::optional<VAddr> cpu_addr = gpu_memory.GpuToCpuAddress(cbuf.Address()); | 1397 | const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(cbuf.Address()); |
| 1421 | if (cpu_addr) { | 1398 | if (cpu_addr) { |
| 1422 | binding.cpu_addr = *cpu_addr; | 1399 | binding.cpu_addr = *cpu_addr; |
| 1423 | binding.size = cbuf.size; | 1400 | binding.size = cbuf.size; |
| @@ -1831,7 +1808,7 @@ void BufferCache<P>::NotifyBufferDeletion() { | |||
| 1831 | dirty_uniform_buffers.fill(~u32{0}); | 1808 | dirty_uniform_buffers.fill(~u32{0}); |
| 1832 | uniform_buffer_binding_sizes.fill({}); | 1809 | uniform_buffer_binding_sizes.fill({}); |
| 1833 | } | 1810 | } |
| 1834 | auto& flags = maxwell3d.dirty.flags; | 1811 | auto& flags = maxwell3d->dirty.flags; |
| 1835 | flags[Dirty::IndexBuffer] = true; | 1812 | flags[Dirty::IndexBuffer] = true; |
| 1836 | flags[Dirty::VertexBuffers] = true; | 1813 | flags[Dirty::VertexBuffers] = true; |
| 1837 | for (u32 index = 0; index < NUM_VERTEX_BUFFERS; ++index) { | 1814 | for (u32 index = 0; index < NUM_VERTEX_BUFFERS; ++index) { |
| @@ -1842,9 +1819,9 @@ void BufferCache<P>::NotifyBufferDeletion() { | |||
| 1842 | 1819 | ||
| 1843 | template <class P> | 1820 | template <class P> |
| 1844 | typename BufferCache<P>::Binding BufferCache<P>::StorageBufferBinding(GPUVAddr ssbo_addr) const { | 1821 | typename BufferCache<P>::Binding BufferCache<P>::StorageBufferBinding(GPUVAddr ssbo_addr) const { |
| 1845 | const GPUVAddr gpu_addr = gpu_memory.Read<u64>(ssbo_addr); | 1822 | const GPUVAddr gpu_addr = gpu_memory->Read<u64>(ssbo_addr); |
| 1846 | const u32 size = gpu_memory.Read<u32>(ssbo_addr + 8); | 1823 | const u32 size = gpu_memory->Read<u32>(ssbo_addr + 8); |
| 1847 | const std::optional<VAddr> cpu_addr = gpu_memory.GpuToCpuAddress(gpu_addr); | 1824 | const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr); |
| 1848 | if (!cpu_addr || size == 0) { | 1825 | if (!cpu_addr || size == 0) { |
| 1849 | return NULL_BINDING; | 1826 | return NULL_BINDING; |
| 1850 | } | 1827 | } |
| @@ -1859,7 +1836,7 @@ typename BufferCache<P>::Binding BufferCache<P>::StorageBufferBinding(GPUVAddr s | |||
| 1859 | template <class P> | 1836 | template <class P> |
| 1860 | typename BufferCache<P>::TextureBufferBinding BufferCache<P>::GetTextureBufferBinding( | 1837 | typename BufferCache<P>::TextureBufferBinding BufferCache<P>::GetTextureBufferBinding( |
| 1861 | GPUVAddr gpu_addr, u32 size, PixelFormat format) { | 1838 | GPUVAddr gpu_addr, u32 size, PixelFormat format) { |
| 1862 | const std::optional<VAddr> cpu_addr = gpu_memory.GpuToCpuAddress(gpu_addr); | 1839 | const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr); |
| 1863 | TextureBufferBinding binding; | 1840 | TextureBufferBinding binding; |
| 1864 | if (!cpu_addr || size == 0) { | 1841 | if (!cpu_addr || size == 0) { |
| 1865 | binding.cpu_addr = 0; | 1842 | binding.cpu_addr = 0; |