mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-07 18:58:06 +02:00
clients/simple-vulkan.c: fix find_memory_type()
- Use "<" instead of "<=" in the loop condition - Remove `(1u << i) <= allowed` from the loop condition for simplicity - Use `(...propertyFlags & properties) == properties` instead of `(...propertyFlags & properties)` to ensure all requested properties are present Signed-off-by: Hiroaki Yamamoto <hrak1529@gmail.com>
This commit is contained in:
parent
3534c77b66
commit
ae25e544c4
1 changed files with 5 additions and 2 deletions
|
|
@ -525,8 +525,11 @@ find_memory_type(struct window *window, uint32_t allowed, VkMemoryPropertyFlags
|
|||
VkPhysicalDeviceMemoryProperties mem_properties;
|
||||
vkGetPhysicalDeviceMemoryProperties(window->vk.phys_dev, &mem_properties);
|
||||
|
||||
for (unsigned i = 0; (1u << i) <= allowed && i <= mem_properties.memoryTypeCount; ++i) {
|
||||
if ((allowed & (1u << i)) && (mem_properties.memoryTypes[i].propertyFlags & properties))
|
||||
for (unsigned i = 0; i < mem_properties.memoryTypeCount; ++i) {
|
||||
bool is_allowed = allowed & (1u << i);
|
||||
bool has_properties =
|
||||
(mem_properties.memoryTypes[i].propertyFlags & properties) == properties;
|
||||
if (is_allowed && has_properties)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue