Skip to content

Commit b75b2e8

Browse files
brechtvlBrecht Van Lommel
authored and
Brecht Van Lommel
committed
Cleanup: Always use fullsize ShaderData on the CPU
This avoids compiler and ASAN warnings. This optimization exist for GPU rendering.
1 parent 5a9d4fd commit b75b2e8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

intern/cycles/kernel/types.h

+6
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,7 @@ struct ccl_align(16) ShaderData
12001200
struct ShaderClosure closure[MAX_CLOSURE];
12011201
};
12021202

1203+
#ifdef __KERNEL_GPU__
12031204
/* ShaderDataTinyStorage needs the same alignment as ShaderData, or else
12041205
* the pointer cast in AS_SHADER_DATA invokes undefined behavior. */
12051206
struct ccl_align(16) ShaderDataTinyStorage
@@ -1213,6 +1214,11 @@ struct ccl_align(16) ShaderDataCausticsStorage
12131214
{
12141215
char pad[sizeof(ShaderData) - sizeof(ShaderClosure) * (MAX_CLOSURE - CAUSTICS_MAX_CLOSURE)];
12151216
};
1217+
#else
1218+
/* On the CPU use full size, to avoid compiler and ASAN warnings. */
1219+
using ShaderDataTinyStorage = ShaderData;
1220+
using ShaderDataCausticsStorage = ShaderData;
1221+
#endif
12161222

12171223
#define AS_SHADER_DATA(shader_data_tiny_storage) \
12181224
((ccl_private ShaderData *)shader_data_tiny_storage)

0 commit comments

Comments
 (0)