Cycles: Cleanup, indentaiton and trailing whitespace and wrapping

This commit is contained in:
Sergey Sharybin 2017-04-28 13:21:17 +02:00
parent a85f457195
commit 4245ed360e
5 changed files with 20 additions and 15 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -120,7 +120,7 @@ public:
std::vector<device_vector<float>* > tex_float_image;
std::vector<device_vector<uchar>* > tex_byte_image;
std::vector<device_vector<half>* > tex_half_image;
/* opencl images */
device_vector<float4> tex_image_float4_packed;
device_vector<uchar4> tex_image_byte4_packed;

View File

@ -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
};