star-vx

Structuring voxels for ray-tracing
git clone git://git.meso-star.fr/star-vx.git
Log | Files | Refs | README | LICENSE

commit 96984b11ab60120b2822347617dbfa4077ba9a91
parent 6984039a23d7c8e81e914a1c6184a4179a0f61e3
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Fri, 22 Jun 2018 11:17:39 +0200

Windows build

Diffstat:
Mcmake/CMakeLists.txt | 8+++++++-
Msrc/svx_bintree.c | 4++--
Msrc/svx_buffer.c | 11+++++++++++
Msrc/svx_c.h | 2+-
Msrc/svx_octree.c | 2+-
Msrc/test_svx_octree.c | 2+-
Msrc/test_svx_octree_trace_ray.c | 2+-
Msrc/test_svx_utils.h | 20++++++++++----------
8 files changed, 34 insertions(+), 17 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -64,6 +64,10 @@ rcmake_prepend_path(SVX_FILES_INC ${SVX_SOURCE_DIR}) rcmake_prepend_path(SVX_FILES_INC_API ${SVX_SOURCE_DIR}) rcmake_prepend_path(SVX_FILES_DOC ${PROJECT_SOURCE_DIR}/../) +if(CMAKE_COMPILER_IS_GNUCC) + set(MATH_LIB m) +endif() + add_library(svx SHARED ${SVX_FILES_SRC} ${SVX_FILES_INC} ${SVX_FILES_INC_API}) target_link_libraries(svx RSys) @@ -93,9 +97,11 @@ if(NOT NO_TEST) new_test(test_svx_bintree) new_test(test_svx_device) new_test(test_svx_octree) - new_test(test_svx_octree_trace_ray m) + new_test(test_svx_octree_trace_ray ${MATH_LIB}) endif() +rcmake_copy_runtime_libraries(test_svx_octree_trace_ray) + ################################################################################ # Define output & install directories ################################################################################ diff --git a/src/svx_bintree.c b/src/svx_bintree.c @@ -51,7 +51,7 @@ svx_bintree_create } if(lower >= upper) { log_err(dev, - "%s: the submitted range is degenrated\n" + "%s: the submitted range is degenerated\n" "\tlower = %g, upper = %g\n", FUNC_NAME, lower, upper); res = RES_BAD_ARG; goto error; @@ -121,7 +121,7 @@ svx_bintree_create /* Adjuste the binary tree definition with respect to the binary tree depth * since finest levels might be removed during the build due to the merging * process */ - bintree->definition = bintree->definition / (1u<<bldr.non_empty_lvl); + bintree->definition = bintree->definition / (1ull<<bldr.non_empty_lvl); exit: if(vox.data) MEM_RM(dev->allocator, vox.data); diff --git a/src/svx_buffer.c b/src/svx_buffer.c @@ -17,7 +17,12 @@ #include <rsys/mem_allocator.h> +#ifdef _MSC_VER +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +#else #include <unistd.h> +#endif /******************************************************************************* * Helper functions @@ -99,7 +104,13 @@ buffer_init { ASSERT(buf && allocator); memset(buf, 0, sizeof(struct buffer)); +#ifdef _MSC_VER + SYSTEM_INFO si; + GetSystemInfo(&si); + buf->pagesize = si.dwPageSize; +#else buf->pagesize = (size_t)sysconf(_SC_PAGESIZE); +#endif buf->voxsize = voxel_size; darray_page_init(allocator, &buf->node_pages); darray_page_init(allocator, &buf->attr_pages); diff --git a/src/svx_c.h b/src/svx_c.h @@ -66,7 +66,7 @@ morton_xyz_encode_u21(const uint32_t xyz[3]) static INLINE void morton_xyz_decode_u21(const uint64_t code, uint32_t xyz[3]) { - ASSERT(xyz && code < ((1ul << 63)-1)); + ASSERT(xyz && code < ((1ull << 63)-1)); xyz[0] = (uint32_t)morton3D_decode_u21(code >> 2); xyz[1] = (uint32_t)morton3D_decode_u21(code >> 1); xyz[2] = (uint32_t)morton3D_decode_u21(code >> 0); diff --git a/src/svx_octree.c b/src/svx_octree.c @@ -155,7 +155,7 @@ svx_octree_create /* Adjust the octree definition with respect to the octree depth since finest * levels might be removed during the build due to the merging process */ - oct->definition = oct->definition / (1u << bldr.non_empty_lvl); + oct->definition = oct->definition / (1ull << bldr.non_empty_lvl); exit: if(vox.data) MEM_RM(dev->allocator, vox.data); diff --git a/src/test_svx_octree.c b/src/test_svx_octree.c @@ -367,7 +367,7 @@ main(int argc, char** argv) CHK(tree_desc.depth == (size_t)log2i((int)(nvxls[0]/2))+1); CHK(tree_desc.type = SVX_OCTREE); - dump_data(stdout, oct, FLOAT, 1, write_scalars); + dump_data(stdout, oct, FLOAT__, 1, write_scalars); #undef NEW_SCN diff --git a/src/test_svx_octree_trace_ray.c b/src/test_svx_octree_trace_ray.c @@ -342,7 +342,7 @@ main(int argc, char** argv) CHK(svx_octree_create(dev, lower, upper, def, &voxel_desc, &oct) == RES_OK); - /*dump_data(stdout, oct, CHAR, 1, write_scalars);*/ + /*dump_data(stdout, oct, CHAR__, 1, write_scalars);*/ #define RT svx_octree_trace_ray d3(r.org, -5,-5, 0); diff --git a/src/test_svx_utils.h b/src/test_svx_utils.h @@ -20,22 +20,22 @@ #include <stdio.h> enum data_type { - CHAR, - INT, - LONG, - FLOAT, - DOUBLE + CHAR__, + INT__, + LONG__, + FLOAT__, + DOUBLE__ }; static INLINE const char* data_type_to_string(const enum data_type type) { switch(type) { - case CHAR: return "char"; - case INT: return "int"; - case LONG: return "long"; - case FLOAT: return "float"; - case DOUBLE: return "double"; + case CHAR__: return "char"; + case INT__: return "int"; + case LONG__: return "long"; + case FLOAT__: return "float"; + case DOUBLE__: return "double"; default: FATAL("Unreachable code.\n"); } }