Revert "Use one context per OSL thread. Not sure if this actually works, but the...
[blender.git] / intern / cycles / kernel / kernel_path.h
index 8e3a0c6e628aef8c06a7f8dba3ba470ba340ab47..6c81fa4cfcad6d5e91be5b4baed2d1cf7c7f11be 100644 (file)
@@ -395,6 +395,8 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
                label = shader_bsdf_sample(kg, &sd, bsdf_u, bsdf_v, &bsdf_eval,
                        &bsdf_omega_in, &bsdf_domega_in, &bsdf_pdf);
 
+               shader_release(kg, &sd);
+
                if(bsdf_pdf == 0.0f || bsdf_eval_is_zero(&bsdf_eval))
                        break;
 
@@ -567,6 +569,8 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
                label = shader_bsdf_sample(kg, &sd, bsdf_u, bsdf_v, &bsdf_eval,
                        &bsdf_omega_in, &bsdf_domega_in, &bsdf_pdf);
 
+               shader_release(kg, &sd);
+
                if(bsdf_pdf == 0.0f || bsdf_eval_is_zero(&bsdf_eval))
                        break;
 
@@ -858,6 +862,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
 
                /* continue in case of transparency */
                throughput *= shader_bsdf_transparency(kg, &sd);
+               shader_release(kg, &sd);
 
                if(is_zero(throughput))
                        break;