[Bf-blender-cvs] [f32fad9] cycles_kernel_split: [CYCLES] Resolve data-flow violation
varunsundar08
noreply at git.blender.org
Mon Apr 6 14:15:34 CEST 2015
Commit: f32fad99c4e4a9cdca6cda5783622716e29316a5
Author: varunsundar08
Date: Mon Apr 6 16:59:58 2015 +0530
Branches: cycles_kernel_split
https://developer.blender.org/rBf32fad99c4e4a9cdca6cda5783622716e29316a5
[CYCLES] Resolve data-flow violation
Don't pre-pone device_update() for all devices. Instead just postpone
load_kernels for SplitKernel-running-devices only.
===================================================================
M intern/cycles/device/device.h
M intern/cycles/device/device_opencl.cpp
M intern/cycles/render/session.cpp
===================================================================
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 0fdd11f..65af602 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -81,7 +81,7 @@ struct DeviceDrawParams {
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), info(info_), stats(stats_) { use_split_kernel = false; }
bool background;
string error_msg;
@@ -100,6 +100,9 @@ public:
/* Maximum closure count */
int clos_max;
+ /* Denotes if the device is going to run cycles using split-kernel */
+ bool use_split_kernel;
+
/* Get all closure nodes associated with the scene */
set<int> closure_nodes;
diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index e68c0db..6f2c609 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -57,7 +57,7 @@ CCL_NAMESPACE_BEGIN
* Since some bytes may be needed for aligning chunks of memory;
* This is the amount of memory that we dedicate for that purpose.
*/
-#define DATA_ALLOCATION_MEM_FACTOR 5000000; //5MB
+#define DATA_ALLOCATION_MEM_FACTOR 5000000 //5MB
/* Additional kernel build options regarding optimization */
string opt;
@@ -673,6 +673,8 @@ public:
device_initialized = false;
#ifdef __SPLIT_KERNEL__
+ use_split_kernel = true;
+
/* Initialize kernels */
ckPathTraceKernel_DataInit_SPLIT_KERNEL = NULL;
ckPathTraceKernel_SceneIntersect_SPLIT_KERNEL = NULL;
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index 335e970..68ba9e5 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -558,6 +558,11 @@ void Session::run_cpu()
/* update status and timing */
update_status_time();
+ if (device->use_split_kernel) {
+ /* OpenCL split - load kernels */
+ load_kernels();
+ }
+
/* path trace */
path_trace();
@@ -656,11 +661,14 @@ void Session::run()
device->clos_max = getClosureCount(scene);
#endif
- /* Need to update scene before we load kernels in order to get associated closures */
- update_scene();
-
/* load kernels */
- load_kernels();
+ /* Note : OpenCL split kernel does not load kernels here. OpenCL split kernel needs to know
+ * closures that will be used in rendering, which is not known at this point; Hence we
+ * defer OpenCL split kernel load_kernels() to after device_update
+ */
+ if (!device->use_split_kernel) {
+ load_kernels();
+ }
/* session thread loop */
progress.set_status("Waiting for render to start");
More information about the Bf-blender-cvs
mailing list