diff options
author | Thomas Dinges <blender@dingto.org> | 2016-05-27 23:58:33 +0300 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2016-05-27 23:58:33 +0300 |
commit | 2ee063868dca9abb7f76be101539fde70a830b72 (patch) | |
tree | e2f299b0464b4f96779e429070e2b3f8ef168cf3 /intern/cycles/kernel | |
parent | bd678f179b3e9d8e551c6f827ba97ed1defe1de2 (diff) |
Cleanup: Shorten texture variables, tex and image was kinda redundant.
Also make prefix consistent, so it starts with either TEX_NUM or TEX_START, followed by texture type and architecture.
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/kernel_globals.h | 8 | ||||
-rw-r--r-- | intern/cycles/kernel/kernels/cpu/kernel.cpp | 14 | ||||
-rw-r--r-- | intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h | 36 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_image.h | 8 |
4 files changed, 33 insertions, 33 deletions
diff --git a/intern/cycles/kernel/kernel_globals.h b/intern/cycles/kernel/kernel_globals.h index 7e6cdf93fb9..e06c68f2fc9 100644 --- a/intern/cycles/kernel/kernel_globals.h +++ b/intern/cycles/kernel/kernel_globals.h @@ -35,10 +35,10 @@ struct Intersection; struct VolumeStep; typedef struct KernelGlobals { - texture_image_uchar4 texture_byte4_images[TEX_NUM_BYTE4_IMAGES_CPU]; - texture_image_float4 texture_float4_images[TEX_NUM_FLOAT4_IMAGES_CPU]; - texture_image_float texture_float_images[TEX_NUM_FLOAT_IMAGES_CPU]; - texture_image_uchar texture_byte_images[TEX_NUM_BYTE_IMAGES_CPU]; + texture_image_uchar4 texture_byte4_images[TEX_NUM_BYTE4_CPU]; + texture_image_float4 texture_float4_images[TEX_NUM_FLOAT4_CPU]; + texture_image_float texture_float_images[TEX_NUM_FLOAT_CPU]; + texture_image_uchar texture_byte_images[TEX_NUM_BYTE_CPU]; # define KERNEL_TEX(type, ttype, name) ttype name; # define KERNEL_IMAGE_TEX(type, ttype, name) diff --git a/intern/cycles/kernel/kernels/cpu/kernel.cpp b/intern/cycles/kernel/kernels/cpu/kernel.cpp index 365ce891354..d8a83f69685 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]; } diff --git a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h index 4807f96a0df..b10861ab857 100644 --- a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h +++ b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h @@ -23,24 +23,24 @@ 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_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_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 +48,12 @@ 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_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/svm/svm_image.h b/intern/cycles/kernel/svm/svm_image.h index 92d2b36bbb1..3d9ab405849 100644 --- a/intern/cycles/kernel/svm/svm_image.h +++ b/intern/cycles/kernel/svm/svm_image.h @@ -18,15 +18,15 @@ CCL_NAMESPACE_BEGIN /* Float4 textures on various devices. */ #if defined(__KERNEL_CPU__) -# define TEX_NUM_FLOAT4_IMAGES TEX_NUM_FLOAT4_IMAGES_CPU +# define TEX_NUM_FLOAT4_IMAGES TEX_NUM_FLOAT4_CPU #elif defined(__KERNEL_CUDA__) # if __CUDA_ARCH__ < 300 -# define TEX_NUM_FLOAT4_IMAGES TEX_NUM_FLOAT4_IMAGES_CUDA +# define TEX_NUM_FLOAT4_IMAGES TEX_NUM_FLOAT4_CUDA # else -# define TEX_NUM_FLOAT4_IMAGES TEX_NUM_FLOAT4_IMAGES_CUDA_KEPLER +# define TEX_NUM_FLOAT4_IMAGES TEX_NUM_FLOAT4_CUDA_KEPLER # endif #else -# define TEX_NUM_FLOAT4_IMAGES TEX_NUM_FLOAT4_IMAGES_OPENCL +# define TEX_NUM_FLOAT4_IMAGES TEX_NUM_FLOAT4_OPENCL #endif #ifdef __KERNEL_OPENCL__ |