diff options
| author | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-10-22 11:03:31 -0600 |
|---|---|---|
| committer | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-10-23 17:32:04 -0600 |
| commit | 87a0ef0feb2ab734b890c8b509fe064e64ec2e88 (patch) | |
| tree | 3e08fc4da579802390a4405a28046bf74319025a | |
| parent | 34d57d56eb667f2fe69a602d839074d1485c1931 (diff) | |
| download | usermoji-87a0ef0feb2ab734b890c8b509fe064e64ec2e88.tar.xz | |
bug-14542: Remove VK_UNSUPPORTED from success return codes
| -rw-r--r-- | demos/cube.c | 21 | ||||
| -rw-r--r-- | demos/tri.c | 21 | ||||
| -rw-r--r-- | demos/vulkaninfo.c | 1 | ||||
| -rw-r--r-- | include/vulkan.h | 11 | ||||
| -rw-r--r-- | layers/param_checker.cpp | 5 | ||||
| -rw-r--r-- | layers/screenshot.cpp | 11 |
6 files changed, 35 insertions, 35 deletions
diff --git a/demos/cube.c b/demos/cube.c index a74c9097..7cb70577 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -407,7 +407,7 @@ struct demo { uint32_t queue_count; }; -static VkResult memory_type_from_properties(struct demo *demo, uint32_t typeBits, VkFlags requirements_mask, uint32_t *typeIndex) +static bool 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++) { @@ -415,13 +415,13 @@ static VkResult memory_type_from_properties(struct demo *demo, uint32_t typeBits // Type is available, does it match user properties? if ((demo->memory_properties.memoryTypes[i].propertyFlags & requirements_mask) == requirements_mask) { *typeIndex = i; - return VK_SUCCESS; + return true; } } typeBits >>= 1; } // No memory types matched, return failure - return VK_UNSUPPORTED; + return false; } static void demo_flush_init_cmd(struct demo *demo) @@ -879,6 +879,7 @@ static void demo_prepare_depth(struct demo *demo) VkMemoryRequirements mem_reqs; VkResult U_ASSERT_ONLY err; + bool U_ASSERT_ONLY pass; demo->depth.format = depth_format; @@ -896,11 +897,11 @@ static void demo_prepare_depth(struct demo *demo) demo->depth.mem_alloc.allocationSize = mem_reqs.size; demo->depth.mem_alloc.memoryTypeIndex = 0; - err = memory_type_from_properties(demo, + pass = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, 0, /* No requirements */ &demo->depth.mem_alloc.memoryTypeIndex); - assert(!err); + assert(pass); /* allocate memory */ err = vkAllocMemory(demo->device, &demo->depth.mem_alloc, &demo->depth.mem); @@ -976,6 +977,7 @@ static void demo_prepare_texture_image(struct demo *demo, int32_t tex_width; int32_t tex_height; VkResult U_ASSERT_ONLY err; + bool U_ASSERT_ONLY pass; if (!loadTexture(filename, NULL, NULL, &tex_width, &tex_height)) { @@ -1014,8 +1016,8 @@ 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, required_props, &tex_obj->mem_alloc.memoryTypeIndex); - assert(!err); + pass = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, required_props, &tex_obj->mem_alloc.memoryTypeIndex); + assert(pass); /* allocate memory */ err = vkAllocMemory(demo->device, &tex_obj->mem_alloc, @@ -1179,6 +1181,7 @@ void demo_prepare_cube_data_buffer(struct demo *demo) int i; mat4x4 MVP, VP; VkResult U_ASSERT_ONLY err; + bool U_ASSERT_ONLY pass; struct vktexcube_vs_uniform data; mat4x4_mul(VP, demo->projection_matrix, demo->view_matrix); @@ -1211,11 +1214,11 @@ void demo_prepare_cube_data_buffer(struct demo *demo) demo->uniform_data.mem_alloc.allocationSize = mem_reqs.size; demo->uniform_data.mem_alloc.memoryTypeIndex = 0; - err = memory_type_from_properties(demo, + pass = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, &demo->uniform_data.mem_alloc.memoryTypeIndex); - assert(!err); + assert(pass); err = vkAllocMemory(demo->device, &demo->uniform_data.mem_alloc, &(demo->uniform_data.mem)); assert(!err); diff --git a/demos/tri.c b/demos/tri.c index 4f211795..e21b0ad2 100644 --- a/demos/tri.c +++ b/demos/tri.c @@ -247,7 +247,7 @@ struct demo { uint32_t queue_count; }; -static VkResult memory_type_from_properties(struct demo *demo, uint32_t typeBits, VkFlags requirements_mask, uint32_t *typeIndex) +static bool 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++) { @@ -255,13 +255,13 @@ static VkResult memory_type_from_properties(struct demo *demo, uint32_t typeBits // Type is available, does it match user properties? if ((demo->memory_properties.memoryTypes[i].propertyFlags & requirements_mask) == requirements_mask) { *typeIndex = i; - return VK_SUCCESS; + return true; } } typeBits >>= 1; } // No memory types matched, return failure - return VK_UNSUPPORTED; + return false; } static void demo_flush_init_cmd(struct demo *demo) @@ -693,6 +693,7 @@ static void demo_prepare_depth(struct demo *demo) VkMemoryRequirements mem_reqs; VkResult U_ASSERT_ONLY err; + bool U_ASSERT_ONLY pass; demo->depth.format = depth_format; @@ -707,11 +708,11 @@ static void demo_prepare_depth(struct demo *demo) /* select memory size and type */ mem_alloc.allocationSize = mem_reqs.size; - err = memory_type_from_properties(demo, + pass = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, 0, /* No requirements */ &mem_alloc.memoryTypeIndex); - assert(!err); + assert(pass); /* allocate memory */ err = vkAllocMemory(demo->device, &mem_alloc, &demo->depth.mem); @@ -744,6 +745,7 @@ static void demo_prepare_texture_image(struct demo *demo, const int32_t tex_width = 2; const int32_t tex_height = 2; VkResult U_ASSERT_ONLY err; + bool U_ASSERT_ONLY pass; tex_obj->tex_width = tex_width; tex_obj->tex_height = tex_height; @@ -777,8 +779,8 @@ static void demo_prepare_texture_image(struct demo *demo, vkGetImageMemoryRequirements(demo->device, tex_obj->image, &mem_reqs); mem_alloc.allocationSize = mem_reqs.size; - err = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, required_props, &mem_alloc.memoryTypeIndex); - assert(!err); + pass = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, required_props, &mem_alloc.memoryTypeIndex); + assert(pass); /* allocate memory */ err = vkAllocMemory(demo->device, &mem_alloc, &tex_obj->mem); @@ -960,6 +962,7 @@ static void demo_prepare_vertices(struct demo *demo) }; VkMemoryRequirements mem_reqs; VkResult U_ASSERT_ONLY err; + bool U_ASSERT_ONLY pass; void *data; memset(&demo->vertices, 0, sizeof(demo->vertices)); @@ -972,11 +975,11 @@ static void demo_prepare_vertices(struct demo *demo) assert(!err); mem_alloc.allocationSize = mem_reqs.size; - err = memory_type_from_properties(demo, + pass = memory_type_from_properties(demo, mem_reqs.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, &mem_alloc.memoryTypeIndex); - assert(!err); + assert(pass); err = vkAllocMemory(demo->device, &mem_alloc, &demo->vertices.mem); assert(!err); diff --git a/demos/vulkaninfo.c b/demos/vulkaninfo.c index 5453c488..a1f17168 100644 --- a/demos/vulkaninfo.c +++ b/demos/vulkaninfo.c @@ -132,7 +132,6 @@ static const char *vk_result_string(VkResult err) switch (err) { #define STR(r) case r: return #r STR(VK_SUCCESS); - STR(VK_UNSUPPORTED); STR(VK_NOT_READY); STR(VK_TIMEOUT); STR(VK_EVENT_SET); diff --git a/include/vulkan.h b/include/vulkan.h index 5f9a8b94..6bc464e6 100644 --- a/include/vulkan.h +++ b/include/vulkan.h @@ -139,12 +139,11 @@ VK_DEFINE_NONDISP_HANDLE(VkCmdPool) typedef enum { VK_SUCCESS = 0, - VK_UNSUPPORTED = 1, - VK_NOT_READY = 2, - VK_TIMEOUT = 3, - VK_EVENT_SET = 4, - VK_EVENT_RESET = 5, - VK_INCOMPLETE = 6, + VK_NOT_READY = 1, + VK_TIMEOUT = 2, + VK_EVENT_SET = 3, + VK_EVENT_RESET = 4, + VK_INCOMPLETE = 5, VK_ERROR_OUT_OF_HOST_MEMORY = -1, VK_ERROR_OUT_OF_DEVICE_MEMORY = -2, VK_ERROR_INITIALIZATION_FAILED = -3, diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp index 8ea75ff3..b42c013e 100644 --- a/layers/param_checker.cpp +++ b/layers/param_checker.cpp @@ -250,11 +250,6 @@ std::string EnumeratorString(VkResult const& enumerator) return "VK_EVENT_RESET"; break; } - case VK_UNSUPPORTED: - { - return "VK_UNSUPPORTED"; - break; - } case VK_SUCCESS: { return "VK_SUCCESS"; diff --git a/layers/screenshot.cpp b/layers/screenshot.cpp index ee39d0b5..e9ec3eb8 100644 --- a/layers/screenshot.cpp +++ b/layers/screenshot.cpp @@ -96,7 +96,7 @@ static vector<int> screenshotFrames; // Flag indicating we have queried _VK_SCREENSHOT env var static bool screenshotEnvQueried = false; -static VkResult memory_type_from_properties( +static bool memory_type_from_properties( VkPhysicalDeviceMemoryProperties *memory_properties, uint32_t typeBits, VkFlags requirements_mask, @@ -108,13 +108,13 @@ static VkResult memory_type_from_properties( // Type is available, does it match user properties? if ((memory_properties->memoryTypes[i].propertyFlags & requirements_mask) == requirements_mask) { *typeIndex = i; - return VK_SUCCESS; + return true; } } typeBits >>= 1; } // No memory types matched, return failure - return VK_UNSUPPORTED; + return false; } static void init_screenshot() @@ -135,6 +135,7 @@ static void writePPM( const char *filename, VkImage image1) { VkImage image2; VkResult err; + bool pass; int x, y; const char *ptr; VkDeviceMemory mem2; @@ -216,11 +217,11 @@ static void writePPM( const char *filename, VkImage image1) pInstanceTable = instance_dispatch_table(instance); pInstanceTable->GetPhysicalDeviceMemoryProperties(physicalDevice, &memory_properties); - err = memory_type_from_properties(&memory_properties, + pass = memory_type_from_properties(&memory_properties, memRequirements.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, &memAllocInfo.memoryTypeIndex); - assert(!err); + assert(pass); err = pTableDevice->AllocMemory(device, &memAllocInfo, &mem2); assert(!err); |
