Skip to content

Commit

Permalink
updates for HIPRT 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardGe committed Sep 20, 2024
1 parent fc6d712 commit 85f0b56
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Windows:
3. Run premake to generate a solution for Visual Studio 2022:
````
cd tutorials
../tools/premake5/win/premake5.exe vs2022
"../tools/premake5/win/premake5.exe" vs2022
````

4. Open the solution, compile & run.
Expand Down
2 changes: 1 addition & 1 deletion contrib/Orochi
Submodule Orochi updated 129 files
6 changes: 3 additions & 3 deletions tutorials/03_custom_intersection/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ class Tutorial : public TutorialBase

hiprtFuncDataSet funcDataSet;
CHECK_ORO( oroMalloc(
reinterpret_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), SphereCount * sizeof( hiprtFloat4 ) ) );
const_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), SphereCount * sizeof( hiprtFloat4 ) ) );
CHECK_ORO( oroMemcpyHtoD(
reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), spheres, SphereCount * sizeof( hiprtFloat4 ) ) );
const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), spheres, SphereCount * sizeof( hiprtFloat4 ) ) );

hiprtFuncTable funcTable;
CHECK_HIPRT( hiprtCreateFuncTable( ctxt, 1, 1, funcTable ) );
Expand All @@ -100,7 +100,7 @@ class Tutorial : public TutorialBase
launchKernel( func, m_res.x, m_res.y, args );
writeImage( "03_custom_intersection.png", m_res.x, m_res.y, pixels );

CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( list.aabbs ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( geomTemp ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( pixels ) ) );
Expand Down
12 changes: 6 additions & 6 deletions tutorials/11_multi_custom_intersection/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ class Tutorial : public TutorialBase

std::vector<hiprtFuncDataSet> funcDataSets( GeomTypesCount );
CHECK_ORO( oroMalloc(
reinterpret_cast<oroDeviceptr*>( &funcDataSets[SphereTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) );
const_cast<oroDeviceptr*>( &funcDataSets[SphereTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) );
CHECK_ORO( oroMemcpyHtoD(
reinterpret_cast<oroDeviceptr>( funcDataSets[SphereTypeIndex].intersectFuncData ),
const_cast<oroDeviceptr>( funcDataSets[SphereTypeIndex].intersectFuncData ),
&sphere,
sizeof( hiprtFloat4 ) ) );
CHECK_ORO( oroMalloc(
reinterpret_cast<oroDeviceptr*>( &funcDataSets[CircleTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) );
const_cast<oroDeviceptr*>( &funcDataSets[CircleTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) );
CHECK_ORO( oroMemcpyHtoD(
reinterpret_cast<oroDeviceptr>( funcDataSets[CircleTypeIndex].intersectFuncData ),
const_cast<oroDeviceptr>( funcDataSets[CircleTypeIndex].intersectFuncData ),
&circle,
sizeof( hiprtFloat4 ) ) );

Expand All @@ -190,8 +190,8 @@ class Tutorial : public TutorialBase
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( listCircles.aabbs ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instanceFrames ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instances ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSets[SphereTypeIndex].intersectFuncData ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSets[CircleTypeIndex].intersectFuncData ) ) );
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSets[SphereTypeIndex].intersectFuncData ) ) );
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSets[CircleTypeIndex].intersectFuncData ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( pixels ) ) );

CHECK_HIPRT( hiprtDestroyGeometry( ctxt, geomSpheres ) );
Expand Down
6 changes: 3 additions & 3 deletions tutorials/13_concurrent_scene_build/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ class Tutorial : public TutorialBase

hiprtFuncDataSet funcDataSet;
CHECK_ORO( oroMalloc(
reinterpret_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
const_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
CHECK_ORO( oroMemcpyHtoD(
reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );
const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );

hiprtFuncTable funcTable;
CHECK_HIPRT( hiprtCreateFuncTable( ctxt, 1, 1, funcTable ) );
Expand All @@ -203,7 +203,7 @@ class Tutorial : public TutorialBase
launchKernel( func, m_res.x, m_res.y, args );
writeImage( "13_concurrent_scene_build.png", m_res.x, m_res.y, pixels );

CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instances ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instanceFrames ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( mesh.triangleIndices ) ) );
Expand Down
6 changes: 3 additions & 3 deletions tutorials/14_batch_build/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ class Tutorial : public TutorialBase

hiprtFuncDataSet funcDataSet;
CHECK_ORO( oroMalloc(
reinterpret_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
const_cast<void**>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
CHECK_ORO( oroMemcpyHtoD(
reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );
const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );

hiprtFuncTable funcTable;
CHECK_HIPRT( hiprtCreateFuncTable( ctxt, 1, 1, funcTable ) );
Expand All @@ -189,7 +189,7 @@ class Tutorial : public TutorialBase
launchKernel( func, m_res.x, m_res.y, args );
writeImage( "14_batch_build.png", m_res.x, m_res.y, pixels );

CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instances ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instanceFrames ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( mesh.triangleIndices ) ) );
Expand Down
6 changes: 3 additions & 3 deletions tutorials/15_multi_level_instancing/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ class Tutorial : public TutorialBase

hiprtFuncDataSet funcDataSet;
CHECK_ORO( oroMalloc(
reinterpret_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
const_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
CHECK_ORO( oroMemcpyHtoD(
reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );
const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );

hiprtFuncTable funcTable;
CHECK_HIPRT( hiprtCreateFuncTable( ctxt, 1, 1, funcTable ) );
Expand All @@ -239,7 +239,7 @@ class Tutorial : public TutorialBase
launchKernel( func, m_res.x, m_res.y, args );
writeImage( "15_multi_level_instancing.png", m_res.x, m_res.y, pixels );

CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInputTop.instances ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInputTop.instanceFrames ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInputMid.instances ) ) );
Expand Down
6 changes: 3 additions & 3 deletions tutorials/16_fluid_simulation/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ class Tutorial : public TutorialBase

hiprtFuncDataSet funcDataSet;
CHECK_ORO( oroMalloc(
reinterpret_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), sim.m_particleCount * sizeof( Particle ) ) );
const_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), sim.m_particleCount * sizeof( Particle ) ) );
CHECK_ORO( oroMemcpyHtoD(
reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ),
const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ),
particles.data(),
sim.m_particleCount * sizeof( Particle ) ) );

Expand Down Expand Up @@ -230,7 +230,7 @@ class Tutorial : public TutorialBase
}
}

CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( list.aabbs ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( geomTemp ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( pSim ) ) );
Expand Down
2 changes: 1 addition & 1 deletion tutorials/17_hiprt_hip/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ project "17_hiprt_hip"
files { "./**.h", "./**.cpp"}
files { "../../hiprt/*.h"}

links {"hiprt0200264"}
links {"hiprt0200464"}
targetdir "../dist/bin/%{cfg.buildcfg}"
4 changes: 3 additions & 1 deletion tutorials/common/TutorialBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include <tutorials/common/TutorialBase.h>

#include <hiprt/hiprt_libpath.h>

#define STB_IMAGE_WRITE_IMPLEMENTATION
#include <contrib/stbi/stbi_image_write.h>

Expand Down Expand Up @@ -61,7 +63,7 @@ void TutorialBase::init( uint32_t deviceIndex )
{
m_res = make_hiprtInt2( 512, 512 );

CHECK_ORO( static_cast<oroError>( oroInitialize( (oroApi)( ORO_API_HIP | ORO_API_CUDA ), 0 ) ) );
CHECK_ORO( static_cast<oroError>( oroInitialize( (oroApi)( ORO_API_HIP | ORO_API_CUDA ), 0, g_hip_paths, g_hiprtc_paths ) ) );

CHECK_ORO( oroInit( 0 ) );
CHECK_ORO( oroDeviceGet( &m_oroDevice, deviceIndex ) );
Expand Down
2 changes: 1 addition & 1 deletion tutorials/common/dependency.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ if os.ishost("linux") then
end

files { "../../hiprt/*.h"}
links {"hiprt0200264"}
links {"hiprt0200464"}

0 comments on commit 85f0b56

Please sign in to comment.