Skip to content

Commit 3d46cb7

Browse files
committed
Temp. mem allocation
1 parent 937ab37 commit 3d46cb7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tutorials/07_custom_bvh_import/main.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@ class Tutorial : public TutorialBase
5959
geomInput.primitive.triangleMesh = mesh;
6060
buildBvh( geomInput );
6161

62-
hiprtDevicePtr geomTemp = nullptr;
62+
size_t geomTempSize;
63+
hiprtDevicePtr geomTemp;
6364
hiprtBuildOptions options;
6465
options.buildFlags = hiprtBuildFlagBitCustomBvhImport;
66+
CHECK_HIPRT( hiprtGetGeometryBuildTemporaryBufferSize( ctxt, geomInput, options, geomTempSize ) );
67+
CHECK_ORO( oroMalloc( reinterpret_cast<oroDeviceptr*>( &geomTemp ), geomTempSize ) );
6568

6669
hiprtGeometry geom;
6770
CHECK_HIPRT( hiprtCreateGeometry( ctxt, geomInput, options, geom ) );

tutorials/common/BvhBuilder.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ class BvhBuilder
143143

144144
nodes[nodeIndex].aabbMin = min( minLeftBox.m_min, minRightBox.m_min );
145145
nodes[nodeIndex].aabbMax = max( minLeftBox.m_max, minRightBox.m_max );
146-
for ( uint32_t k = 2; k < 2; ++k )
147-
nodes[nodeIndex].childIndices[k] = hiprtInvalidValue;
148-
149146
if ( minIndex - begin == 1 )
150147
{
151148
nodes[nodeIndex].childIndices[0] = indices[minAxis][begin];

0 commit comments

Comments
 (0)