Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel.cpp
| Show All 31 Lines | |||||
| void kernel_const_copy(KernelGlobals *kg, const char *name, void *host, size_t size) | void kernel_const_copy(KernelGlobals *kg, const char *name, void *host, size_t size) | ||||
| { | { | ||||
| if(strcmp(name, "__data") == 0) | if(strcmp(name, "__data") == 0) | ||||
| memcpy(&kg->__data, host, size); | memcpy(&kg->__data, host, size); | ||||
| else | else | ||||
| assert(0); | assert(0); | ||||
| } | } | ||||
| void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t width, size_t height) | void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t width, size_t height, InterpolationType interpolation) | ||||
| { | { | ||||
| if(0) { | if(0) { | ||||
| } | } | ||||
| #define KERNEL_TEX(type, ttype, tname) \ | #define KERNEL_TEX(type, ttype, tname) \ | ||||
| else if(strcmp(name, #tname) == 0) { \ | else if(strcmp(name, #tname) == 0) { \ | ||||
| kg->tname.data = (type*)mem; \ | kg->tname.data = (type*)mem; \ | ||||
| kg->tname.width = width; \ | kg->tname.width = width; \ | ||||
| Show All 9 Lines | else if(strstr(name, "__tex_image_float")) { | ||||
| if (array_index >= 0 && array_index < MAX_FLOAT_IMAGES) { | if (array_index >= 0 && array_index < MAX_FLOAT_IMAGES) { | ||||
| tex = &kg->texture_float_images[array_index]; | tex = &kg->texture_float_images[array_index]; | ||||
| } | } | ||||
| if(tex) { | if(tex) { | ||||
| tex->data = (float4*)mem; | tex->data = (float4*)mem; | ||||
| tex->width = width; | tex->width = width; | ||||
| tex->height = height; | tex->height = height; | ||||
| tex->interpolation = interpolation; | |||||
| } | } | ||||
| } | } | ||||
| else if(strstr(name, "__tex_image")) { | else if(strstr(name, "__tex_image")) { | ||||
| texture_image_uchar4 *tex = NULL; | texture_image_uchar4 *tex = NULL; | ||||
| int id = atoi(name + strlen("__tex_image_")); | int id = atoi(name + strlen("__tex_image_")); | ||||
| int array_index = id - MAX_FLOAT_IMAGES; | int array_index = id - MAX_FLOAT_IMAGES; | ||||
| if (array_index >= 0 && array_index < MAX_BYTE_IMAGES) { | if (array_index >= 0 && array_index < MAX_BYTE_IMAGES) { | ||||
| tex = &kg->texture_byte_images[array_index]; | tex = &kg->texture_byte_images[array_index]; | ||||
| } | } | ||||
| if(tex) { | if(tex) { | ||||
| tex->data = (uchar4*)mem; | tex->data = (uchar4*)mem; | ||||
| tex->width = width; | tex->width = width; | ||||
| tex->height = height; | tex->height = height; | ||||
| tex->interpolation = interpolation; | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| assert(0); | assert(0); | ||||
| } | } | ||||
| /* On x86-64, we can assume SSE2, so avoid the extra kernel and compile this one with SSE2 intrinsics */ | /* On x86-64, we can assume SSE2, so avoid the extra kernel and compile this one with SSE2 intrinsics */ | ||||
| #if defined(__x86_64__) || defined(_M_X64) | #if defined(__x86_64__) || defined(_M_X64) | ||||
| ▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines | |||||