aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Ashburn <jon@lunarg.com>2015-08-28 13:48:40 -0600
committerJon Ashburn <jon@lunarg.com>2015-09-04 15:46:31 -0600
commit27f084f19e7b3a430e6d1ebfa9e2daf118687fd2 (patch)
tree5524d708fdf5853e3bf88d8e553817c518f92cf8
parent94be72c20be1cfd4ea8b8f6c27c6bdc75cb2a843 (diff)
downloadusermoji-27f084f19e7b3a430e6d1ebfa9e2daf118687fd2.tar.xz
demos: Add allocation callback to tri test CreateInstance
-rw-r--r--demos/tri.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/demos/tri.c b/demos/tri.c
index 1a53d0ea..feb187d9 100644
--- a/demos/tri.c
+++ b/demos/tri.c
@@ -1705,6 +1705,20 @@ static VkBool32 demo_check_layers(uint32_t check_count, char **check_names,
return 1;
}
+void* VKAPI myalloc(
+ void* pUserData,
+ size_t size,
+ size_t alignment,
+ VkSystemAllocType allocType)
+{
+ return malloc(size);
+}
+void VKAPI myfree(
+ void* pUserData,
+ void* pMem)
+{
+ return free(pMem);
+}
static void demo_init_vk(struct demo *demo)
{
VkResult err;
@@ -1785,11 +1799,16 @@ static void demo_init_vk(struct demo *demo)
.engineVersion = 0,
.apiVersion = VK_API_VERSION,
};
+ VkAllocCallbacks cb = {
+ .pUserData = NULL,
+ .pfnAlloc = myalloc,
+ .pfnFree = myfree,
+ };
VkInstanceCreateInfo inst_info = {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pNext = NULL,
.pAppInfo = &app,
- .pAllocCb = NULL,
+ .pAllocCb = &cb,
.layerCount = enabled_layer_count,
.ppEnabledLayerNames = (const char *const*) layer_names,
.extensionCount = enabled_extension_count,