[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43726] trunk/blender/intern/cycles: Cycles: fix issues rendering second render layer passes, and avoid unnecessary

Brecht Van Lommel brechtvanlommel at pandora.be
Thu Jan 26 15:55:33 CET 2012


Revision: 43726
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43726
Author:   blendix
Date:     2012-01-26 14:55:25 +0000 (Thu, 26 Jan 2012)
Log Message:
-----------
Cycles: fix issues rendering second render layer passes, and avoid unnecessary
clear of buffer.

Modified Paths:
--------------
    trunk/blender/intern/cycles/blender/blender_session.cpp
    trunk/blender/intern/cycles/kernel/kernel_passes.h
    trunk/blender/intern/cycles/kernel/kernel_path.h
    trunk/blender/intern/cycles/render/buffers.cpp

Modified: trunk/blender/intern/cycles/blender/blender_session.cpp
===================================================================
--- trunk/blender/intern/cycles/blender/blender_session.cpp	2012-01-26 13:13:48 UTC (rev 43725)
+++ trunk/blender/intern/cycles/blender/blender_session.cpp	2012-01-26 14:55:25 UTC (rev 43726)
@@ -203,6 +203,9 @@
 		b_rlay = *b_iter;
 
 		/* add passes */
+		vector<Pass> passes;
+		Pass::add(PASS_COMBINED, passes);
+
 		if(session_params.device.type == DEVICE_CPU) { /* todo */
 			BL::RenderLayer::passes_iterator b_pass_iter;
 			
@@ -211,12 +214,13 @@
 				PassType pass_type = get_pass_type(b_pass);
 
 				if(pass_type != PASS_NONE)
-					Pass::add(pass_type, buffer_params.passes);
+					Pass::add(pass_type, passes);
 			}
 		}
 
-		scene->film->passes = buffer_params.passes;
-		scene->film->need_update = true;
+		buffer_params.passes = passes;
+		scene->film->passes = passes;
+		scene->film->tag_update(scene);
 
 		/* update session */
 		session->reset(buffer_params, session_params.samples);

Modified: trunk/blender/intern/cycles/kernel/kernel_passes.h
===================================================================
--- trunk/blender/intern/cycles/kernel/kernel_passes.h	2012-01-26 13:13:48 UTC (rev 43725)
+++ trunk/blender/intern/cycles/kernel/kernel_passes.h	2012-01-26 14:55:25 UTC (rev 43726)
@@ -36,15 +36,6 @@
 	*buf = (sample == 0)? value: *buf + value;
 }
 
-__device_inline void kernel_clear_passes(__global float *buffer, int sample, int pass_stride)
-{
-#ifdef __PASSES__
-	if(sample == 0 && pass_stride != 4)
-		for(int i = 4; i < pass_stride; i++)
-			buffer[i] = 0.0f;
-#endif
-}
-
 __device void kernel_write_data_passes(KernelGlobals *kg, __global float *buffer, PathRadiance *L,
 	ShaderData *sd, int sample, int path_flag, float3 throughput)
 {

Modified: trunk/blender/intern/cycles/kernel/kernel_path.h
===================================================================
--- trunk/blender/intern/cycles/kernel/kernel_path.h	2012-01-26 13:13:48 UTC (rev 43725)
+++ trunk/blender/intern/cycles/kernel/kernel_path.h	2012-01-26 14:55:25 UTC (rev 43726)
@@ -377,8 +377,6 @@
 	rng_state += index;
 	buffer += index*pass_stride;
 
-	kernel_clear_passes(buffer, sample, pass_stride);
-
 	/* initialize random numbers */
 	RNG rng;
 

Modified: trunk/blender/intern/cycles/render/buffers.cpp
===================================================================
--- trunk/blender/intern/cycles/render/buffers.cpp	2012-01-26 13:13:48 UTC (rev 43725)
+++ trunk/blender/intern/cycles/render/buffers.cpp	2012-01-26 14:55:25 UTC (rev 43726)
@@ -157,11 +157,18 @@
 			assert(pass.components == components);
 
 			/* scalar */
-			for(int i = 0; i < size; i++, in += pass_stride, pixels++) {
-				float f = *in;
-
-				pixels[0] = f*scale_exposure;
+			if(type == PASS_DEPTH) {
+				for(int i = 0; i < size; i++, in += pass_stride, pixels++) {
+					float f = *in;
+					pixels[0] = (f == 0.0f)? 1e10f: f*scale_exposure;
+				}
 			}
+			else {
+				for(int i = 0; i < size; i++, in += pass_stride, pixels++) {
+					float f = *in;
+					pixels[0] = f*scale_exposure;
+				}
+			}
 		}
 		else if(components == 3) {
 			assert(pass.components == 4);



More information about the Bf-blender-cvs mailing list