[Bf-blender-cvs] [2ee0638] master: Cleanup: Shorten texture variables, tex and image was kinda redundant.
Thomas Dinges
noreply at git.blender.org
Fri May 27 22:59:47 CEST 2016
Commit: 2ee063868dca9abb7f76be101539fde70a830b72
Author: Thomas Dinges
Date: Fri May 27 22:58:33 2016 +0200
Branches: master
https://developer.blender.org/rB2ee063868dca9abb7f76be101539fde70a830b72
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.
===================================================================
M intern/cycles/kernel/kernel_globals.h
M intern/cycles/kernel/kernels/cpu/kernel.cpp
M intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h
M intern/cycles/kernel/svm/svm_image.h
M intern/cycles/render/image.cpp
M intern/cycles/render/scene.h
M intern/cycles/util/util_texture.h
===================================================================
diff --git a/intern/cycles/kernel/kernel_globals.h b/intern/cycles/kernel/kernel_globals.h
index 7e6cdf9..e06c68f 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 365ce89..d8a83f6 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 4807f96..b10861a 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 92d2b36..3d9ab40 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__
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index a3d2d23..2bef90d 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -51,46 +51,46 @@ ImageManager::ImageManager(const DeviceInfo& info)
/* CPU */
if(device_type == DEVICE_CPU) {
- tex_num_images[IMAGE_DATA_TYPE_BYTE4] = TEX_NUM_BYTE4_IMAGES_CPU;
- tex_num_images[IMAGE_DATA_TYPE_FLOAT4] = TEX_NUM_FLOAT4_IMAGES_CPU;
- tex_num_images[IMAGE_DATA_TYPE_FLOAT] = TEX_NUM_FLOAT_IMAGES_CPU;
- tex_num_images[IMAGE_DATA_TYPE_BYTE] = TEX_NUM_BYTE_IMAGES_CPU;
- tex_image_byte4_start = TEX_IMAGE_BYTE4_START_CPU;
- tex_image_float_start = TEX_IMAGE_FLOAT_START_CPU;
- tex_image_byte_start = TEX_IMAGE_BYTE_START_CPU;
+ tex_num_images[IMAGE_DATA_TYPE_BYTE4] = TEX_NUM_BYTE4_CPU;
+ tex_num_images[IMAGE_DATA_TYPE_FLOAT4] = TEX_NUM_FLOAT4_CPU;
+ tex_num_images[IMAGE_DATA_TYPE_FLOAT] = TEX_NUM_FLOAT_CPU;
+ tex_num_images[IMAGE_DATA_TYPE_BYTE] = TEX_NUM_BYTE_CPU;
+ tex_image_byte4_start = TEX_START_BYTE4_CPU;
+ tex_image_float_start = TEX_START_FLOAT_CPU;
+ tex_image_byte_start = TEX_START_BYTE_CPU;
}
/* CUDA */
else if(device_type == DEVICE_CUDA) {
if(info.has_bindless_textures) {
/* Kepler and above */
- tex_num_images[IMAGE_DATA_TYPE_BYTE4] = TEX_NUM_BYTE4_IMAGES_CUDA_KEPLER;
- tex_num_images[IMAGE_DATA_TYPE_FLOAT4] = TEX_NUM_FLOAT4_IMAGES_CUDA_KEPLER;
- tex_num_images[IMAGE_DATA_TYPE_FLOAT] = TEX_NUM_FLOAT_IMAGES_CUDA_KEPLER;
- tex_num_images[IMAGE_DATA_TYPE_BYTE] = TEX_NUM_BYTE_IMAGES_CUDA_KEPLER;
- tex_image_byte4_start = TEX_IMAGE_BYTE4_START_CUDA_KEPLER;
- tex_image_float_start = TEX_IMAGE_FLOAT_START_CUDA_KEPLER;
- tex_image_byte_start = TEX_IMAGE_BYTE_START_CUDA_KEPLER;
+ tex_num_images[IMAGE_DATA_TYPE_BYTE4] = TEX_NUM_BYTE4_CUDA_KEPLER;
+ tex_num_images[IMAGE_DATA_TYPE_FLOAT4] = TEX_NUM_FLOAT4_CUDA_KEPLER;
+ tex_num_images[IMAGE_DATA_TYPE_FLOAT] = TEX_NUM_FLOAT_CUDA_KEPLER;
+ tex_num_images[IMAGE_DATA_TYPE_BYTE] = TEX_NUM_BYTE_CUDA_KEPLER;
+ tex_image_byte4_start = TEX_START_BYTE4_CUDA_KEPLER;
+ tex_image_float_start = TEX_START_FLOAT_CUDA_KEPLER;
+ tex_image_byte_start = TEX_START_BYTE_CUDA_KEPLER;
}
else {
/* Fermi */
- tex_num_images[IMAGE_DATA_TYPE_BYTE4] = TEX_NUM_BYTE4_IMAGES_CUDA;
- tex_num_images[IMAGE_DATA_TYPE_FLOAT4] = TEX_NUM_FLOAT4_IMAGES_CUDA;
- tex_num_images[IMAGE_DATA_TYPE_FLOAT] = TEX_NUM_FLOAT_IMAGES_CUDA;
- tex_num_images[IMAGE_DATA_TYPE_BYTE] = TEX_NUM_BYTE_IMAGES_CUDA;
- tex_image_byte4_start = TEX_IMAGE_BYTE4_START_CUDA;
- tex_image_float_start = TEX_IMAGE_FLOAT_START_CUDA;
- tex_image_byte_start = TEX_IMAGE_BYTE_START_CUDA;
+ tex_num_images[IMAGE_DATA_TYPE_BYTE4] = TEX_NUM_BYTE4_CUDA;
+ tex_num_images[IMAGE_DATA_TYPE_FLOAT4] = TEX_NUM_FLOAT4_CUDA;
+ tex_num_images[IMAGE_DATA_TYPE_FLOAT] = TEX_NUM_FLOAT_CUDA;
+ tex_num_images[IMAGE_DATA_TYPE_BYTE] = TEX_NUM_BYTE_CUDA;
+ tex_image_byte4_start = TEX_START_BYTE4_CUDA;
+ tex_image_float_start = TEX_START_FLOAT_CUDA;
+ tex_image_byte_start = TEX_START_BYTE_CUDA;
}
}
/* OpenC
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list