diff options
-rw-r--r-- | stockton-render/src/draw/builders/pipeline.rs | 21 | ||||
-rw-r--r-- | stockton-render/src/draw/draw_passes/ui.rs | 1 |
2 files changed, 17 insertions, 5 deletions
diff --git a/stockton-render/src/draw/builders/pipeline.rs b/stockton-render/src/draw/builders/pipeline.rs index 329fa7f..0c06774 100644 --- a/stockton-render/src/draw/builders/pipeline.rs +++ b/stockton-render/src/draw/builders/pipeline.rs @@ -107,6 +107,11 @@ pub struct PipelineSpec { push_constants: Vec<(ShaderStageFlags, Range<u32>)>, + #[builder(default = "false")] + dynamic_viewport: bool, + #[builder(default = "false")] + dynamic_scissor: bool, + renderpass: RenderpassSpec, } @@ -176,11 +181,17 @@ impl PipelineSpec { // Baked states let baked_states = BakedStates { - viewport: Some(Viewport { - rect: extent.rect(), - depth: (0.0..1.0), - }), - scissor: Some(extent.rect()), + viewport: match self.dynamic_viewport { + true => None, + false => Some(Viewport { + rect: extent.rect(), + depth: (0.0..1.0), + }), + }, + scissor: match self.dynamic_scissor { + true => None, + false => Some(extent.rect()), + }, blend_constants: None, depth_bounds: None, }; diff --git a/stockton-render/src/draw/draw_passes/ui.rs b/stockton-render/src/draw/draw_passes/ui.rs index 82ca4b1..5e6c68e 100644 --- a/stockton-render/src/draw/draw_passes/ui.rs +++ b/stockton-render/src/draw/draw_passes/ui.rs @@ -276,6 +276,7 @@ impl<'a> IntoDrawPass<UiDrawPass<'a>> for () { resolves: vec![], preserves: vec![], }) + .dynamic_scissor(true) .build() .context("Error building pipeline")?; |