sketch_2d/
pipeline.rs

1/*
2 * Created on Thu Jul 06 2023
3 *
4 * Copyright (c) storycraft. Licensed under the MIT Licence.
5 */
6
7use wgpu::{TextureFormat, MultisampleState, DepthStencilState};
8
9#[derive(Debug, Clone)]
10pub struct RenderPipelineData {
11    pub texture_format: TextureFormat,
12    pub depth_stencil: Option<DepthStencilState>,
13    pub multi_sample: Option<MultisampleState>,
14}
15
16impl RenderPipelineData {
17    pub fn depth_stencil_read_only(&self) -> Option<DepthStencilState> {
18        self.depth_stencil.clone().map(|mut depth_stencil| {
19            depth_stencil.depth_write_enabled = false;
20            depth_stencil
21        })
22    }
23}