diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/osl/bsdf_diffuse_ramp.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/bsdf_phong_ramp.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_bssrdf.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_closures.h | 9 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_shader.cpp | 4 |
5 files changed, 23 insertions, 2 deletions
diff --git a/intern/cycles/kernel/osl/bsdf_diffuse_ramp.cpp b/intern/cycles/kernel/osl/bsdf_diffuse_ramp.cpp index 0e8193aa68c..8f9c2efd470 100644 --- a/intern/cycles/kernel/osl/bsdf_diffuse_ramp.cpp +++ b/intern/cycles/kernel/osl/bsdf_diffuse_ramp.cpp @@ -50,6 +50,9 @@ public: float3 fcolors[8]; DiffuseRampClosure() : CBSDFClosure(LABEL_DIFFUSE) + {} + + void setup() { sc.prim = this; m_shaderdata_flag = bsdf_diffuse_ramp_setup(&sc); diff --git a/intern/cycles/kernel/osl/bsdf_phong_ramp.cpp b/intern/cycles/kernel/osl/bsdf_phong_ramp.cpp index 3c95bfc119e..c5851747b54 100644 --- a/intern/cycles/kernel/osl/bsdf_phong_ramp.cpp +++ b/intern/cycles/kernel/osl/bsdf_phong_ramp.cpp @@ -49,6 +49,9 @@ public: float3 fcolors[8]; PhongRampClosure() : CBSDFClosure(LABEL_GLOSSY) + {} + + void setup() { sc.prim = this; m_shaderdata_flag = bsdf_phong_ramp_setup(&sc); diff --git a/intern/cycles/kernel/osl/osl_bssrdf.cpp b/intern/cycles/kernel/osl/osl_bssrdf.cpp index 887015c886e..94337290d20 100644 --- a/intern/cycles/kernel/osl/osl_bssrdf.cpp +++ b/intern/cycles/kernel/osl/osl_bssrdf.cpp @@ -52,6 +52,9 @@ using namespace OSL; class CubicBSSRDFClosure : public CBSSRDFClosure { public: CubicBSSRDFClosure() + {} + + void setup() { sc.type = CLOSURE_BSSRDF_CUBIC_ID; sc.data0 = fabsf(average(radius)); @@ -90,6 +93,9 @@ CCLOSURE_PREPARE(closure_bssrdf_cubic_prepare, CubicBSSRDFClosure) class GaussianBSSRDFClosure : public CBSSRDFClosure { public: GaussianBSSRDFClosure() + {} + + void setup() { sc.type = CLOSURE_BSSRDF_GAUSSIAN_ID; sc.data0 = fabsf(average(radius)); diff --git a/intern/cycles/kernel/osl/osl_closures.h b/intern/cycles/kernel/osl/osl_closures.h index 46d645d69b1..b6c38e01b23 100644 --- a/intern/cycles/kernel/osl/osl_closures.h +++ b/intern/cycles/kernel/osl/osl_closures.h @@ -96,8 +96,9 @@ public: AmbientOcclusion, ///< Ambient occlusion }; - CClosurePrimitive (Category category_) : category (category_) { } + CClosurePrimitive (Category category_) : category (category_) {} virtual ~CClosurePrimitive() {} + virtual void setup() {} Category category; }; @@ -110,7 +111,7 @@ public: CBSDFClosure(int scattering) : CClosurePrimitive(BSDF), m_scattering_label(scattering), m_shaderdata_flag(0) - { } + {} int scattering() const { return m_scattering_label; } int shaderdata_flag() const { return m_shaderdata_flag; } @@ -136,6 +137,10 @@ class Upper##Closure : public CBSDFClosure { \ public: \ Upper##Closure() : CBSDFClosure(TYPE) \ { \ + } \ +\ + void setup() \ + { \ sc.prim = NULL; \ m_shaderdata_flag = bsdf_##lower##_setup(&sc); \ } \ diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp index 146736ba799..f2be61eb535 100644 --- a/intern/cycles/kernel/osl/osl_shader.cpp +++ b/intern/cycles/kernel/osl/osl_shader.cpp @@ -156,6 +156,8 @@ static void flatten_surface_closure_tree(ShaderData *sd, int path_flag, sc.weight = weight; #endif + prim->setup(); + switch (prim->category) { case CClosurePrimitive::BSDF: { CBSDFClosure *bsdf = (CBSDFClosure *)prim; @@ -395,6 +397,8 @@ static void flatten_volume_closure_tree(ShaderData *sd, sc.weight = weight; #endif + prim->setup(); + switch (prim->category) { case CClosurePrimitive::Volume: { /* sample weight */ |