diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2013-11-29 05:09:24 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2013-11-29 07:01:07 +0400 |
commit | 746628e0d021fa616c69e9ff0ef9ad71cba23694 (patch) | |
tree | 4ca4b0e2d1aae189bc06df1a0b652ec5280a37aa /intern/cycles/kernel/osl/osl_closures.cpp | |
parent | aa3933b411fc61d673facc6ea6f8cce6d86a3c6c (diff) |
Cycles OSL: refactoring to remove all dependencies on builtin OSL closures.
These were removed in new OSL versions. We only used these as base classes,
not using them at all simplifies the code a bit.
Diffstat (limited to 'intern/cycles/kernel/osl/osl_closures.cpp')
-rw-r--r-- | intern/cycles/kernel/osl/osl_closures.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp index 221406a1716..340e4492584 100644 --- a/intern/cycles/kernel/osl/osl_closures.cpp +++ b/intern/cycles/kernel/osl/osl_closures.cpp @@ -171,25 +171,16 @@ BSDF_CLOSURE_CLASS_END(HairTransmission, hair_transmission) /* Registration */ -static void generic_closure_setup(OSL::RendererServices *, int id, void *data) -{ - assert(data); - OSL::ClosurePrimitive *prim = (OSL::ClosurePrimitive *)data; - prim->setup(); -} - -static bool generic_closure_compare(int id, const void *dataA, const void *dataB) -{ - assert(dataA && dataB); - - OSL::ClosurePrimitive *primA = (OSL::ClosurePrimitive *)dataA; - OSL::ClosurePrimitive *primB = (OSL::ClosurePrimitive *)dataB; - return primA->mergeable(primB); -} - static void register_closure(OSL::ShadingSystem *ss, const char *name, int id, OSL::ClosureParam *params, OSL::PrepareClosureFunc prepare) { - ss->register_closure(name, id, params, prepare, generic_closure_setup, generic_closure_compare); + /* 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 */ +#ifdef CLOSURE_PREPARE + ss->register_closure(name, id, params, prepare, NULL, NULL); +#else + ss->register_closure(name, id, params, prepare, NULL); +#endif } void OSLShader::register_closures(OSLShadingSystem *ss_) |