@@ -31,34 +31,34 @@ class Tutorial : public TutorialBase
3131 CHECK_HIPRT ( hiprtCreateContext ( HIPRT_API_VERSION, m_ctxtInput, ctxt ) );
3232
3333 hiprtTriangleMeshPrimitive mesh;
34- mesh.triangleCount = 2 ;
35- mesh.triangleStride = sizeof ( hiprtInt3 );
36- int triangleIndices[] = { 0 , 1 , 2 , 3 , 4 , 5 };
34+ mesh.triangleCount = 2 ;
35+ mesh.triangleStride = sizeof ( hiprtInt3 );
36+ uint32_t triangleIndices[] = { 0 , 1 , 2 , 3 , 4 , 5 };
3737 CHECK_ORO (
3838 oroMalloc ( reinterpret_cast <oroDeviceptr*>( &mesh.triangleIndices ), mesh.triangleCount * sizeof ( hiprtInt3 ) ) );
3939 CHECK_ORO ( oroMemcpyHtoD (
4040 reinterpret_cast <oroDeviceptr>( mesh.triangleIndices ),
4141 triangleIndices,
4242 mesh.triangleCount * sizeof ( hiprtInt3 ) ) );
4343
44- mesh.vertexCount = 6 ;
45- mesh.vertexStride = sizeof ( hiprtFloat3 );
46- const float s = 0 .5f ;
47- const float t = 0 .8f ;
48- hiprtFloat3 vertices[] = {
49- { s, s , 0 .0f },
50- { s + t * s , -s * s , 0 .0f },
51- { s - t * s , -s * s , 0 .0f },
52- { -s, s , 0 .0f },
53- { -s + t * s , -s * s , 0 .0f },
54- { -s - t * s , -s * s , 0 .0f } };
44+ mesh.vertexCount = 6 ;
45+ mesh.vertexStride = sizeof ( hiprtFloat3 );
46+ constexpr float S = 0 .5f ;
47+ constexpr float T = 0 .8f ;
48+ hiprtFloat3 vertices[] = {
49+ { S, S , 0 .0f },
50+ { S + T * S , -S * S , 0 .0f },
51+ { S - T * S , -S * S , 0 .0f },
52+ { -S, S , 0 .0f },
53+ { -S + T * S , -S * S , 0 .0f },
54+ { -S - T * S , -S * S , 0 .0f } };
5555 CHECK_ORO ( oroMalloc ( reinterpret_cast <oroDeviceptr*>( &mesh.vertices ), mesh.vertexCount * sizeof ( hiprtFloat3 ) ) );
5656 CHECK_ORO ( oroMemcpyHtoD (
5757 reinterpret_cast <oroDeviceptr>( mesh.vertices ), vertices, mesh.vertexCount * sizeof ( hiprtFloat3 ) ) );
5858
5959 hiprtGeometryBuildInput geomInput;
6060 geomInput.type = hiprtPrimitiveTypeTriangleMesh;
61- geomInput.triangleMesh . primitive = mesh;
61+ geomInput.primitive . triangleMesh = mesh;
6262
6363 size_t geomTempSize;
6464 hiprtDevicePtr geomTemp;
@@ -71,14 +71,17 @@ class Tutorial : public TutorialBase
7171 CHECK_HIPRT ( hiprtCreateGeometry ( ctxt, geomInput, options, geom ) );
7272 CHECK_HIPRT ( hiprtBuildGeometry ( ctxt, hiprtBuildOperationBuild, geomInput, options, geomTemp, 0 , geom ) );
7373
74+ hiprtInstance instance;
75+ instance.type = hiprtInstanceTypeGeometry;
76+ instance.geometry = geom;
77+
7478 hiprtSceneBuildInput sceneInput;
7579 sceneInput.instanceCount = 1 ;
7680 sceneInput.instanceMasks = nullptr ;
7781 sceneInput.instanceTransformHeaders = nullptr ;
78- hiprtDevicePtr geoms[] = { geom };
79- CHECK_ORO ( oroMalloc ( reinterpret_cast <oroDeviceptr*>( &sceneInput.instanceGeometries ), sizeof ( hiprtDevicePtr ) ) );
82+ CHECK_ORO ( oroMalloc ( reinterpret_cast <oroDeviceptr*>( &sceneInput.instances ), sizeof ( hiprtInstance ) ) );
8083 CHECK_ORO (
81- oroMemcpyHtoD ( reinterpret_cast <oroDeviceptr>( sceneInput.instanceGeometries ), geoms , sizeof ( hiprtDevicePtr ) ) );
84+ oroMemcpyHtoD ( reinterpret_cast <oroDeviceptr>( sceneInput.instances ), &instance , sizeof ( hiprtInstance ) ) );
8285
8386 hiprtFrameSRT frame;
8487 frame.translation = make_hiprtFloat3 ( 0 .0f , 0 .0f , 0 .0f );
@@ -101,14 +104,14 @@ class Tutorial : public TutorialBase
101104 oroFunction func;
102105 buildTraceKernelFromBitcode ( ctxt, " ../common/TutorialKernels.h" , " SceneIntersectionKernel" , func );
103106
104- u8 * pixels;
107+ uint8_t * pixels;
105108 CHECK_ORO ( oroMalloc ( reinterpret_cast <oroDeviceptr*>( &pixels ), m_res.x * m_res.y * 4 ) );
106109
107110 void * args[] = { &scene, &pixels, &m_res };
108111 launchKernel ( func, m_res.x , m_res.y , args );
109112 writeImage ( " 02_scene_intersection.png" , m_res.x , m_res.y , pixels );
110113
111- CHECK_ORO ( oroFree ( reinterpret_cast <oroDeviceptr>( sceneInput.instanceGeometries ) ) );
114+ CHECK_ORO ( oroFree ( reinterpret_cast <oroDeviceptr>( sceneInput.instances ) ) );
112115 CHECK_ORO ( oroFree ( reinterpret_cast <oroDeviceptr>( sceneInput.instanceFrames ) ) );
113116 CHECK_ORO ( oroFree ( reinterpret_cast <oroDeviceptr>( mesh.triangleIndices ) ) );
114117 CHECK_ORO ( oroFree ( reinterpret_cast <oroDeviceptr>( mesh.vertices ) ) );
0 commit comments