Cycles: Make all #include statements relative to cycles source directory
[blender.git] / intern / cycles / device / device_network.cpp
index 8f00324c3e17eab19275acd3cd0d24948ce44627..66758954f44b4c55783241819482593ec98d2b70 100644 (file)
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
- * limitations under the License
+ * limitations under the License.
  */
 
-#include "device.h"
-#include "device_intern.h"
-#include "device_network.h"
+#include "device/device.h"
+#include "device/device_intern.h"
+#include "device/device_network.h"
 
-#include "util_foreach.h"
+#include "util/util_foreach.h"
+#include "util/util_logging.h"
 
 #if defined(WITH_NETWORK)
 
@@ -50,6 +51,11 @@ public:
 
        thread_mutex rpc_lock;
 
+       virtual bool show_samples() const
+       {
+               return false;
+       }
+
        NetworkDevice(DeviceInfo& info, Stats &stats, const char *address)
        : Device(info, stats, true), socket(io_service)
        {
@@ -81,8 +87,14 @@ public:
                snd.write();
        }
 
-       void mem_alloc(device_memory& mem, MemoryType type)
+       void mem_alloc(const char *name, device_memory& mem, MemoryType type)
        {
+               if(name) {
+                       VLOG(1) << "Buffer allocate: " << name << ", "
+                                   << string_human_readable_number(mem.memory_size()) << " bytes. ("
+                                   << string_human_readable_size(mem.memory_size()) << ")";
+               }
+
                thread_scoped_lock lock(rpc_lock);
 
                mem.device_pointer = ++mem_counter;
@@ -162,8 +174,15 @@ public:
                snd.write_buffer(host, size);
        }
 
-       void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic)
+       void tex_alloc(const char *name,
+                      device_memory& mem,
+                      InterpolationType interpolation,
+                      ExtensionType extension)
        {
+               VLOG(1) << "Texture allocate: " << name << ", "
+                       << string_human_readable_number(mem.memory_size()) << " bytes. ("
+                       << string_human_readable_size(mem.memory_size()) << ")";
+
                thread_scoped_lock lock(rpc_lock);
 
                mem.device_pointer = ++mem_counter;
@@ -175,7 +194,7 @@ public:
                snd.add(name_string);
                snd.add(mem);
                snd.add(interpolation);
-               snd.add(periodic);
+               snd.add(extension);
                snd.write();
                snd.write_buffer((void*)mem.data_pointer, mem.memory_size());
        }
@@ -194,7 +213,7 @@ public:
                }
        }
 
-       bool load_kernels(bool experimental)
+       bool load_kernels(const DeviceRequestedFeatures& requested_features)
        {
                if(error_func.have_error())
                        return false;
@@ -202,7 +221,10 @@ public:
                thread_scoped_lock lock(rpc_lock);
 
                RPCSend snd(socket, &error_func, "load_kernels");
-               snd.add(experimental);
+               snd.add(requested_features.experimental);
+               snd.add(requested_features.max_closure);
+               snd.add(requested_features.max_nodes_group);
+               snd.add(requested_features.nodes_features);
                snd.write();
 
                bool result;
@@ -269,7 +291,7 @@ public:
                                lock.unlock();
 
                                TileList::iterator it = tile_list_find(the_tiles, tile);
-                               if (it != the_tiles.end()) {
+                               if(it != the_tiles.end()) {
                                        tile.buffers = it->buffers;
                                        the_tiles.erase(it);
                                }
@@ -299,6 +321,11 @@ public:
                snd.write();
        }
 
+       int get_split_task_count(DeviceTask& task)
+       {
+               return 1;
+       }
+
 private:
        NetworkError error_func;
 };
@@ -326,7 +353,7 @@ class DeviceServer {
 public:
        thread_mutex rpc_lock;
 
-       void network_error(const string &message){
+       void network_error(const string &message) {
                error_func.network_error(message);
        }
 
@@ -366,7 +393,7 @@ protected:
        {
                /* create a new DataVector and insert it into mem_data */
                pair<DataMap::iterator,bool> data_ins = mem_data.insert(
-                               DataMap::value_type(client_pointer, DataVector()));
+                       DataMap::value_type(client_pointer, DataVector()));
 
                /* make sure it was a unique insertion */
                assert(data_ins.second);
@@ -460,7 +487,7 @@ protected:
                                mem.data_pointer = 0;
 
                        /* perform the allocation on the actual device */
-                       device->mem_alloc(mem, type);
+                       device->mem_alloc(NULL, mem, type);
 
                        /* store a mapping to/from client_pointer and real device pointer */
                        pointer_mapping_insert(client_pointer, mem.device_pointer);
@@ -560,13 +587,13 @@ protected:
                        network_device_memory mem;
                        string name;
                        InterpolationType interpolation;
-                       bool periodic;
+                       ExtensionType extension_type;
                        device_ptr client_pointer;
 
                        rcv.read(name);
                        rcv.read(mem);
                        rcv.read(interpolation);
-                       rcv.read(periodic);
+                       rcv.read(extension_type);
                        lock.unlock();
 
                        client_pointer = mem.device_pointer;
@@ -582,7 +609,7 @@ protected:
 
                        rcv.read_buffer((uint8_t*)mem.data_pointer, data_size);
 
-                       device->tex_alloc(name.c_str(), mem, interpolation, periodic);
+                       device->tex_alloc(name.c_str(), mem, interpolation, extension_type);
 
                        pointer_mapping_insert(client_pointer, mem.device_pointer);
                }
@@ -600,11 +627,14 @@ protected:
                        device->tex_free(mem);
                }
                else if(rcv.name == "load_kernels") {
-                       bool experimental;
-                       rcv.read(experimental);
+                       DeviceRequestedFeatures requested_features;
+                       rcv.read(requested_features.experimental);
+                       rcv.read(requested_features.max_closure);
+                       rcv.read(requested_features.max_nodes_group);
+                       rcv.read(requested_features.nodes_features);
 
                        bool result;
-                       result = device->load_kernels(experimental);
+                       result = device->load_kernels(requested_features);
                        RPCSend snd(socket, &error_func, "load_kernels");
                        snd.add(result);
                        snd.write();
@@ -631,6 +661,9 @@ protected:
                        if(task.shader_output)
                                task.shader_output = device_ptr_from_client_pointer(task.shader_output);
 
+                       if(task.shader_output_luma)
+                               task.shader_output_luma = device_ptr_from_client_pointer(task.shader_output_luma);
+
 
                        task.acquire_tile = function_bind(&DeviceServer::task_acquire_tile, this, _1, _2);
                        task.release_tile = function_bind(&DeviceServer::task_release_tile, this, _1);