aboutsummaryrefslogtreecommitdiff
path: root/stockton-render/src/draw/target.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:22 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:22 +0100
commit82ba63bc9fb8873d3e5612d34770c957aaca51a7 (patch)
tree85ac63f99f04b8a2e252446357c6eea964c38b7a /stockton-render/src/draw/target.rs
parent38c66803774854cfa8c7f4539480e9e5039ab6de (diff)
refactor(draw): take pipeline out as its own struct
Diffstat (limited to 'stockton-render/src/draw/target.rs')
-rw-r--r--stockton-render/src/draw/target.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/stockton-render/src/draw/target.rs b/stockton-render/src/draw/target.rs
index 19f41dc..05efc59 100644
--- a/stockton-render/src/draw/target.rs
+++ b/stockton-render/src/draw/target.rs
@@ -16,13 +16,9 @@
*/
//! Resources needed for drawing on the screen, including sync objects
-use super::texture::image::LoadedImage;
-use crate::types::*;
use core::{iter::once, mem::ManuallyDrop};
-use crate::draw::buffer::ModifiableBuffer;
-use crate::draw::draw_buffers::DrawBuffers;
use arrayvec::ArrayVec;
use hal::{
format::{ChannelType, Format, Swizzle},
@@ -34,6 +30,12 @@ use hal::{
};
use na::Mat4;
+use super::{
+ buffer::ModifiableBuffer, draw_buffers::DrawBuffers, pipeline::CompletePipeline,
+ texture::image::LoadedImage,
+};
+use crate::types::*;
+
/// Defines the colour range we use.
const COLOR_RANGE: hal::image::SubresourceRange = hal::image::SubresourceRange {
aspects: hal::format::Aspects::COLOR,
@@ -149,7 +151,7 @@ impl TargetChain {
device: &mut Device,
adapter: &Adapter,
surface: &mut Surface,
- renderpass: &RenderPass,
+ pipeline: &CompletePipeline,
cmd_pool: &mut CommandPool,
properties: SwapchainProperties,
old_swapchain: Option<Swapchain>,
@@ -210,7 +212,7 @@ impl TargetChain {
TargetResources::new(
device,
cmd_pool,
- renderpass,
+ &pipeline.renderpass,
image,
&(*depth_buffer.image_view),
properties.extent,
@@ -264,9 +266,7 @@ impl TargetChain {
&'a mut self,
device: &mut Device,
draw_buffers: &mut DrawBuffers,
- renderpass: &RenderPass,
- pipeline: &GraphicsPipeline,
- pipeline_layout: &PipelineLayout,
+ pipeline: &CompletePipeline,
vp: &Mat4,
) -> Result<&'a mut crate::types::CommandBuffer, &'static str> {
self.last_drawn = (self.last_drawn + 1) % self.targets.len();
@@ -329,19 +329,19 @@ impl TargetChain {
target.cmd_buffer.begin_primary(CommandBufferFlags::EMPTY);
// Main render pass / pipeline
target.cmd_buffer.begin_render_pass(
- renderpass,
+ &pipeline.renderpass,
&target.framebuffer,
self.properties.viewport.rect,
clear_values.iter(),
SubpassContents::Inline,
);
- target.cmd_buffer.bind_graphics_pipeline(&pipeline);
+ target.cmd_buffer.bind_graphics_pipeline(&pipeline.pipeline);
// VP Matrix
let vp = &*(vp.data.as_slice() as *const [f32] as *const [u32]);
target.cmd_buffer.push_graphics_constants(
- &pipeline_layout,
+ &pipeline.pipeline_layout,
ShaderStageFlags::VERTEX,
0,
vp,