star-enclosures-3d

Extract enclosures from 3D geometry
git clone git://git.meso-star.fr/star-enclosures-3d.git
Log | Files | Refs | README | LICENSE

commit e2f31f71bf7ec05621ed1e1ce7c4e1a47791e32b
parent 89ee753dce248d7343357d8274bd491272b7345d
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Tue, 20 Mar 2018 17:04:11 +0100

More on Linux build.

Diffstat:
Msrc/senc_scene_analyze.c | 16++++++++++++----
Msrc/test_senc_many_enclosures.c | 4++--
2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/senc_scene_analyze.c b/src/senc_scene_analyze.c @@ -27,6 +27,16 @@ #include <rsys/hash_table.h> #include <rsys/dynamic_array.h> +#if defined(COMPILER_GCC) +#define ATOMIC_CAS_PTR(Atom, NewVal, Comparand) /* Return the initial value */ \ + ATOMIC_CAS((Atom), (NewVal), (Comparand)) +#elif defined(COMPILER_CL) +#define ATOMIC_CAS_PTR(Atom, NewVal, Comparand) /* Return the initial value */ \ + (InterlockedCompareExchangePointer(Atom, NewVal, Comparand)) +#else +#error "Undefined atomic operations" +#endif + #include <star/s3d.h> #include <omp.h> @@ -518,7 +528,6 @@ group_connex_components struct s3d_scene_view* s3d_view) { res_T res = RES_OK; - struct mem_allocator* alloc; struct cc_descriptor** descriptors; size_t tmp; component_id_t cc_count; @@ -529,7 +538,6 @@ group_connex_components (void)trgsides; ASSERT(desc && trgsides && triangles_comp && connex_components); - alloc = descriptor_get_allocator(desc); descriptors = darray_ptr_component_descriptor_data_get(connex_components); tmp = darray_ptr_component_descriptor_size_get(connex_components); ASSERT(tmp <= COMPONENT_MAX__); @@ -554,7 +562,7 @@ group_connex_components ASSERT(cc->cc_group_root == CC_GROUP_ID_NONE); if(cc->max_z_nz < 0) { - size_t id; + int64_t id; /* Don't need to cast a ray */ cc->cc_group_root = cc->cc_id; /* New group with self as root */ id = ATOMIC_INCR(&next_enclosure_id) - 1; @@ -582,7 +590,7 @@ group_connex_components cc->cc_group_root = CC_GROUP_ROOT_INFINITE; cc->enclosure_id = 0; /* Keep the first component facing infinity */ - ATOMIC_CAS(&(intptr_t)infinity_first_cc, (intptr_t)cc, (intptr_t)NULL); + ATOMIC_CAS_PTR(&infinity_first_cc, cc, NULL); if(infinity_first_cc->medium != cc->medium) { const side_id_t infinity_first_side = infinity_first_cc->max_z_side_id; const medium_id_t infinity_medium = infinity_first_cc->medium; diff --git a/src/test_senc_many_enclosures.c b/src/test_senc_many_enclosures.c @@ -111,8 +111,8 @@ main(int argc, char** argv) double misalignment = 0.01; FOR_EACH(k, 0, NB_CYL_1) { double center_y = (2 + NB_CYL_1) * (j - NB_CYL_1 / 2); - m_in = k; - m_out = k + 1; + m_in = (unsigned)k; + m_out = (unsigned)(k + 1); ctx.ctx.scale = k + 1; /* Mitigate Embree issue #181 * We cannot keep perfect alignment of cylinders