added deferred example

This commit is contained in:
Evghenii
2014-01-06 12:26:49 +01:00
parent 774e907ecf
commit 260b1ad887
11 changed files with 144 additions and 583 deletions

View File

@@ -60,11 +60,13 @@
#endif
#include "deferred.h"
#include "../timing.h"
#include "../ispc_malloc.h"
///////////////////////////////////////////////////////////////////////////
static void *
lAlignedMalloc(size_t size, int32_t alignment) {
#ifndef _CUDA_
#ifdef ISPC_IS_WINDOWS
return _aligned_malloc(size, alignment);
#endif
@@ -79,11 +81,18 @@ lAlignedMalloc(size_t size, int32_t alignment) {
((void**)amem)[-1] = mem;
return amem;
#endif
#else
void *ptr;
ispc_malloc(&ptr, size);
return ptr;
#endif
}
static void
lAlignedFree(void *ptr) {
#ifndef _CUDA_
#ifdef ISPC_IS_WINDOWS
_aligned_free(ptr);
#endif
@@ -93,6 +102,9 @@ lAlignedFree(void *ptr) {
#ifdef ISPC_IS_APPLE
free(((void**)ptr)[-1]);
#endif
#else
ispc_free(ptr);
#endif
}