[Bf-blender-cvs] [4cb0e25] master: Cycles: Use 16 bytes aligned closures in OSL

Sergey Sharybin noreply at git.blender.org
Wed Dec 3 16:52:09 CET 2014


Commit: 4cb0e256789231a329780bbdc8706e6aa031e52e
Author: Sergey Sharybin
Date:   Wed Dec 3 20:34:03 2014 +0500
Branches: master
https://developer.blender.org/rB4cb0e256789231a329780bbdc8706e6aa031e52e

Cycles: Use 16 bytes aligned closures in OSL

This solves bugs like T42210 which are caused by compiler being
smart and using some SSE instructions to operate with closure
classes, which was failing because those classes are not allocated
by the regular allocator but allocated in memory pool in OSL.

With newer versions of OSL it is now possible to force closure
classes being aligned to a given boundary and this commit uses
this new functionality.

Unfortunately, it means we're no longer compatible with older
versions of OSL, only latest git version from upstream and our
branch at github are supported:

  https://github.com/Nazg-Gul/OpenShadingLanguage/tree/blender-fixes

For OSX and Windows it's not an issue because libraries are
already updated there, Linux users would need to run install_deps
script.

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

M	intern/cycles/kernel/osl/osl_closures.cpp

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

diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp
index bae9cb2..1d99f1d 100644
--- a/intern/cycles/kernel/osl/osl_closures.cpp
+++ b/intern/cycles/kernel/osl/osl_closures.cpp
@@ -189,7 +189,7 @@ static void register_closure(OSL::ShadingSystem *ss, const char *name, int id, O
 	/* optimization: it's possible to not use a prepare function at all and
 	 * only initialize the actual class when accessing the closure component
 	 * data, but then we need to map the id to the class somehow */
-	ss->register_closure(name, id, params, prepare, NULL);
+	ss->register_closure(name, id, params, prepare, NULL, 16);
 }
 
 void OSLShader::register_closures(OSLShadingSystem *ss_)




More information about the Bf-blender-cvs mailing list