kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #27723
patch to fix Bug #1626278
There is no propose to use mm_alloc at this moment so I changed it to the regular malloc.
(This also should make the Raspberry PI users happier and use KiCad! :O )
Mario
From a522f2340737d4fad94d6ed038bfcb5c34fae8ec Mon Sep 17 00:00:00 2001
Message-Id: <a522f2340737d4fad94d6ed038bfcb5c34fae8ec.1486671836.git.mrluzeiro@xxxxx>
From: Mario Luzeiro <mrluzeiro@xxxxx>
Date: Thu, 9 Feb 2017 21:23:40 +0100
Subject: [PATCH] Fixes: lp:1626278
https://bugs.launchpad.net/kicad/+bug/1626278
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.
---
.../3d_render_raytracing/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 257e843..8291fb8 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 <vector>
#include <boost/range/algorithm/partition.hpp>
#include <boost/range/algorithm/nth_element.hpp>
-//#include <mm_malloc.h>
-#include <xmmintrin.h>
+#include <stdlib.h>
#include <stack>
#include <wx/debug.h>
@@ -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<LinearBVHNode *>( _mm_malloc( sizeof( LinearBVHNode ) *
- totalNodes,
- L1_CACHE_LINE_SIZE ) );
+ m_nodes = static_cast<LinearBVHNode *>( 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<BVHPrimitiveInfo> &primiti
(*totalNodes)++;
// !TODO: implement an memory Arena
- BVHBuildNode *node = static_cast<BVHBuildNode *>( _mm_malloc( sizeof( BVHBuildNode ),
- L1_CACHE_LINE_SIZE ) );
+ BVHBuildNode *node = static_cast<BVHBuildNode *>( 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<BVHPrimitiveInfo> &primit
const int maxBVHNodes = 2 * numPrimitives;
// !TODO: implement a memory arena
- BVHBuildNode *nodes = static_cast<BVHBuildNode *>( _mm_malloc( maxBVHNodes *
- sizeof( BVHBuildNode ),
- L1_CACHE_LINE_SIZE ) );
+ BVHBuildNode *nodes = static_cast<BVHBuildNode *>( 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<BVHBuildNode *>( _mm_malloc( sizeof( BVHBuildNode ),
- L1_CACHE_LINE_SIZE ) );
+ BVHBuildNode *node = static_cast<BVHBuildNode *>( malloc( sizeof( BVHBuildNode ) ) );
m_addresses_pointer_to_mm_free.push_back( node );
--
2.7.4
Follow ups