diff --git a/intern/cycles/kernel/kernels/cpu/kernel.cpp b/intern/cycles/kernel/kernels/cpu/kernel.cpp index db2de6836d3..998619ac897 100644 --- a/intern/cycles/kernel/kernels/cpu/kernel.cpp +++ b/intern/cycles/kernel/kernels/cpu/kernel.cpp @@ -115,7 +115,7 @@ void kernel_tex_copy(KernelGlobals *kg, texture_image_float *tex = NULL; int id = atoi(name + strlen("__tex_image_float_")); int array_index = kernel_tex_index(id); - + if(array_index >= 0) { if(array_index >= kg->texture_float_images.size()) { kg->texture_float_images.resize(array_index+1); @@ -134,7 +134,7 @@ void kernel_tex_copy(KernelGlobals *kg, texture_image_uchar4 *tex = NULL; int id = atoi(name + strlen("__tex_image_byte4_")); int array_index = kernel_tex_index(id); - + if(array_index >= 0) { if(array_index >= kg->texture_byte4_images.size()) { kg->texture_byte4_images.resize(array_index+1); @@ -153,7 +153,7 @@ void kernel_tex_copy(KernelGlobals *kg, texture_image_uchar *tex = NULL; int id = atoi(name + strlen("__tex_image_byte_")); int array_index = kernel_tex_index(id); - + if(array_index >= 0) { if(array_index >= kg->texture_byte_images.size()) { kg->texture_byte_images.resize(array_index+1); @@ -172,7 +172,7 @@ void kernel_tex_copy(KernelGlobals *kg, texture_image_half4 *tex = NULL; int id = atoi(name + strlen("__tex_image_half4_")); int array_index = kernel_tex_index(id); - + if(array_index >= 0) { if(array_index >= kg->texture_half4_images.size()) { kg->texture_half4_images.resize(array_index+1); @@ -191,7 +191,7 @@ void kernel_tex_copy(KernelGlobals *kg, texture_image_half *tex = NULL; int id = atoi(name + strlen("__tex_image_half_")); int array_index = kernel_tex_index(id); - + if(array_index >= 0) { if(array_index >= kg->texture_half_images.size()) { kg->texture_half_images.resize(array_index+1); diff --git a/intern/cycles/kernel/svm/svm_voxel.h b/intern/cycles/kernel/svm/svm_voxel.h index 1d97e8344bd..f4a5b2b2994 100644 --- a/intern/cycles/kernel/svm/svm_voxel.h +++ b/intern/cycles/kernel/svm/svm_voxel.h @@ -46,8 +46,13 @@ ccl_device void svm_node_tex_voxel(KernelGlobals *kg, # if defined(__KERNEL_CUDA__) # if __CUDA_ARCH__ >= 300 CUtexObject tex = kernel_tex_fetch(__bindless_mapping, id); - if(kernel_tex_type(id) == IMAGE_DATA_TYPE_FLOAT4 || kernel_tex_type(id) == IMAGE_DATA_TYPE_BYTE4 || kernel_tex_type(id) == IMAGE_DATA_TYPE_HALF4) + const int texture_type = kernel_tex_type(id); + if(texture_type == IMAGE_DATA_TYPE_FLOAT4 || + texture_type == IMAGE_DATA_TYPE_BYTE4 || + texture_type == IMAGE_DATA_TYPE_HALF4) + { r = kernel_tex_image_interp_3d_float4(tex, co.x, co.y, co.z); + } else { float f = kernel_tex_image_interp_3d_float(tex, co.x, co.y, co.z); r = make_float4(f, f, f, 1.0f); diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index 697b9f75658..cd5db841bda 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -52,7 +52,7 @@ ImageManager::ImageManager(const DeviceInfo& info) max_num_images = TEX_NUM_MAX; has_half_images = true; cuda_fermi_limits = false; - + if(device_type == DEVICE_CUDA) { if(!info.has_bindless_textures) { /* CUDA Fermi hardware (SM 2.x) has a hard limit on the number of textures */ @@ -63,7 +63,7 @@ ImageManager::ImageManager(const DeviceInfo& info) else if(device_type == DEVICE_OPENCL) { has_half_images = false; } - + for(size_t type = 0; type < IMAGE_DATA_NUM_TYPES; type++) { tex_num_images[type] = 0; } @@ -104,8 +104,8 @@ bool ImageManager::set_animation_frame_update(int frame) } ImageDataType ImageManager::get_image_metadata(const string& filename, - void *builtin_data, - bool& is_linear) + void *builtin_data, + bool& is_linear) { bool is_float = false, is_half = false; is_linear = false; @@ -354,7 +354,7 @@ int ImageManager::add_image(const string& filename, return -1; } } - + if(slot == images[type].size()) { images[type].resize(images[type].size() + 1); } @@ -372,7 +372,7 @@ int ImageManager::add_image(const string& filename, img->use_alpha = use_alpha; images[type][slot] = img; - + ++tex_num_images[type]; need_update = true; diff --git a/intern/cycles/render/scene.h b/intern/cycles/render/scene.h index b02f9f35393..09f239f09eb 100644 --- a/intern/cycles/render/scene.h +++ b/intern/cycles/render/scene.h @@ -120,7 +120,7 @@ public: std::vector* > tex_float_image; std::vector* > tex_byte_image; std::vector* > tex_half_image; - + /* opencl images */ device_vector tex_image_float4_packed; device_vector tex_image_byte4_packed; diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h index 296343ecfd3..aacf7c1bd8e 100644 --- a/intern/cycles/util/util_types.h +++ b/intern/cycles/util/util_types.h @@ -156,7 +156,7 @@ enum InterpolationType { /* Texture types * Since we store the type in the lower bits of a flat index, - * the shift and bit mask constant below need to be kept in sync. + * the shift and bit mask constant below need to be kept in sync. */ enum ImageDataType { @@ -166,7 +166,7 @@ enum ImageDataType { IMAGE_DATA_TYPE_FLOAT = 3, IMAGE_DATA_TYPE_BYTE = 4, IMAGE_DATA_TYPE_HALF = 5, - + IMAGE_DATA_NUM_TYPES };