aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:23 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:23 +0100
commit6fd563b20772ad0ad279f6461179978766a77948 (patch)
tree12e8e77ca6ae594de509e24f2598c0369bb0f766
parent5851b43ca65d979b2d290eb94bd0187f9b9e5736 (diff)
fix(render): ui draw pass validation errors
-rw-r--r--stockton-render/src/draw/builders/pipeline.rs21
-rw-r--r--stockton-render/src/draw/draw_passes/ui.rs1
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")?;