[Bf-blender-cvs] [f353f129ec3] principled-v2: Fix compilation with OSL, support for v2 is still missing

Lukas Stockner noreply at git.blender.org
Mon Jul 4 23:56:17 CEST 2022


Commit: f353f129ec3775dd744561889f70fd1503698b0b
Author: Lukas Stockner
Date:   Mon Jul 4 23:31:48 2022 +0200
Branches: principled-v2
https://developer.blender.org/rBf353f129ec3775dd744561889f70fd1503698b0b

Fix compilation with OSL, support for v2 is still missing

===================================================================

M	intern/cycles/kernel/closure/bsdf_microfacet_glass.h
M	intern/cycles/kernel/closure/bsdf_microfacet_util.h
M	intern/cycles/kernel/osl/closures.cpp

===================================================================

diff --git a/intern/cycles/kernel/closure/bsdf_microfacet_glass.h b/intern/cycles/kernel/closure/bsdf_microfacet_glass.h
index 1fd65f676a6..8001cd8fb17 100644
--- a/intern/cycles/kernel/closure/bsdf_microfacet_glass.h
+++ b/intern/cycles/kernel/closure/bsdf_microfacet_glass.h
@@ -3,6 +3,8 @@
 
 #pragma once
 
+#include "kernel/sample/lcg.h"
+
 CCL_NAMESPACE_BEGIN
 
 ccl_device_inline float3
diff --git a/intern/cycles/kernel/closure/bsdf_microfacet_util.h b/intern/cycles/kernel/closure/bsdf_microfacet_util.h
index 8a412601903..e6688e8a82b 100644
--- a/intern/cycles/kernel/closure/bsdf_microfacet_util.h
+++ b/intern/cycles/kernel/closure/bsdf_microfacet_util.h
@@ -5,6 +5,8 @@
 
 #include "kernel/closure/bsdf_util.h"
 
+#include "kernel/util/lookup_table.h"
+
 CCL_NAMESPACE_BEGIN
 
 /* GGX microfacet with Smith shadow-masking from:
diff --git a/intern/cycles/kernel/osl/closures.cpp b/intern/cycles/kernel/osl/closures.cpp
index 39157f0b796..e80b7aa1fd5 100644
--- a/intern/cycles/kernel/osl/closures.cpp
+++ b/intern/cycles/kernel/osl/closures.cpp
@@ -27,7 +27,7 @@
 #include "kernel/closure/bsdf_diffuse.h"
 #include "kernel/closure/bsdf_microfacet.h"
 #include "kernel/closure/bsdf_microfacet_beckmann.h"
-#include "kernel/closure/bsdf_microfacet_multi.h"
+#include "kernel/closure/bsdf_microfacet_glass.h"
 #include "kernel/closure/bsdf_oren_nayar.h"
 #include "kernel/closure/bsdf_reflection.h"
 #include "kernel/closure/bsdf_refraction.h"
@@ -681,14 +681,7 @@ class MicrofacetMultiClosure : public CBSDFClosure {
       return NULL;
     }
 
-    MicrofacetExtra *extra = (MicrofacetExtra *)closure_alloc_extra(sd, sizeof(MicrofacetExtra));
-    if (!extra) {
-      return NULL;
-    }
-
-    bsdf->extra = extra;
-    bsdf->extra->color = color;
-    bsdf->extra->cspec0 = make_float3(0.0f, 0.0f, 0.0f);
+    bsdf->extra = NULL;
     return bsdf;
   }
 };
@@ -704,10 +697,12 @@ class MicrofacetMultiGGXClosure : public MicrofacetMultiClosure {
       return;
     }
 
+    const KernelGlobalsCPU *kg = sd->osl_globals;
+
     bsdf->ior = 0.0f;
     bsdf->T = make_float3(0.0f, 0.0f, 0.0f);
     bsdf->alpha_y = bsdf->alpha_x;
-    sd->flag |= bsdf_microfacet_multi_ggx_setup(bsdf);
+    sd->flag |= bsdf_microfacet_multi_ggx_setup(kg, bsdf, sd, color);
   }
 };
 
@@ -734,8 +729,10 @@ class MicrofacetMultiGGXAnisoClosure : public MicrofacetMultiClosure {
       return;
     }
 
+    const KernelGlobalsCPU *kg = sd->osl_globals;
+
     bsdf->ior = 0.0f;
-    sd->flag |= bsdf_microfacet_multi_ggx_setup(bsdf);
+    sd->flag |= bsdf_microfacet_multi_ggx_setup(kg, bsdf, sd, color);
   }
 };
 
@@ -768,9 +765,11 @@ class MicrofacetMultiGGXGlassClosure : public MicrofacetMultiClosure {
       return;
     }
 
+    const KernelGlobalsCPU *kg = sd->osl_globals;
+
     bsdf->T = make_float3(0.0f, 0.0f, 0.0f);
     bsdf->alpha_y = bsdf->alpha_x;
-    sd->flag |= bsdf_microfacet_multi_ggx_glass_setup(bsdf);
+    sd->flag |= bsdf_microfacet_multi_ggx_glass_setup(kg, bsdf, sd, color);
   }
 };
 
@@ -833,9 +832,11 @@ class MicrofacetMultiGGXFresnelClosure : public MicrofacetMultiFresnelClosure {
       return;
     }
 
+    const KernelGlobalsCPU *kg = sd->osl_globals;
+
     bsdf->T = make_float3(0.0f, 0.0f, 0.0f);
     bsdf->alpha_y = bsdf->alpha_x;
-    sd->flag |= bsdf_microfacet_multi_ggx_fresnel_setup(bsdf, sd);
+    sd->flag |= bsdf_microfacet_multi_ggx_fresnel_setup(kg, bsdf, sd);
   }
 };
 
@@ -865,7 +866,9 @@ class MicrofacetMultiGGXAnisoFresnelClosure : public MicrofacetMultiFresnelClosu
       return;
     }
 
-    sd->flag |= bsdf_microfacet_multi_ggx_fresnel_setup(bsdf, sd);
+    const KernelGlobalsCPU *kg = sd->osl_globals;
+
+    sd->flag |= bsdf_microfacet_multi_ggx_fresnel_setup(kg, bsdf, sd);
   }
 };
 
@@ -901,9 +904,11 @@ class MicrofacetMultiGGXGlassFresnelClosure : public MicrofacetMultiFresnelClosu
       return;
     }
 
+    const KernelGlobalsCPU *kg = sd->osl_globals;
+
     bsdf->T = make_float3(0.0f, 0.0f, 0.0f);
     bsdf->alpha_y = bsdf->alpha_x;
-    sd->flag |= bsdf_microfacet_multi_ggx_glass_fresnel_setup(bsdf, sd);
+    sd->flag |= bsdf_microfacet_multi_ggx_glass_fresnel_setup(kg, bsdf, sd);
   }
 };



More information about the Bf-blender-cvs mailing list