mirror of https://github.com/PCSX2/pcsx2.git
Vulkan/Context: Remove unused memory type functions
VulkanMemoryAllocator takes care of this.
This commit is contained in:
parent
20c534fc46
commit
3a91ed2571
|
@ -1316,97 +1316,6 @@ namespace Vulkan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Context::GetMemoryType(u32 bits, VkMemoryPropertyFlags properties, u32* out_type_index)
|
|
||||||
{
|
|
||||||
for (u32 i = 0; i < VK_MAX_MEMORY_TYPES; i++)
|
|
||||||
{
|
|
||||||
if ((bits & (1 << i)) != 0)
|
|
||||||
{
|
|
||||||
u32 supported = m_device_memory_properties.memoryTypes[i].propertyFlags & properties;
|
|
||||||
if (supported == properties)
|
|
||||||
{
|
|
||||||
*out_type_index = i;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 Context::GetMemoryType(u32 bits, VkMemoryPropertyFlags properties)
|
|
||||||
{
|
|
||||||
u32 type_index = VK_MAX_MEMORY_TYPES;
|
|
||||||
if (!GetMemoryType(bits, properties, &type_index))
|
|
||||||
{
|
|
||||||
Console.Error("Unable to find memory type for %x:%x", bits, properties);
|
|
||||||
pxFailRel("Unable to find memory type");
|
|
||||||
}
|
|
||||||
|
|
||||||
return type_index;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 Context::GetUploadMemoryType(u32 bits, bool* is_coherent)
|
|
||||||
{
|
|
||||||
// Try for coherent memory first.
|
|
||||||
VkMemoryPropertyFlags flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
|
|
||||||
|
|
||||||
u32 type_index;
|
|
||||||
if (!GetMemoryType(bits, flags, &type_index))
|
|
||||||
{
|
|
||||||
Console.Warning("Vulkan: Failed to find a coherent memory type for uploads, this will affect performance.");
|
|
||||||
|
|
||||||
// Try non-coherent memory.
|
|
||||||
flags &= ~VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
|
|
||||||
if (!GetMemoryType(bits, flags, &type_index))
|
|
||||||
{
|
|
||||||
// We shouldn't have any memory types that aren't host-visible.
|
|
||||||
pxFailRel("Unable to get memory type for upload.");
|
|
||||||
type_index = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_coherent)
|
|
||||||
*is_coherent = ((flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) != 0);
|
|
||||||
|
|
||||||
return type_index;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 Context::GetReadbackMemoryType(u32 bits, bool* is_coherent, bool* is_cached)
|
|
||||||
{
|
|
||||||
// Try for cached and coherent memory first.
|
|
||||||
VkMemoryPropertyFlags flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT |
|
|
||||||
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
|
|
||||||
|
|
||||||
u32 type_index;
|
|
||||||
if (!GetMemoryType(bits, flags, &type_index))
|
|
||||||
{
|
|
||||||
// For readbacks, caching is more important than coherency.
|
|
||||||
flags &= ~VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
|
|
||||||
if (!GetMemoryType(bits, flags, &type_index))
|
|
||||||
{
|
|
||||||
Console.Warning("Vulkan: Failed to find a cached memory type for readbacks, this will affect "
|
|
||||||
"performance.");
|
|
||||||
|
|
||||||
// Remove the cached bit as well.
|
|
||||||
flags &= ~VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
|
|
||||||
if (!GetMemoryType(bits, flags, &type_index))
|
|
||||||
{
|
|
||||||
// We shouldn't have any memory types that aren't host-visible.
|
|
||||||
pxFailRel("Unable to get memory type for upload.");
|
|
||||||
type_index = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_coherent)
|
|
||||||
*is_coherent = ((flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) != 0);
|
|
||||||
if (is_cached)
|
|
||||||
*is_cached = ((flags & VK_MEMORY_PROPERTY_HOST_CACHED_BIT) != 0);
|
|
||||||
|
|
||||||
return type_index;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkRenderPass Context::CreateCachedRenderPass(RenderPassCacheKey key)
|
VkRenderPass Context::CreateCachedRenderPass(RenderPassCacheKey key)
|
||||||
{
|
{
|
||||||
VkAttachmentReference color_reference;
|
VkAttachmentReference color_reference;
|
||||||
|
|
|
@ -118,15 +118,6 @@ namespace Vulkan
|
||||||
}
|
}
|
||||||
__fi VkDeviceSize GetMaxImageDimension2D() const { return m_device_properties.limits.maxImageDimension2D; }
|
__fi VkDeviceSize GetMaxImageDimension2D() const { return m_device_properties.limits.maxImageDimension2D; }
|
||||||
|
|
||||||
// Finds a memory type index for the specified memory properties and the bits returned by
|
|
||||||
// vkGetImageMemoryRequirements
|
|
||||||
bool GetMemoryType(u32 bits, VkMemoryPropertyFlags properties, u32* out_type_index);
|
|
||||||
u32 GetMemoryType(u32 bits, VkMemoryPropertyFlags properties);
|
|
||||||
|
|
||||||
// Finds a memory type for upload or readback buffers.
|
|
||||||
u32 GetUploadMemoryType(u32 bits, bool* is_coherent = nullptr);
|
|
||||||
u32 GetReadbackMemoryType(u32 bits, bool* is_coherent = nullptr, bool* is_cached = nullptr);
|
|
||||||
|
|
||||||
// Creates a simple render pass.
|
// Creates a simple render pass.
|
||||||
__ri VkRenderPass GetRenderPass(VkFormat color_format, VkFormat depth_format,
|
__ri VkRenderPass GetRenderPass(VkFormat color_format, VkFormat depth_format,
|
||||||
VkAttachmentLoadOp color_load_op = VK_ATTACHMENT_LOAD_OP_LOAD,
|
VkAttachmentLoadOp color_load_op = VK_ATTACHMENT_LOAD_OP_LOAD,
|
||||||
|
|
Loading…
Reference in New Issue