| 164 | } |
| 165 | |
| 166 | bool PhysicalDevice::SetMemoryType(const uint32_t type_bits, VkMemoryAllocateInfo* info, const VkFlags properties, |
| 167 | const VkFlags forbid, const VkMemoryHeapFlags heapFlags) const { |
| 168 | uint32_t type_mask = type_bits; |
| 169 | // Search memtypes to find first index with those properties |
| 170 | for (uint32_t i = 0; i < memory_properties_.memoryTypeCount; i++) { |
| 171 | if ((type_mask & 1) == 1) { |
| 172 | // Type is available, does it match user properties? |
| 173 | if ((memory_properties_.memoryTypes[i].propertyFlags & properties) == properties && |
| 174 | (memory_properties_.memoryTypes[i].propertyFlags & forbid) == 0 && |
| 175 | (memory_properties_.memoryHeaps[memory_properties_.memoryTypes[i].heapIndex].size >= info->allocationSize)) { |
| 176 | // Memory properties available, does it match user heap flags? |
| 177 | if ((heapFlags == 0) || |
| 178 | ((heapFlags & memory_properties_.memoryHeaps[memory_properties_.memoryTypes[i].heapIndex].flags) == |
| 179 | heapFlags)) { |
| 180 | info->memoryTypeIndex = i; |
| 181 | return true; |
| 182 | } |
| 183 | } |
| 184 | } |
| 185 | type_mask >>= 1; |
| 186 | } |
| 187 | // No memory types matched, return failure |
| 188 | return false; |
| 189 | } |
| 190 | |
| 191 | /* |
| 192 | * Return list of PhysicalDevice layers |
no outgoing calls
no test coverage detected