[Bf-blender-cvs] [bb5c227] soc-2016-cycles_images: Avoid passing flat_slot to tex_alloc() as well.

Thomas Dinges noreply at git.blender.org
Thu May 19 12:22:07 CEST 2016


Commit: bb5c227666dce55b004fbe6e97be276412865f84
Author: Thomas Dinges
Date:   Thu May 19 12:21:52 2016 +0200
Branches: soc-2016-cycles_images
https://developer.blender.org/rBbb5c227666dce55b004fbe6e97be276412865f84

Avoid passing flat_slot to tex_alloc() as well.

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

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

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

diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 2bfcf67..e11bb7f 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -225,12 +225,10 @@ public:
 	virtual void tex_alloc(const char * /*name*/,
 	                       device_memory& /*mem*/,
 	                       InterpolationType interpolation = INTERPOLATION_NONE,
-	                       ExtensionType extension = EXTENSION_REPEAT,
-	                       int flat_slot = 0)
+	                       ExtensionType extension = EXTENSION_REPEAT)
 	{
 		(void)interpolation;  /* Ignored. */
 		(void)extension;  /* Ignored. */
-		(void)flat_slot; /* Ignored. */
 	};
 
 	virtual void tex_free(device_memory& /*mem*/) {};
diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index 3071c52..26f8439 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -153,8 +153,7 @@ public:
 	void tex_alloc(const char *name,
 	               device_memory& mem,
 	               InterpolationType interpolation,
-	               ExtensionType extension,
-	               int /*flat_slot*/)
+	               ExtensionType extension)
 	{
 		VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
 		kernel_tex_copy(&kernel_globals,
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 741dcd5..4feb510 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -407,7 +407,7 @@ public:
 	{
 		if(info.has_bindless_textures && sync_bindless_mapping) {
 			tex_free(bindless_mapping);
-			tex_alloc("__bindless_mapping", bindless_mapping, INTERPOLATION_NONE, EXTENSION_REPEAT, 0);
+			tex_alloc("__bindless_mapping", bindless_mapping, INTERPOLATION_NONE, EXTENSION_REPEAT);
 			sync_bindless_mapping = false;
 		}
 	}
@@ -487,8 +487,7 @@ public:
 	void tex_alloc(const char *name,
 	               device_memory& mem,
 	               InterpolationType interpolation,
-	               ExtensionType extension,
-	               int flat_slot)
+	               ExtensionType extension)
 	{
 		VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
 
@@ -670,6 +669,15 @@ public:
 
 			/* Bindless Textures - Kepler */
 			if(has_bindless_textures) {
+				int flat_slot = 0;
+				if(string_startswith(name, "__tex_image")) {
+					int pos =  string(name).rfind("_");
+					flat_slot = atoi(name + pos + 1);
+				}
+				else {
+					assert(0);
+				}
+
 				CUDA_RESOURCE_DESC resDesc;
 				memset(&resDesc, 0, sizeof(resDesc));
 				resDesc.resType = CU_RESOURCE_TYPE_ARRAY;
diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp
index 34a97db..434d008 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -173,14 +173,13 @@ public:
 	               device_memory& mem,
 	               InterpolationType
 	               interpolation,
-	               ExtensionType extension,
-	               int flat_slot)
+	               ExtensionType extension)
 	{
 		VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
 
 		foreach(SubDevice& sub, devices) {
 			mem.device_pointer = 0;
-			sub.device->tex_alloc(name, mem, interpolation, extension, flat_slot);
+			sub.device->tex_alloc(name, mem, interpolation, extension);
 			sub.ptr_map[unique_ptr] = mem.device_pointer;
 		}
 
diff --git a/intern/cycles/device/device_network.cpp b/intern/cycles/device/device_network.cpp
index 449f543..cf4a05d 100644
--- a/intern/cycles/device/device_network.cpp
+++ b/intern/cycles/device/device_network.cpp
@@ -166,8 +166,7 @@ public:
 	void tex_alloc(const char *name,
 	               device_memory& mem,
 	               InterpolationType interpolation,
-	               ExtensionType extension,
-	               int flat_slot)
+	               ExtensionType extension)
 	{
 		VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
 
@@ -183,7 +182,6 @@ public:
 		snd.add(mem);
 		snd.add(interpolation);
 		snd.add(extension);
-		snd.add(flat_slot);
 		snd.write();
 		snd.write_buffer((void*)mem.data_pointer, mem.memory_size());
 	}
@@ -583,7 +581,6 @@ protected:
 			rcv.read(mem);
 			rcv.read(interpolation);
 			rcv.read(extension_type);
-			rcv.read(flat_slot);
 			lock.unlock();
 
 			client_pointer = mem.device_pointer;
@@ -599,7 +596,7 @@ protected:
 
 			rcv.read_buffer((uint8_t*)mem.data_pointer, data_size);
 
-			device->tex_alloc(name.c_str(), mem, interpolation, extension_type, flat_slot);
+			device->tex_alloc(name.c_str(), mem, interpolation, extension_type);
 
 			pointer_mapping_insert(client_pointer, mem.device_pointer);
 		}
diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index 61f83f2..1b4e542 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -1185,8 +1185,7 @@ public:
 	void tex_alloc(const char *name,
 	               device_memory& mem,
 	               InterpolationType /*interpolation*/,
-	               ExtensionType /*extension*/,
-	               int /*flat_slot*/)
+	               ExtensionType /*extension*/)
 	{
 		VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
 		mem_alloc(mem, MEM_READ_ONLY);
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index d8fb5ba..dcf9181 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -789,8 +789,7 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, ImageD
 			device->tex_alloc(name.c_str(),
 			                  tex_img,
 			                  img->interpolation,
-			                  img->extension,
-			                  flat_slot);
+			                  img->extension);
 		}
 	}
 	else if(type == IMAGE_DATA_TYPE_FLOAT) {
@@ -813,8 +812,7 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, ImageD
 			device->tex_alloc(name.c_str(),
 			                  tex_img,
 			                  img->interpolation,
-			                  img->extension,
-			                  flat_slot);
+			                  img->extension);
 		}
 	}
 	else if(type == IMAGE_DATA_TYPE_BYTE4) {
@@ -840,8 +838,7 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, ImageD
 			device->tex_alloc(name.c_str(),
 			                  tex_img,
 			                  img->interpolation,
-			                  img->extension,
-			                  flat_slot);
+			                  img->extension);
 		}
 	}
 	else {
@@ -864,8 +861,7 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, ImageD
 			device->tex_alloc(name.c_str(),
 			                  tex_img,
 			                  img->interpolation,
-			                  img->extension,
-			                  flat_slot);
+			                  img->extension);
 		}
 	}




More information about the Bf-blender-cvs mailing list