early-access version 1928
This commit is contained in:
parent
1255a0abc2
commit
1d25a09b5f
2 changed files with 22 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 1926.
|
This is the source code for early-access 1928.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -61,11 +61,15 @@ std::optional<u32> FindMemoryTypeIndex(const VkPhysicalDeviceMemoryProperties& p
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 FindMemoryTypeIndex(const VkPhysicalDeviceMemoryProperties& props, u32 type_mask) {
|
u32 FindMemoryTypeIndex(const VkPhysicalDeviceMemoryProperties& props, u32 type_mask,
|
||||||
// Try to find a DEVICE_LOCAL_BIT type, Nvidia and AMD have a dedicated heap for this
|
bool try_device_local) {
|
||||||
std::optional<u32> type = FindMemoryTypeIndex(props, type_mask, STREAM_FLAGS);
|
std::optional<u32> type;
|
||||||
if (type) {
|
if (try_device_local) {
|
||||||
return *type;
|
// Try to find a DEVICE_LOCAL_BIT type, Nvidia and AMD have a dedicated heap for this
|
||||||
|
type = FindMemoryTypeIndex(props, type_mask, STREAM_FLAGS);
|
||||||
|
if (type) {
|
||||||
|
return *type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Otherwise try without the DEVICE_LOCAL_BIT
|
// Otherwise try without the DEVICE_LOCAL_BIT
|
||||||
type = FindMemoryTypeIndex(props, type_mask, HOST_FLAGS);
|
type = FindMemoryTypeIndex(props, type_mask, HOST_FLAGS);
|
||||||
|
@ -115,12 +119,21 @@ StagingBufferPool::StagingBufferPool(const Device& device_, MemoryAllocator& mem
|
||||||
.buffer = *stream_buffer,
|
.buffer = *stream_buffer,
|
||||||
};
|
};
|
||||||
const auto memory_properties = device.GetPhysical().GetMemoryProperties();
|
const auto memory_properties = device.GetPhysical().GetMemoryProperties();
|
||||||
stream_memory = dev.AllocateMemory(VkMemoryAllocateInfo{
|
VkMemoryAllocateInfo stream_memory_info{
|
||||||
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
||||||
.pNext = make_dedicated ? &dedicated_info : nullptr,
|
.pNext = make_dedicated ? &dedicated_info : nullptr,
|
||||||
.allocationSize = requirements.size,
|
.allocationSize = requirements.size,
|
||||||
.memoryTypeIndex = FindMemoryTypeIndex(memory_properties, requirements.memoryTypeBits),
|
.memoryTypeIndex =
|
||||||
});
|
FindMemoryTypeIndex(memory_properties, requirements.memoryTypeBits, true),
|
||||||
|
};
|
||||||
|
stream_memory = dev.TryAllocateMemory(stream_memory_info);
|
||||||
|
if (!stream_memory) {
|
||||||
|
LOG_INFO(Render_Vulkan, "Dynamic memory allocation failed, trying with system memory");
|
||||||
|
stream_memory_info.memoryTypeIndex =
|
||||||
|
FindMemoryTypeIndex(memory_properties, requirements.memoryTypeBits, false);
|
||||||
|
stream_memory = dev.AllocateMemory(stream_memory_info);
|
||||||
|
}
|
||||||
|
|
||||||
if (device.HasDebuggingToolAttached()) {
|
if (device.HasDebuggingToolAttached()) {
|
||||||
stream_memory.SetObjectNameEXT("Stream Buffer Memory");
|
stream_memory.SetObjectNameEXT("Stream Buffer Memory");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue