Skip to content

Commit 8d26d0f

Browse files
authored
Merge pull request #39 from GPUOpen-LibrariesAndSDKs/release-2.4
Release 2.4
2 parents 7e4d141 + a29cea9 commit 8d26d0f

File tree

11 files changed

+35
-37
lines changed

11 files changed

+35
-37
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# HIP RT SDK
22

3-
**This repository is only for tutorials. The SDK binaries needs to be downloaded from [HIP RT project page](https://gpuopen.com/hiprt/).**
3+
**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).**
44

55
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.
66

@@ -53,7 +53,7 @@ Windows:
5353
3. Run premake to generate a solution for Visual Studio 2022:
5454
````
5555
cd tutorials
56-
../tools/premake5/win/premake5.exe vs2022
56+
"../tools/premake5/win/premake5.exe" vs2022
5757
````
5858

5959
4. Open the solution, compile & run.

contrib/Orochi

Submodule Orochi updated 129 files

tutorials/03_custom_intersection/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ class Tutorial : public TutorialBase
8080
std::vector<hiprtFuncNameSet> funcNameSets = { funcNameSet };
8181

8282
hiprtFuncDataSet funcDataSet;
83-
CHECK_ORO( oroMalloc(
84-
reinterpret_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), SphereCount * sizeof( hiprtFloat4 ) ) );
83+
CHECK_ORO(
84+
oroMalloc( const_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), SphereCount * sizeof( hiprtFloat4 ) ) );
8585
CHECK_ORO( oroMemcpyHtoD(
86-
reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), spheres, SphereCount * sizeof( hiprtFloat4 ) ) );
86+
const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), spheres, SphereCount * sizeof( hiprtFloat4 ) ) );
8787

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

103-
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
103+
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
104104
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( list.aabbs ) ) );
105105
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( geomTemp ) ) );
106106
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( pixels ) ) );

tutorials/11_multi_custom_intersection/main.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,14 @@ class Tutorial : public TutorialBase
161161
1 );
162162

163163
std::vector<hiprtFuncDataSet> funcDataSets( GeomTypesCount );
164-
CHECK_ORO( oroMalloc(
165-
reinterpret_cast<oroDeviceptr*>( &funcDataSets[SphereTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) );
164+
CHECK_ORO(
165+
oroMalloc( const_cast<oroDeviceptr*>( &funcDataSets[SphereTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) );
166166
CHECK_ORO( oroMemcpyHtoD(
167-
reinterpret_cast<oroDeviceptr>( funcDataSets[SphereTypeIndex].intersectFuncData ),
168-
&sphere,
169-
sizeof( hiprtFloat4 ) ) );
170-
CHECK_ORO( oroMalloc(
171-
reinterpret_cast<oroDeviceptr*>( &funcDataSets[CircleTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) );
167+
const_cast<oroDeviceptr>( funcDataSets[SphereTypeIndex].intersectFuncData ), &sphere, sizeof( hiprtFloat4 ) ) );
168+
CHECK_ORO(
169+
oroMalloc( const_cast<oroDeviceptr*>( &funcDataSets[CircleTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) );
172170
CHECK_ORO( oroMemcpyHtoD(
173-
reinterpret_cast<oroDeviceptr>( funcDataSets[CircleTypeIndex].intersectFuncData ),
174-
&circle,
175-
sizeof( hiprtFloat4 ) ) );
171+
const_cast<oroDeviceptr>( funcDataSets[CircleTypeIndex].intersectFuncData ), &circle, sizeof( hiprtFloat4 ) ) );
176172

177173
hiprtFuncTable funcTable;
178174
CHECK_HIPRT( hiprtCreateFuncTable( ctxt, GeomTypesCount, 1, funcTable ) );
@@ -190,8 +186,8 @@ class Tutorial : public TutorialBase
190186
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( listCircles.aabbs ) ) );
191187
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instanceFrames ) ) );
192188
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instances ) ) );
193-
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSets[SphereTypeIndex].intersectFuncData ) ) );
194-
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSets[CircleTypeIndex].intersectFuncData ) ) );
189+
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSets[SphereTypeIndex].intersectFuncData ) ) );
190+
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSets[CircleTypeIndex].intersectFuncData ) ) );
195191
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( pixels ) ) );
196192

197193
CHECK_HIPRT( hiprtDestroyGeometry( ctxt, geomSpheres ) );

tutorials/13_concurrent_scene_build/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ class Tutorial : public TutorialBase
186186
ctxt, "../common/TutorialKernels.h", "SceneBuildKernel", func, nullptr, &funcNameSets, 1, 1 );
187187

188188
hiprtFuncDataSet funcDataSet;
189-
CHECK_ORO( oroMalloc(
190-
reinterpret_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
189+
CHECK_ORO(
190+
oroMalloc( const_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
191191
CHECK_ORO( oroMemcpyHtoD(
192-
reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );
192+
const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );
193193

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

206-
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
206+
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
207207
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instances ) ) );
208208
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instanceFrames ) ) );
209209
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( mesh.triangleIndices ) ) );

tutorials/14_batch_build/main.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,9 @@ class Tutorial : public TutorialBase
172172
ctxt, "../common/TutorialKernels.h", "SceneBuildKernel", func, nullptr, &funcNameSets, 1, 1 );
173173

174174
hiprtFuncDataSet funcDataSet;
175-
CHECK_ORO( oroMalloc(
176-
reinterpret_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
175+
CHECK_ORO( oroMalloc( const_cast<void**>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
177176
CHECK_ORO( oroMemcpyHtoD(
178-
reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );
177+
const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );
179178

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

192-
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
191+
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
193192
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instances ) ) );
194193
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instanceFrames ) ) );
195194
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( mesh.triangleIndices ) ) );

tutorials/15_multi_level_instancing/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ class Tutorial : public TutorialBase
222222
ctxt, "../common/TutorialKernels.h", "SceneBuildKernel", func, nullptr, &funcNameSets, 1, 1 );
223223

224224
hiprtFuncDataSet funcDataSet;
225-
CHECK_ORO( oroMalloc(
226-
reinterpret_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
225+
CHECK_ORO(
226+
oroMalloc( const_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
227227
CHECK_ORO( oroMemcpyHtoD(
228-
reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );
228+
const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );
229229

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

242-
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
242+
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
243243
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInputTop.instances ) ) );
244244
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInputTop.instanceFrames ) ) );
245245
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInputMid.instances ) ) );

tutorials/16_fluid_simulation/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ class Tutorial : public TutorialBase
130130

131131
hiprtFuncDataSet funcDataSet;
132132
CHECK_ORO( oroMalloc(
133-
reinterpret_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), sim.m_particleCount * sizeof( Particle ) ) );
133+
const_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), sim.m_particleCount * sizeof( Particle ) ) );
134134
CHECK_ORO( oroMemcpyHtoD(
135-
reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ),
135+
const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ),
136136
particles.data(),
137137
sim.m_particleCount * sizeof( Particle ) ) );
138138

@@ -230,7 +230,7 @@ class Tutorial : public TutorialBase
230230
}
231231
}
232232

233-
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
233+
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
234234
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( list.aabbs ) ) );
235235
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( geomTemp ) ) );
236236
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( pSim ) ) );

tutorials/17_hiprt_hip/premake5.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ project "17_hiprt_hip"
2929
files { "./**.h", "./**.cpp"}
3030
files { "../../hiprt/*.h"}
3131

32-
links {"hiprt0200264"}
32+
links {"hiprt0200464"}
3333
targetdir "../dist/bin/%{cfg.buildcfg}"

tutorials/common/TutorialBase.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
#include <tutorials/common/TutorialBase.h>
2424

25+
#include <hiprt/hiprt_libpath.h>
26+
2527
#define STB_IMAGE_WRITE_IMPLEMENTATION
2628
#include <contrib/stbi/stbi_image_write.h>
2729

@@ -61,7 +63,8 @@ void TutorialBase::init( uint32_t deviceIndex )
6163
{
6264
m_res = make_hiprtInt2( 512, 512 );
6365

64-
CHECK_ORO( static_cast<oroError>( oroInitialize( (oroApi)( ORO_API_HIP | ORO_API_CUDA ), 0 ) ) );
66+
CHECK_ORO(
67+
static_cast<oroError>( oroInitialize( (oroApi)( ORO_API_HIP | ORO_API_CUDA ), 0, g_hip_paths, g_hiprtc_paths ) ) );
6568

6669
CHECK_ORO( oroInit( 0 ) );
6770
CHECK_ORO( oroDeviceGet( &m_oroDevice, deviceIndex ) );

0 commit comments

Comments
 (0)