19
19
/* Constant Globals */
24
#include "osl_globals.h"
29
21
CCL_NAMESPACE_BEGIN
31
23
/* On the CPU, we pass along the struct KernelGlobals to nearly everywhere in
32
the kernel, to access constant data. These are all stored as "textures", but
33
these are really just standard arrays. We can't use actually globals because
34
multiple renders may be running inside the same process. */
24
* the kernel, to access constant data. These are all stored as "textures", but
25
* these are really just standard arrays. We can't use actually globals because
26
* multiple renders may be running inside the same process. */
36
28
#ifdef __KERNEL_CPU__
33
struct OSLShadingSystem;
36
#define MAX_BYTE_IMAGES 512
37
#define MAX_FLOAT_IMAGES 5
38
39
typedef struct KernelGlobals {
40
texture_image_uchar4 texture_byte_images[MAX_BYTE_IMAGES];
41
texture_image_float4 texture_float_images[MAX_FLOAT_IMAGES];
40
43
#define KERNEL_TEX(type, ttype, name) ttype name;
41
#define KERNEL_IMAGE_TEX(type, ttype, name) ttype name;
44
#define KERNEL_IMAGE_TEX(type, ttype, name)
42
45
#include "kernel_textures.h"
47
50
/* On the CPU, we also have the OSL globals here. Most data structures are shared
48
with SVM, the difference is in the shaders and object/mesh attributes. */
51
* with SVM, the difference is in the shaders and object/mesh attributes. */
53
OSLShadingSystem *osl_ss;
54
OSLThreadData *osl_tdata;
56
61
/* For CUDA, constant memory textures must be globals, so we can't put them
57
into a struct. As a result we don't actually use this struct and use actual
58
globals and simply pass along a NULL pointer everywhere, which we hope gets
62
* into a struct. As a result we don't actually use this struct and use actual
63
* globals and simply pass along a NULL pointer everywhere, which we hope gets
61
66
#ifdef __KERNEL_CUDA__