1- use crate :: cuda:: { CudaRendererBuffers , PTX } ;
1+ use crate :: cuda:: CudaRendererBuffers ;
22use anyhow:: Result ;
33use cust:: {
4- function:: { BlockSize , GridSize } ,
5- memory:: { DeviceBox , DeviceBuffer , DeviceVariable , UnifiedBox , UnifiedBuffer } ,
6- module:: Module ,
4+ memory:: { DeviceBox , DeviceBuffer } ,
75 prelude:: Stream ,
86} ;
97use optix:: {
@@ -20,7 +18,7 @@ use optix::{
2018 shader_binding_table:: { SbtRecord , ShaderBindingTable } ,
2119} ;
2220use path_tracer_gpu:: { optix:: LaunchParams , scene:: Scene , sphere:: Sphere , Object } ;
23- use vek :: Vec3 ;
21+
2422pub type RaygenRecord = SbtRecord < i32 > ;
2523pub type MissRecord = SbtRecord < i32 > ;
2624pub type SphereHitgroupRecord = SbtRecord < Sphere > ;
@@ -31,11 +29,7 @@ pub(crate) static OPTIX_PTX: &str = include_str!("../../../../resources/path_tra
3129pub struct OptixRenderer {
3230 sbt : ShaderBindingTable ,
3331 gas : Accel ,
34- buf_raygen : DeviceBuffer < RaygenRecord > ,
35- buf_sphere_hitgroup : DeviceBuffer < SphereHitgroupRecord > ,
36- buf_miss : DeviceBuffer < MissRecord > ,
3732 pipeline : Pipeline ,
38- aabb_buffer : DeviceBuffer < Aabb > ,
3933}
4034
4135impl OptixRenderer {
@@ -74,7 +68,7 @@ impl OptixRenderer {
7468 ) ;
7569 let ( pg_sphere_hitgroup, _log) = ProgramGroup :: new ( ctx, & [ pgdesc_sphere_hitgroup] ) ?;
7670
77- let ( accel, aabb_buffer ) = Self :: build_accel_from_scene ( ctx, stream, scene) ?;
71+ let accel = Self :: build_accel_from_scene ( ctx, stream, scene) ?;
7872
7973 let rec_raygen: Vec < _ > = pg_raygen
8074 . iter ( )
@@ -116,19 +110,15 @@ impl OptixRenderer {
116110 Ok ( Self {
117111 sbt,
118112 gas : accel,
119- buf_raygen,
120- buf_miss,
121- buf_sphere_hitgroup,
122113 pipeline,
123- aabb_buffer,
124114 } )
125115 }
126116
127117 fn build_accel_from_scene (
128118 ctx : & mut DeviceContext ,
129119 stream : & Stream ,
130120 scene : & Scene ,
131- ) -> Result < ( Accel , DeviceBuffer < Aabb > ) > {
121+ ) -> Result < Accel > {
132122 let mut aabbs = Vec :: with_capacity ( scene. objects . len ( ) ) ;
133123 for obj in scene. objects . iter ( ) {
134124 match obj {
@@ -160,7 +150,7 @@ impl OptixRenderer {
160150 let gas = Accel :: build ( ctx, stream, & [ accel_options] , & build_inputs, true ) ?;
161151 // dont need to synchronize, we enqueue the optix launch on the same stream so it will be ordered
162152 // correctly
163- Ok ( ( gas, buf ) )
153+ Ok ( gas)
164154 }
165155
166156 fn build_scene_hitgroup_records (
@@ -186,12 +176,7 @@ impl OptixRenderer {
186176 Ok ( sphere_records)
187177 }
188178
189- pub fn render (
190- & mut self ,
191- module : & Module ,
192- stream : & Stream ,
193- buffers : & mut CudaRendererBuffers ,
194- ) -> Result < ( ) > {
179+ pub fn render ( & mut self , stream : & Stream , buffers : & mut CudaRendererBuffers ) -> Result < ( ) > {
195180 let dims = buffers. viewport . bounds . numcast ( ) . unwrap ( ) ;
196181
197182 let launch_params = LaunchParams {
0 commit comments