From 85f0b5612cf3b09f354fc3d06b09a8724d12fec1 Mon Sep 17 00:00:00 2001 From: Richard Geslot Date: Fri, 20 Sep 2024 12:27:48 +0200 Subject: [PATCH] updates for HIPRT 2.4 --- README.md | 2 +- contrib/Orochi | 2 +- tutorials/03_custom_intersection/main.cpp | 6 +++--- tutorials/11_multi_custom_intersection/main.cpp | 12 ++++++------ tutorials/13_concurrent_scene_build/main.cpp | 6 +++--- tutorials/14_batch_build/main.cpp | 6 +++--- tutorials/15_multi_level_instancing/main.cpp | 6 +++--- tutorials/16_fluid_simulation/main.cpp | 6 +++--- tutorials/17_hiprt_hip/premake5.lua | 2 +- tutorials/common/TutorialBase.cpp | 4 +++- tutorials/common/dependency.lua | 2 +- 11 files changed, 28 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index edf2922..3d9d1bf 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/contrib/Orochi b/contrib/Orochi index b209cc1..58db9c1 160000 --- a/contrib/Orochi +++ b/contrib/Orochi @@ -1 +1 @@ -Subproject commit b209cc1a93b7922ab3863ef673addb3c0d1bcb76 +Subproject commit 58db9c18b952f5148f0e4465a86a66e487d50525 diff --git a/tutorials/03_custom_intersection/main.cpp b/tutorials/03_custom_intersection/main.cpp index a8a2107..8e13f17 100644 --- a/tutorials/03_custom_intersection/main.cpp +++ b/tutorials/03_custom_intersection/main.cpp @@ -81,9 +81,9 @@ class Tutorial : public TutorialBase hiprtFuncDataSet funcDataSet; CHECK_ORO( oroMalloc( - reinterpret_cast( &funcDataSet.intersectFuncData ), SphereCount * sizeof( hiprtFloat4 ) ) ); + const_cast( &funcDataSet.intersectFuncData ), SphereCount * sizeof( hiprtFloat4 ) ) ); CHECK_ORO( oroMemcpyHtoD( - reinterpret_cast( funcDataSet.intersectFuncData ), spheres, SphereCount * sizeof( hiprtFloat4 ) ) ); + const_cast( funcDataSet.intersectFuncData ), spheres, SphereCount * sizeof( hiprtFloat4 ) ) ); hiprtFuncTable funcTable; CHECK_HIPRT( hiprtCreateFuncTable( ctxt, 1, 1, funcTable ) ); @@ -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( funcDataSet.intersectFuncData ) ) ); + CHECK_ORO( oroFree( const_cast( funcDataSet.intersectFuncData ) ) ); CHECK_ORO( oroFree( reinterpret_cast( list.aabbs ) ) ); CHECK_ORO( oroFree( reinterpret_cast( geomTemp ) ) ); CHECK_ORO( oroFree( reinterpret_cast( pixels ) ) ); diff --git a/tutorials/11_multi_custom_intersection/main.cpp b/tutorials/11_multi_custom_intersection/main.cpp index 3c8e9a3..ab58f4d 100644 --- a/tutorials/11_multi_custom_intersection/main.cpp +++ b/tutorials/11_multi_custom_intersection/main.cpp @@ -162,15 +162,15 @@ class Tutorial : public TutorialBase std::vector funcDataSets( GeomTypesCount ); CHECK_ORO( oroMalloc( - reinterpret_cast( &funcDataSets[SphereTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) ); + const_cast( &funcDataSets[SphereTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) ); CHECK_ORO( oroMemcpyHtoD( - reinterpret_cast( funcDataSets[SphereTypeIndex].intersectFuncData ), + const_cast( funcDataSets[SphereTypeIndex].intersectFuncData ), &sphere, sizeof( hiprtFloat4 ) ) ); CHECK_ORO( oroMalloc( - reinterpret_cast( &funcDataSets[CircleTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) ); + const_cast( &funcDataSets[CircleTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) ); CHECK_ORO( oroMemcpyHtoD( - reinterpret_cast( funcDataSets[CircleTypeIndex].intersectFuncData ), + const_cast( funcDataSets[CircleTypeIndex].intersectFuncData ), &circle, sizeof( hiprtFloat4 ) ) ); @@ -190,8 +190,8 @@ class Tutorial : public TutorialBase CHECK_ORO( oroFree( reinterpret_cast( listCircles.aabbs ) ) ); CHECK_ORO( oroFree( reinterpret_cast( sceneInput.instanceFrames ) ) ); CHECK_ORO( oroFree( reinterpret_cast( sceneInput.instances ) ) ); - CHECK_ORO( oroFree( reinterpret_cast( funcDataSets[SphereTypeIndex].intersectFuncData ) ) ); - CHECK_ORO( oroFree( reinterpret_cast( funcDataSets[CircleTypeIndex].intersectFuncData ) ) ); + CHECK_ORO( oroFree( const_cast( funcDataSets[SphereTypeIndex].intersectFuncData ) ) ); + CHECK_ORO( oroFree( const_cast( funcDataSets[CircleTypeIndex].intersectFuncData ) ) ); CHECK_ORO( oroFree( reinterpret_cast( pixels ) ) ); CHECK_HIPRT( hiprtDestroyGeometry( ctxt, geomSpheres ) ); diff --git a/tutorials/13_concurrent_scene_build/main.cpp b/tutorials/13_concurrent_scene_build/main.cpp index e95f055..53301a8 100644 --- a/tutorials/13_concurrent_scene_build/main.cpp +++ b/tutorials/13_concurrent_scene_build/main.cpp @@ -187,9 +187,9 @@ class Tutorial : public TutorialBase hiprtFuncDataSet funcDataSet; CHECK_ORO( oroMalloc( - reinterpret_cast( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) ); + const_cast( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) ); CHECK_ORO( oroMemcpyHtoD( - reinterpret_cast( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) ); + const_cast( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) ); hiprtFuncTable funcTable; CHECK_HIPRT( hiprtCreateFuncTable( ctxt, 1, 1, funcTable ) ); @@ -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( funcDataSet.intersectFuncData ) ) ); + CHECK_ORO( oroFree( const_cast( funcDataSet.intersectFuncData ) ) ); CHECK_ORO( oroFree( reinterpret_cast( sceneInput.instances ) ) ); CHECK_ORO( oroFree( reinterpret_cast( sceneInput.instanceFrames ) ) ); CHECK_ORO( oroFree( reinterpret_cast( mesh.triangleIndices ) ) ); diff --git a/tutorials/14_batch_build/main.cpp b/tutorials/14_batch_build/main.cpp index e0d95cc..c729638 100644 --- a/tutorials/14_batch_build/main.cpp +++ b/tutorials/14_batch_build/main.cpp @@ -173,9 +173,9 @@ class Tutorial : public TutorialBase hiprtFuncDataSet funcDataSet; CHECK_ORO( oroMalloc( - reinterpret_cast( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) ); + const_cast( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) ); CHECK_ORO( oroMemcpyHtoD( - reinterpret_cast( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) ); + const_cast( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) ); hiprtFuncTable funcTable; CHECK_HIPRT( hiprtCreateFuncTable( ctxt, 1, 1, funcTable ) ); @@ -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( funcDataSet.intersectFuncData ) ) ); + CHECK_ORO( oroFree( const_cast( funcDataSet.intersectFuncData ) ) ); CHECK_ORO( oroFree( reinterpret_cast( sceneInput.instances ) ) ); CHECK_ORO( oroFree( reinterpret_cast( sceneInput.instanceFrames ) ) ); CHECK_ORO( oroFree( reinterpret_cast( mesh.triangleIndices ) ) ); diff --git a/tutorials/15_multi_level_instancing/main.cpp b/tutorials/15_multi_level_instancing/main.cpp index ee4a025..9b6e654 100644 --- a/tutorials/15_multi_level_instancing/main.cpp +++ b/tutorials/15_multi_level_instancing/main.cpp @@ -223,9 +223,9 @@ class Tutorial : public TutorialBase hiprtFuncDataSet funcDataSet; CHECK_ORO( oroMalloc( - reinterpret_cast( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) ); + const_cast( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) ); CHECK_ORO( oroMemcpyHtoD( - reinterpret_cast( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) ); + const_cast( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) ); hiprtFuncTable funcTable; CHECK_HIPRT( hiprtCreateFuncTable( ctxt, 1, 1, funcTable ) ); @@ -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( funcDataSet.intersectFuncData ) ) ); + CHECK_ORO( oroFree( const_cast( funcDataSet.intersectFuncData ) ) ); CHECK_ORO( oroFree( reinterpret_cast( sceneInputTop.instances ) ) ); CHECK_ORO( oroFree( reinterpret_cast( sceneInputTop.instanceFrames ) ) ); CHECK_ORO( oroFree( reinterpret_cast( sceneInputMid.instances ) ) ); diff --git a/tutorials/16_fluid_simulation/main.cpp b/tutorials/16_fluid_simulation/main.cpp index 72b2212..98d6337 100644 --- a/tutorials/16_fluid_simulation/main.cpp +++ b/tutorials/16_fluid_simulation/main.cpp @@ -130,9 +130,9 @@ class Tutorial : public TutorialBase hiprtFuncDataSet funcDataSet; CHECK_ORO( oroMalloc( - reinterpret_cast( &funcDataSet.intersectFuncData ), sim.m_particleCount * sizeof( Particle ) ) ); + const_cast( &funcDataSet.intersectFuncData ), sim.m_particleCount * sizeof( Particle ) ) ); CHECK_ORO( oroMemcpyHtoD( - reinterpret_cast( funcDataSet.intersectFuncData ), + const_cast( funcDataSet.intersectFuncData ), particles.data(), sim.m_particleCount * sizeof( Particle ) ) ); @@ -230,7 +230,7 @@ class Tutorial : public TutorialBase } } - CHECK_ORO( oroFree( reinterpret_cast( funcDataSet.intersectFuncData ) ) ); + CHECK_ORO( oroFree( const_cast( funcDataSet.intersectFuncData ) ) ); CHECK_ORO( oroFree( reinterpret_cast( list.aabbs ) ) ); CHECK_ORO( oroFree( reinterpret_cast( geomTemp ) ) ); CHECK_ORO( oroFree( reinterpret_cast( pSim ) ) ); diff --git a/tutorials/17_hiprt_hip/premake5.lua b/tutorials/17_hiprt_hip/premake5.lua index ef4e8e1..5705f48 100644 --- a/tutorials/17_hiprt_hip/premake5.lua +++ b/tutorials/17_hiprt_hip/premake5.lua @@ -29,5 +29,5 @@ project "17_hiprt_hip" files { "./**.h", "./**.cpp"} files { "../../hiprt/*.h"} - links {"hiprt0200264"} + links {"hiprt0200464"} targetdir "../dist/bin/%{cfg.buildcfg}" diff --git a/tutorials/common/TutorialBase.cpp b/tutorials/common/TutorialBase.cpp index b89c110..a9cdadf 100644 --- a/tutorials/common/TutorialBase.cpp +++ b/tutorials/common/TutorialBase.cpp @@ -22,6 +22,8 @@ #include +#include + #define STB_IMAGE_WRITE_IMPLEMENTATION #include @@ -61,7 +63,7 @@ void TutorialBase::init( uint32_t deviceIndex ) { m_res = make_hiprtInt2( 512, 512 ); - CHECK_ORO( static_cast( oroInitialize( (oroApi)( ORO_API_HIP | ORO_API_CUDA ), 0 ) ) ); + CHECK_ORO( static_cast( 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 ) ); diff --git a/tutorials/common/dependency.lua b/tutorials/common/dependency.lua index 2a27344..b49b59c 100644 --- a/tutorials/common/dependency.lua +++ b/tutorials/common/dependency.lua @@ -12,5 +12,5 @@ if os.ishost("linux") then end files { "../../hiprt/*.h"} -links {"hiprt0200264"} +links {"hiprt0200464"}