diff options
Diffstat (limited to 'intern/cycles/device/device.h')
-rw-r--r-- | intern/cycles/device/device.h | 82 |
1 files changed, 71 insertions, 11 deletions
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index 7c17f7f4112..6b4a190bbf0 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -55,6 +55,7 @@ public: bool advanced_shading; bool pack_images; bool extended_images; /* 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; DeviceInfo() @@ -66,25 +67,76 @@ public: advanced_shading = true; pack_images = false; extended_images = false; + use_split_kernel = false; + } +}; + +class DeviceRequestedFeatures { +public: + /* Use experimental feature set. */ + bool experimental; + + /* Maximum number of closures in shader trees. */ + int max_closure; + + /* Selective nodes compilation. */ + + /* Identifier of a node group up to which all the nodes needs to be + * compiled in. Nodes from higher group indices will be ignores. + */ + int max_nodes_group; + + /* Features bitfield indicating which features from the requested group + * will be compiled in. Nodes which corresponds to features which are not + * in this bitfield will be ignored even if they're in the requested group. + */ + int nodes_features; + + /* BVH/sampling kernel features. */ + bool use_hair; + bool use_object_motion; + bool use_camera_motion; + + DeviceRequestedFeatures() + { + /* TODO(sergey): Find more meaningful defaults. */ + experimental = false; + max_closure = 0; + max_nodes_group = 0; + nodes_features = 0; + use_hair = false; + use_object_motion = false; + use_camera_motion = false; + } + + bool modified(const DeviceRequestedFeatures& requested_features) + { + return !(experimental == requested_features.experimental && + max_closure == requested_features.max_closure && + max_nodes_group == requested_features.max_nodes_group && + nodes_features == requested_features.nodes_features); } }; /* Device */ struct DeviceDrawParams { - boost::function<void(void)> bind_display_space_shader_cb; - boost::function<void(void)> unbind_display_space_shader_cb; + function<void(void)> bind_display_space_shader_cb; + function<void(void)> unbind_display_space_shader_cb; }; class Device { protected: - Device(DeviceInfo& info_, Stats &stats_, bool background) : background(background), info(info_), stats(stats_) {} + Device(DeviceInfo& info_, Stats &stats_, bool background) : background(background), vertex_buffer(0), info(info_), stats(stats_) {} bool background; string error_msg; + /* used for real time display */ + unsigned int vertex_buffer; + public: - virtual ~Device() {} + virtual ~Device(); /* info */ DeviceInfo info; @@ -106,9 +158,15 @@ public: virtual void const_copy_to(const char *name, void *host, size_t size) = 0; /* texture memory */ - virtual void tex_alloc(const char *name, device_memory& mem, - InterpolationType interpolation = INTERPOLATION_NONE, bool periodic = false) {}; - virtual void tex_free(device_memory& mem) {}; + virtual void tex_alloc(const char * /*name*/, + device_memory& /*mem*/, + InterpolationType interpolation = INTERPOLATION_NONE, + bool periodic = false) + { + (void)interpolation; /* Ignored. */ + (void)periodic; /* Ignored. */ + }; + virtual void tex_free(device_memory& /*mem*/) {}; /* pixel memory */ virtual void pixels_alloc(device_memory& mem); @@ -119,7 +177,9 @@ public: virtual void *osl_memory() { return NULL; } /* load/compile kernels, must be called before adding tasks */ - virtual bool load_kernels(bool experimental) { return true; } + virtual bool load_kernels( + const DeviceRequestedFeatures& /*requested_features*/) + { return true; } /* tasks */ virtual int get_split_task_count(DeviceTask& task) = 0; @@ -129,7 +189,7 @@ public: /* opengl drawing */ virtual void draw_pixels(device_memory& mem, int y, int w, int h, - int dy, int width, int height, bool transparent, + int dx, int dy, int width, int height, bool transparent, const DeviceDrawParams &draw_params); #ifdef WITH_NETWORK @@ -138,8 +198,8 @@ public: #endif /* multi device */ - virtual void map_tile(Device *sub_device, RenderTile& tile) {} - virtual int device_number(Device *sub_device) { return 0; } + virtual void map_tile(Device * /*sub_device*/, RenderTile& /*tile*/) {} + virtual int device_number(Device * /*sub_device*/) { return 0; } /* static */ static Device *create(DeviceInfo& info, Stats &stats, bool background = true); |