kernel.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright 2011-2013 Blender Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef __KERNEL_H__
  17. #define __KERNEL_H__
  18. /* CPU Kernel Interface */
  19. #include "util/util_types.h"
  20. #include "kernel/kernel_types.h"
  21. CCL_NAMESPACE_BEGIN
  22. #define KERNEL_NAME_JOIN(x, y, z) x##_##y##_##z
  23. #define KERNEL_NAME_EVAL(arch, name) KERNEL_NAME_JOIN(kernel, arch, name)
  24. #define KERNEL_FUNCTION_FULL_NAME(name) KERNEL_NAME_EVAL(KERNEL_ARCH, name)
  25. struct KernelGlobals;
  26. struct KernelData;
  27. KernelGlobals *kernel_globals_create();
  28. void kernel_globals_free(KernelGlobals *kg);
  29. void *kernel_osl_memory(KernelGlobals *kg);
  30. bool kernel_osl_use(KernelGlobals *kg);
  31. void kernel_const_copy(KernelGlobals *kg, const char *name, void *host, size_t size);
  32. void kernel_tex_copy(KernelGlobals *kg, const char *name, void *mem, size_t size);
  33. #define KERNEL_ARCH cpu
  34. #include "kernel/kernels/cpu/kernel_cpu.h"
  35. #define KERNEL_ARCH cpu_sse2
  36. #include "kernel/kernels/cpu/kernel_cpu.h"
  37. #define KERNEL_ARCH cpu_sse3
  38. #include "kernel/kernels/cpu/kernel_cpu.h"
  39. #define KERNEL_ARCH cpu_sse41
  40. #include "kernel/kernels/cpu/kernel_cpu.h"
  41. #define KERNEL_ARCH cpu_avx
  42. #include "kernel/kernels/cpu/kernel_cpu.h"
  43. #define KERNEL_ARCH cpu_avx2
  44. #include "kernel/kernels/cpu/kernel_cpu.h"
  45. CCL_NAMESPACE_END
  46. #endif /* __KERNEL_H__ */