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
diff options
context:
space:
mode:
authorStefan Werner <stefan.werner@tangent-animation.com>2018-11-23 15:08:15 +0300
committerStefan Werner <stefan.werner@tangent-animation.com>2018-11-23 15:19:53 +0300
commit071f4f4ce0b9520ab0c73d6d68365ad449ca8b80 (patch)
tree9f37bfcac669366b9ad5fb7605f2fbbed9b71b0a /intern/cycles/device/opencl
parent0a2b2d59a5897212ba3771503feb6770fb636bc8 (diff)
Cycles: Improved robustness of hair motion blur.motion_curve_fix
In some instances, the number of control vertices of a hair could change mid-frame. Cycles would then be unable to calculate proper motion blur for those hairs. This adds interpolated CVs to fill in for the missing data. While this will not necessarily result in a fully accurate reconstruction of the guide hair, it preserves motion blur instead of disabling it. Reviewers: #cycles, sergey Reviewed By: #cycles, sergey Subscribers: sergey, brecht, #cycles Tags: #cycles Differential Revision: https://developer.blender.org/D3695
Diffstat (limited to 'intern/cycles/device/opencl')
-rw-r--r--intern/cycles/device/opencl/opencl.h4
-rw-r--r--intern/cycles/device/opencl/opencl_base.cpp50
-rw-r--r--intern/cycles/device/opencl/opencl_mega.cpp4
-rw-r--r--intern/cycles/device/opencl/opencl_split.cpp6
-rw-r--r--intern/cycles/device/opencl/opencl_util.cpp8
5 files changed, 38 insertions, 34 deletions
diff --git a/intern/cycles/device/opencl/opencl.h b/intern/cycles/device/opencl/opencl.h
index 6c73d10a376..8cb7f6d0b82 100644
--- a/intern/cycles/device/opencl/opencl.h
+++ b/intern/cycles/device/opencl/opencl.h
@@ -245,7 +245,7 @@ public:
(device)->set_error(message); \
fprintf(stderr, "%s\n", message.c_str()); \
} \
- } (void)0
+ } (void) 0
#define opencl_assert(stmt) \
{ \
@@ -257,7 +257,7 @@ public:
error_msg = message; \
fprintf(stderr, "%s\n", message.c_str()); \
} \
- } (void)0
+ } (void) 0
class OpenCLDeviceBase : public Device
{
diff --git a/intern/cycles/device/opencl/opencl_base.cpp b/intern/cycles/device/opencl/opencl_base.cpp
index cc887134bb0..1e73d37d7a4 100644
--- a/intern/cycles/device/opencl/opencl_base.cpp
+++ b/intern/cycles/device/opencl/opencl_base.cpp
@@ -761,7 +761,7 @@ bool OpenCLDeviceBase::denoising_non_local_means(device_ptr image_ptr,
cl_mem variance_mem = CL_MEM_PTR(variance_ptr);
cl_mem out_mem = CL_MEM_PTR(out_ptr);
- mem_zero_kernel(*difference, sizeof(float)*pass_stride);
+ mem_zero_kernel(*weightAccum, sizeof(float)*pass_stride);
mem_zero_kernel(out_ptr, sizeof(float)*pass_stride);
cl_kernel ckNLMCalcDifference = denoising_program(ustring("filter_nlm_calc_difference"));
@@ -865,38 +865,38 @@ bool OpenCLDeviceBase::denoising_reconstruct(device_ptr color_ptr,
int h = task->reconstruction_state.source_h;
int stride = task->buffer.stride;
- int shift_stride = stride*h;
- int num_shifts = (2*task->radius + 1)*(2*task->radius + 1);
- int mem_size = sizeof(float)*shift_stride*num_shifts;
+ int r = task->radius;
+ int pass_stride = task->buffer.pass_stride;
+ int num_shifts = (2*r+1)*(2*r+1);
- cl_mem difference = clCreateBuffer(cxContext, CL_MEM_READ_WRITE, mem_size, NULL, &ciErr);
- opencl_assert_err(ciErr, "clCreateBuffer denoising_reconstruct");
- cl_mem blurDifference = clCreateBuffer(cxContext, CL_MEM_READ_WRITE, mem_size, NULL, &ciErr);
- opencl_assert_err(ciErr, "clCreateBuffer denoising_reconstruct");
+ device_sub_ptr difference(task->buffer.temporary_mem, 0, pass_stride*num_shifts);
+ device_sub_ptr blurDifference(task->buffer.temporary_mem, pass_stride*num_shifts, pass_stride*num_shifts);
+ cl_mem difference_mem = CL_MEM_PTR(*difference);
+ cl_mem blurDifference_mem = CL_MEM_PTR(*blurDifference);
kernel_set_args(ckNLMCalcDifference, 0,
color_mem,
color_variance_mem,
- difference,
+ difference_mem,
w, h, stride,
- shift_stride,
- task->radius,
- task->buffer.pass_stride,
+ pass_stride,
+ r,
+ pass_stride,
1.0f, task->nlm_k_2);
kernel_set_args(ckNLMBlur, 0,
- difference,
- blurDifference,
+ difference_mem,
+ blurDifference_mem,
w, h, stride,
- shift_stride,
- task->radius, 4);
+ pass_stride,
+ r, 4);
kernel_set_args(ckNLMCalcWeight, 0,
- blurDifference,
- difference,
+ blurDifference_mem,
+ difference_mem,
w, h, stride,
- shift_stride,
- task->radius, 4);
+ pass_stride,
+ r, 4);
kernel_set_args(ckNLMConstructGramian, 0,
- blurDifference,
+ blurDifference_mem,
buffer_mem,
transform_mem,
rank_mem,
@@ -904,9 +904,8 @@ bool OpenCLDeviceBase::denoising_reconstruct(device_ptr color_ptr,
XtWY_mem,
task->reconstruction_state.filter_window,
w, h, stride,
- shift_stride,
- task->radius, 4,
- task->buffer.pass_stride);
+ pass_stride,
+ r, 4);
enqueue_kernel(ckNLMCalcDifference, w*h, num_shifts, true);
enqueue_kernel(ckNLMBlur, w*h, num_shifts, true);
@@ -914,9 +913,6 @@ bool OpenCLDeviceBase::denoising_reconstruct(device_ptr color_ptr,
enqueue_kernel(ckNLMBlur, w*h, num_shifts, true);
enqueue_kernel(ckNLMConstructGramian, w*h, num_shifts, true, 256);
- opencl_assert(clReleaseMemObject(difference));
- opencl_assert(clReleaseMemObject(blurDifference));
-
kernel_set_args(ckFinalize, 0,
output_mem,
rank_mem,
diff --git a/intern/cycles/device/opencl/opencl_mega.cpp b/intern/cycles/device/opencl/opencl_mega.cpp
index e004c0b44f4..89001366d9d 100644
--- a/intern/cycles/device/opencl/opencl_mega.cpp
+++ b/intern/cycles/device/opencl/opencl_mega.cpp
@@ -43,6 +43,10 @@ public:
return true;
}
+ virtual BVHLayoutMask get_bvh_layout_mask() const {
+ return BVH_LAYOUT_BVH2;
+ }
+
virtual bool load_kernels(const DeviceRequestedFeatures& /*requested_features*/,
vector<OpenCLProgram*> &programs)
{
diff --git a/intern/cycles/device/opencl/opencl_split.cpp b/intern/cycles/device/opencl/opencl_split.cpp
index 66a4aa7e891..adb73bc6e2c 100644
--- a/intern/cycles/device/opencl/opencl_split.cpp
+++ b/intern/cycles/device/opencl/opencl_split.cpp
@@ -95,6 +95,10 @@ public:
return true;
}
+ virtual BVHLayoutMask get_bvh_layout_mask() const {
+ return BVH_LAYOUT_BVH2;
+ }
+
virtual bool load_kernels(const DeviceRequestedFeatures& requested_features,
vector<OpenCLDeviceBase::OpenCLProgram*> &programs)
{
@@ -459,4 +463,4 @@ Device *opencl_create_split_device(DeviceInfo& info, Stats& stats, bool backgrou
CCL_NAMESPACE_END
-#endif /* WITH_OPENCL */
+#endif /* WITH_OPENCL */
diff --git a/intern/cycles/device/opencl/opencl_util.cpp b/intern/cycles/device/opencl/opencl_util.cpp
index 895e4149a3a..4c9f3cd6ef7 100644
--- a/intern/cycles/device/opencl/opencl_util.cpp
+++ b/intern/cycles/device/opencl/opencl_util.cpp
@@ -106,7 +106,7 @@ cl_context OpenCLCache::get_context(cl_platform_id platform,
cl_int ciErr = clRetainContext(slot.context);
assert(ciErr == CL_SUCCESS);
- (void)ciErr;
+ (void) ciErr;
return slot.context;
}
@@ -153,7 +153,7 @@ cl_program OpenCLCache::get_program(cl_platform_id platform,
cl_int ciErr = clRetainProgram(entry.program);
assert(ciErr == CL_SUCCESS);
- (void)ciErr;
+ (void) ciErr;
return entry.program;
}
@@ -188,7 +188,7 @@ void OpenCLCache::store_context(cl_platform_id platform,
* The caller is going to release the object when done with it. */
cl_int ciErr = clRetainContext(context);
assert(ciErr == CL_SUCCESS);
- (void)ciErr;
+ (void) ciErr;
}
void OpenCLCache::store_program(cl_platform_id platform,
@@ -227,7 +227,7 @@ void OpenCLCache::store_program(cl_platform_id platform,
*/
cl_int ciErr = clRetainProgram(program);
assert(ciErr == CL_SUCCESS);
- (void)ciErr;
+ (void) ciErr;
}
string OpenCLCache::get_kernel_md5()