From 2a793cc22c854b822ac3e7368d96b0901c586fb0 Mon Sep 17 00:00:00 2001 From: Mario Luzeiro Date: Thu, 9 Feb 2017 21:23:40 +0100 Subject: [PATCH] Remove mm_malloc from raytracer There is no need to use mm_malloc at this moment. Explanation: 1) It was planned that there was advantadge to use aligned memory but it was not measured the performance. 2) aligned memory is needed for use with SIMD (i.e: SSE) but that is not used at moment. Fixes: lp:1626278 https://bugs.launchpad.net/kicad/+bug/1626278 --- .../accelerators/cbvh_pbrt.cpp | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/accelerators/cbvh_pbrt.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/accelerators/cbvh_pbrt.cpp index 257e843e66..8291fb82a3 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/accelerators/cbvh_pbrt.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/accelerators/cbvh_pbrt.cpp @@ -71,8 +71,7 @@ #include #include #include -//#include -#include +#include #include #include @@ -287,9 +286,8 @@ CBVH_PBRT::CBVH_PBRT( const CGENERICCONTAINER &aObjectContainer, m_primitives.swap( orderedPrims ); // Compute representation of depth-first traversal of BVH tree - m_nodes = static_cast( _mm_malloc( sizeof( LinearBVHNode ) * - totalNodes, - L1_CACHE_LINE_SIZE ) ); + m_nodes = static_cast( malloc( sizeof( LinearBVHNode ) * + totalNodes ) ); m_addresses_pointer_to_mm_free.push_back( m_nodes ); for( int i = 0; i < totalNodes; ++i ) @@ -337,7 +335,7 @@ CBVH_PBRT::~CBVH_PBRT() ii != m_addresses_pointer_to_mm_free.end(); ++ii ) { - _mm_free( *ii ); + free( *ii ); *ii = NULL; } } @@ -461,8 +459,7 @@ BVHBuildNode *CBVH_PBRT::recursiveBuild ( std::vector &primiti (*totalNodes)++; // !TODO: implement an memory Arena - BVHBuildNode *node = static_cast( _mm_malloc( sizeof( BVHBuildNode ), - L1_CACHE_LINE_SIZE ) ); + BVHBuildNode *node = static_cast( malloc( sizeof( BVHBuildNode ) ) ); m_addresses_pointer_to_mm_free.push_back( node ); node->bounds.Reset(); @@ -774,9 +771,8 @@ BVHBuildNode *CBVH_PBRT::HLBVHBuild( const std::vector &primit const int maxBVHNodes = 2 * numPrimitives; // !TODO: implement a memory arena - BVHBuildNode *nodes = static_cast( _mm_malloc( maxBVHNodes * - sizeof( BVHBuildNode ), - L1_CACHE_LINE_SIZE ) ); + BVHBuildNode *nodes = static_cast( malloc( maxBVHNodes * + sizeof( BVHBuildNode ) ) ); m_addresses_pointer_to_mm_free.push_back( nodes ); @@ -965,8 +961,7 @@ BVHBuildNode *CBVH_PBRT::buildUpperSAH( (*totalNodes)++; - BVHBuildNode *node = static_cast( _mm_malloc( sizeof( BVHBuildNode ), - L1_CACHE_LINE_SIZE ) ); + BVHBuildNode *node = static_cast( malloc( sizeof( BVHBuildNode ) ) ); m_addresses_pointer_to_mm_free.push_back( node );