diff options
author | Tony Barbour <tony@LunarG.com> | 2016-03-07 15:48:06 -0700 |
---|---|---|
committer | Tony Barbour <tony@LunarG.com> | 2016-03-07 16:44:22 -0700 |
commit | 3ec16a56566d3b140c488dc9acb2204a1ec199ca (patch) | |
tree | ef9a4bbb58d39a5493982c534c08465ae81e1526 /glslang_revision | |
parent | bba4211b4dc705ecb570bb5e76d9ebb5836339a0 (diff) |
demos: Remove allocation callback code from tri demo
From LoaderAndValidationLayers issue #84:
demos/tri.c implements VkAllocationCallbacks with aligned_alloc/_aligned_malloc, free/_aligned_free, and realloc.
I belive that is broken in many ways:
realloc does not return a pointer with the necessary alignment.
realloc(_aligned_malloc(...)) crashes.
_aligned_free(realloc(...)) crashes.
aligned_alloc requires that size must be a multiple of alignment, while Vulkan provides no such guarantee to these callbacks.
On POSIX-based implementations, aligned_alloc requires that alignment must be a multiple of sizeof(void *) as well as a power of two, while Vulkan merely requires it to be a power of two.
aligned_alloc(0), realloc(p, 0) might return non-NULL, while I think Vulkan requires NULL.
_aligned_malloc(0, a) is documented to invoke the invalid parameter handler (although I'm not sure it actually does in practice).
Implementing a valid allocator is quite non-trivial, so it may be best to just delete the allocator entirely from the demo.
(See also KhronosGroup/Vulkan-Docs#21 and KhronosGroup/Vulkan-Docs#103 for related discussions.)
Change-Id: I3ef3ba19c64127bd65a7dbe7b0b54de42e68ebb0
Diffstat (limited to 'glslang_revision')
0 files changed, 0 insertions, 0 deletions