From 58005e135b32cecedfe832b0a67ba7fb4942d4ab Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 3 Dec 2014 20:50:25 +0500 Subject: Cycles: Remove workaround in ShaderClosure Since the aligned allocation of shader closures in OSL memory pool this workaround is no longer needed. Also put a comment which describes the desired layout of the structure so array of shader closures is all nicely aligned. --- intern/cycles/kernel/kernel_types.h | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'intern/cycles/kernel') diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index ca75c261636..1595f7a715a 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -539,34 +539,25 @@ typedef enum AttributeStandard { #define MAX_CLOSURE 1 #endif -/* TODO(sergey): This is rather nasty bug happening in here, which - * could be simply a compilers bug for which we can't find a generic - * platform independent workaround. Also even if it's a compiler - * issue, it's not so simple to upgrade the compiler in the release - * environment for Linux and doing it so closer to the release is - * rather a risky business. - * - * For this release it's probably safer to stick with such a rather - * dirty solution, and look for a cleaner fix during the next release - * cycle. +/* This struct is to be 16 bytes aligned, we also keep some extra precautions: + * - All the float3 members are in the beginning of the struct, so compiler + * does not put own pddings trying to align this members. + * - We make sure OSL pointer is also 16 bytes aligned. */ typedef struct ShaderClosure { - ClosureType type; float3 weight; -#ifndef __APPLE__ + float3 N; + float3 T; + + ClosureType type; float sample_weight; -#endif float data0; float data1; float data2; + int pad1, pad2, pad3; - float3 N; - float3 T; -#ifdef __APPLE__ - float sample_weight; -#endif #ifdef __OSL__ - void *prim; + void *prim, *pad4; #endif } ShaderClosure; -- cgit v1.2.3