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
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/kernel/osl/osl_closures.cpp')
-rw-r--r--intern/cycles/kernel/osl/osl_closures.cpp63
1 files changed, 32 insertions, 31 deletions
diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp
index 27205df3732..7152a56bd70 100644
--- a/intern/cycles/kernel/osl/osl_closures.cpp
+++ b/intern/cycles/kernel/osl/osl_closures.cpp
@@ -227,9 +227,9 @@ CLOSURE_FLOAT3_PARAM(DiffuseClosure, params.N),
return bsdf;
}
- void setup(ShaderData *sd, int path_flag, float3 weight)
+ void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
- if (!skip(sd, path_flag, LABEL_GLOSSY)) {
+ if (!skip(kg, sd, path_flag, LABEL_GLOSSY)) {
PrincipledHairBSDF *bsdf = (PrincipledHairBSDF *)alloc(sd, path_flag, weight);
if (!bsdf) {
return;
@@ -287,7 +287,7 @@ class PrincipledClearcoatClosure : public CBSDFClosure {
return bsdf;
}
- void setup(ShaderData *sd, int path_flag, float3 weight)
+ void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
@@ -471,12 +471,13 @@ void OSLShader::register_closures(OSLShadingSystem *ss_)
/* BSDF Closure */
-bool CBSDFClosure::skip(const ShaderData *sd, int path_flag, int scattering)
+bool CBSDFClosure::skip(const KernelGlobals *kg,
+ const ShaderData *sd,
+ int path_flag,
+ int scattering)
{
/* caustic options */
if ((scattering & LABEL_GLOSSY) && (path_flag & PATH_RAY_DIFFUSE)) {
- KernelGlobals *kg = sd->osl_globals;
-
if ((!kernel_data.integrator.caustics_reflective && (scattering & LABEL_REFLECT)) ||
(!kernel_data.integrator.caustics_refractive && (scattering & LABEL_TRANSMIT))) {
return true;
@@ -494,12 +495,12 @@ class MicrofacetFresnelClosure : public CBSDFClosure {
float3 color;
float3 cspec0;
- MicrofacetBsdf *alloc(ShaderData *sd, int path_flag, float3 weight)
+ MicrofacetBsdf *alloc(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
/* Technically, the MultiGGX Glass closure may also transmit. However,
* since this is set statically and only used for caustic flags, this
* is probably as good as it gets. */
- if (skip(sd, path_flag, LABEL_GLOSSY | LABEL_REFLECT)) {
+ if (skip(kg, sd, path_flag, LABEL_GLOSSY | LABEL_REFLECT)) {
return NULL;
}
@@ -524,9 +525,9 @@ class MicrofacetFresnelClosure : public CBSDFClosure {
class MicrofacetGGXFresnelClosure : public MicrofacetFresnelClosure {
public:
- void setup(ShaderData *sd, int path_flag, float3 weight)
+ void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -553,9 +554,9 @@ CCLOSURE_PREPARE(closure_bsdf_microfacet_ggx_fresnel_prepare, MicrofacetGGXFresn
class MicrofacetGGXAnisoFresnelClosure : public MicrofacetFresnelClosure {
public:
- void setup(ShaderData *sd, int path_flag, float3 weight)
+ void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -588,12 +589,12 @@ class MicrofacetMultiClosure : public CBSDFClosure {
MicrofacetBsdf params;
float3 color;
- MicrofacetBsdf *alloc(ShaderData *sd, int path_flag, float3 weight)
+ MicrofacetBsdf *alloc(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
/* Technically, the MultiGGX closure may also transmit. However,
* since this is set statically and only used for caustic flags, this
* is probably as good as it gets. */
- if (skip(sd, path_flag, LABEL_GLOSSY | LABEL_REFLECT)) {
+ if (skip(kg, sd, path_flag, LABEL_GLOSSY | LABEL_REFLECT)) {
return NULL;
}
@@ -618,9 +619,9 @@ class MicrofacetMultiClosure : public CBSDFClosure {
class MicrofacetMultiGGXClosure : public MicrofacetMultiClosure {
public:
- void setup(ShaderData *sd, int path_flag, float3 weight)
+ void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -646,9 +647,9 @@ CCLOSURE_PREPARE(closure_bsdf_microfacet_multi_ggx_prepare, MicrofacetMultiGGXCl
class MicrofacetMultiGGXAnisoClosure : public MicrofacetMultiClosure {
public:
- void setup(ShaderData *sd, int path_flag, float3 weight)
+ void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -678,9 +679,9 @@ class MicrofacetMultiGGXGlassClosure : public MicrofacetMultiClosure {
{
}
- void setup(ShaderData *sd, int path_flag, float3 weight)
+ void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -712,12 +713,12 @@ class MicrofacetMultiFresnelClosure : public CBSDFClosure {
float3 color;
float3 cspec0;
- MicrofacetBsdf *alloc(ShaderData *sd, int path_flag, float3 weight)
+ MicrofacetBsdf *alloc(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
/* Technically, the MultiGGX closure may also transmit. However,
* since this is set statically and only used for caustic flags, this
* is probably as good as it gets. */
- if (skip(sd, path_flag, LABEL_GLOSSY | LABEL_REFLECT)) {
+ if (skip(kg, sd, path_flag, LABEL_GLOSSY | LABEL_REFLECT)) {
return NULL;
}
@@ -742,9 +743,9 @@ class MicrofacetMultiFresnelClosure : public CBSDFClosure {
class MicrofacetMultiGGXFresnelClosure : public MicrofacetMultiFresnelClosure {
public:
- void setup(ShaderData *sd, int path_flag, float3 weight)
+ void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -772,9 +773,9 @@ CCLOSURE_PREPARE(closure_bsdf_microfacet_multi_ggx_fresnel_prepare,
class MicrofacetMultiGGXAnisoFresnelClosure : public MicrofacetMultiFresnelClosure {
public:
- void setup(ShaderData *sd, int path_flag, float3 weight)
+ void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -806,9 +807,9 @@ class MicrofacetMultiGGXGlassFresnelClosure : public MicrofacetMultiFresnelClosu
{
}
- void setup(ShaderData *sd, int path_flag, float3 weight)
+ void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -841,7 +842,7 @@ class TransparentClosure : public CBSDFClosure {
ShaderClosure params;
float3 unused;
- void setup(ShaderData *sd, int path_flag, float3 weight)
+ void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
bsdf_transparent_setup(sd, weight, path_flag);
}
@@ -860,7 +861,7 @@ CCLOSURE_PREPARE(closure_bsdf_transparent_prepare, TransparentClosure)
class VolumeAbsorptionClosure : public CBSDFClosure {
public:
- void setup(ShaderData *sd, int path_flag, float3 weight)
+ void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
volume_extinction_setup(sd, weight);
}
@@ -879,7 +880,7 @@ class VolumeHenyeyGreensteinClosure : public CBSDFClosure {
public:
HenyeyGreensteinVolume params;
- void setup(ShaderData *sd, int path_flag, float3 weight)
+ void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
{
volume_extinction_setup(sd, weight);