Commit: fdd45788bf1400d7ce18d2d9101a6f4201dd5079
Author: Thomas Dinges
Date:   Wed May 18 16:11:56 2016 +0200
Branches: soc-2016-cycles_images
https://developer.blender.org/rBfdd45788bf1400d7ce18d2d9101a6f4201dd5079

Fix some review comments (Variable naming and spacing).

===================================================================

M       intern/cycles/device/device.h
M       intern/cycles/device/device_cuda.cpp
M       intern/cycles/device/device_multi.cpp
M       intern/cycles/render/image.cpp

===================================================================

diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 181abba..7d48692 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -54,7 +54,7 @@ public:
        bool display_device;
        bool advanced_shading;
        bool pack_images;
-       bool bindless_textures; /* flag for GPU and Multi device */
+       bool has_bindless_textures; /* flag for GPU and Multi device */
        bool use_split_kernel; /* Denotes if the device is going to run cycles 
using split-kernel */
        vector<DeviceInfo> multi_devices;
 
@@ -66,7 +66,7 @@ public:
                display_device = false;
                advanced_shading = true;
                pack_images = false;
-               bindless_textures = false;
+               has_bindless_textures = false;
                use_split_kernel = false;
        }
 };
diff --git a/intern/cycles/device/device_cuda.cpp 
b/intern/cycles/device/device_cuda.cpp
index 79f0b84..9cbdde2 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -473,7 +473,9 @@ public:
        {
                VLOG(1) << "Texture allocate: " << name << ", " << 
mem.memory_size() << " bytes.";
 
-               bool is_kepler_card = info.bindless_textures;
+               /* Check if we are on sm_30 or above.
+                * We use arrays and bindles textures for storage there */
+               bool has_bindless_textures = info.has_bindless_textures;
 
                /* General variables for both architectures */
                string bind_name = name;
@@ -516,7 +518,7 @@ public:
                /* General variables for Fermi */
                CUtexref texref = NULL;
 
-               if(!is_kepler_card) {
+               if(!has_bindless_textures) {
                        if(mem.data_depth > 1) {
                                /* Kernel uses different bind names for 2d and 
3d float textures,
                                 * so we have to adjust couple of things here.
@@ -524,8 +526,8 @@ public:
                                vector<string> tokens;
                                string_split(tokens, name, "_");
                                bind_name = 
string_printf("__tex_image_%s_3d_%s",
-                                                                               
  tokens[2].c_str(),
-                                                                               
  tokens[3].c_str());
+                                                         tokens[2].c_str(),
+                                                         tokens[3].c_str());
                        }
 
                        cuda_push_context();
@@ -539,7 +541,7 @@ public:
 
                /* Data Storage */
                if(interpolation == INTERPOLATION_NONE) {
-                       if(is_kepler_card) {
+                       if(has_bindless_textures) {
                                mem_alloc(mem, MEM_READ_ONLY);
                                mem_copy_to(mem);
 
@@ -642,7 +644,7 @@ public:
                                cuda_assert(cuMemcpyHtoA(handle, 0, 
(void*)mem.data_pointer, size));
 
                        /* Bindless Textures - Kepler */
-                       if(is_kepler_card) {
+                       if(has_bindless_textures) {
                                CUDA_RESOURCE_DESC resDesc;
                                memset(&resDesc, 0, sizeof(resDesc));
                                resDesc.resType = CU_RESOURCE_TYPE_ARRAY;
@@ -676,7 +678,7 @@ public:
                }
 
                /* Fermi, Data and Image Textures */
-               if(!is_kepler_card) {
+               if(!has_bindless_textures) {
                        cuda_assert(cuTexRefSetAddressMode(texref, 0, 
address_mode));
                        cuda_assert(cuTexRefSetAddressMode(texref, 1, 
address_mode));
                        if(mem.data_depth > 1) {
@@ -1299,7 +1301,7 @@ void device_cuda_info(vector<DeviceInfo>& devices)
                info.num = num;
 
                info.advanced_shading = (major >= 2);
-               info.bindless_textures = (major >= 3);
+               info.has_bindless_textures = (major >= 3);
                info.pack_images = false;
 
                /* if device has a kernel timeout, assume it is used for 
display */
diff --git a/intern/cycles/device/device_multi.cpp 
b/intern/cycles/device/device_multi.cpp
index ae857ab..f41c65d 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -353,7 +353,7 @@ static bool device_multi_add(vector<DeviceInfo>& devices, 
DeviceType type, bool
 
        info.advanced_shading = with_advanced_shading;
        info.pack_images = false;
-       info.bindless_textures = true;
+       info.has_bindless_textures = true;
 
        foreach(DeviceInfo& subinfo, devices) {
                if(subinfo.type == type) {
@@ -377,7 +377,7 @@ static bool device_multi_add(vector<DeviceInfo>& devices, 
DeviceType type, bool
                        if(subinfo.display_device)
                                info.display_device = true;
                        info.pack_images = info.pack_images || 
subinfo.pack_images;
-                       info.bindless_textures = info.bindless_textures && 
subinfo.bindless_textures;
+                       info.has_bindless_textures = info.has_bindless_textures 
&& subinfo.has_bindless_textures;
                        num_added++;
                }
        }
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index 9ac493c..135b411 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -49,7 +49,7 @@ ImageManager::ImageManager(const DeviceInfo& info)
                tex_image_byte_start = TEX_IMAGE_BYTE_START_CPU;
        }
        /* CUDA (Fermi) */
-       else if((info.type == DEVICE_CUDA || info.type == DEVICE_MULTI) && 
!info.bindless_textures) {
+       else if((info.type == DEVICE_CUDA || info.type == DEVICE_MULTI) && 
!info.has_bindless_textures) {
                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;
@@ -59,7 +59,7 @@ ImageManager::ImageManager(const DeviceInfo& info)
                tex_image_byte_start = TEX_IMAGE_BYTE_START_CUDA;
        }
        /* CUDA (Kepler and above) */
-       else if((info.type == DEVICE_CUDA || info.type == DEVICE_MULTI) && 
info.bindless_textures) {
+       else if((info.type == DEVICE_CUDA || info.type == DEVICE_MULTI) && 
info.has_bindless_textures) {
                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;
@@ -873,7 +873,7 @@ void ImageManager::device_load_image(Device *device, 
DeviceScene *dscene, ImageD
        }
 
        /* Save mapping for Bindless Texture IDs */
-       if(device->info.bindless_textures) {
+       if(device->info.has_bindless_textures) {
                dscene->data.bindless_mapping[flat_slot] = bindless_slot;
        }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to