(dimensions: Vec2<usize>, camera: &Camera, scene: &Scene)
| 36 | |
| 37 | impl CudaRendererBuffers { |
| 38 | pub fn new(dimensions: Vec2<usize>, camera: &Camera, scene: &Scene) -> CudaResult<Self> { |
| 39 | let accumulated_buffer = Self::image_buffer(dimensions)?; |
| 40 | let out_buffer = Self::image_buffer(dimensions)?; |
| 41 | let denoised_buffer = Self::image_buffer(dimensions)?; |
| 42 | let scaled_buffer = Self::image_buffer(dimensions)?; |
| 43 | |
| 44 | let objects = scene.objects.as_unified_buf()?; |
| 45 | let materials = scene.materials.as_unified_buf()?; |
| 46 | |
| 47 | let mut viewport = Viewport::default(); |
| 48 | camera.as_viewport(&mut viewport); |
| 49 | viewport.bounds = dimensions; |
| 50 | |
| 51 | let rand_states = DefaultRand::initialize_states(SEED, dimensions.product()) |
| 52 | .as_slice() |
| 53 | .as_unified_buf()?; |
| 54 | |
| 55 | Ok(Self { |
| 56 | accumulated_buffer, |
| 57 | scaled_buffer, |
| 58 | out_buffer, |
| 59 | denoised_buffer, |
| 60 | viewport, |
| 61 | objects, |
| 62 | materials, |
| 63 | rand_states, |
| 64 | }) |
| 65 | } |
| 66 | |
| 67 | /// Resets and reallocates the entire scene. This may be slow because it needs to reallocate |
| 68 | /// all of the GPU scene buffers. |
nothing calls this directly
no test coverage detected