Skip to content

Commit f49291a

Browse files
committed
Chore: clean up unused code warnings
1 parent b62a97d commit f49291a

File tree

3 files changed

+10
-24
lines changed

3 files changed

+10
-24
lines changed

examples/cuda/cpu/path_tracer/src/cuda/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ impl CudaRenderer {
204204
start.record(stream)?;
205205

206206
if use_optix {
207-
self.optix_renderer
208-
.render(module, stream, &mut self.buffers)?;
207+
self.optix_renderer.render(stream, &mut self.buffers)?;
209208
} else {
210209
unsafe {
211210
let scene = DeviceBox::new_async(

examples/cuda/cpu/path_tracer/src/optix/mod.rs

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
use crate::cuda::{CudaRendererBuffers, PTX};
1+
use crate::cuda::CudaRendererBuffers;
22
use anyhow::Result;
33
use cust::{
4-
function::{BlockSize, GridSize},
5-
memory::{DeviceBox, DeviceBuffer, DeviceVariable, UnifiedBox, UnifiedBuffer},
6-
module::Module,
4+
memory::{DeviceBox, DeviceBuffer},
75
prelude::Stream,
86
};
97
use optix::{
@@ -20,7 +18,7 @@ use optix::{
2018
shader_binding_table::{SbtRecord, ShaderBindingTable},
2119
};
2220
use path_tracer_gpu::{optix::LaunchParams, scene::Scene, sphere::Sphere, Object};
23-
use vek::Vec3;
21+
2422
pub type RaygenRecord = SbtRecord<i32>;
2523
pub type MissRecord = SbtRecord<i32>;
2624
pub type SphereHitgroupRecord = SbtRecord<Sphere>;
@@ -31,11 +29,7 @@ pub(crate) static OPTIX_PTX: &str = include_str!("../../../../resources/path_tra
3129
pub 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

4135
impl 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 {

examples/cuda/gpu/path_tracer_gpu/src/optix.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(dead_code, unused_imports)]
2+
13
use crate::{
24
hittable::{HitRecord, Hittable},
35
material::Material,

0 commit comments

Comments
 (0)