diff options
| author | Tony Barbour <tony@LunarG.com> | 2015-10-15 12:42:56 -0600 |
|---|---|---|
| committer | Tony Barbour <tony@LunarG.com> | 2015-10-19 09:32:27 -0600 |
| commit | 8a9f62a2d83874a66b1b6c7a0b75ad5db459f5af (patch) | |
| tree | 2fde15665902a5d6e94f33188d6306e47547fd3c | |
| parent | 04e23cb13d1e9d51134b77ed8c60441308afe3f3 (diff) | |
| download | usermoji-8a9f62a2d83874a66b1b6c7a0b75ad5db459f5af.tar.xz | |
Clarify parameter usage in memory_type_from_properties
| -rw-r--r-- | demos/cube.c | 12 | ||||
| -rw-r--r-- | demos/tri.c | 12 | ||||
| -rw-r--r-- | layers/screenshot.cpp | 4 |
3 files changed, 14 insertions, 14 deletions
diff --git a/demos/cube.c b/demos/cube.c index 10fc17b7..a57bf4ff 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -407,13 +407,13 @@ struct demo { uint32_t queue_count; }; -static VkResult memory_type_from_properties(struct demo *demo, uint32_t typeBits, VkFlags properties, uint32_t *typeIndex) +static VkResult memory_type_from_properties(struct demo *demo, uint32_t typeBits, VkFlags requirements_mask, uint32_t *typeIndex) { // Search memtypes to find first index with those properties for (uint32_t i = 0; i < 32; i++) { if ((typeBits & 1) == 1) { // Type is available, does it match user properties? - if ((demo->memory_properties.memoryTypes[i].propertyFlags & properties) == properties) { + if ((demo->memory_properties.memoryTypes[i].propertyFlags & requirements_mask) == requirements_mask) { *typeIndex = i; return VK_SUCCESS; } @@ -853,7 +853,7 @@ static void demo_prepare_depth(struct demo *demo) err = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, - VK_MEMORY_PROPERTY_DEVICE_ONLY, + 0, /* No requirements */ &demo->depth.mem_alloc.memoryTypeIndex); assert(!err); @@ -925,7 +925,7 @@ static void demo_prepare_texture_image(struct demo *demo, struct texture_object *tex_obj, VkImageTiling tiling, VkImageUsageFlags usage, - VkFlags mem_props) + VkFlags required_props) { const VkFormat tex_format = VK_FORMAT_R8G8B8A8_UNORM; int32_t tex_width; @@ -970,7 +970,7 @@ static void demo_prepare_texture_image(struct demo *demo, tex_obj->mem_alloc.allocationSize = mem_reqs.size; tex_obj->mem_alloc.memoryTypeIndex = 0; - err = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, mem_props, &tex_obj->mem_alloc.memoryTypeIndex); + err = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, required_props, &tex_obj->mem_alloc.memoryTypeIndex); assert(!err); /* allocate memory */ @@ -983,7 +983,7 @@ static void demo_prepare_texture_image(struct demo *demo, tex_obj->mem, 0); assert(!err); - if (mem_props & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { + if (required_props & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { const VkImageSubresource subres = { .aspect = VK_IMAGE_ASPECT_COLOR, .mipLevel = 0, diff --git a/demos/tri.c b/demos/tri.c index f071e2fc..06321c22 100644 --- a/demos/tri.c +++ b/demos/tri.c @@ -247,13 +247,13 @@ struct demo { uint32_t queue_count; }; -static VkResult memory_type_from_properties(struct demo *demo, uint32_t typeBits, VkFlags properties, uint32_t *typeIndex) +static VkResult memory_type_from_properties(struct demo *demo, uint32_t typeBits, VkFlags requirements_mask, uint32_t *typeIndex) { // Search memtypes to find first index with those properties for (uint32_t i = 0; i < 32; i++) { if ((typeBits & 1) == 1) { // Type is available, does it match user properties? - if ((demo->memory_properties.memoryTypes[i].propertyFlags & properties) == properties) { + if ((demo->memory_properties.memoryTypes[i].propertyFlags & requirements_mask) == requirements_mask) { *typeIndex = i; return VK_SUCCESS; } @@ -665,7 +665,7 @@ static void demo_prepare_depth(struct demo *demo) mem_alloc.allocationSize = mem_reqs.size; err = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, - VK_MEMORY_PROPERTY_DEVICE_ONLY, + 0, /* No requirements */ &mem_alloc.memoryTypeIndex); assert(!err); @@ -694,7 +694,7 @@ static void demo_prepare_texture_image(struct demo *demo, struct texture_object *tex_obj, VkImageTiling tiling, VkImageUsageFlags usage, - VkFlags mem_props) + VkFlags required_props) { const VkFormat tex_format = VK_FORMAT_B8G8R8A8_UNORM; const int32_t tex_width = 2; @@ -733,7 +733,7 @@ static void demo_prepare_texture_image(struct demo *demo, err = vkGetImageMemoryRequirements(demo->device, tex_obj->image, &mem_reqs); mem_alloc.allocationSize = mem_reqs.size; - err = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, mem_props, &mem_alloc.memoryTypeIndex); + err = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, required_props, &mem_alloc.memoryTypeIndex); assert(!err); /* allocate memory */ @@ -745,7 +745,7 @@ static void demo_prepare_texture_image(struct demo *demo, tex_obj->mem, 0); assert(!err); - if (mem_props & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { + if (required_props & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { const VkImageSubresource subres = { .aspect = VK_IMAGE_ASPECT_COLOR, .mipLevel = 0, diff --git a/layers/screenshot.cpp b/layers/screenshot.cpp index deba9bb6..ac3e20d7 100644 --- a/layers/screenshot.cpp +++ b/layers/screenshot.cpp @@ -99,14 +99,14 @@ static bool screenshotEnvQueried = false; static VkResult memory_type_from_properties( VkPhysicalDeviceMemoryProperties *memory_properties, uint32_t typeBits, - VkFlags properties, + VkFlags requirements_mask, uint32_t *typeIndex) { // Search memtypes to find first index with those properties for (uint32_t i = 0; i < 32; i++) { if ((typeBits & 1) == 1) { // Type is available, does it match user properties? - if ((memory_properties->memoryTypes[i].propertyFlags & properties) == properties) { + if ((memory_properties->memoryTypes[i].propertyFlags & requirements_mask) == requirements_mask) { *typeIndex = i; return VK_SUCCESS; } |
