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++) {
// 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)
VkMemoryRequirements mem_reqs;
VkResult U_ASSERT_ONLY err;
+ bool U_ASSERT_ONLY pass;
demo->depth.format = depth_format;
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);
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))
{
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,
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);
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);
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++) {
// 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)
VkMemoryRequirements mem_reqs;
VkResult U_ASSERT_ONLY err;
+ bool U_ASSERT_ONLY pass;
demo->depth.format = depth_format;
/* 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);
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;
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);
};
VkMemoryRequirements mem_reqs;
VkResult U_ASSERT_ONLY err;
+ bool U_ASSERT_ONLY pass;
void *data;
memset(&demo->vertices, 0, sizeof(demo->vertices));
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);
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);
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,
return "VK_EVENT_RESET";
break;
}
- case VK_UNSUPPORTED:
- {
- return "VK_UNSUPPORTED";
- break;
- }
case VK_SUCCESS:
{
return "VK_SUCCESS";
// 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,
// 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()
{
VkImage image2;
VkResult err;
+ bool pass;
int x, y;
const char *ptr;
VkDeviceMemory mem2;
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);