From fc6d7126001962fb2e01ba4354196558c8203dbc Mon Sep 17 00:00:00 2001 From: Richard Geslot Date: Thu, 19 Sep 2024 15:57:15 +0200 Subject: [PATCH 1/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5676211..edf2922 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # HIP RT SDK -**This repository is only for tutorials. The SDK binaries needs to be downloaded from [HIP RT project page](https://gpuopen.com/hiprt/).** +**This repository is only for tutorials. The SDK binaries needs to be downloaded from [HIP RT project page](https://gpuopen.com/hiprt/) and the full source code of HIP RT can be found [here](https://github.com/GPUOpen-LibrariesAndSDKs/HIPRT).** HIP RT is a ray tracing library in HIP. The APIs are designed to be minimal and low level, making it easy to write a ray tracing application in HIP. We designed the library and APIs to be simple to use and integrate into any existing HIP applications. Although there are a few other ray tracing APIs which, we designed HIP RT to be simpler and easier to use, so you do not need to learn many new kernel types. From 85f0b5612cf3b09f354fc3d06b09a8724d12fec1 Mon Sep 17 00:00:00 2001 From: Richard Geslot Date: Fri, 20 Sep 2024 12:27:48 +0200 Subject: [PATCH 2/3] 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"} From a29cea9387666653e37f18cd18abedef368e098b Mon Sep 17 00:00:00 2001 From: rprbuild Date: Mon, 23 Sep 2024 13:32:12 +0000 Subject: [PATCH 3/3] Automatic: Committing clang-format changes --- tutorials/03_custom_intersection/main.cpp | 4 ++-- tutorials/11_multi_custom_intersection/main.cpp | 16 ++++++---------- tutorials/13_concurrent_scene_build/main.cpp | 4 ++-- tutorials/14_batch_build/main.cpp | 3 +-- tutorials/15_multi_level_instancing/main.cpp | 4 ++-- tutorials/common/TutorialBase.cpp | 3 ++- 6 files changed, 15 insertions(+), 19 deletions(-) diff --git a/tutorials/03_custom_intersection/main.cpp b/tutorials/03_custom_intersection/main.cpp index 8e13f17..6d24641 100644 --- a/tutorials/03_custom_intersection/main.cpp +++ b/tutorials/03_custom_intersection/main.cpp @@ -80,8 +80,8 @@ class Tutorial : public TutorialBase std::vector funcNameSets = { funcNameSet }; hiprtFuncDataSet funcDataSet; - CHECK_ORO( oroMalloc( - const_cast( &funcDataSet.intersectFuncData ), SphereCount * sizeof( hiprtFloat4 ) ) ); + CHECK_ORO( + oroMalloc( const_cast( &funcDataSet.intersectFuncData ), SphereCount * sizeof( hiprtFloat4 ) ) ); CHECK_ORO( oroMemcpyHtoD( const_cast( funcDataSet.intersectFuncData ), spheres, SphereCount * sizeof( hiprtFloat4 ) ) ); diff --git a/tutorials/11_multi_custom_intersection/main.cpp b/tutorials/11_multi_custom_intersection/main.cpp index ab58f4d..a889297 100644 --- a/tutorials/11_multi_custom_intersection/main.cpp +++ b/tutorials/11_multi_custom_intersection/main.cpp @@ -161,18 +161,14 @@ class Tutorial : public TutorialBase 1 ); std::vector funcDataSets( GeomTypesCount ); - CHECK_ORO( oroMalloc( - const_cast( &funcDataSets[SphereTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) ); + CHECK_ORO( + oroMalloc( const_cast( &funcDataSets[SphereTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) ); CHECK_ORO( oroMemcpyHtoD( - const_cast( funcDataSets[SphereTypeIndex].intersectFuncData ), - &sphere, - sizeof( hiprtFloat4 ) ) ); - CHECK_ORO( oroMalloc( - const_cast( &funcDataSets[CircleTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) ); + const_cast( funcDataSets[SphereTypeIndex].intersectFuncData ), &sphere, sizeof( hiprtFloat4 ) ) ); + CHECK_ORO( + oroMalloc( const_cast( &funcDataSets[CircleTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) ); CHECK_ORO( oroMemcpyHtoD( - const_cast( funcDataSets[CircleTypeIndex].intersectFuncData ), - &circle, - sizeof( hiprtFloat4 ) ) ); + const_cast( funcDataSets[CircleTypeIndex].intersectFuncData ), &circle, sizeof( hiprtFloat4 ) ) ); hiprtFuncTable funcTable; CHECK_HIPRT( hiprtCreateFuncTable( ctxt, GeomTypesCount, 1, funcTable ) ); diff --git a/tutorials/13_concurrent_scene_build/main.cpp b/tutorials/13_concurrent_scene_build/main.cpp index 53301a8..e9d49d4 100644 --- a/tutorials/13_concurrent_scene_build/main.cpp +++ b/tutorials/13_concurrent_scene_build/main.cpp @@ -186,8 +186,8 @@ class Tutorial : public TutorialBase ctxt, "../common/TutorialKernels.h", "SceneBuildKernel", func, nullptr, &funcNameSets, 1, 1 ); hiprtFuncDataSet funcDataSet; - CHECK_ORO( oroMalloc( - const_cast( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) ); + CHECK_ORO( + oroMalloc( const_cast( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) ); CHECK_ORO( oroMemcpyHtoD( const_cast( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) ); diff --git a/tutorials/14_batch_build/main.cpp b/tutorials/14_batch_build/main.cpp index c729638..c88676b 100644 --- a/tutorials/14_batch_build/main.cpp +++ b/tutorials/14_batch_build/main.cpp @@ -172,8 +172,7 @@ class Tutorial : public TutorialBase ctxt, "../common/TutorialKernels.h", "SceneBuildKernel", func, nullptr, &funcNameSets, 1, 1 ); hiprtFuncDataSet funcDataSet; - CHECK_ORO( oroMalloc( - const_cast( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) ); + CHECK_ORO( oroMalloc( const_cast( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) ); CHECK_ORO( oroMemcpyHtoD( const_cast( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) ); diff --git a/tutorials/15_multi_level_instancing/main.cpp b/tutorials/15_multi_level_instancing/main.cpp index 9b6e654..c48f1eb 100644 --- a/tutorials/15_multi_level_instancing/main.cpp +++ b/tutorials/15_multi_level_instancing/main.cpp @@ -222,8 +222,8 @@ class Tutorial : public TutorialBase ctxt, "../common/TutorialKernels.h", "SceneBuildKernel", func, nullptr, &funcNameSets, 1, 1 ); hiprtFuncDataSet funcDataSet; - CHECK_ORO( oroMalloc( - const_cast( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) ); + CHECK_ORO( + oroMalloc( const_cast( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) ); CHECK_ORO( oroMemcpyHtoD( const_cast( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) ); diff --git a/tutorials/common/TutorialBase.cpp b/tutorials/common/TutorialBase.cpp index a9cdadf..3f74058 100644 --- a/tutorials/common/TutorialBase.cpp +++ b/tutorials/common/TutorialBase.cpp @@ -63,7 +63,8 @@ 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, g_hip_paths, g_hiprtc_paths ) ) ); + 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 ) );