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 | f194721df3852e9914588d1a00479ed9c974de3f (patch) | |
| tree | cbe15d668001ef441d55f330e4e988d5604a74eb /layers/vk_layer_utils.cpp | |
| parent | 7cd389c11c9d1097fb04ba44b3f1d213c98ebc99 (diff) | |
| download | usermoji-f194721df3852e9914588d1a00479ed9c974de3f.tar.xz | |
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 'layers/vk_layer_utils.cpp')
0 files changed, 0 insertions, 0 deletions
