[Bf-blender-cvs] [3544d6d] soc-2016-cycles_denoising: Cycles Denoising: Fix pass handling with MSVC

Lukas Stockner noreply at git.blender.org
Tue Nov 22 04:25:43 CET 2016


Commit: 3544d6d6ca0bb88832469fa35b9f5a4f938c17ce
Author: Lukas Stockner
Date:   Sat Sep 10 19:26:39 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rB3544d6d6ca0bb88832469fa35b9f5a4f938c17ce

Cycles Denoising: Fix pass handling with MSVC

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

M	intern/cycles/device/device_cpu.cpp
M	intern/cycles/kernel/kernel_path.h
M	intern/cycles/util/util_system.cpp
M	intern/cycles/util/util_system.h
M	source/blender/render/intern/source/external_engine.c

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

diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index 1d1c201..9f1d6e5 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -539,9 +539,6 @@ public:
 		RenderTile tile;
 
 		while(task.acquire_tile(this, tile)) {
-#ifdef WITH_CYCLES_DEBUG_FPE
-			scoped_fpe fpe(FPE_ENABLED);
-#endif
 			float *render_buffer = (float*)tile.buffer;
 
 			if(tile.task == RenderTile::PATH_TRACE) {
@@ -550,6 +547,9 @@ public:
 				int end_sample = tile.start_sample + tile.num_samples;
 
 				for(int sample = start_sample; sample < end_sample; sample++) {
+#ifdef WITH_CYCLES_DEBUG_FPE
+					scoped_fpe fpe(FPE_ENABLED);
+#endif
 					if(task.get_cancel() || task_pool.canceled()) {
 						if(task.need_finish_queue == false)
 							break;
@@ -564,6 +564,9 @@ public:
 
 					tile.sample = sample + 1;
 
+#ifdef WITH_CYCLES_DEBUG_FPE
+					fpe.restore();
+#endif
 					task.update_progress(&tile);
 				}
 
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index d7d83e1..d75d122 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -796,7 +796,7 @@ ccl_device_inline float kernel_path_integrate(KernelGlobals *kg,
 
 		/* blurring of bsdf after bounces, for rays that have a small likelihood
 		 * of following this particular path (diffuse, rough glossy) */
-		if(kernel_data.integrator.filter_glossy != FLT_MAX) {
+		if(kernel_data.integrator.filter_glossy != FLT_MAX && state.min_ray_pdf < 1e10f) {
 			float blur_pdf = kernel_data.integrator.filter_glossy*state.min_ray_pdf;
 
 			if(blur_pdf < 1.0f) {
diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp
index 1001c28..f859b9e 100644
--- a/intern/cycles/util/util_system.cpp
+++ b/intern/cycles/util/util_system.cpp
@@ -321,7 +321,7 @@ scoped_fpe::scoped_fpe(FPEState state)
 	}
 }
 
-scoped_fpe::~scoped_fpe()
+void scoped_fpe::restore()
 {
 	if(was_enabled) {
 		system_enable_fpe();
@@ -331,6 +331,11 @@ scoped_fpe::~scoped_fpe()
 	}
 }
 
+scoped_fpe::~scoped_fpe()
+{
+	restore();
+}
+
 #endif
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/util/util_system.h b/intern/cycles/util/util_system.h
index c627c9e..a66c7eb 100644
--- a/intern/cycles/util/util_system.h
+++ b/intern/cycles/util/util_system.h
@@ -49,6 +49,7 @@ class scoped_fpe
 {
 public:
 	explicit scoped_fpe(FPEState state);
+	void restore();
 	~scoped_fpe();
 private:
 	bool was_enabled;
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index 7697e46..0c243d1 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -255,7 +255,7 @@ void RE_engine_add_pass(RenderEngine *engine, int passtype, int channels, const
 		return;
 	}
 
-	render_result_add_pass(re->result, 1UL << passtype, channels, layername, viewname);
+	render_result_add_pass(re->result, ((uint64_t)1)<<passtype, channels, layername, viewname);
 }
 
 void RE_engine_end_result(RenderEngine *engine, RenderResult *result, int cancel, int highlight, int merge_results)




More information about the Bf-blender-cvs mailing list