Fix T65212: Cycles SSS failing on 32 bit
This commit is contained in:
@@ -42,6 +42,8 @@ typedef ccl_addr_space struct VelvetBsdf {
|
|||||||
float invsigma2;
|
float invsigma2;
|
||||||
} VelvetBsdf;
|
} VelvetBsdf;
|
||||||
|
|
||||||
|
static_assert(sizeof(ShaderClosure) >= sizeof(VelvetBsdf), "VelvetBsdf is too large!");
|
||||||
|
|
||||||
ccl_device int bsdf_ashikhmin_velvet_setup(VelvetBsdf *bsdf)
|
ccl_device int bsdf_ashikhmin_velvet_setup(VelvetBsdf *bsdf)
|
||||||
{
|
{
|
||||||
float sigma = fmaxf(bsdf->sigma, 0.01f);
|
float sigma = fmaxf(bsdf->sigma, 0.01f);
|
||||||
|
@@ -39,6 +39,8 @@ typedef ccl_addr_space struct DiffuseBsdf {
|
|||||||
SHADER_CLOSURE_BASE;
|
SHADER_CLOSURE_BASE;
|
||||||
} DiffuseBsdf;
|
} DiffuseBsdf;
|
||||||
|
|
||||||
|
static_assert(sizeof(ShaderClosure) >= sizeof(DiffuseBsdf), "DiffuseBsdf is too large!");
|
||||||
|
|
||||||
/* DIFFUSE */
|
/* DIFFUSE */
|
||||||
|
|
||||||
ccl_device int bsdf_diffuse_setup(DiffuseBsdf *bsdf)
|
ccl_device int bsdf_diffuse_setup(DiffuseBsdf *bsdf)
|
||||||
|
@@ -43,6 +43,8 @@ typedef ccl_addr_space struct DiffuseRampBsdf {
|
|||||||
float3 *colors;
|
float3 *colors;
|
||||||
} DiffuseRampBsdf;
|
} DiffuseRampBsdf;
|
||||||
|
|
||||||
|
static_assert(sizeof(ShaderClosure) >= sizeof(DiffuseRampBsdf), "DiffuseRampBsdf is too large!");
|
||||||
|
|
||||||
ccl_device float3 bsdf_diffuse_ramp_get_color(const float3 colors[8], float pos)
|
ccl_device float3 bsdf_diffuse_ramp_get_color(const float3 colors[8], float pos)
|
||||||
{
|
{
|
||||||
int MAXCOLORS = 8;
|
int MAXCOLORS = 8;
|
||||||
|
@@ -44,6 +44,8 @@ typedef ccl_addr_space struct HairBsdf {
|
|||||||
float offset;
|
float offset;
|
||||||
} HairBsdf;
|
} HairBsdf;
|
||||||
|
|
||||||
|
static_assert(sizeof(ShaderClosure) >= sizeof(HairBsdf), "HairBsdf is too large!");
|
||||||
|
|
||||||
ccl_device int bsdf_hair_reflection_setup(HairBsdf *bsdf)
|
ccl_device int bsdf_hair_reflection_setup(HairBsdf *bsdf)
|
||||||
{
|
{
|
||||||
bsdf->type = CLOSURE_BSDF_HAIR_REFLECTION_ID;
|
bsdf->type = CLOSURE_BSDF_HAIR_REFLECTION_ID;
|
||||||
|
@@ -48,6 +48,8 @@ typedef ccl_addr_space struct MicrofacetBsdf {
|
|||||||
float3 T;
|
float3 T;
|
||||||
} MicrofacetBsdf;
|
} MicrofacetBsdf;
|
||||||
|
|
||||||
|
static_assert(sizeof(ShaderClosure) >= sizeof(MicrofacetBsdf), "MicrofacetBsdf is too large!");
|
||||||
|
|
||||||
/* Beckmann and GGX microfacet importance sampling. */
|
/* Beckmann and GGX microfacet importance sampling. */
|
||||||
|
|
||||||
ccl_device_inline void microfacet_beckmann_sample_slopes(KernelGlobals *kg,
|
ccl_device_inline void microfacet_beckmann_sample_slopes(KernelGlobals *kg,
|
||||||
|
@@ -27,6 +27,8 @@ typedef ccl_addr_space struct OrenNayarBsdf {
|
|||||||
float b;
|
float b;
|
||||||
} OrenNayarBsdf;
|
} OrenNayarBsdf;
|
||||||
|
|
||||||
|
static_assert(sizeof(ShaderClosure) >= sizeof(OrenNayarBsdf), "OrenNayarBsdf is too large!");
|
||||||
|
|
||||||
ccl_device float3 bsdf_oren_nayar_get_intensity(const ShaderClosure *sc,
|
ccl_device float3 bsdf_oren_nayar_get_intensity(const ShaderClosure *sc,
|
||||||
float3 n,
|
float3 n,
|
||||||
float3 v,
|
float3 v,
|
||||||
|
@@ -44,6 +44,8 @@ typedef ccl_addr_space struct PhongRampBsdf {
|
|||||||
float3 *colors;
|
float3 *colors;
|
||||||
} PhongRampBsdf;
|
} PhongRampBsdf;
|
||||||
|
|
||||||
|
static_assert(sizeof(ShaderClosure) >= sizeof(PhongRampBsdf), "PhongRampBsdf is too large!");
|
||||||
|
|
||||||
ccl_device float3 bsdf_phong_ramp_get_color(const float3 colors[8], float pos)
|
ccl_device float3 bsdf_phong_ramp_get_color(const float3 colors[8], float pos)
|
||||||
{
|
{
|
||||||
int MAXCOLORS = 8;
|
int MAXCOLORS = 8;
|
||||||
|
@@ -30,6 +30,9 @@ typedef ccl_addr_space struct PrincipledDiffuseBsdf {
|
|||||||
float roughness;
|
float roughness;
|
||||||
} PrincipledDiffuseBsdf;
|
} PrincipledDiffuseBsdf;
|
||||||
|
|
||||||
|
static_assert(sizeof(ShaderClosure) >= sizeof(PrincipledDiffuseBsdf),
|
||||||
|
"PrincipledDiffuseBsdf is too large!");
|
||||||
|
|
||||||
ccl_device float3 calculate_principled_diffuse_brdf(
|
ccl_device float3 calculate_principled_diffuse_brdf(
|
||||||
const PrincipledDiffuseBsdf *bsdf, float3 N, float3 V, float3 L, float3 H, float *pdf)
|
const PrincipledDiffuseBsdf *bsdf, float3 N, float3 V, float3 L, float3 H, float *pdf)
|
||||||
{
|
{
|
||||||
|
@@ -28,6 +28,9 @@ typedef ccl_addr_space struct PrincipledSheenBsdf {
|
|||||||
SHADER_CLOSURE_BASE;
|
SHADER_CLOSURE_BASE;
|
||||||
} PrincipledSheenBsdf;
|
} PrincipledSheenBsdf;
|
||||||
|
|
||||||
|
static_assert(sizeof(ShaderClosure) >= sizeof(PrincipledSheenBsdf),
|
||||||
|
"PrincipledSheenBsdf is too large!");
|
||||||
|
|
||||||
ccl_device float3 calculate_principled_sheen_brdf(
|
ccl_device float3 calculate_principled_sheen_brdf(
|
||||||
const PrincipledSheenBsdf *bsdf, float3 N, float3 V, float3 L, float3 H, float *pdf)
|
const PrincipledSheenBsdf *bsdf, float3 N, float3 V, float3 L, float3 H, float *pdf)
|
||||||
{
|
{
|
||||||
|
@@ -42,6 +42,8 @@ typedef ccl_addr_space struct ToonBsdf {
|
|||||||
float smooth;
|
float smooth;
|
||||||
} ToonBsdf;
|
} ToonBsdf;
|
||||||
|
|
||||||
|
static_assert(sizeof(ShaderClosure) >= sizeof(ToonBsdf), "ToonBsdf is too large!");
|
||||||
|
|
||||||
/* DIFFUSE TOON */
|
/* DIFFUSE TOON */
|
||||||
|
|
||||||
ccl_device int bsdf_diffuse_toon_setup(ToonBsdf *bsdf)
|
ccl_device int bsdf_diffuse_toon_setup(ToonBsdf *bsdf)
|
||||||
|
@@ -30,6 +30,8 @@ typedef ccl_addr_space struct Bssrdf {
|
|||||||
float channels;
|
float channels;
|
||||||
} Bssrdf;
|
} Bssrdf;
|
||||||
|
|
||||||
|
static_assert(sizeof(ShaderClosure) >= sizeof(Bssrdf), "Bssrdf is too large!");
|
||||||
|
|
||||||
/* Planar Truncated Gaussian
|
/* Planar Truncated Gaussian
|
||||||
*
|
*
|
||||||
* Note how this is different from the typical gaussian, this one integrates
|
* Note how this is different from the typical gaussian, this one integrates
|
||||||
|
@@ -40,6 +40,9 @@ typedef ccl_addr_space struct HenyeyGreensteinVolume {
|
|||||||
float g;
|
float g;
|
||||||
} HenyeyGreensteinVolume;
|
} HenyeyGreensteinVolume;
|
||||||
|
|
||||||
|
static_assert(sizeof(ShaderClosure) >= sizeof(HenyeyGreensteinVolume),
|
||||||
|
"HenyeyGreensteinVolume is too large!");
|
||||||
|
|
||||||
/* Given cosine between rays, return probability density that a photon bounces
|
/* Given cosine between rays, return probability density that a photon bounces
|
||||||
* to that direction. The g parameter controls how different it is from the
|
* to that direction. The g parameter controls how different it is from the
|
||||||
* uniform sphere. g=0 uniform diffuse-like, g=1 close to sharp single ray. */
|
* uniform sphere. g=0 uniform diffuse-like, g=1 close to sharp single ray. */
|
||||||
|
@@ -804,8 +804,9 @@ typedef struct AttributeDescriptor {
|
|||||||
* ShaderClosure has a fixed size, and any extra space must be allocated
|
* ShaderClosure has a fixed size, and any extra space must be allocated
|
||||||
* with closure_alloc_extra().
|
* with closure_alloc_extra().
|
||||||
*
|
*
|
||||||
* We pad the struct to 80 bytes and ensure it is aligned to 16 bytes, which
|
* We pad the struct to align to 16 bytes. All shader closures are assumed
|
||||||
* we assume to be the maximum required alignment for any struct. */
|
* to fit in this struct size. CPU sizes are a bit larger because float3 is
|
||||||
|
* padded to be 16 bytes, while it's only 12 bytes on the GPU. */
|
||||||
|
|
||||||
#define SHADER_CLOSURE_BASE \
|
#define SHADER_CLOSURE_BASE \
|
||||||
float3 weight; \
|
float3 weight; \
|
||||||
@@ -817,7 +818,10 @@ typedef ccl_addr_space struct ccl_align(16) ShaderClosure
|
|||||||
{
|
{
|
||||||
SHADER_CLOSURE_BASE;
|
SHADER_CLOSURE_BASE;
|
||||||
|
|
||||||
float data[10]; /* pad to 80 bytes */
|
#ifdef __KERNEL_CPU__
|
||||||
|
float pad[2];
|
||||||
|
#endif
|
||||||
|
float data[10];
|
||||||
}
|
}
|
||||||
ShaderClosure;
|
ShaderClosure;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user