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.
This commit is contained in:
Sergey Sharybin
2014-12-03 20:50:25 +05:00
parent 4cb0e25678
commit 58005e135b

View File

@@ -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;