[Bf-blender-cvs] [8ad16d7] soc-2016-cycles_denoising: Cycles: Fix denoising debug passes with CUDA

Lukas Stockner noreply at git.blender.org
Wed Jul 6 21:26:25 CEST 2016


Commit: 8ad16d79233dd6a48fd0141692dff6899dd2cfdb
Author: Lukas Stockner
Date:   Wed Jul 6 21:24:44 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rB8ad16d79233dd6a48fd0141692dff6899dd2cfdb

Cycles: Fix denoising debug passes with CUDA

===================================================================

M	intern/cycles/device/device_cuda.cpp
M	intern/cycles/kernel/CMakeLists.txt

===================================================================

diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 392b62d..912465b 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -830,12 +830,13 @@ public:
 
 #ifdef WITH_CYCLES_DEBUG_FILTER
 		FilterStorage *host_storage = new FilterStorage[filter_w*filter_h];
-		cuMemcpyDtoH(host_storage, d_storage, sizeof(host_storage));
+		cuda_assert(cuMemcpyDtoH(host_storage, d_storage, sizeof(FilterStorage)*filter_w*filter_h));
+		std::string prefix = string_printf("debug_%dx%d_cuda", rtile.x+rtile.buffers->params.overscan, rtile.y+rtile.buffers->params.overscan);
 		for(int i = 0; i < DENOISE_FEATURES; i++)
-			debug_write_pfm(string_printf("debug_%dx%d_bandwidth_%d.pfm", rtile.x, rtile.y, i).c_str(), &host_storage[0].bandwidth[i], filter_w, filter_h, sizeof(FilterStorage)/sizeof(float), filter_w);
-		debug_write_pfm(string_printf("debug_%dx%d_global_bandwidth.pfm", rtile.x, rtile.y).c_str(), &host_storage[0].global_bandwidth, filter_w, filter_h, sizeof(FilterStorage)/sizeof(float), filter_w);
-		debug_write_pfm(string_printf("debug_%dx%d_filtered_global_bandwidth.pfm", rtile.x, rtile.y).c_str(), &host_storage[0].filtered_global_bandwidth, filter_w, filter_h, sizeof(FilterStorage)/sizeof(float), filter_w);
-		debug_write_pfm(string_printf("debug_%dx%d_sum_weight.pfm", rtile.x, rtile.y).c_str(), &host_storage[0].sum_weight, filter_w, filter_h, sizeof(FilterStorage)/sizeof(float), filter_w);
+			debug_write_pfm(string_printf("%s_bandwidth_%d.pfm", prefix.c_str(), i).c_str(), &host_storage[0].bandwidth[i], filter_w, filter_h, sizeof(FilterStorage)/sizeof(float), filter_w);
+		debug_write_pfm(string_printf("%s_global_bandwidth.pfm", prefix.c_str()).c_str(), &host_storage[0].global_bandwidth, filter_w, filter_h, sizeof(FilterStorage)/sizeof(float), filter_w);
+		debug_write_pfm(string_printf("%s_filtered_global_bandwidth.pfm", prefix.c_str()).c_str(), &host_storage[0].filtered_global_bandwidth, filter_w, filter_h, sizeof(FilterStorage)/sizeof(float), filter_w);
+		debug_write_pfm(string_printf("%s_sum_weight.pfm", prefix.c_str()).c_str(), &host_storage[0].sum_weight, filter_w, filter_h, sizeof(FilterStorage)/sizeof(float), filter_w);
 		delete[] host_storage;
 #endif
 
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index 2cdf45f..7726541 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -233,7 +233,9 @@ if(WITH_CYCLES_CUDA_BINARIES)
 		endif()
 
 		if(WITH_CYCLES_DEBUG_FILTER)
-			set(cuda_debug_flags "${cuda_debug_flags} -DWITH_CYCLES_DEBUG_FILTER")
+			set(cuda_filter_debug_flags "-DWITH_CYCLES_DEBUG_FILTER")
+		else()
+			set(cuda_filter_debug_flags "")
 		endif()
 
 		set(cuda_version_flags "-D__KERNEL_CUDA_VERSION__=${CUDA_VERSION}")
@@ -253,6 +255,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
 					${cuda_math_flags}
 					${cuda_extra_flags}
 					${cuda_debug_flags}
+					${cuda_filter_debug_flags}
 					-I${CMAKE_CURRENT_SOURCE_DIR}/../util
 					-I${CMAKE_CURRENT_SOURCE_DIR}/svm
 					-DCCL_NAMESPACE_BEGIN=




More information about the Bf-blender-cvs mailing list