Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-01-09 18:38:04 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-01-09 18:42:03 +0300
commitb7fb3296c101bf408455352ec9784a8870672c81 (patch)
tree2e85e7b1b5e14be10eba9c11703d7cc7d9f2d407 /intern
parent1a6a80270dae82d5ce9bf1266476f7bf0fe1d714 (diff)
Fix T60300, T57774: Cycles OpenCL viewport crash with subsurface scattering.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/device/device_split_kernel.cpp45
-rw-r--r--intern/cycles/device/device_split_kernel.h7
2 files changed, 24 insertions, 28 deletions
diff --git a/intern/cycles/device/device_split_kernel.cpp b/intern/cycles/device/device_split_kernel.cpp
index efaae8c84f4..ab2c11e904d 100644
--- a/intern/cycles/device/device_split_kernel.cpp
+++ b/intern/cycles/device/device_split_kernel.cpp
@@ -32,10 +32,9 @@ DeviceSplitKernel::DeviceSplitKernel(Device *device)
ray_state(device, "ray_state", MEM_READ_WRITE),
queue_index(device, "queue_index"),
use_queues_flag(device, "use_queues_flag"),
- work_pool_wgs(device, "work_pool_wgs")
+ work_pool_wgs(device, "work_pool_wgs"),
+ kernel_data_initialized(false)
{
- first_tile = true;
-
avg_time_per_sample = 0.0;
kernel_path_init = NULL;
@@ -116,6 +115,9 @@ bool DeviceSplitKernel::load_kernels(const DeviceRequestedFeatures& requested_fe
#undef LOAD_KERNEL
+ /* Re-initialiaze kernel-dependent data when kernels change. */
+ kernel_data_initialized = false;
+
return true;
}
@@ -137,33 +139,25 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task,
return false;
}
- /* Get local size */
- size_t local_size[2];
- {
+ /* Allocate all required global memory once. */
+ if(!kernel_data_initialized) {
+ kernel_data_initialized = true;
+
+ /* Set local size */
int2 lsize = split_kernel_local_size();
local_size[0] = lsize[0];
local_size[1] = lsize[1];
- }
-
- /* Number of elements in the global state buffer */
- int num_global_elements = global_size[0] * global_size[1];
- /* Allocate all required global memory once. */
- if(first_tile) {
- first_tile = false;
-
- /* Set gloabl size */
- {
- int2 gsize = split_kernel_global_size(kgbuffer, kernel_data, task);
+ /* Set global size */
+ int2 gsize = split_kernel_global_size(kgbuffer, kernel_data, task);
- /* Make sure that set work size is a multiple of local
- * work size dimensions.
- */
- global_size[0] = round_up(gsize[0], local_size[0]);
- global_size[1] = round_up(gsize[1], local_size[1]);
- }
+ /* Make sure that set work size is a multiple of local
+ * work size dimensions.
+ */
+ global_size[0] = round_up(gsize[0], local_size[0]);
+ global_size[1] = round_up(gsize[1], local_size[1]);
- num_global_elements = global_size[0] * global_size[1];
+ int num_global_elements = global_size[0] * global_size[1];
assert(num_global_elements % WORK_POOL_SIZE == 0);
/* Calculate max groups */
@@ -180,6 +174,9 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task,
ray_state.alloc(num_global_elements);
}
+ /* Number of elements in the global state buffer */
+ int num_global_elements = global_size[0] * global_size[1];
+
#define ENQUEUE_SPLIT_KERNEL(name, global_size, local_size) \
if(device->have_error()) { \
return false; \
diff --git a/intern/cycles/device/device_split_kernel.h b/intern/cycles/device/device_split_kernel.h
index 5af4367d1b6..622733b843f 100644
--- a/intern/cycles/device/device_split_kernel.h
+++ b/intern/cycles/device/device_split_kernel.h
@@ -92,10 +92,9 @@ private:
/* Work pool with respect to each work group. */
device_only_memory<unsigned int> work_pool_wgs;
- /* Marked True in constructor and marked false at the end of path_trace(). */
- bool first_tile;
-
- /* Cached global size */
+ /* Cached kernel-dependent data, initialized once. */
+ bool kernel_data_initialized;
+ size_t local_size[2];
size_t global_size[2];
public: