1
- use crate :: cuda:: { CudaRendererBuffers , PTX } ;
1
+ use crate :: cuda:: CudaRendererBuffers ;
2
2
use anyhow:: Result ;
3
3
use cust:: {
4
- function:: { BlockSize , GridSize } ,
5
- memory:: { DeviceBox , DeviceBuffer , DeviceVariable , UnifiedBox , UnifiedBuffer } ,
6
- module:: Module ,
4
+ memory:: { DeviceBox , DeviceBuffer } ,
7
5
prelude:: Stream ,
8
6
} ;
9
7
use optix:: {
@@ -20,7 +18,7 @@ use optix::{
20
18
shader_binding_table:: { SbtRecord , ShaderBindingTable } ,
21
19
} ;
22
20
use path_tracer_gpu:: { optix:: LaunchParams , scene:: Scene , sphere:: Sphere , Object } ;
23
- use vek :: Vec3 ;
21
+
24
22
pub type RaygenRecord = SbtRecord < i32 > ;
25
23
pub type MissRecord = SbtRecord < i32 > ;
26
24
pub type SphereHitgroupRecord = SbtRecord < Sphere > ;
@@ -31,11 +29,7 @@ pub(crate) static OPTIX_PTX: &str = include_str!("../../../../resources/path_tra
31
29
pub struct OptixRenderer {
32
30
sbt : ShaderBindingTable ,
33
31
gas : Accel ,
34
- buf_raygen : DeviceBuffer < RaygenRecord > ,
35
- buf_sphere_hitgroup : DeviceBuffer < SphereHitgroupRecord > ,
36
- buf_miss : DeviceBuffer < MissRecord > ,
37
32
pipeline : Pipeline ,
38
- aabb_buffer : DeviceBuffer < Aabb > ,
39
33
}
40
34
41
35
impl OptixRenderer {
@@ -74,7 +68,7 @@ impl OptixRenderer {
74
68
) ;
75
69
let ( pg_sphere_hitgroup, _log) = ProgramGroup :: new ( ctx, & [ pgdesc_sphere_hitgroup] ) ?;
76
70
77
- let ( accel, aabb_buffer ) = Self :: build_accel_from_scene ( ctx, stream, scene) ?;
71
+ let accel = Self :: build_accel_from_scene ( ctx, stream, scene) ?;
78
72
79
73
let rec_raygen: Vec < _ > = pg_raygen
80
74
. iter ( )
@@ -116,19 +110,15 @@ impl OptixRenderer {
116
110
Ok ( Self {
117
111
sbt,
118
112
gas : accel,
119
- buf_raygen,
120
- buf_miss,
121
- buf_sphere_hitgroup,
122
113
pipeline,
123
- aabb_buffer,
124
114
} )
125
115
}
126
116
127
117
fn build_accel_from_scene (
128
118
ctx : & mut DeviceContext ,
129
119
stream : & Stream ,
130
120
scene : & Scene ,
131
- ) -> Result < ( Accel , DeviceBuffer < Aabb > ) > {
121
+ ) -> Result < Accel > {
132
122
let mut aabbs = Vec :: with_capacity ( scene. objects . len ( ) ) ;
133
123
for obj in scene. objects . iter ( ) {
134
124
match obj {
@@ -160,7 +150,7 @@ impl OptixRenderer {
160
150
let gas = Accel :: build ( ctx, stream, & [ accel_options] , & build_inputs, true ) ?;
161
151
// dont need to synchronize, we enqueue the optix launch on the same stream so it will be ordered
162
152
// correctly
163
- Ok ( ( gas, buf ) )
153
+ Ok ( gas)
164
154
}
165
155
166
156
fn build_scene_hitgroup_records (
@@ -186,12 +176,7 @@ impl OptixRenderer {
186
176
Ok ( sphere_records)
187
177
}
188
178
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 < ( ) > {
195
180
let dims = buffers. viewport . bounds . numcast ( ) . unwrap ( ) ;
196
181
197
182
let launch_params = LaunchParams {
0 commit comments