Cycles: Fix building with native only option

Approach suggested by Lukas S.
This commit is contained in:
Mai Lavelle
2017-05-16 15:59:57 -04:00
parent e14a2e87dc
commit 966a2681f9
2 changed files with 52 additions and 36 deletions

View File

@@ -22,6 +22,7 @@
#include "kernel/kernel_compat_cpu.h"
#ifndef KERNEL_STUB
# ifndef __SPLIT_KERNEL__
# include "kernel/kernel_math.h"
# include "kernel/kernel_types.h"
@@ -55,12 +56,15 @@
# include "kernel/split/kernel_next_iteration_setup.h"
# include "kernel/split/kernel_indirect_subsurface.h"
# include "kernel/split/kernel_buffer_update.h"
#endif
#ifdef KERNEL_STUB
# endif /* __SPLIT_KERNEL__ */
#else
# include "util/util_debug.h"
# define STUB_ASSERT(arch, name) assert(!(#name " kernel stub for architecture " #arch " was called!"))
#endif
# ifdef __SPLIT_KERNEL__
# include "kernel/split/kernel_data_init.h"
# endif /* __SPLIT_KERNEL__ */
#endif /* KERNEL_STUB */
CCL_NAMESPACE_BEGIN
@@ -191,13 +195,18 @@ void KERNEL_FUNCTION_FULL_NAME(shader)(KernelGlobals *kg,
{ \
STUB_ASSERT(KERNEL_ARCH, name); \
}
# define DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(name, type) \
void KERNEL_FUNCTION_FULL_NAME(name)(KernelGlobals *kg, KernelData* /*data*/) \
{ \
STUB_ASSERT(KERNEL_ARCH, name); \
}
#else
# define DEFINE_SPLIT_KERNEL_FUNCTION(name) \
void KERNEL_FUNCTION_FULL_NAME(name)(KernelGlobals *kg, KernelData* /*data*/) \
{ \
kernel_##name(kg); \
}
#endif /* KERNEL_STUB */
# define DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(name, type) \
void KERNEL_FUNCTION_FULL_NAME(name)(KernelGlobals *kg, KernelData* /*data*/) \
@@ -205,6 +214,7 @@ void KERNEL_FUNCTION_FULL_NAME(shader)(KernelGlobals *kg,
ccl_local type locals; \
kernel_##name(kg, &locals); \
}
#endif /* KERNEL_STUB */
DEFINE_SPLIT_KERNEL_FUNCTION(path_init)
DEFINE_SPLIT_KERNEL_FUNCTION(scene_intersect)

View File

@@ -67,6 +67,10 @@ void KERNEL_FUNCTION_FULL_NAME(data_init)(
unsigned int num_samples,
ccl_global float *buffer)
{
#ifdef KERNEL_STUB
STUB_ASSERT(KERNEL_ARCH, data_init);
#else
#ifdef __KERNEL_OPENCL__
kg->data = data;
#endif
@@ -143,6 +147,8 @@ void KERNEL_FUNCTION_FULL_NAME(data_init)(
*(rng_state + index) = hash_int_2d(x, y);
}
}
#endif /* KERENL_STUB */
}
CCL_NAMESPACE_END