Blender V2.61 - r43446
|
00001 /* 00002 * Copyright 2011, Blender Foundation. 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 */ 00018 00019 /* Constant Globals */ 00020 00021 #ifdef __KERNEL_CPU__ 00022 00023 #ifdef __OSL__ 00024 #include "osl_globals.h" 00025 #endif 00026 00027 #endif 00028 00029 CCL_NAMESPACE_BEGIN 00030 00031 /* On the CPU, we pass along the struct KernelGlobals to nearly everywhere in 00032 the kernel, to access constant data. These are all stored as "textures", but 00033 these are really just standard arrays. We can't use actually globals because 00034 multiple renders may be running inside the same process. */ 00035 00036 #ifdef __KERNEL_CPU__ 00037 00038 typedef struct KernelGlobals { 00039 00040 #define KERNEL_TEX(type, ttype, name) ttype name; 00041 #define KERNEL_IMAGE_TEX(type, ttype, name) ttype name; 00042 #include "kernel_textures.h" 00043 00044 KernelData __data; 00045 00046 #ifdef __OSL__ 00047 /* On the CPU, we also have the OSL globals here. Most data structures are shared 00048 with SVM, the difference is in the shaders and object/mesh attributes. */ 00049 OSLGlobals osl; 00050 #endif 00051 00052 } KernelGlobals; 00053 00054 #endif 00055 00056 /* For CUDA, constant memory textures must be globals, so we can't put them 00057 into a struct. As a result we don't actually use this struct and use actual 00058 globals and simply pass along a NULL pointer everywhere, which we hope gets 00059 optimized out. */ 00060 00061 #ifdef __KERNEL_CUDA__ 00062 00063 __constant__ KernelData __data; 00064 typedef struct KernelGlobals {} KernelGlobals; 00065 00066 #define KERNEL_TEX(type, ttype, name) ttype name; 00067 #define KERNEL_IMAGE_TEX(type, ttype, name) ttype name; 00068 #include "kernel_textures.h" 00069 00070 #endif 00071 00072 /* OpenCL */ 00073 00074 #ifdef __KERNEL_OPENCL__ 00075 00076 typedef struct KernelGlobals { 00077 __constant KernelData *data; 00078 00079 #define KERNEL_TEX(type, ttype, name) \ 00080 __global type *name; 00081 #include "kernel_textures.h" 00082 } KernelGlobals; 00083 00084 #endif 00085 00086 CCL_NAMESPACE_END 00087