Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2012-10-06 20:28:02 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-10-06 20:28:02 +0400
commit78978dcd805af2db50478fcba7fdf56d3fbca2ec (patch)
treec6eb6966b0b8fafbc2ccf098de30b2e15ab14d14 /intern
parent2ecb4781a7634b7e95c7426c0f15e98abafee4a5 (diff)
Fix for a case of 'static initialization fiasco' with OSL closure variables. The parameter lists are using OIIO::TypeDesc static standards, which are also static variables. With static OSL libraries these are not initialized when the closure parameter lists are initialized, so OSL rejects the closure types.
Putting static initialization into functions works just as well, but ensures the OIIO::TypeDesc access is delayed until initialization is complete.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/kernel/osl/background.cpp23
-rw-r--r--intern/cycles/kernel/osl/bsdf_ashikhmin_velvet.cpp16
-rw-r--r--intern/cycles/kernel/osl/bsdf_diffuse.cpp30
-rw-r--r--intern/cycles/kernel/osl/bsdf_microfacet.cpp74
-rw-r--r--intern/cycles/kernel/osl/bsdf_oren_nayar.cpp16
-rw-r--r--intern/cycles/kernel/osl/bsdf_phong.cpp34
-rw-r--r--intern/cycles/kernel/osl/bsdf_reflection.cpp14
-rw-r--r--intern/cycles/kernel/osl/bsdf_refraction.cpp16
-rw-r--r--intern/cycles/kernel/osl/bsdf_transparent.cpp12
-rw-r--r--intern/cycles/kernel/osl/bsdf_ward.cpp20
-rw-r--r--intern/cycles/kernel/osl/bsdf_westin.cpp34
-rw-r--r--intern/cycles/kernel/osl/bssrdf.cpp14
-rw-r--r--intern/cycles/kernel/osl/debug.cpp14
-rw-r--r--intern/cycles/kernel/osl/emissive.cpp12
-rw-r--r--intern/cycles/kernel/osl/osl_closures.cpp44
-rw-r--r--intern/cycles/kernel/osl/osl_closures.h44
-rw-r--r--intern/cycles/kernel/osl/vol_subsurface.cpp20
17 files changed, 264 insertions, 173 deletions
diff --git a/intern/cycles/kernel/osl/background.cpp b/intern/cycles/kernel/osl/background.cpp
index 81812a46b6c..6290eed0af8 100644
--- a/intern/cycles/kernel/osl/background.cpp
+++ b/intern/cycles/kernel/osl/background.cpp
@@ -85,16 +85,25 @@ public:
}
};
-ClosureParam closure_background_params[] = {
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(GenericBackgroundClosure)
-};
+
+ClosureParam *closure_background_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(GenericBackgroundClosure)
+ };
+ return params;
+}
CLOSURE_PREPARE(closure_background_prepare, GenericBackgroundClosure)
-ClosureParam closure_holdout_params[] = {
- CLOSURE_FINISH_PARAM(HoldoutClosure)
-};
+ClosureParam *closure_holdout_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_FINISH_PARAM(HoldoutClosure)
+ };
+ return params;
+}
CLOSURE_PREPARE(closure_holdout_prepare, HoldoutClosure)
diff --git a/intern/cycles/kernel/osl/bsdf_ashikhmin_velvet.cpp b/intern/cycles/kernel/osl/bsdf_ashikhmin_velvet.cpp
index 2c545ca55e7..a1904d7f5d7 100644
--- a/intern/cycles/kernel/osl/bsdf_ashikhmin_velvet.cpp
+++ b/intern/cycles/kernel/osl/bsdf_ashikhmin_velvet.cpp
@@ -173,12 +173,16 @@ public:
-ClosureParam bsdf_ashikhmin_velvet_params[] = {
- CLOSURE_VECTOR_PARAM(AshikhminVelvetClosure, m_N),
- CLOSURE_FLOAT_PARAM(AshikhminVelvetClosure, m_sigma),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(AshikhminVelvetClosure)
-};
+ClosureParam *bsdf_ashikhmin_velvet_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_VECTOR_PARAM(AshikhminVelvetClosure, m_N),
+ CLOSURE_FLOAT_PARAM(AshikhminVelvetClosure, m_sigma),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(AshikhminVelvetClosure)
+ };
+ return params;
+}
CLOSURE_PREPARE(bsdf_ashikhmin_velvet_prepare, AshikhminVelvetClosure)
diff --git a/intern/cycles/kernel/osl/bsdf_diffuse.cpp b/intern/cycles/kernel/osl/bsdf_diffuse.cpp
index 582ac01d959..1e06d3b583f 100644
--- a/intern/cycles/kernel/osl/bsdf_diffuse.cpp
+++ b/intern/cycles/kernel/osl/bsdf_diffuse.cpp
@@ -168,17 +168,25 @@ public:
}
};
-ClosureParam bsdf_diffuse_params[] = {
- CLOSURE_VECTOR_PARAM(DiffuseClosure, m_N),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(DiffuseClosure)
-};
-
-ClosureParam bsdf_translucent_params[] = {
- CLOSURE_VECTOR_PARAM(TranslucentClosure, m_N),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(TranslucentClosure)
-};
+ClosureParam *bsdf_diffuse_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_VECTOR_PARAM(DiffuseClosure, m_N),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(DiffuseClosure)
+ };
+ return params;
+}
+
+ClosureParam *bsdf_translucent_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_VECTOR_PARAM(TranslucentClosure, m_N),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(TranslucentClosure)
+ };
+ return params;
+}
CLOSURE_PREPARE(bsdf_diffuse_prepare, DiffuseClosure)
CLOSURE_PREPARE(bsdf_translucent_prepare, TranslucentClosure)
diff --git a/intern/cycles/kernel/osl/bsdf_microfacet.cpp b/intern/cycles/kernel/osl/bsdf_microfacet.cpp
index 09730d8c3e1..8446dbbe982 100644
--- a/intern/cycles/kernel/osl/bsdf_microfacet.cpp
+++ b/intern/cycles/kernel/osl/bsdf_microfacet.cpp
@@ -503,35 +503,51 @@ public:
-ClosureParam bsdf_microfacet_ggx_params[] = {
- CLOSURE_VECTOR_PARAM(MicrofacetGGXClosure<0>, m_N),
- CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure<0>, m_ag),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(MicrofacetGGXClosure<0>)
-};
-
-ClosureParam bsdf_microfacet_ggx_refraction_params[] = {
- CLOSURE_VECTOR_PARAM(MicrofacetGGXClosure<1>, m_N),
- CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure<1>, m_ag),
- CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure<1>, m_eta),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(MicrofacetGGXClosure<1>)
-};
-
-ClosureParam bsdf_microfacet_beckmann_params[] = {
- CLOSURE_VECTOR_PARAM(MicrofacetBeckmannClosure<0>, m_N),
- CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure<0>, m_ab),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(MicrofacetBeckmannClosure<0>)
-};
-
-ClosureParam bsdf_microfacet_beckmann_refraction_params[] = {
- CLOSURE_VECTOR_PARAM(MicrofacetBeckmannClosure<1>, m_N),
- CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure<1>, m_ab),
- CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure<1>, m_eta),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(MicrofacetBeckmannClosure<1>)
-};
+ClosureParam *bsdf_microfacet_ggx_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_VECTOR_PARAM(MicrofacetGGXClosure<0>, m_N),
+ CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure<0>, m_ag),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(MicrofacetGGXClosure<0>)
+ };
+ return params;
+}
+
+ClosureParam *bsdf_microfacet_ggx_refraction_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_VECTOR_PARAM(MicrofacetGGXClosure<1>, m_N),
+ CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure<1>, m_ag),
+ CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure<1>, m_eta),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(MicrofacetGGXClosure<1>)
+ };
+ return params;
+}
+
+ClosureParam *bsdf_microfacet_beckmann_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_VECTOR_PARAM(MicrofacetBeckmannClosure<0>, m_N),
+ CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure<0>, m_ab),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(MicrofacetBeckmannClosure<0>)
+ };
+ return params;
+}
+
+ClosureParam *bsdf_microfacet_beckmann_refraction_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_VECTOR_PARAM(MicrofacetBeckmannClosure<1>, m_N),
+ CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure<1>, m_ab),
+ CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure<1>, m_eta),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(MicrofacetBeckmannClosure<1>)
+ };
+ return params;
+}
CLOSURE_PREPARE(bsdf_microfacet_ggx_prepare, MicrofacetGGXClosure<0>)
CLOSURE_PREPARE(bsdf_microfacet_ggx_refraction_prepare, MicrofacetGGXClosure<1>)
diff --git a/intern/cycles/kernel/osl/bsdf_oren_nayar.cpp b/intern/cycles/kernel/osl/bsdf_oren_nayar.cpp
index 83d0e583695..2a00100c256 100644
--- a/intern/cycles/kernel/osl/bsdf_oren_nayar.cpp
+++ b/intern/cycles/kernel/osl/bsdf_oren_nayar.cpp
@@ -125,12 +125,16 @@ private:
}
};
-ClosureParam bsdf_oren_nayar_params[] = {
- CLOSURE_VECTOR_PARAM(OrenNayarClosure, m_N),
- CLOSURE_FLOAT_PARAM(OrenNayarClosure, m_sigma),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(OrenNayarClosure)
-};
+ClosureParam *bsdf_oren_nayar_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_VECTOR_PARAM(OrenNayarClosure, m_N),
+ CLOSURE_FLOAT_PARAM(OrenNayarClosure, m_sigma),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(OrenNayarClosure)
+ };
+ return params;
+}
CLOSURE_PREPARE(bsdf_oren_nayar_prepare, OrenNayarClosure)
diff --git a/intern/cycles/kernel/osl/bsdf_phong.cpp b/intern/cycles/kernel/osl/bsdf_phong.cpp
index 57745079d33..1f430cc6f5d 100644
--- a/intern/cycles/kernel/osl/bsdf_phong.cpp
+++ b/intern/cycles/kernel/osl/bsdf_phong.cpp
@@ -258,18 +258,28 @@ public:
-ClosureParam bsdf_phong_params[] = {
- CLOSURE_VECTOR_PARAM(PhongClosure, m_N),
- CLOSURE_FLOAT_PARAM (PhongClosure, m_exponent),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(PhongClosure) };
-
-ClosureParam bsdf_phong_ramp_params[] = {
- CLOSURE_VECTOR_PARAM (PhongRampClosure, m_N),
- CLOSURE_FLOAT_PARAM (PhongRampClosure, m_exponent),
- CLOSURE_COLOR_ARRAY_PARAM(PhongRampClosure, m_colors, PhongRampClosure::MAXCOLORS),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM (PhongRampClosure) };
+ClosureParam *bsdf_phong_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_VECTOR_PARAM(PhongClosure, m_N),
+ CLOSURE_FLOAT_PARAM (PhongClosure, m_exponent),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(PhongClosure)
+ };
+ return params;
+}
+
+ClosureParam *bsdf_phong_ramp_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_VECTOR_PARAM (PhongRampClosure, m_N),
+ CLOSURE_FLOAT_PARAM (PhongRampClosure, m_exponent),
+ CLOSURE_COLOR_ARRAY_PARAM(PhongRampClosure, m_colors, PhongRampClosure::MAXCOLORS),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM (PhongRampClosure)
+ };
+ return params;
+}
CLOSURE_PREPARE(bsdf_phong_prepare, PhongClosure)
CLOSURE_PREPARE(bsdf_phong_ramp_prepare, PhongRampClosure)
diff --git a/intern/cycles/kernel/osl/bsdf_reflection.cpp b/intern/cycles/kernel/osl/bsdf_reflection.cpp
index 7041b4ced6f..1b85ec146d3 100644
--- a/intern/cycles/kernel/osl/bsdf_reflection.cpp
+++ b/intern/cycles/kernel/osl/bsdf_reflection.cpp
@@ -97,11 +97,15 @@ public:
}
};
-ClosureParam bsdf_reflection_params[] = {
- CLOSURE_VECTOR_PARAM(ReflectionClosure, m_N),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(ReflectionClosure)
-};
+ClosureParam *bsdf_reflection_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_VECTOR_PARAM(ReflectionClosure, m_N),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(ReflectionClosure)
+ };
+ return params;
+}
CLOSURE_PREPARE(bsdf_reflection_prepare, ReflectionClosure)
diff --git a/intern/cycles/kernel/osl/bsdf_refraction.cpp b/intern/cycles/kernel/osl/bsdf_refraction.cpp
index f56ad7b127c..76ee53f7929 100644
--- a/intern/cycles/kernel/osl/bsdf_refraction.cpp
+++ b/intern/cycles/kernel/osl/bsdf_refraction.cpp
@@ -108,12 +108,16 @@ public:
}
};
-ClosureParam bsdf_refraction_params[] = {
- CLOSURE_VECTOR_PARAM(RefractionClosure, m_N),
- CLOSURE_FLOAT_PARAM(RefractionClosure, m_eta),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(RefractionClosure)
-};
+ClosureParam *bsdf_refraction_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_VECTOR_PARAM(RefractionClosure, m_N),
+ CLOSURE_FLOAT_PARAM(RefractionClosure, m_eta),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(RefractionClosure)
+ };
+ return params;
+}
CLOSURE_PREPARE(bsdf_refraction_prepare, RefractionClosure)
diff --git a/intern/cycles/kernel/osl/bsdf_transparent.cpp b/intern/cycles/kernel/osl/bsdf_transparent.cpp
index acde92530a2..29cef8e192f 100644
--- a/intern/cycles/kernel/osl/bsdf_transparent.cpp
+++ b/intern/cycles/kernel/osl/bsdf_transparent.cpp
@@ -87,10 +87,14 @@ public:
-ClosureParam bsdf_transparent_params[] = {
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(TransparentClosure)
-};
+ClosureParam *bsdf_transparent_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(TransparentClosure)
+ };
+ return params;
+}
CLOSURE_PREPARE(bsdf_transparent_prepare, TransparentClosure)
diff --git a/intern/cycles/kernel/osl/bsdf_ward.cpp b/intern/cycles/kernel/osl/bsdf_ward.cpp
index 4aacbc4ffc3..9d8d2fc4b76 100644
--- a/intern/cycles/kernel/osl/bsdf_ward.cpp
+++ b/intern/cycles/kernel/osl/bsdf_ward.cpp
@@ -211,14 +211,18 @@ public:
-ClosureParam bsdf_ward_params[] = {
- CLOSURE_VECTOR_PARAM(WardClosure, m_N),
- CLOSURE_VECTOR_PARAM(WardClosure, m_T),
- CLOSURE_FLOAT_PARAM(WardClosure, m_ax),
- CLOSURE_FLOAT_PARAM(WardClosure, m_ay),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(WardClosure)
-};
+ClosureParam *bsdf_ward_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_VECTOR_PARAM(WardClosure, m_N),
+ CLOSURE_VECTOR_PARAM(WardClosure, m_T),
+ CLOSURE_FLOAT_PARAM(WardClosure, m_ax),
+ CLOSURE_FLOAT_PARAM(WardClosure, m_ay),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(WardClosure)
+ };
+ return params;
+}
CLOSURE_PREPARE(bsdf_ward_prepare, WardClosure)
diff --git a/intern/cycles/kernel/osl/bsdf_westin.cpp b/intern/cycles/kernel/osl/bsdf_westin.cpp
index a476e8045f7..6716376ad3e 100644
--- a/intern/cycles/kernel/osl/bsdf_westin.cpp
+++ b/intern/cycles/kernel/osl/bsdf_westin.cpp
@@ -222,19 +222,27 @@ public:
-ClosureParam bsdf_westin_backscatter_params[] = {
- CLOSURE_VECTOR_PARAM(WestinBackscatterClosure, m_N),
- CLOSURE_FLOAT_PARAM(WestinBackscatterClosure, m_roughness),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(WestinBackscatterClosure)
-};
-
-ClosureParam bsdf_westin_sheen_params[] = {
- CLOSURE_VECTOR_PARAM(WestinSheenClosure, m_N),
- CLOSURE_FLOAT_PARAM(WestinSheenClosure, m_edginess),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(WestinSheenClosure)
-};
+ClosureParam *bsdf_westin_backscatter_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_VECTOR_PARAM(WestinBackscatterClosure, m_N),
+ CLOSURE_FLOAT_PARAM(WestinBackscatterClosure, m_roughness),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(WestinBackscatterClosure)
+ };
+ return params;
+}
+
+ClosureParam *bsdf_westin_sheen_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_VECTOR_PARAM(WestinSheenClosure, m_N),
+ CLOSURE_FLOAT_PARAM(WestinSheenClosure, m_edginess),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(WestinSheenClosure)
+ };
+ return params;
+}
CLOSURE_PREPARE(bsdf_westin_backscatter_prepare, WestinBackscatterClosure)
CLOSURE_PREPARE(bsdf_westin_sheen_prepare, WestinSheenClosure)
diff --git a/intern/cycles/kernel/osl/bssrdf.cpp b/intern/cycles/kernel/osl/bssrdf.cpp
index b195cf513cd..889e8a54796 100644
--- a/intern/cycles/kernel/osl/bssrdf.cpp
+++ b/intern/cycles/kernel/osl/bssrdf.cpp
@@ -94,11 +94,15 @@ public:
-ClosureParam closure_bssrdf_cubic_params[] = {
- CLOSURE_COLOR_PARAM(BSSRDFCubicClosure, m_radius),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(BSSRDFCubicClosure)
-};
+ClosureParam *closure_bssrdf_cubic_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_COLOR_PARAM(BSSRDFCubicClosure, m_radius),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(BSSRDFCubicClosure)
+ };
+ return params;
+}
CLOSURE_PREPARE(closure_bssrdf_cubic_prepare, BSSRDFCubicClosure)
diff --git a/intern/cycles/kernel/osl/debug.cpp b/intern/cycles/kernel/osl/debug.cpp
index 768a9100e8a..ee5fb30371a 100644
--- a/intern/cycles/kernel/osl/debug.cpp
+++ b/intern/cycles/kernel/osl/debug.cpp
@@ -69,11 +69,15 @@ public:
};
-ClosureParam closure_debug_params[] = {
- CLOSURE_STRING_PARAM(DebugClosure, m_tag),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(DebugClosure)
-};
+ClosureParam *closure_debug_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_STRING_PARAM(DebugClosure, m_tag),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(DebugClosure)
+ };
+ return params;
+}
CLOSURE_PREPARE(closure_debug_prepare, DebugClosure)
diff --git a/intern/cycles/kernel/osl/emissive.cpp b/intern/cycles/kernel/osl/emissive.cpp
index 0a582c3f558..3ee57cbe6b6 100644
--- a/intern/cycles/kernel/osl/emissive.cpp
+++ b/intern/cycles/kernel/osl/emissive.cpp
@@ -97,10 +97,14 @@ public:
-ClosureParam closure_emission_params[] = {
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(GenericEmissiveClosure)
-};
+ClosureParam *closure_emission_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(GenericEmissiveClosure)
+ };
+ return params;
+}
CLOSURE_PREPARE(closure_emission_prepare, GenericEmissiveClosure)
diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp
index a1a108a1b1d..9e99d4d2480 100644
--- a/intern/cycles/kernel/osl/osl_closures.cpp
+++ b/intern/cycles/kernel/osl/osl_closures.cpp
@@ -64,28 +64,28 @@ static void register_closure(OSL::ShadingSystem *ss, const char *name, int id, O
void OSLShader::register_closures(OSL::ShadingSystem *ss)
{
- register_closure(ss, "diffuse", OSL_CLOSURE_BSDF_DIFFUSE_ID, bsdf_diffuse_params, bsdf_diffuse_prepare);
- register_closure(ss, "oren_nayar", OSL_CLOSURE_BSDF_OREN_NAYAR_ID, bsdf_oren_nayar_params, bsdf_oren_nayar_prepare);
- register_closure(ss, "translucent", OSL_CLOSURE_BSDF_TRANSLUCENT_ID, bsdf_translucent_params, bsdf_translucent_prepare);
- register_closure(ss, "reflection", OSL_CLOSURE_BSDF_REFLECTION_ID, bsdf_reflection_params, bsdf_reflection_prepare);
- register_closure(ss, "refraction", OSL_CLOSURE_BSDF_REFRACTION_ID, bsdf_refraction_params, bsdf_refraction_prepare);
- register_closure(ss, "transparent", OSL_CLOSURE_BSDF_TRANSPARENT_ID, bsdf_transparent_params, bsdf_transparent_prepare);
- register_closure(ss, "microfacet_ggx", OSL_CLOSURE_BSDF_MICROFACET_GGX_ID, bsdf_microfacet_ggx_params, bsdf_microfacet_ggx_prepare);
- register_closure(ss, "microfacet_ggx_refraction", OSL_CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID, bsdf_microfacet_ggx_refraction_params, bsdf_microfacet_ggx_refraction_prepare);
- register_closure(ss, "microfacet_beckmann", OSL_CLOSURE_BSDF_MICROFACET_BECKMANN_ID, bsdf_microfacet_beckmann_params, bsdf_microfacet_beckmann_prepare);
- register_closure(ss, "microfacet_beckmann_refraction", OSL_CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID, bsdf_microfacet_beckmann_refraction_params, bsdf_microfacet_beckmann_refraction_prepare);
- register_closure(ss, "ward", OSL_CLOSURE_BSDF_WARD_ID, bsdf_ward_params, bsdf_ward_prepare);
- register_closure(ss, "phong", OSL_CLOSURE_BSDF_PHONG_ID, bsdf_phong_params, bsdf_phong_prepare);
- register_closure(ss, "phong_ramp", OSL_CLOSURE_BSDF_PHONG_RAMP_ID, bsdf_phong_ramp_params, bsdf_phong_ramp_prepare);
- register_closure(ss, "ashikhmin_velvet", OSL_CLOSURE_BSDF_ASHIKHMIN_VELVET_ID, bsdf_ashikhmin_velvet_params, bsdf_ashikhmin_velvet_prepare);
- register_closure(ss, "westin_backscatter", OSL_CLOSURE_BSDF_WESTIN_BACKSCATTER_ID, bsdf_westin_backscatter_params, bsdf_westin_backscatter_prepare);
- register_closure(ss, "westin_sheen", OSL_CLOSURE_BSDF_WESTIN_SHEEN_ID, bsdf_westin_sheen_params, bsdf_westin_sheen_prepare);
- register_closure(ss, "bssrdf_cubic", OSL_CLOSURE_BSSRDF_CUBIC_ID, closure_bssrdf_cubic_params, closure_bssrdf_cubic_prepare);
- register_closure(ss, "emission", OSL_CLOSURE_EMISSION_ID, closure_emission_params, closure_emission_prepare);
- register_closure(ss, "debug", OSL_CLOSURE_DEBUG_ID, closure_debug_params, closure_debug_prepare);
- register_closure(ss, "background", OSL_CLOSURE_BACKGROUND_ID, closure_background_params, closure_background_prepare);
- register_closure(ss, "holdout", OSL_CLOSURE_HOLDOUT_ID, closure_holdout_params, closure_holdout_prepare);
- register_closure(ss, "subsurface", OSL_CLOSURE_SUBSURFACE_ID, closure_subsurface_params, closure_subsurface_prepare);
+ register_closure(ss, "diffuse", OSL_CLOSURE_BSDF_DIFFUSE_ID, bsdf_diffuse_params(), bsdf_diffuse_prepare);
+ register_closure(ss, "oren_nayar", OSL_CLOSURE_BSDF_OREN_NAYAR_ID, bsdf_oren_nayar_params(), bsdf_oren_nayar_prepare);
+ register_closure(ss, "translucent", OSL_CLOSURE_BSDF_TRANSLUCENT_ID, bsdf_translucent_params(), bsdf_translucent_prepare);
+ register_closure(ss, "reflection", OSL_CLOSURE_BSDF_REFLECTION_ID, bsdf_reflection_params(), bsdf_reflection_prepare);
+ register_closure(ss, "refraction", OSL_CLOSURE_BSDF_REFRACTION_ID, bsdf_refraction_params(), bsdf_refraction_prepare);
+ register_closure(ss, "transparent", OSL_CLOSURE_BSDF_TRANSPARENT_ID, bsdf_transparent_params(), bsdf_transparent_prepare);
+ register_closure(ss, "microfacet_ggx", OSL_CLOSURE_BSDF_MICROFACET_GGX_ID, bsdf_microfacet_ggx_params(), bsdf_microfacet_ggx_prepare);
+ register_closure(ss, "microfacet_ggx_refraction", OSL_CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID, bsdf_microfacet_ggx_refraction_params(), bsdf_microfacet_ggx_refraction_prepare);
+ register_closure(ss, "microfacet_beckmann", OSL_CLOSURE_BSDF_MICROFACET_BECKMANN_ID, bsdf_microfacet_beckmann_params(), bsdf_microfacet_beckmann_prepare);
+ register_closure(ss, "microfacet_beckmann_refraction", OSL_CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID, bsdf_microfacet_beckmann_refraction_params(), bsdf_microfacet_beckmann_refraction_prepare);
+ register_closure(ss, "ward", OSL_CLOSURE_BSDF_WARD_ID, bsdf_ward_params(), bsdf_ward_prepare);
+ register_closure(ss, "phong", OSL_CLOSURE_BSDF_PHONG_ID, bsdf_phong_params(), bsdf_phong_prepare);
+ register_closure(ss, "phong_ramp", OSL_CLOSURE_BSDF_PHONG_RAMP_ID, bsdf_phong_ramp_params(), bsdf_phong_ramp_prepare);
+ register_closure(ss, "ashikhmin_velvet", OSL_CLOSURE_BSDF_ASHIKHMIN_VELVET_ID, bsdf_ashikhmin_velvet_params(), bsdf_ashikhmin_velvet_prepare);
+ register_closure(ss, "westin_backscatter", OSL_CLOSURE_BSDF_WESTIN_BACKSCATTER_ID, bsdf_westin_backscatter_params(), bsdf_westin_backscatter_prepare);
+ register_closure(ss, "westin_sheen", OSL_CLOSURE_BSDF_WESTIN_SHEEN_ID, bsdf_westin_sheen_params(), bsdf_westin_sheen_prepare);
+ register_closure(ss, "bssrdf_cubic", OSL_CLOSURE_BSSRDF_CUBIC_ID, closure_bssrdf_cubic_params(), closure_bssrdf_cubic_prepare);
+ register_closure(ss, "emission", OSL_CLOSURE_EMISSION_ID, closure_emission_params(), closure_emission_prepare);
+ register_closure(ss, "debug", OSL_CLOSURE_DEBUG_ID, closure_debug_params(), closure_debug_prepare);
+ register_closure(ss, "background", OSL_CLOSURE_BACKGROUND_ID, closure_background_params(), closure_background_prepare);
+ register_closure(ss, "holdout", OSL_CLOSURE_HOLDOUT_ID, closure_holdout_params(), closure_holdout_prepare);
+ register_closure(ss, "subsurface", OSL_CLOSURE_SUBSURFACE_ID, closure_subsurface_params(), closure_subsurface_prepare);
}
CCL_NAMESPACE_END
diff --git a/intern/cycles/kernel/osl/osl_closures.h b/intern/cycles/kernel/osl/osl_closures.h
index 00794183ca5..a69af45672d 100644
--- a/intern/cycles/kernel/osl/osl_closures.h
+++ b/intern/cycles/kernel/osl/osl_closures.h
@@ -64,28 +64,28 @@ enum {
OSL_CLOSURE_SUBSURFACE_ID
};
-extern OSL::ClosureParam bsdf_diffuse_params[];
-extern OSL::ClosureParam bsdf_oren_nayar_params[];
-extern OSL::ClosureParam bsdf_translucent_params[];
-extern OSL::ClosureParam bsdf_reflection_params[];
-extern OSL::ClosureParam bsdf_refraction_params[];
-extern OSL::ClosureParam bsdf_transparent_params[];
-extern OSL::ClosureParam bsdf_microfacet_ggx_params[];
-extern OSL::ClosureParam bsdf_microfacet_ggx_refraction_params[];
-extern OSL::ClosureParam bsdf_microfacet_beckmann_params[];
-extern OSL::ClosureParam bsdf_microfacet_beckmann_refraction_params[];
-extern OSL::ClosureParam bsdf_ward_params[];
-extern OSL::ClosureParam bsdf_phong_params[];
-extern OSL::ClosureParam bsdf_phong_ramp_params[];
-extern OSL::ClosureParam bsdf_ashikhmin_velvet_params[];
-extern OSL::ClosureParam bsdf_westin_backscatter_params[];
-extern OSL::ClosureParam bsdf_westin_sheen_params[];
-extern OSL::ClosureParam closure_bssrdf_cubic_params[];
-extern OSL::ClosureParam closure_emission_params[];
-extern OSL::ClosureParam closure_debug_params[];
-extern OSL::ClosureParam closure_background_params[];
-extern OSL::ClosureParam closure_holdout_params[];
-extern OSL::ClosureParam closure_subsurface_params[];
+OSL::ClosureParam *bsdf_diffuse_params();
+OSL::ClosureParam *bsdf_oren_nayar_params();
+OSL::ClosureParam *bsdf_translucent_params();
+OSL::ClosureParam *bsdf_reflection_params();
+OSL::ClosureParam *bsdf_refraction_params();
+OSL::ClosureParam *bsdf_transparent_params();
+OSL::ClosureParam *bsdf_microfacet_ggx_params();
+OSL::ClosureParam *bsdf_microfacet_ggx_refraction_params();
+OSL::ClosureParam *bsdf_microfacet_beckmann_params();
+OSL::ClosureParam *bsdf_microfacet_beckmann_refraction_params();
+OSL::ClosureParam *bsdf_ward_params();
+OSL::ClosureParam *bsdf_phong_params();
+OSL::ClosureParam *bsdf_phong_ramp_params();
+OSL::ClosureParam *bsdf_ashikhmin_velvet_params();
+OSL::ClosureParam *bsdf_westin_backscatter_params();
+OSL::ClosureParam *bsdf_westin_sheen_params();
+OSL::ClosureParam *closure_bssrdf_cubic_params();
+OSL::ClosureParam *closure_emission_params();
+OSL::ClosureParam *closure_debug_params();
+OSL::ClosureParam *closure_background_params();
+OSL::ClosureParam *closure_holdout_params();
+OSL::ClosureParam *closure_subsurface_params();
void bsdf_diffuse_prepare(OSL::RendererServices *, int id, void *data);
void bsdf_oren_nayar_prepare(OSL::RendererServices *, int id, void *data);
diff --git a/intern/cycles/kernel/osl/vol_subsurface.cpp b/intern/cycles/kernel/osl/vol_subsurface.cpp
index 818a057b6cc..5845428ed43 100644
--- a/intern/cycles/kernel/osl/vol_subsurface.cpp
+++ b/intern/cycles/kernel/osl/vol_subsurface.cpp
@@ -122,14 +122,18 @@ public:
-ClosureParam closure_subsurface_params[] = {
- CLOSURE_FLOAT_PARAM(SubsurfaceClosure, m_eta),
- CLOSURE_FLOAT_PARAM(SubsurfaceClosure, m_g),
- CLOSURE_COLOR_PARAM(SubsurfaceClosure, m_mfp),
- CLOSURE_COLOR_PARAM(SubsurfaceClosure, m_albedo),
- CLOSURE_STRING_KEYPARAM("label"),
- CLOSURE_FINISH_PARAM(SubsurfaceClosure)
-};
+ClosureParam *closure_subsurface_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_FLOAT_PARAM(SubsurfaceClosure, m_eta),
+ CLOSURE_FLOAT_PARAM(SubsurfaceClosure, m_g),
+ CLOSURE_COLOR_PARAM(SubsurfaceClosure, m_mfp),
+ CLOSURE_COLOR_PARAM(SubsurfaceClosure, m_albedo),
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(SubsurfaceClosure)
+ };
+ return params;
+}
CLOSURE_PREPARE(closure_subsurface_prepare, SubsurfaceClosure)