From fc4b1fede385687acb2cf7f82591aa43097110a9 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 17 Oct 2021 20:09:45 +0200 Subject: Cleanup: consistently use uint32_t for path flag --- intern/cycles/kernel/osl/background.cpp | 4 +-- intern/cycles/kernel/osl/bsdf_diffuse_ramp.cpp | 2 +- intern/cycles/kernel/osl/bsdf_phong_ramp.cpp | 2 +- intern/cycles/kernel/osl/emissive.cpp | 2 +- intern/cycles/kernel/osl/osl_bssrdf.cpp | 4 +-- intern/cycles/kernel/osl/osl_closures.cpp | 42 +++++++++++++------------- intern/cycles/kernel/osl/osl_closures.h | 6 ++-- intern/cycles/kernel/osl/osl_shader.cpp | 10 +++--- intern/cycles/kernel/osl/osl_shader.h | 6 ++-- 9 files changed, 39 insertions(+), 39 deletions(-) (limited to 'intern/cycles/kernel/osl') diff --git a/intern/cycles/kernel/osl/background.cpp b/intern/cycles/kernel/osl/background.cpp index 8e497986dcc..bb290a5ced2 100644 --- a/intern/cycles/kernel/osl/background.cpp +++ b/intern/cycles/kernel/osl/background.cpp @@ -54,7 +54,7 @@ using namespace OSL; /// class GenericBackgroundClosure : public CClosurePrimitive { public: - void setup(ShaderData *sd, int /* path_flag */, float3 weight) + void setup(ShaderData *sd, uint32_t /* path_flag */, float3 weight) { background_setup(sd, weight); } @@ -69,7 +69,7 @@ class GenericBackgroundClosure : public CClosurePrimitive { /// class HoldoutClosure : CClosurePrimitive { public: - void setup(ShaderData *sd, int /* path_flag */, float3 weight) + void setup(ShaderData *sd, uint32_t /* path_flag */, float3 weight) { closure_alloc(sd, sizeof(ShaderClosure), CLOSURE_HOLDOUT_ID, weight); sd->flag |= SD_HOLDOUT; diff --git a/intern/cycles/kernel/osl/bsdf_diffuse_ramp.cpp b/intern/cycles/kernel/osl/bsdf_diffuse_ramp.cpp index a2f9d3f759a..45216f4c74d 100644 --- a/intern/cycles/kernel/osl/bsdf_diffuse_ramp.cpp +++ b/intern/cycles/kernel/osl/bsdf_diffuse_ramp.cpp @@ -53,7 +53,7 @@ class DiffuseRampClosure : public CBSDFClosure { DiffuseRampBsdf params; Color3 colors[8]; - void setup(ShaderData *sd, int /* path_flag */, float3 weight) + void setup(ShaderData *sd, uint32_t /* path_flag */, float3 weight) { DiffuseRampBsdf *bsdf = (DiffuseRampBsdf *)bsdf_alloc_osl( sd, sizeof(DiffuseRampBsdf), weight, ¶ms); diff --git a/intern/cycles/kernel/osl/bsdf_phong_ramp.cpp b/intern/cycles/kernel/osl/bsdf_phong_ramp.cpp index 812c3b6e71b..90160fba962 100644 --- a/intern/cycles/kernel/osl/bsdf_phong_ramp.cpp +++ b/intern/cycles/kernel/osl/bsdf_phong_ramp.cpp @@ -52,7 +52,7 @@ class PhongRampClosure : public CBSDFClosure { PhongRampBsdf params; Color3 colors[8]; - void setup(ShaderData *sd, int /* path_flag */, float3 weight) + void setup(ShaderData *sd, uint32_t /* path_flag */, float3 weight) { PhongRampBsdf *bsdf = (PhongRampBsdf *)bsdf_alloc_osl( sd, sizeof(PhongRampBsdf), weight, ¶ms); diff --git a/intern/cycles/kernel/osl/emissive.cpp b/intern/cycles/kernel/osl/emissive.cpp index 80dfbee879e..5a7fe14b22e 100644 --- a/intern/cycles/kernel/osl/emissive.cpp +++ b/intern/cycles/kernel/osl/emissive.cpp @@ -56,7 +56,7 @@ using namespace OSL; /// class GenericEmissiveClosure : public CClosurePrimitive { public: - void setup(ShaderData *sd, int /* path_flag */, float3 weight) + void setup(ShaderData *sd, uint32_t /* path_flag */, float3 weight) { emission_setup(sd, weight); } diff --git a/intern/cycles/kernel/osl/osl_bssrdf.cpp b/intern/cycles/kernel/osl/osl_bssrdf.cpp index b6b0d72103a..5bf7b604498 100644 --- a/intern/cycles/kernel/osl/osl_bssrdf.cpp +++ b/intern/cycles/kernel/osl/osl_bssrdf.cpp @@ -67,7 +67,7 @@ class CBSSRDFClosure : public CClosurePrimitive { ior = 1.4f; } - void setup(ShaderData *sd, int path_flag, float3 weight) + void setup(ShaderData *sd, uint32_t path_flag, float3 weight) { if (method == u_burley) { alloc(sd, path_flag, weight, CLOSURE_BSSRDF_BURLEY_ID); @@ -80,7 +80,7 @@ class CBSSRDFClosure : public CClosurePrimitive { } } - void alloc(ShaderData *sd, int path_flag, float3 weight, ClosureType type) + void alloc(ShaderData *sd, uint32_t path_flag, float3 weight, ClosureType type) { Bssrdf *bssrdf = bssrdf_alloc(sd, weight); diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp index 94712a4dd13..b59bf5a1322 100644 --- a/intern/cycles/kernel/osl/osl_closures.cpp +++ b/intern/cycles/kernel/osl/osl_closures.cpp @@ -203,7 +203,7 @@ CLOSURE_FLOAT3_PARAM(DiffuseClosure, params.N), public: PrincipledSheenBsdf params; - void setup(ShaderData *sd, int path_flag, float3 weight) + void setup(ShaderData *sd, uint32_t path_flag, float3 weight) { if (!skip(sd, path_flag, LABEL_DIFFUSE)) { PrincipledSheenBsdf *bsdf = (PrincipledSheenBsdf *)bsdf_alloc_osl( @@ -228,7 +228,7 @@ class PrincipledHairClosure : public CBSDFClosure { public: PrincipledHairBSDF params; - PrincipledHairBSDF *alloc(ShaderData *sd, int path_flag, float3 weight) + PrincipledHairBSDF *alloc(ShaderData *sd, uint32_t path_flag, float3 weight) { PrincipledHairBSDF *bsdf = (PrincipledHairBSDF *)bsdf_alloc_osl( sd, sizeof(PrincipledHairBSDF), weight, ¶ms); @@ -246,7 +246,7 @@ class PrincipledHairClosure : public CBSDFClosure { return bsdf; } - void setup(ShaderData *sd, int path_flag, float3 weight) + void setup(ShaderData *sd, uint32_t path_flag, float3 weight) { if (!skip(sd, path_flag, LABEL_GLOSSY)) { PrincipledHairBSDF *bsdf = (PrincipledHairBSDF *)alloc(sd, path_flag, weight); @@ -282,7 +282,7 @@ class PrincipledClearcoatClosure : public CBSDFClosure { MicrofacetBsdf params; float clearcoat, clearcoat_roughness; - MicrofacetBsdf *alloc(ShaderData *sd, int path_flag, float3 weight) + MicrofacetBsdf *alloc(ShaderData *sd, uint32_t path_flag, float3 weight) { MicrofacetBsdf *bsdf = (MicrofacetBsdf *)bsdf_alloc_osl( sd, sizeof(MicrofacetBsdf), weight, ¶ms); @@ -306,7 +306,7 @@ class PrincipledClearcoatClosure : public CBSDFClosure { return bsdf; } - void setup(ShaderData *sd, int path_flag, float3 weight) + void setup(ShaderData *sd, uint32_t path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); if (!bsdf) { @@ -496,7 +496,7 @@ void OSLShader::register_closures(OSLShadingSystem *ss_) /* BSDF Closure */ -bool CBSDFClosure::skip(const ShaderData *sd, int path_flag, int scattering) +bool CBSDFClosure::skip(const ShaderData *sd, uint32_t path_flag, int scattering) { /* caustic options */ if ((scattering & LABEL_GLOSSY) && (path_flag & PATH_RAY_DIFFUSE)) { @@ -519,7 +519,7 @@ class MicrofacetClosure : public CBSDFClosure { ustring distribution; int refract; - void setup(ShaderData *sd, int path_flag, float3 weight) + void setup(ShaderData *sd, uint32_t path_flag, float3 weight) { static ustring u_ggx("ggx"); static ustring u_default("default"); @@ -595,7 +595,7 @@ class MicrofacetFresnelClosure : public CBSDFClosure { float3 color; float3 cspec0; - MicrofacetBsdf *alloc(ShaderData *sd, int path_flag, float3 weight) + MicrofacetBsdf *alloc(ShaderData *sd, uint32_t 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 @@ -625,7 +625,7 @@ class MicrofacetFresnelClosure : public CBSDFClosure { class MicrofacetGGXFresnelClosure : public MicrofacetFresnelClosure { public: - void setup(ShaderData *sd, int path_flag, float3 weight) + void setup(ShaderData *sd, uint32_t path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); if (!bsdf) { @@ -654,7 +654,7 @@ 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(ShaderData *sd, uint32_t path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); if (!bsdf) { @@ -689,7 +689,7 @@ class MicrofacetMultiClosure : public CBSDFClosure { MicrofacetBsdf params; float3 color; - MicrofacetBsdf *alloc(ShaderData *sd, int path_flag, float3 weight) + MicrofacetBsdf *alloc(ShaderData *sd, uint32_t path_flag, float3 weight) { /* Technically, the MultiGGX closure may also transmit. However, * since this is set statically and only used for caustic flags, this @@ -719,7 +719,7 @@ class MicrofacetMultiClosure : public CBSDFClosure { class MicrofacetMultiGGXClosure : public MicrofacetMultiClosure { public: - void setup(ShaderData *sd, int path_flag, float3 weight) + void setup(ShaderData *sd, uint32_t path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); if (!bsdf) { @@ -747,7 +747,7 @@ 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(ShaderData *sd, uint32_t path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); if (!bsdf) { @@ -779,7 +779,7 @@ class MicrofacetMultiGGXGlassClosure : public MicrofacetMultiClosure { { } - void setup(ShaderData *sd, int path_flag, float3 weight) + void setup(ShaderData *sd, uint32_t path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); if (!bsdf) { @@ -813,7 +813,7 @@ class MicrofacetMultiFresnelClosure : public CBSDFClosure { float3 color; float3 cspec0; - MicrofacetBsdf *alloc(ShaderData *sd, int path_flag, float3 weight) + MicrofacetBsdf *alloc(ShaderData *sd, uint32_t path_flag, float3 weight) { /* Technically, the MultiGGX closure may also transmit. However, * since this is set statically and only used for caustic flags, this @@ -843,7 +843,7 @@ class MicrofacetMultiFresnelClosure : public CBSDFClosure { class MicrofacetMultiGGXFresnelClosure : public MicrofacetMultiFresnelClosure { public: - void setup(ShaderData *sd, int path_flag, float3 weight) + void setup(ShaderData *sd, uint32_t path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); if (!bsdf) { @@ -873,7 +873,7 @@ 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(ShaderData *sd, uint32_t path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); if (!bsdf) { @@ -907,7 +907,7 @@ class MicrofacetMultiGGXGlassFresnelClosure : public MicrofacetMultiFresnelClosu { } - void setup(ShaderData *sd, int path_flag, float3 weight) + void setup(ShaderData *sd, uint32_t path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); if (!bsdf) { @@ -942,7 +942,7 @@ class TransparentClosure : public CBSDFClosure { ShaderClosure params; float3 unused; - void setup(ShaderData *sd, int path_flag, float3 weight) + void setup(ShaderData *sd, uint32_t path_flag, float3 weight) { bsdf_transparent_setup(sd, weight, path_flag); } @@ -961,7 +961,7 @@ CCLOSURE_PREPARE(closure_bsdf_transparent_prepare, TransparentClosure) class VolumeAbsorptionClosure : public CBSDFClosure { public: - void setup(ShaderData *sd, int path_flag, float3 weight) + void setup(ShaderData *sd, uint32_t path_flag, float3 weight) { volume_extinction_setup(sd, weight); } @@ -980,7 +980,7 @@ class VolumeHenyeyGreensteinClosure : public CBSDFClosure { public: HenyeyGreensteinVolume params; - void setup(ShaderData *sd, int path_flag, float3 weight) + void setup(ShaderData *sd, uint32_t path_flag, float3 weight) { volume_extinction_setup(sd, weight); diff --git a/intern/cycles/kernel/osl/osl_closures.h b/intern/cycles/kernel/osl/osl_closures.h index e4058e3a746..90a965a3365 100644 --- a/intern/cycles/kernel/osl/osl_closures.h +++ b/intern/cycles/kernel/osl/osl_closures.h @@ -113,7 +113,7 @@ void closure_bsdf_principled_hair_prepare(OSL::RendererServices *, int id, void class CClosurePrimitive { public: - virtual void setup(ShaderData *sd, int path_flag, float3 weight) = 0; + virtual void setup(ShaderData *sd, uint32_t path_flag, float3 weight) = 0; OSL::ustring label; }; @@ -122,7 +122,7 @@ class CClosurePrimitive { class CBSDFClosure : public CClosurePrimitive { public: - bool skip(const ShaderData *sd, int path_flag, int scattering); + bool skip(const ShaderData *sd, uint32_t path_flag, int scattering); }; #define BSDF_CLOSURE_CLASS_BEGIN(Upper, lower, structname, TYPE) \ @@ -132,7 +132,7 @@ class CBSDFClosure : public CClosurePrimitive { structname params; \ float3 unused; \ \ - void setup(ShaderData *sd, int path_flag, float3 weight) \ + void setup(ShaderData *sd, uint32_t path_flag, float3 weight) \ { \ if (!skip(sd, path_flag, TYPE)) { \ structname *bsdf = (structname *)bsdf_alloc_osl(sd, sizeof(structname), weight, ¶ms); \ diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp index a1df63ca8ff..4c067e88ab6 100644 --- a/intern/cycles/kernel/osl/osl_shader.cpp +++ b/intern/cycles/kernel/osl/osl_shader.cpp @@ -90,7 +90,7 @@ void OSLShader::thread_free(KernelGlobalsCPU *kg) static void shaderdata_to_shaderglobals(const KernelGlobalsCPU *kg, ShaderData *sd, const IntegratorStateCPU *state, - int path_flag, + uint32_t path_flag, OSLThreadData *tdata) { OSL::ShaderGlobals *globals = &tdata->globals; @@ -140,7 +140,7 @@ static void shaderdata_to_shaderglobals(const KernelGlobalsCPU *kg, /* Surface */ static void flatten_surface_closure_tree(ShaderData *sd, - int path_flag, + uint32_t path_flag, const OSL::ClosureColor *closure, float3 weight = make_float3(1.0f, 1.0f, 1.0f)) { @@ -177,7 +177,7 @@ static void flatten_surface_closure_tree(ShaderData *sd, void OSLShader::eval_surface(const KernelGlobalsCPU *kg, const IntegratorStateCPU *state, ShaderData *sd, - int path_flag) + uint32_t path_flag) { /* setup shader globals from shader data */ OSLThreadData *tdata = kg->osl_tdata; @@ -285,7 +285,7 @@ static void flatten_background_closure_tree(ShaderData *sd, void OSLShader::eval_background(const KernelGlobalsCPU *kg, const IntegratorStateCPU *state, ShaderData *sd, - int path_flag) + uint32_t path_flag) { /* setup shader globals from shader data */ OSLThreadData *tdata = kg->osl_tdata; @@ -343,7 +343,7 @@ static void flatten_volume_closure_tree(ShaderData *sd, void OSLShader::eval_volume(const KernelGlobalsCPU *kg, const IntegratorStateCPU *state, ShaderData *sd, - int path_flag) + uint32_t path_flag) { /* setup shader globals from shader data */ OSLThreadData *tdata = kg->osl_tdata; diff --git a/intern/cycles/kernel/osl/osl_shader.h b/intern/cycles/kernel/osl/osl_shader.h index 686a1e1374a..2b3810b0a33 100644 --- a/intern/cycles/kernel/osl/osl_shader.h +++ b/intern/cycles/kernel/osl/osl_shader.h @@ -57,15 +57,15 @@ class OSLShader { static void eval_surface(const KernelGlobalsCPU *kg, const IntegratorStateCPU *state, ShaderData *sd, - int path_flag); + uint32_t path_flag); static void eval_background(const KernelGlobalsCPU *kg, const IntegratorStateCPU *state, ShaderData *sd, - int path_flag); + uint32_t path_flag); static void eval_volume(const KernelGlobalsCPU *kg, const IntegratorStateCPU *state, ShaderData *sd, - int path_flag); + uint32_t path_flag); static void eval_displacement(const KernelGlobalsCPU *kg, const IntegratorStateCPU *state, ShaderData *sd); -- cgit v1.2.3