diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-02 18:26:28 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-02 18:26:28 +0400 |
commit | efe4ea284abb33bbc0ab99e636decd3195c0e333 (patch) | |
tree | 7bf6b3fa602b7fdf5b911ef3e650d1779be0684d /intern | |
parent | 1f96a120f6c7bb34a20e524cdd51b151f61c4b75 (diff) |
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.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/CMakeLists.txt | 2 | ||||
-rw-r--r-- | intern/cycles/SConscript | 7 | ||||
-rw-r--r-- | intern/cycles/app/cycles_xml.cpp | 47 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_bvh.h | 17 | ||||
-rw-r--r-- | intern/cycles/render/mesh.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/subd/subd_mesh.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/util/util_cache.h | 2 | ||||
-rw-r--r-- | intern/cycles/util/util_system.cpp | 6 |
8 files changed, 33 insertions, 54 deletions
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index 9b05d2c332d..3dc9ca5d284 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -16,7 +16,7 @@ if(WIN32 AND MSVC) 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() diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript index 3299faa864a..bc9eb563e50 100644 --- a/intern/cycles/SConscript +++ b/intern/cycles/SConscript @@ -46,13 +46,14 @@ if env['WITH_BF_RAYOPTIMIZATION']: 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) diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp index d89c30619b6..0bd0c48933d 100644 --- a/intern/cycles/app/cycles_xml.cpp +++ b/intern/cycles/app/cycles_xml.cpp @@ -339,64 +339,33 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug 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")) { diff --git a/intern/cycles/kernel/kernel_bvh.h b/intern/cycles/kernel/kernel_bvh.h index 04150b7ea90..35215fd0f9f 100644 --- a/intern/cycles/kernel/kernel_bvh.h +++ b/intern/cycles/kernel/kernel_bvh.h @@ -33,6 +33,15 @@ CCL_NAMESPACE_BEGIN #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 @@ __device_inline void bvh_node_intersect(KernelGlobals *kg, 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 @@ __device_inline void bvh_node_intersect(KernelGlobals *kg, 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__ diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index 19992771c1d..fc2dd49205a 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -685,9 +685,9 @@ void MeshManager::device_update(Device *device, DeviceScene *dscene, Scene *scen 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); diff --git a/intern/cycles/subd/subd_mesh.cpp b/intern/cycles/subd/subd_mesh.cpp index 8ed4854b786..3e6e0de48ea 100644 --- a/intern/cycles/subd/subd_mesh.cpp +++ b/intern/cycles/subd/subd_mesh.cpp @@ -88,7 +88,7 @@ SubdFace *SubdMesh::add_face(int *index, int num) /* 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; } diff --git a/intern/cycles/util/util_cache.h b/intern/cycles/util/util_cache.h index 91e8a94a584..6e3c7c47e39 100644 --- a/intern/cycles/util/util_cache.h +++ b/intern/cycles/util/util_cache.h @@ -106,7 +106,7 @@ public: 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; } } diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp index abf5e08de97..e8c81e57654 100644 --- a/intern/cycles/util/util_system.cpp +++ b/intern/cycles/util/util_system.cpp @@ -142,15 +142,15 @@ bool system_cpu_support_optimized() static bool caps_init = false; if(!caps_init) { - int result[4], num, num_ex; + int result[4], num; //, num_ex; memset(&caps, 0, sizeof(caps)); __cpuid(result, 0); num = result[0]; - __cpuid(result, 0x80000000); - num_ex = result[0]; + /*__cpuid(result, 0x80000000); + num_ex = result[0];*/ if(num >= 1){ __cpuid(result, 0x00000001); |