From 59b5e4463d6eec0de27d6da6c85f8c719674e966 Mon Sep 17 00:00:00 2001 From: tcmal Date: Sun, 25 Aug 2024 17:44:24 +0100 Subject: refactor(skeleton): clean up targetchain --- stockton-render/src/level.rs | 23 +++++++++++------------ stockton-render/src/ui.rs | 11 +++++------ stockton-render/src/window.rs | 2 +- 3 files changed, 17 insertions(+), 19 deletions(-) (limited to 'stockton-render/src') diff --git a/stockton-render/src/level.rs b/stockton-render/src/level.rs index c9a8155..e288617 100644 --- a/stockton-render/src/level.rs +++ b/stockton-render/src/level.rs @@ -357,7 +357,7 @@ where .renderpass(RenderpassSpec { colors: vec![AttachmentSpec { attachment: Attachment { - format: Some(context.target_chain().properties().format), + format: Some(context.properties().color_format), samples: 1, ops: P::attachment_ops(), stencil_ops: P::attachment_ops(), @@ -368,7 +368,7 @@ where }], depth: Some(AttachmentSpec { attachment: Attachment { - format: Some(context.target_chain().properties().depth_format), + format: Some(context.properties().depth_format), samples: 1, ops: AttachmentOps::new( AttachmentLoadOp::Clear, @@ -406,16 +406,15 @@ where let pipeline = spec .build( &mut device, - context.target_chain().properties().extent, - context.target_chain().properties(), + context.properties().extent, once(&*repo.get_ds_layout()?), ) .context("Error building pipeline")?; - let fat = context.target_chain().properties().framebuffer_attachment(); + let fat = context.properties().swapchain_framebuffer_attachment(); let dat = FramebufferAttachment { usage: Usage::DEPTH_STENCIL_ATTACHMENT, - format: context.target_chain().properties().depth_format, + format: context.properties().depth_format, view_caps: ViewCapabilities::empty(), }; let framebuffers = TargetSpecificResources::new( @@ -423,22 +422,22 @@ where Ok(device.create_framebuffer( &pipeline.renderpass, IntoIter::new([fat.clone(), dat.clone()]), - context.target_chain().properties().extent, + context.properties().extent, )?) }, - context.target_chain().properties().image_count as usize, + context.properties().image_count as usize, )?; (pipeline, framebuffers) }; let db_spec = ImageSpec { - width: context.target_chain().properties().extent.width, - height: context.target_chain().properties().extent.height, - format: context.target_chain().properties().depth_format, + width: context.properties().extent.width, + height: context.properties().extent.height, + format: context.properties().depth_format, usage: Usage::DEPTH_STENCIL_ATTACHMENT, resources: DEPTH_RESOURCES, }; - let img_count = context.target_chain().properties().image_count; + let img_count = context.properties().image_count; let depth_buffers = TargetSpecificResources::new( || { BoundImageView::from_context(context, &db_spec) diff --git a/stockton-render/src/ui.rs b/stockton-render/src/ui.rs index 8401f63..89afe18 100644 --- a/stockton-render/src/ui.rs +++ b/stockton-render/src/ui.rs @@ -275,7 +275,7 @@ impl<'a, P: PassPosition> IntoDrawPass, P> for () { .renderpass(RenderpassSpec { colors: vec![AttachmentSpec { attachment: Attachment { - format: Some(context.target_chain().properties().format), + format: Some(context.properties().color_format), samples: 1, ops: P::attachment_ops(), stencil_ops: P::attachment_ops(), @@ -312,22 +312,21 @@ impl<'a, P: PassPosition> IntoDrawPass, P> for () { let pipeline = spec .build( &mut device, - context.target_chain().properties().extent, - context.target_chain().properties(), + context.properties().extent, once(&*repo.get_ds_layout()?), ) .context("Error building pipeline")?; - let fat = context.target_chain().properties().framebuffer_attachment(); + let fat = context.properties().swapchain_framebuffer_attachment(); let framebuffers = TargetSpecificResources::new( || unsafe { Ok(device.create_framebuffer( &pipeline.renderpass, IntoIter::new([fat.clone()]), - context.target_chain().properties().extent, + context.properties().extent, )?) }, - context.target_chain().properties().image_count as usize, + context.properties().image_count as usize, )?; (pipeline, framebuffers) }; diff --git a/stockton-render/src/window.rs b/stockton-render/src/window.rs index da80915..e6cf7fb 100644 --- a/stockton-render/src/window.rs +++ b/stockton-render/src/window.rs @@ -85,7 +85,7 @@ pub struct UiState { impl UiState { pub fn populate_initial_state>(&mut self, renderer: &Renderer) { - let props = &renderer.context().target_chain().properties(); + let props = renderer.context().properties(); self.set_dimensions(props.extent.width, props.extent.height); self.set_pixels_per_point(Some(renderer.context().pixels_per_point())); debug!("{:?}", self.raw_input); -- cgit v1.2.3