[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42340] trunk/blender/intern/cycles: Cycles:

Brecht Van Lommel brechtvanlommel at pandora.be
Fri Dec 2 15:26:32 CET 2011


Revision: 42340
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42340
Author:   blendix
Date:     2011-12-02 14:26:28 +0000 (Fri, 02 Dec 2011)
Log Message:
-----------
Cycles:
* Fix broken compile of test app.
* Fix some warnings compiling with gcc for 32 bit.
* More tweaks to avoid extended precision issue from #29301.

Modified Paths:
--------------
    trunk/blender/intern/cycles/CMakeLists.txt
    trunk/blender/intern/cycles/SConscript
    trunk/blender/intern/cycles/app/cycles_xml.cpp
    trunk/blender/intern/cycles/kernel/kernel_bvh.h
    trunk/blender/intern/cycles/render/mesh.cpp
    trunk/blender/intern/cycles/subd/subd_mesh.cpp
    trunk/blender/intern/cycles/util/util_cache.h
    trunk/blender/intern/cycles/util/util_system.cpp

Modified: trunk/blender/intern/cycles/CMakeLists.txt
===================================================================
--- trunk/blender/intern/cycles/CMakeLists.txt	2011-12-02 13:07:39 UTC (rev 42339)
+++ trunk/blender/intern/cycles/CMakeLists.txt	2011-12-02 14:26:28 UTC (rev 42340)
@@ -16,7 +16,7 @@
 	set(CYCLES_OPTIMIZED_KERNEL_FLAGS "/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc")
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast -D_CRT_SECURE_NO_WARNINGS /EHsc")
 elseif(CMAKE_COMPILER_IS_GNUCC)
-	set(CYCLES_OPTIMIZED_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3")
+	set(CYCLES_OPTIMIZED_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mfpmath=sse")
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
 endif()
 

Modified: trunk/blender/intern/cycles/SConscript
===================================================================
--- trunk/blender/intern/cycles/SConscript	2011-12-02 13:07:39 UTC (rev 42339)
+++ trunk/blender/intern/cycles/SConscript	2011-12-02 14:26:28 UTC (rev 42340)
@@ -46,13 +46,14 @@
     if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
         optim_cxxflags.append('/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
     else:
-        optim_cxxflags.append('-ffast-math -msse -msse2 -msse3'.split())
+        optim_cxxflags.append('-ffast-math -msse -msse2 -msse3 -mfpmath=sse'.split())
     
-    optim_defs = defs + ['WITH_OPTIMIZED_KERNEL']
+    defs.append('WITH_OPTIMIZED_KERNEL')
+    optim_defs = defs[:]
     optim_sources = [path.join('kernel', 'kernel_optimized.cpp')]
 
     cycles_optim = cycles.Clone()
-    cycles_optim.BlenderLib('bf_intern_cycles_optimized', optim_sources, incs, optim_defs, libtype=['intern'], priority=[0], compileflags=[None], cxx_compileflags=optim_cxxflags)
+    cycles_optim.BlenderLib('bf_intern_cycles_optimized', optim_sources, incs, optim_defs, libtype=['intern'], priority=[10], compileflags=[None], cxx_compileflags=optim_cxxflags)
 
 cycles.BlenderLib('bf_intern_cycles', sources, incs, defs, libtype=['intern'], priority=[0], compileflags=[None], cxx_compileflags=cxxflags)
 

Modified: trunk/blender/intern/cycles/app/cycles_xml.cpp
===================================================================
--- trunk/blender/intern/cycles/app/cycles_xml.cpp	2011-12-02 13:07:39 UTC (rev 42339)
+++ trunk/blender/intern/cycles/app/cycles_xml.cpp	2011-12-02 14:26:28 UTC (rev 42340)
@@ -339,64 +339,33 @@
 		else if(string_iequals(node.name(), "noise_texture")) {
 			snode = new NoiseTextureNode();
 		}
-		else if(string_iequals(node.name(), "blend_texture")) {
-			BlendTextureNode *blend = new BlendTextureNode();
-			xml_read_enum(&blend->progression, BlendTextureNode::progression_enum, node, "progression");
-			xml_read_enum(&blend->axis, BlendTextureNode::axis_enum, node, "axis");
+		else if(string_iequals(node.name(), "gradient_texture")) {
+			GradientTextureNode *blend = new GradientTextureNode();
+			xml_read_enum(&blend->type, GradientTextureNode::type_enum, node, "type");
 			snode = blend;
 		}
-		else if(string_iequals(node.name(), "clouds_texture")) {
-			CloudsTextureNode *clouds = new CloudsTextureNode();
-			xml_read_bool(&clouds->hard, node, "hard");
-			xml_read_int(&clouds->depth, node, "depth");
-			xml_read_enum(&clouds->basis, CloudsTextureNode::basis_enum, node, "basis");
-			snode = clouds;
-		}
 		else if(string_iequals(node.name(), "voronoi_texture")) {
 			VoronoiTextureNode *voronoi = new VoronoiTextureNode();
-			xml_read_enum(&voronoi->distance_metric, VoronoiTextureNode::distance_metric_enum, node, "distance_metric");
 			xml_read_enum(&voronoi->coloring, VoronoiTextureNode::coloring_enum, node, "coloring");
 			snode = voronoi;
 		}
 		else if(string_iequals(node.name(), "musgrave_texture")) {
 			MusgraveTextureNode *musgrave = new MusgraveTextureNode();
 			xml_read_enum(&musgrave->type, MusgraveTextureNode::type_enum, node, "type");
-			xml_read_enum(&musgrave->basis, MusgraveTextureNode::basis_enum, node, "basis");
 			snode = musgrave;
 		}
-		else if(string_iequals(node.name(), "marble_texture")) {
-			MarbleTextureNode *marble = new MarbleTextureNode();
-			xml_read_enum(&marble->type, MarbleTextureNode::type_enum, node, "type");
-			xml_read_enum(&marble->wave, MarbleTextureNode::wave_enum, node, "wave");
-			xml_read_enum(&marble->basis, MarbleTextureNode::basis_enum, node, "basis");
-			xml_read_bool(&marble->hard, node, "hard");
-			xml_read_int(&marble->depth, node, "depth");
-			snode = marble;
-		}
 		else if(string_iequals(node.name(), "magic_texture")) {
 			MagicTextureNode *magic = new MagicTextureNode();
 			xml_read_int(&magic->depth, node, "depth");
 			snode = magic;
 		}
-		else if(string_iequals(node.name(), "stucci_texture")) {
-			StucciTextureNode *stucci = new StucciTextureNode();
-			xml_read_enum(&stucci->type, StucciTextureNode::type_enum, node, "type");
-			xml_read_enum(&stucci->basis, StucciTextureNode::basis_enum, node, "basis");
-			xml_read_bool(&stucci->hard, node, "hard");
-			snode = stucci;
-		}
-		else if(string_iequals(node.name(), "distorted_noise_texture")) {
-			DistortedNoiseTextureNode *dist = new DistortedNoiseTextureNode();
-			xml_read_enum(&dist->basis, DistortedNoiseTextureNode::basis_enum, node, "basis");
-			xml_read_enum(&dist->distortion_basis, DistortedNoiseTextureNode::basis_enum, node, "distortion_basis");
+		else if(string_iequals(node.name(), "noise_texture")) {
+			NoiseTextureNode *dist = new NoiseTextureNode();
 			snode = dist;
 		}
-		else if(string_iequals(node.name(), "wood_texture")) {
-			WoodTextureNode *wood = new WoodTextureNode();
-			xml_read_enum(&wood->type, WoodTextureNode::type_enum, node, "type");
-			xml_read_enum(&wood->wave, WoodTextureNode::wave_enum, node, "wave");
-			xml_read_enum(&wood->basis, WoodTextureNode::basis_enum, node, "basis");
-			xml_read_bool(&wood->hard, node, "hard");
+		else if(string_iequals(node.name(), "wave_texture")) {
+			WaveTextureNode *wood = new WaveTextureNode();
+			xml_read_enum(&wood->type, WaveTextureNode::type_enum, node, "type");
 			snode = wood;
 		}
 		else if(string_iequals(node.name(), "mapping")) {

Modified: trunk/blender/intern/cycles/kernel/kernel_bvh.h
===================================================================
--- trunk/blender/intern/cycles/kernel/kernel_bvh.h	2011-12-02 13:07:39 UTC (rev 42339)
+++ trunk/blender/intern/cycles/kernel/kernel_bvh.h	2011-12-02 14:26:28 UTC (rev 42340)
@@ -33,6 +33,15 @@
 #define BVH_NODE_SIZE 4
 #define TRI_NODE_SIZE 3
 
+/* silly workaround for float extended precision that happens when compiling
+   without sse support on x86, it results in different results for float ops
+   that you would otherwise expect to compare correctly */
+#if !defined(__i386__) || defined(__SSE__)
+#define NO_EXTENDED_PRECISION
+#else
+#define NO_EXTENDED_PRECISION volatile
+#endif
+
 __device_inline float3 bvh_inverse_direction(float3 dir)
 {
 	/* avoid divide by zero (ooeps = exp2f(-80.0f)) */
@@ -94,8 +103,8 @@
 	float c0hiy = n0xy.w * idir.y - ood.y;
 	float c0loz = nz.x * idir.z - ood.z;
 	float c0hiz = nz.y * idir.z - ood.z;
-	float c0min = max4(min(c0lox, c0hix), min(c0loy, c0hiy), min(c0loz, c0hiz), 0.0f);
-	float c0max = min4(max(c0lox, c0hix), max(c0loy, c0hiy), max(c0loz, c0hiz), t);
+	NO_EXTENDED_PRECISION float c0min = max4(min(c0lox, c0hix), min(c0loy, c0hiy), min(c0loz, c0hiz), 0.0f);
+	NO_EXTENDED_PRECISION float c0max = min4(max(c0lox, c0hix), max(c0loy, c0hiy), max(c0loz, c0hiz), t);
 
 	float c1loz = nz.z * idir.z - ood.z;
 	float c1hiz = nz.w * idir.z - ood.z;
@@ -103,8 +112,8 @@
 	float c1hix = n1xy.y * idir.x - ood.x;
 	float c1loy = n1xy.z * idir.y - ood.y;
 	float c1hiy = n1xy.w * idir.y - ood.y;
-	float c1min = max4(min(c1lox, c1hix), min(c1loy, c1hiy), min(c1loz, c1hiz), 0.0f);
-	float c1max = min4(max(c1lox, c1hix), max(c1loy, c1hiy), max(c1loz, c1hiz), t);
+	NO_EXTENDED_PRECISION float c1min = max4(min(c1lox, c1hix), min(c1loy, c1hiy), min(c1loz, c1hiz), 0.0f);
+	NO_EXTENDED_PRECISION float c1max = min4(max(c1lox, c1hix), max(c1loy, c1hiy), max(c1loz, c1hiz), t);
 
 	/* decide which nodes to traverse next */
 #ifdef __VISIBILITY_FLAG__

Modified: trunk/blender/intern/cycles/render/mesh.cpp
===================================================================
--- trunk/blender/intern/cycles/render/mesh.cpp	2011-12-02 13:07:39 UTC (rev 42339)
+++ trunk/blender/intern/cycles/render/mesh.cpp	2011-12-02 14:26:28 UTC (rev 42340)
@@ -685,9 +685,9 @@
 			if(!mesh->transform_applied) {
 				string msg = "Updating Mesh BVH ";
 				if(mesh->name == "")
-					msg += string_printf("%ld/%ld", i+1, num_instance_bvh);
+					msg += string_printf("%lu/%lu", (unsigned long)(i+1), (unsigned long)num_instance_bvh);
 				else
-					msg += string_printf("%s %ld/%ld", mesh->name.c_str(), i+1, num_instance_bvh);
+					msg += string_printf("%s %lu/%lu", mesh->name.c_str(), (unsigned long)(i+1), (unsigned long)num_instance_bvh);
 				progress.set_status(msg, "Building BVH");
 
 				mesh->compute_bvh(&scene->params, progress);

Modified: trunk/blender/intern/cycles/subd/subd_mesh.cpp
===================================================================
--- trunk/blender/intern/cycles/subd/subd_mesh.cpp	2011-12-02 13:07:39 UTC (rev 42339)
+++ trunk/blender/intern/cycles/subd/subd_mesh.cpp	2011-12-02 14:26:28 UTC (rev 42340)
@@ -88,7 +88,7 @@
 	/* test non-manifold cases */
 	if(!can_add_face(index, num)) {
 		/* we could try to add face in opposite winding instead .. */
-		fprintf(stderr, "Warning: non manifold mesh, invalid face '%lu'.\n", faces.size());
+		fprintf(stderr, "Warning: non manifold mesh, invalid face '%lu'.\n", (unsigned long)faces.size());
 		return NULL;
 	}
 	

Modified: trunk/blender/intern/cycles/util/util_cache.h
===================================================================
--- trunk/blender/intern/cycles/util/util_cache.h	2011-12-02 13:07:39 UTC (rev 42339)
+++ trunk/blender/intern/cycles/util/util_cache.h	2011-12-02 14:26:28 UTC (rev 42340)
@@ -106,7 +106,7 @@
 		data.resize(size/sizeof(T));
 
 		if(!fread(&data[0], size, 1, f)) {
-			fprintf(stderr, "Failed to read vector data from cache (%ld).\n", size);
+			fprintf(stderr, "Failed to read vector data from cache (%lu).\n", (unsigned long)size);
 			return;
 		}
 	}

Modified: trunk/blender/intern/cycles/util/util_system.cpp
===================================================================

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list