diff options
author | Pascal Schoen <pascal_schoen@gmx.net> | 2016-08-03 12:42:02 +0300 |
---|---|---|
committer | Pascal Schoen <pascal_schoen@gmx.net> | 2016-08-03 12:42:02 +0300 |
commit | 81f6c06b1f53180bf32a5c11ac1fa64e2b6abf52 (patch) | |
tree | c7ad4920e48e0eb529e2064fd0d3813c29d5383b /intern/cycles/kernel/kernels | |
parent | ece5a08e0d6e51a83c223ea87346134216e5b34e (diff) | |
parent | 7065022f7aa23ba13d2999e1e40162a8f480af0e (diff) |
Merge branch 'master' into cycles_disney_brdf
Diffstat (limited to 'intern/cycles/kernel/kernels')
-rw-r--r-- | intern/cycles/kernel/kernels/cpu/kernel.cpp | 46 | ||||
-rw-r--r-- | intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h | 48 | ||||
-rw-r--r-- | intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/kernels/cuda/kernel.cu | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/kernels/opencl/kernel.cl | 1 |
5 files changed, 75 insertions, 28 deletions
diff --git a/intern/cycles/kernel/kernels/cpu/kernel.cpp b/intern/cycles/kernel/kernels/cpu/kernel.cpp index 365ce891354..f11c85d5f6a 100644 --- a/intern/cycles/kernel/kernels/cpu/kernel.cpp +++ b/intern/cycles/kernel/kernels/cpu/kernel.cpp @@ -95,7 +95,7 @@ void kernel_tex_copy(KernelGlobals *kg, int id = atoi(name + strlen("__tex_image_float4_")); int array_index = id; - if(array_index >= 0 && array_index < TEX_NUM_FLOAT4_IMAGES_CPU) { + if(array_index >= 0 && array_index < TEX_NUM_FLOAT4_CPU) { tex = &kg->texture_float4_images[array_index]; } @@ -109,9 +109,9 @@ void kernel_tex_copy(KernelGlobals *kg, else if(strstr(name, "__tex_image_float")) { texture_image_float *tex = NULL; int id = atoi(name + strlen("__tex_image_float_")); - int array_index = id - TEX_IMAGE_FLOAT_START_CPU; + int array_index = id - TEX_START_FLOAT_CPU; - if(array_index >= 0 && array_index < TEX_NUM_FLOAT_IMAGES_CPU) { + if(array_index >= 0 && array_index < TEX_NUM_FLOAT_CPU) { tex = &kg->texture_float_images[array_index]; } @@ -125,9 +125,9 @@ void kernel_tex_copy(KernelGlobals *kg, else if(strstr(name, "__tex_image_byte4")) { texture_image_uchar4 *tex = NULL; int id = atoi(name + strlen("__tex_image_byte4_")); - int array_index = id - TEX_IMAGE_BYTE4_START_CPU; + int array_index = id - TEX_START_BYTE4_CPU; - if(array_index >= 0 && array_index < TEX_NUM_BYTE4_IMAGES_CPU) { + if(array_index >= 0 && array_index < TEX_NUM_BYTE4_CPU) { tex = &kg->texture_byte4_images[array_index]; } @@ -141,9 +141,9 @@ void kernel_tex_copy(KernelGlobals *kg, else if(strstr(name, "__tex_image_byte")) { texture_image_uchar *tex = NULL; int id = atoi(name + strlen("__tex_image_byte_")); - int array_index = id - TEX_IMAGE_BYTE_START_CPU; + int array_index = id - TEX_START_BYTE_CPU; - if(array_index >= 0 && array_index < TEX_NUM_BYTE_IMAGES_CPU) { + if(array_index >= 0 && array_index < TEX_NUM_BYTE_CPU) { tex = &kg->texture_byte_images[array_index]; } @@ -154,6 +154,38 @@ void kernel_tex_copy(KernelGlobals *kg, tex->extension = extension; } } + else if(strstr(name, "__tex_image_half4")) { + texture_image_half4 *tex = NULL; + int id = atoi(name + strlen("__tex_image_half4_")); + int array_index = id - TEX_START_HALF4_CPU; + + if(array_index >= 0 && array_index < TEX_NUM_HALF4_CPU) { + tex = &kg->texture_half4_images[array_index]; + } + + if(tex) { + tex->data = (half4*)mem; + tex->dimensions_set(width, height, depth); + tex->interpolation = interpolation; + tex->extension = extension; + } + } + else if(strstr(name, "__tex_image_half")) { + texture_image_half *tex = NULL; + int id = atoi(name + strlen("__tex_image_half_")); + int array_index = id - TEX_START_HALF_CPU; + + if(array_index >= 0 && array_index < TEX_NUM_HALF_CPU) { + tex = &kg->texture_half_images[array_index]; + } + + if(tex) { + tex->data = (half*)mem; + tex->dimensions_set(width, height, depth); + tex->interpolation = interpolation; + tex->extension = extension; + } + } else assert(0); } diff --git a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h index 4807f96a0df..47383140170 100644 --- a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h +++ b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h @@ -23,24 +23,32 @@ CCL_NAMESPACE_BEGIN ccl_device float4 kernel_tex_image_interp_impl(KernelGlobals *kg, int tex, float x, float y) { - if(tex >= TEX_IMAGE_BYTE_START_CPU) - return kg->texture_byte_images[tex - TEX_IMAGE_BYTE_START_CPU].interp(x, y); - else if(tex >= TEX_IMAGE_FLOAT_START_CPU) - return kg->texture_float_images[tex - TEX_IMAGE_FLOAT_START_CPU].interp(x, y); - else if(tex >= TEX_IMAGE_BYTE4_START_CPU) - return kg->texture_byte4_images[tex - TEX_IMAGE_BYTE4_START_CPU].interp(x, y); + if(tex >= TEX_START_HALF_CPU) + return kg->texture_half_images[tex - TEX_START_HALF_CPU].interp(x, y); + else if(tex >= TEX_START_HALF4_CPU) + return kg->texture_half4_images[tex - TEX_START_HALF4_CPU].interp(x, y); + else if(tex >= TEX_START_BYTE_CPU) + return kg->texture_byte_images[tex - TEX_START_BYTE_CPU].interp(x, y); + else if(tex >= TEX_START_FLOAT_CPU) + return kg->texture_float_images[tex - TEX_START_FLOAT_CPU].interp(x, y); + else if(tex >= TEX_START_BYTE4_CPU) + return kg->texture_byte4_images[tex - TEX_START_BYTE4_CPU].interp(x, y); else return kg->texture_float4_images[tex].interp(x, y); } ccl_device float4 kernel_tex_image_interp_3d_impl(KernelGlobals *kg, int tex, float x, float y, float z) { - if(tex >= TEX_IMAGE_BYTE_START_CPU) - return kg->texture_byte_images[tex - TEX_IMAGE_BYTE_START_CPU].interp_3d(x, y, z); - else if(tex >= TEX_IMAGE_FLOAT_START_CPU) - return kg->texture_float_images[tex - TEX_IMAGE_FLOAT_START_CPU].interp_3d(x, y, z); - else if(tex >= TEX_IMAGE_BYTE4_START_CPU) - return kg->texture_byte4_images[tex - TEX_IMAGE_BYTE4_START_CPU].interp_3d(x, y, z); + if(tex >= TEX_START_HALF_CPU) + return kg->texture_half_images[tex - TEX_START_HALF_CPU].interp_3d(x, y, z); + else if(tex >= TEX_START_HALF4_CPU) + return kg->texture_half4_images[tex - TEX_START_HALF4_CPU].interp_3d(x, y, z); + else if(tex >= TEX_START_BYTE_CPU) + return kg->texture_byte_images[tex - TEX_START_BYTE_CPU].interp_3d(x, y, z); + else if(tex >= TEX_START_FLOAT_CPU) + return kg->texture_float_images[tex - TEX_START_FLOAT_CPU].interp_3d(x, y, z); + else if(tex >= TEX_START_BYTE4_CPU) + return kg->texture_byte4_images[tex - TEX_START_BYTE4_CPU].interp_3d(x, y, z); else return kg->texture_float4_images[tex].interp_3d(x, y, z); @@ -48,12 +56,16 @@ ccl_device float4 kernel_tex_image_interp_3d_impl(KernelGlobals *kg, int tex, fl ccl_device float4 kernel_tex_image_interp_3d_ex_impl(KernelGlobals *kg, int tex, float x, float y, float z, int interpolation) { - if(tex >= TEX_IMAGE_BYTE_START_CPU) - return kg->texture_byte_images[tex - TEX_IMAGE_BYTE_START_CPU].interp_3d_ex(x, y, z, interpolation); - else if(tex >= TEX_IMAGE_FLOAT_START_CPU) - return kg->texture_float_images[tex - TEX_IMAGE_FLOAT_START_CPU].interp_3d_ex(x, y, z, interpolation); - else if(tex >= TEX_IMAGE_BYTE4_START_CPU) - return kg->texture_byte4_images[tex - TEX_IMAGE_BYTE4_START_CPU].interp_3d_ex(x, y, z, interpolation); + if(tex >= TEX_START_HALF_CPU) + return kg->texture_half4_images[tex - TEX_START_HALF_CPU].interp_3d_ex(x, y, z, interpolation); + else if(tex >= TEX_START_HALF4_CPU) + return kg->texture_half_images[tex - TEX_START_HALF4_CPU].interp_3d_ex(x, y, z, interpolation); + else if(tex >= TEX_START_BYTE_CPU) + return kg->texture_byte_images[tex - TEX_START_BYTE_CPU].interp_3d_ex(x, y, z, interpolation); + else if(tex >= TEX_START_FLOAT_CPU) + return kg->texture_float_images[tex - TEX_START_FLOAT_CPU].interp_3d_ex(x, y, z, interpolation); + else if(tex >= TEX_START_BYTE4_CPU) + return kg->texture_byte4_images[tex - TEX_START_BYTE4_CPU].interp_3d_ex(x, y, z, interpolation); else return kg->texture_float4_images[tex].interp_3d_ex(x, y, z, interpolation); } diff --git a/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h b/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h index 962196ccbdd..ec82d4b4c22 100644 --- a/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h +++ b/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h @@ -109,6 +109,7 @@ void KERNEL_FUNCTION_FULL_NAME(shader)(KernelGlobals *kg, { if(type >= SHADER_EVAL_BAKE) { kernel_assert(output_luma == NULL); +#ifdef __BAKING__ kernel_bake_evaluate(kg, input, output, @@ -117,6 +118,7 @@ void KERNEL_FUNCTION_FULL_NAME(shader)(KernelGlobals *kg, i, offset, sample); +#endif } else { kernel_shader_evaluate(kg, diff --git a/intern/cycles/kernel/kernels/cuda/kernel.cu b/intern/cycles/kernel/kernels/cuda/kernel.cu index 37fae54faf0..eb2b6ea5414 100644 --- a/intern/cycles/kernel/kernels/cuda/kernel.cu +++ b/intern/cycles/kernel/kernels/cuda/kernel.cu @@ -77,8 +77,8 @@ # define CUDA_KERNEL_MAX_REGISTERS 63 # define CUDA_KERNEL_BRANCHED_MAX_REGISTERS 63 -/* 5.0, 5.2 and 5.3 */ -#elif __CUDA_ARCH__ == 500 || __CUDA_ARCH__ == 520 || __CUDA_ARCH__ == 530 +/* 5.0, 5.2, 5.3, 6.0, 6.1 */ +#elif __CUDA_ARCH__ >= 500 # define CUDA_MULTIPRESSOR_MAX_REGISTERS 65536 # define CUDA_MULTIPROCESSOR_MAX_BLOCKS 32 # define CUDA_BLOCK_MAX_THREADS 1024 @@ -86,7 +86,7 @@ /* tunable parameters */ # define CUDA_THREADS_BLOCK_WIDTH 16 -# define CUDA_KERNEL_MAX_REGISTERS 40 +# define CUDA_KERNEL_MAX_REGISTERS 48 # define CUDA_KERNEL_BRANCHED_MAX_REGISTERS 63 /* unknown architecture */ diff --git a/intern/cycles/kernel/kernels/opencl/kernel.cl b/intern/cycles/kernel/kernels/opencl/kernel.cl index aad06ed5c76..37907cd8fdc 100644 --- a/intern/cycles/kernel/kernels/opencl/kernel.cl +++ b/intern/cycles/kernel/kernels/opencl/kernel.cl @@ -35,6 +35,7 @@ # include "../../kernel_montecarlo.h" # include "../../kernel_projection.h" # include "../../geom/geom.h" +# include "../../bvh/bvh.h" # include "../../kernel_accumulate.h" # include "../../kernel_camera.h" |