Commit c3f7960c by Nicolas Capens Committed by Nicolas Capens

Define generic memory type.

Generic system memory is cached on all known ARMv8 and x86 CPUs, so advertise it as such. Bug b/118383648 Change-Id: Ic757206a497fc299e1e76a939220092f7c0a124d Reviewed-on: https://swiftshader-review.googlesource.com/c/22448Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarCorentin Wallez <cwallez@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent ee841c56
...@@ -43,7 +43,7 @@ const VkMemoryRequirements Buffer::getMemoryRequirements() const ...@@ -43,7 +43,7 @@ const VkMemoryRequirements Buffer::getMemoryRequirements() const
{ {
VkMemoryRequirements memoryRequirements = {}; VkMemoryRequirements memoryRequirements = {};
memoryRequirements.alignment = vk::REQUIRED_MEMORY_ALIGNMENT; memoryRequirements.alignment = vk::REQUIRED_MEMORY_ALIGNMENT;
memoryRequirements.memoryTypeBits = vk::REQUIRED_MEMORY_TYPE_BITS; memoryRequirements.memoryTypeBits = vk::MEMORY_TYPE_GENERIC_BIT;
memoryRequirements.size = size; // TODO: also reserve space for a header containing memoryRequirements.size = size; // TODO: also reserve space for a header containing
// the size of the buffer (for robust buffer access) // the size of the buffer (for robust buffer access)
return memoryRequirements; return memoryRequirements;
......
...@@ -38,7 +38,7 @@ enum ...@@ -38,7 +38,7 @@ enum
enum enum
{ {
REQUIRED_MEMORY_ALIGNMENT = 8, // For 64 bit formats on ARM64 REQUIRED_MEMORY_ALIGNMENT = 8, // For 64 bit formats on ARM64
REQUIRED_MEMORY_TYPE_BITS = 1, MEMORY_TYPE_GENERIC_BIT = 0x1, // Generic system memory.
}; };
enum enum
......
...@@ -446,13 +446,23 @@ const VkPhysicalDeviceMemoryProperties& PhysicalDevice::getMemoryProperties() co ...@@ -446,13 +446,23 @@ const VkPhysicalDeviceMemoryProperties& PhysicalDevice::getMemoryProperties() co
static const VkPhysicalDeviceMemoryProperties properties static const VkPhysicalDeviceMemoryProperties properties
{ {
1, // memoryTypeCount 1, // memoryTypeCount
{{VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | {
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | // vk::MEMORY_TYPE_GENERIC_BIT
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, {
0}}, // heapIndex VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
VK_MEMORY_PROPERTY_HOST_CACHED_BIT, // propertyFlags
0 // heapIndex
},
},
1, // memoryHeapCount 1, // memoryHeapCount
{{1ull << 31, // size, FIXME(sugoi): This could be configurable based on available RAM {
VK_MEMORY_HEAP_DEVICE_LOCAL_BIT}}, {
1ull << 31, // size, FIXME(sugoi): This should be configurable based on available RAM
VK_MEMORY_HEAP_DEVICE_LOCAL_BIT // flags
},
}
}; };
return properties; return properties;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment