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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-14 13:13:43 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-14 13:24:15 +0300
commitb50cf33d917b3e0fe7152cff96996e5a850c68d4 (patch)
tree775a7e8a6129e634d8a4982671fa0999a76444e7 /intern/cycles/kernel/osl/osl_closures.cpp
parent9fecac32d9e9f3e6dd69f89fe4ceaddcecaf1277 (diff)
Fix T64515, T60434: crash in OSL and preview render after recent changes
The refactoring of texture handles did not take into account that render services are shared between multiple render session. Now the texture to handle map is also shared between render sessions.
Diffstat (limited to 'intern/cycles/kernel/osl/osl_closures.cpp')
-rw-r--r--intern/cycles/kernel/osl/osl_closures.cpp63
1 files changed, 31 insertions, 32 deletions
diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp
index 7152a56bd70..27205df3732 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(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ void setup(ShaderData *sd, int path_flag, float3 weight)
{
- if (!skip(kg, sd, path_flag, LABEL_GLOSSY)) {
+ if (!skip(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(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ void setup(ShaderData *sd, int path_flag, float3 weight)
{
MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
@@ -471,13 +471,12 @@ void OSLShader::register_closures(OSLShadingSystem *ss_)
/* BSDF Closure */
-bool CBSDFClosure::skip(const KernelGlobals *kg,
- const ShaderData *sd,
- int path_flag,
- int scattering)
+bool CBSDFClosure::skip(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;
@@ -495,12 +494,12 @@ class MicrofacetFresnelClosure : public CBSDFClosure {
float3 color;
float3 cspec0;
- MicrofacetBsdf *alloc(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ MicrofacetBsdf *alloc(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(kg, sd, path_flag, LABEL_GLOSSY | LABEL_REFLECT)) {
+ if (skip(sd, path_flag, LABEL_GLOSSY | LABEL_REFLECT)) {
return NULL;
}
@@ -525,9 +524,9 @@ class MicrofacetFresnelClosure : public CBSDFClosure {
class MicrofacetGGXFresnelClosure : public MicrofacetFresnelClosure {
public:
- void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ void setup(ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -554,9 +553,9 @@ CCLOSURE_PREPARE(closure_bsdf_microfacet_ggx_fresnel_prepare, MicrofacetGGXFresn
class MicrofacetGGXAnisoFresnelClosure : public MicrofacetFresnelClosure {
public:
- void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ void setup(ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -589,12 +588,12 @@ class MicrofacetMultiClosure : public CBSDFClosure {
MicrofacetBsdf params;
float3 color;
- MicrofacetBsdf *alloc(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ MicrofacetBsdf *alloc(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(kg, sd, path_flag, LABEL_GLOSSY | LABEL_REFLECT)) {
+ if (skip(sd, path_flag, LABEL_GLOSSY | LABEL_REFLECT)) {
return NULL;
}
@@ -619,9 +618,9 @@ class MicrofacetMultiClosure : public CBSDFClosure {
class MicrofacetMultiGGXClosure : public MicrofacetMultiClosure {
public:
- void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ void setup(ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -647,9 +646,9 @@ CCLOSURE_PREPARE(closure_bsdf_microfacet_multi_ggx_prepare, MicrofacetMultiGGXCl
class MicrofacetMultiGGXAnisoClosure : public MicrofacetMultiClosure {
public:
- void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ void setup(ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -679,9 +678,9 @@ class MicrofacetMultiGGXGlassClosure : public MicrofacetMultiClosure {
{
}
- void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ void setup(ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -713,12 +712,12 @@ class MicrofacetMultiFresnelClosure : public CBSDFClosure {
float3 color;
float3 cspec0;
- MicrofacetBsdf *alloc(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ MicrofacetBsdf *alloc(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(kg, sd, path_flag, LABEL_GLOSSY | LABEL_REFLECT)) {
+ if (skip(sd, path_flag, LABEL_GLOSSY | LABEL_REFLECT)) {
return NULL;
}
@@ -743,9 +742,9 @@ class MicrofacetMultiFresnelClosure : public CBSDFClosure {
class MicrofacetMultiGGXFresnelClosure : public MicrofacetMultiFresnelClosure {
public:
- void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ void setup(ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -773,9 +772,9 @@ CCLOSURE_PREPARE(closure_bsdf_microfacet_multi_ggx_fresnel_prepare,
class MicrofacetMultiGGXAnisoFresnelClosure : public MicrofacetMultiFresnelClosure {
public:
- void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ void setup(ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -807,9 +806,9 @@ class MicrofacetMultiGGXGlassFresnelClosure : public MicrofacetMultiFresnelClosu
{
}
- void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ void setup(ShaderData *sd, int path_flag, float3 weight)
{
- MicrofacetBsdf *bsdf = alloc(kg, sd, path_flag, weight);
+ MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight);
if (!bsdf) {
return;
}
@@ -842,7 +841,7 @@ class TransparentClosure : public CBSDFClosure {
ShaderClosure params;
float3 unused;
- void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ void setup(ShaderData *sd, int path_flag, float3 weight)
{
bsdf_transparent_setup(sd, weight, path_flag);
}
@@ -861,7 +860,7 @@ CCLOSURE_PREPARE(closure_bsdf_transparent_prepare, TransparentClosure)
class VolumeAbsorptionClosure : public CBSDFClosure {
public:
- void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ void setup(ShaderData *sd, int path_flag, float3 weight)
{
volume_extinction_setup(sd, weight);
}
@@ -880,7 +879,7 @@ class VolumeHenyeyGreensteinClosure : public CBSDFClosure {
public:
HenyeyGreensteinVolume params;
- void setup(const KernelGlobals *kg, ShaderData *sd, int path_flag, float3 weight)
+ void setup(ShaderData *sd, int path_flag, float3 weight)
{
volume_extinction_setup(sd, weight);