@@ -5,7 +5,9 @@ use imgui::Ui;
55
66use std:: time:: Duration ;
77
8- use crate :: { common:: Camera , optix:: OptixRenderer } ;
8+ use crate :: common:: Camera ;
9+ // See the OPTIX_DISABLED comment.
10+ // use crate::optix::OptixRenderer;
911use anyhow:: Result ;
1012use cust:: {
1113 error:: CudaResult ,
@@ -15,10 +17,11 @@ use cust::{
1517 prelude:: * ,
1618} ;
1719use glam:: { U8Vec3 , USizeVec2 } ;
18- use optix:: {
19- context:: DeviceContext ,
20- denoiser:: { Denoiser , DenoiserModelKind , Image , ImageFormat } ,
21- } ;
20+ // See the OPTIX_DISABLED comment.
21+ // use optix::{
22+ // context::DeviceContext,
23+ // denoiser::{Denoiser, DenoiserModelKind, Image, ImageFormat},
24+ // };
2225use path_tracer_kernels:: scene:: Scene ;
2326/// Seed for the random states
2427pub const SEED : u64 = 932174513921034 ;
@@ -33,45 +36,51 @@ pub(crate) static PTX: &str = include_str!(concat!(env!("OUT_DIR"), "/kernels.pt
3336pub struct CudaRenderer {
3437 stream : Stream ,
3538 module : Module ,
36- denoiser : Denoiser ,
37- _optix_context : DeviceContext ,
39+ // See the OPTIX_DISABLED comment.
40+ // denoiser: Denoiser,
41+ // _optix_context: DeviceContext,
3842 _context : Context ,
3943
4044 buffers : CudaRendererBuffers ,
4145 cpu_image : Vec < U8Vec3 > ,
42- optix_renderer : OptixRenderer ,
46+ // See the OPTIX_DISABLED comment.
47+ // optix_renderer: OptixRenderer,
4348}
4449
4550impl CudaRenderer {
4651 pub fn new ( dimensions : USizeVec2 , camera : & Camera , scene : & Scene ) -> Result < Self > {
4752 let context = cust:: quick_init ( ) ?;
48- optix :: init ( ) . unwrap ( ) ;
49-
50- let mut optix_context = DeviceContext :: new ( & context, false ) . unwrap ( ) ;
53+ // See the OPTIX_DISABLED comment.
54+ // optix::init().unwrap();
55+ // let mut optix_context = DeviceContext::new(&context, false).unwrap();
5156
5257 let module = Module :: from_ptx ( PTX , & [ ] ) . unwrap ( ) ;
5358 let stream = Stream :: new ( StreamFlags :: NON_BLOCKING , None ) ?;
54- let mut denoiser =
55- Denoiser :: new ( & optix_context, DenoiserModelKind :: Ldr , Default :: default ( ) ) . unwrap ( ) ;
5659
57- denoiser
58- . setup_state ( & stream, dimensions. x as u32 , dimensions. y as u32 , false )
59- . unwrap ( ) ;
60+ // See the OPTIX_DISABLED comment.
61+ // let mut denoiser =
62+ // Denoiser::new(&optix_context, DenoiserModelKind::Ldr, Default::default()).unwrap();
63+ // denoiser
64+ // .setup_state(&stream, dimensions.x as u32, dimensions.y as u32, false)
65+ // .unwrap();
6066
6167 let buffers = CudaRendererBuffers :: new ( dimensions, camera, scene) ?;
6268 let cpu_image = vec ! [ U8Vec3 :: ZERO ; dimensions. element_product( ) ] ;
6369
64- let optix_renderer = OptixRenderer :: new ( & mut optix_context, & stream, scene) ?;
70+ // See the OPTIX_DISABLED comment.
71+ // let optix_renderer = OptixRenderer::new(&mut optix_context, &stream, scene)?;
6572
6673 Ok ( Self {
6774 _context : context,
68- _optix_context : optix_context,
69- denoiser,
75+ // See the OPTIX_DISABLED comment.
76+ // _optix_context: optix_context,
77+ // denoiser,
7078 module,
7179 stream,
7280 buffers,
7381 cpu_image,
74- optix_renderer,
82+ // See the OPTIX_DISABLED comment.
83+ // optix_renderer,
7584 } )
7685 }
7786
@@ -97,9 +106,11 @@ impl CudaRenderer {
97106 self . cpu_image
98107 . resize ( new_size. element_product ( ) , U8Vec3 :: ZERO ) ;
99108
100- self . denoiser
101- . setup_state ( & self . stream , new_size. x as u32 , new_size. y as u32 , false )
102- . unwrap ( ) ;
109+ // See the OPTIX_DISABLED comment.
110+ // self.denoiser
111+ // .setup_state(&self.stream, new_size.x as u32, new_size.y as u32, false)
112+ // .unwrap();
113+
103114 Ok ( ( ) )
104115 }
105116
@@ -123,8 +134,9 @@ impl CudaRenderer {
123134 let stream = & self . stream ;
124135
125136 let ( blocks, threads) = self . launch_dimensions ( ) ;
126- let width = self . buffers . viewport . bounds . x as u32 ;
127- let height = self . buffers . viewport . bounds . y as u32 ;
137+ // See the OPTIX_DISABLED comment.
138+ // let width = self.buffers.viewport.bounds.x as u32;
139+ // let height = self.buffers.viewport.bounds.y as u32;
128140
129141 let start = Event :: new ( EventFlags :: DEFAULT ) ?;
130142 let denoising_stop = Event :: new ( EventFlags :: DEFAULT ) ?;
@@ -144,23 +156,24 @@ impl CudaRenderer {
144156 }
145157
146158 let input_buf = if denoise {
147- let input_image = Image :: new (
148- & self . buffers . scaled_buffer ,
149- ImageFormat :: Float3 ,
150- width,
151- height,
152- ) ;
153-
154- self . denoiser
155- . invoke (
156- stream,
157- Default :: default ( ) ,
158- input_image,
159- Default :: default ( ) ,
160- & mut self . buffers . denoised_buffer ,
161- )
162- . unwrap ( ) ;
163-
159+ // See the OPTIX_DISABLED comment.
160+ // let input_image = Image::new(
161+ // &self.buffers.scaled_buffer,
162+ // ImageFormat::Float3,
163+ // width,
164+ // height,
165+ // );
166+ //
167+ // self.denoiser
168+ // .invoke(
169+ // stream,
170+ // Default::default(),
171+ // input_image,
172+ // Default::default(),
173+ // &mut self.buffers.denoised_buffer,
174+ // )
175+ // .unwrap();
176+ //
164177 self . buffers . denoised_buffer . as_device_ptr ( )
165178 } else {
166179 self . buffers . scaled_buffer . as_device_ptr ( )
@@ -204,7 +217,8 @@ impl CudaRenderer {
204217 start. record ( stream) ?;
205218
206219 if use_optix {
207- self . optix_renderer . render ( stream, & mut self . buffers ) ?;
220+ // See the OPTIX_DISABLED comment.
221+ // self.optix_renderer.render(stream, &mut self.buffers)?;
208222 } else {
209223 unsafe {
210224 let scene = DeviceBox :: new_async (
0 commit comments