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.
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user