From fa9175ff02acffd02679398e17732f3832d3fc28 Mon Sep 17 00:00:00 2001 From: Stefan Werner Date: Thu, 8 Mar 2018 00:15:41 +0100 Subject: Code refactor: use KernelLight instead of float4 arrays. Original patch by Stefan with modifications by Brecht. --- intern/cycles/kernel/kernel_types.h | 56 ++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) (limited to 'intern/cycles/kernel/kernel_types.h') diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index b6f1a3a6d98..198ce39c63f 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -36,7 +36,6 @@ CCL_NAMESPACE_BEGIN /* Constants */ #define OBJECT_VECTOR_SIZE 6 -#define LIGHT_SIZE 11 #define FILTER_TABLE_SIZE 1024 #define RAMP_TABLE_SIZE 256 #define SHUTTER_TABLE_SIZE 256 @@ -1456,6 +1455,61 @@ typedef struct KernelObject { } KernelObject;; static_assert_align(KernelObject, 16); +typedef struct KernelSpotLight { + float radius; + float invarea; + float spot_angle; + float spot_smooth; + float dir[3]; +} KernelSpotLight; + +/* PointLight is SpotLight with only radius and invarea being used. */ + +typedef struct KernelAreaLight { + float axisu[3]; + float invarea; + float axisv[3]; + float dir[3]; +} KernelAreaLight; + +typedef struct KernelDistantLight { + float radius; + float cosangle; + float invarea; +} KernelDistantLight; + +typedef struct KernelLight { + int type; + float co[3]; + int shader_id; + int samples; + float max_bounces; + float random; + float4 tfm[3]; + float4 itfm[3]; + union { + KernelSpotLight spot; + KernelAreaLight area; + KernelDistantLight distant; + }; +} KernelLight; +static_assert_align(KernelLight, 16); + +typedef struct KernelLightDistribution { + float totarea; + int prim; + union { + struct { + int shader_flag; + int object_id; + } mesh_light; + struct { + float pad; + float size; + } lamp; + }; +} KernelLightDistribution; +static_assert_align(KernelLightDistribution, 16); /* Declarations required for split kernel */ -- cgit v1.2.3