Revision: 56767
          http://sourceforge.net/p/brlcad/code/56767
Author:   brlcad
Date:     2013-08-13 02:53:41 +0000 (Tue, 13 Aug 2013)
Log Message:
-----------
since TIE tries to be coherent, document the sizes of each of the struct 
elements and ensure that we stay on 4-byte boundaries.  ironically shows that 
several core data structs do not fit within a cache line when using 
double-precision, so this is far from optimal.  related and most significantly, 
I'm adding two new 'b' fields (on tie_tri_s and tie_kdtree_s) to hold kd-tree 
data.  reason why will become apparent in the next commit.

Modified Paths:
--------------
    brlcad/trunk/include/tie.h

Modified: brlcad/trunk/include/tie.h
===================================================================
--- brlcad/trunk/include/tie.h  2013-08-13 01:02:33 UTC (rev 56766)
+++ brlcad/trunk/include/tie.h  2013-08-13 02:53:41 UTC (rev 56767)
@@ -80,33 +80,40 @@
        *(_t *)&((uint8_t *)_tv)[_ti] = *(_t *)&((uint8_t *)_fv)[_fi]; }
 
 typedef struct TIE_3_s {
-    tfloat v[3];
+    tfloat v[3];       /* 12-bytes or 24-bytes */
 } TIE_3;
 
 struct tie_ray_s {
-    point_t pos;    /* Position */
-    vect_t dir;    /* Direction */
-    short depth;  /* Depth */
-    short kdtree_depth;
+    point_t pos;       /* 24-bytes, Position */
+    vect_t dir;                /* 24-bytes, Direction */
+    short depth;       /* 2-bytes, Depth */
+    short kdtree_depth;        /* 2-bytes */
 };
 
 struct tie_id_s {
-    point_t pos;    /* Point */
-    vect_t norm;   /* Normal */
-    fastf_t dist;   /* Distance */
-    fastf_t alpha;     /* Barycentric Coordinate Alpha */
-    fastf_t beta;      /* Barycentric Coordinate Beta */
+    point_t pos;       /* 24-bytes, Point */
+    vect_t norm;       /* 24-bytes, Normal */
+    fastf_t dist;      /* 8-bytes, Distance */
+    fastf_t alpha;     /* 8-bytes, Barycentric Coordinate Alpha */
+    fastf_t beta;      /* 8-bytes, Barycentric Coordinate Beta */
 };
 
 struct tie_tri_s {
-    TIE_3 data[3];     /* 36-bytes, Data[0] = Point, Data[1] = Normal, Data[2] 
= DotProduct, VectorU, VectorV */
-    tfloat *v;         /* 8-bytes */
-    void *ptr;         /* 4-bytes */
+    TIE_3 data[3];     /* 12*3=36-bytes or 24*3=72-bytes,
+                        *
+                        * Data[0] = Point,
+                        * Data[1] = Normal,
+                        * Data[2] = DotProduct, VectorU, VectorV
+                        */
+    tfloat *v;         /* 4-bytes or 8-bytes */
+    void *ptr;         /* 4-bytes or 8-bytes */
+    uint32_t b;                /* 4-bytes (way more than we need, but helps 
keep alignment) */
 };
 
 struct tie_kdtree_s {
-    fastf_t axis;
-    void *data;
+    float axis; /* 4-bytes, intentionally float */
+    uint32_t b; /* 4-bytes, bit array to store data about the kdtree node */
+    void *data; /* 4-bytes or 8-bytes */
 };
 
 
@@ -117,8 +124,8 @@
     unsigned int tri_num;
     unsigned int tri_num_alloc;
     struct tie_tri_s *tri_list;
-    int stat;          /* used for testing various statistics */
-    unsigned int kdmethod;             /* Optimal or Fast */
+    int stat;                  /* used for testing various statistics */
+    unsigned int kdmethod;     /* Optimal or Fast */
     point_t min, max;
     vect_t amin, amax, mid;
     fastf_t radius;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to