Browse Source

Minimal stopgaps for MCI to boot

- Clamp staging buffer size to 2GB to prevent Vulkan allocation failures
- Add size validation in MappedUploadMemory to avoid buffer overruns
xbzk-mci-bare-minimum-boot-fix
xbzk 2 weeks ago
committed by crueter
parent
commit
c38b8911d0
  1. 3
      src/video_core/buffer_cache/buffer_cache.h
  2. 2
      src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp

3
src/video_core/buffer_cache/buffer_cache.h

@ -1574,6 +1574,9 @@ void BufferCache<P>::MappedUploadMemory([[maybe_unused]] Buffer& buffer,
if constexpr (USE_MEMORY_MAPS) {
auto upload_staging = runtime.UploadStagingBuffer(total_size_bytes);
const std::span<u8> staging_pointer = upload_staging.mapped_span;
if (staging_pointer.size() < total_size_bytes) {
return;
}
for (BufferCopy& copy : copies) {
u8* const src_pointer = staging_pointer.data() + copy.src_offset;
const DAddr device_addr = buffer.CpuAddr() + copy.dst_offset;

2
src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp

@ -181,7 +181,7 @@ std::optional<StagingBufferRef> StagingBufferPool::TryGetReservedBuffer(size_t s
StagingBufferRef StagingBufferPool::CreateStagingBuffer(size_t size, MemoryUsage usage,
bool deferred) {
const u32 log2 = Common::Log2Ceil64(size);
const u32 log2 = (std::min)(Common::Log2Ceil64(size), 31U);
VkBufferCreateInfo buffer_ci = {
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
.pNext = nullptr,

Loading…
Cancel
Save