Skip to content

Commit bda5358

Browse files
committed
aligning ISPC Ray1 struct to at least 16 bytes
1 parent 697a44f commit bda5358

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

include/embree2/rtcore_ray.isph

+17-15
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,29 @@
3030
RTCORE_ALIGN(16) struct RTCRay1
3131
{
3232
/* ray data */
33-
float org[3]; //!< Ray origin
34-
float align0; //!< unused member to force alignment of following members
33+
uniform float org[3]; //!< Ray origin
34+
uniform float align0; //!< unused member to force alignment of following members
3535

36-
float dir[3]; //!< Ray direction
37-
float align1; //!< unused member to force alignment of following members
36+
uniform float dir[3]; //!< Ray direction
37+
uniform float align1; //!< unused member to force alignment of following members
3838

39-
float tnear; //!< Start of ray segment
40-
float tfar; //!< End of ray segment (set to hit distance)
41-
float time; //!< Time of this ray for motion blur
42-
int mask; //!< Used to mask out objects during traversal
39+
uniform float tnear; //!< Start of ray segment
40+
uniform float tfar; //!< End of ray segment (set to hit distance)
41+
uniform float time; //!< Time of this ray for motion blur
42+
uniform int mask; //!< Used to mask out objects during traversal
4343

4444
/* hit data */
45-
float Ng[3]; //!< Unnormalized geometry normal
46-
float align2;
45+
uniform float Ng[3]; //!< Unnormalized geometry normal
46+
uniform float align2;
4747

48-
float u; //!< Barycentric u coordinate of hit
49-
float v; //!< Barycentric v coordinate of hit
48+
uniform float u; //!< Barycentric u coordinate of hit
49+
uniform float v; //!< Barycentric v coordinate of hit
5050

51-
int geomID; //!< geometry ID
52-
int primID; //!< primitive ID
53-
int instID; //!< instance ID
51+
uniform int geomID; //!< geometry ID
52+
uniform int primID; //!< primitive ID
53+
uniform int instID; //!< instance ID
54+
55+
varying float align[0]; //!< this variable causes ISPC to align the struct on the stack
5456
};
5557

5658
/*! Ray structure for packets of 4 rays. */

tutorials/common/tutorial/ray.isph

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct RTCRay1
3535
uniform int geomID; //!< geometry ID
3636
uniform int primID; //!< primitive ID
3737
uniform int instID; //!< instance ID
38+
varying float align[0]; //!< forces ISPC to align the ray to at least 16 bytes
3839
};
3940

4041
/*! Ray structure. Contains all information about a ray including

0 commit comments

Comments
 (0)