aboutsummaryrefslogtreecommitdiff
path: root/stockton-skeleton
diff options
context:
space:
mode:
Diffstat (limited to 'stockton-skeleton')
-rw-r--r--stockton-skeleton/src/builders/pipeline.rs1
-rw-r--r--stockton-skeleton/src/builders/shader.rs4
-rw-r--r--stockton-skeleton/src/context.rs2
-rw-r--r--stockton-skeleton/src/draw_passes/cons.rs4
-rw-r--r--stockton-skeleton/src/draw_passes/mod.rs4
-rw-r--r--stockton-skeleton/src/lib.rs17
-rw-r--r--stockton-skeleton/src/target.rs2
-rw-r--r--stockton-skeleton/src/texture/load.rs2
-rw-r--r--stockton-skeleton/src/texture/loader.rs3
9 files changed, 24 insertions, 15 deletions
diff --git a/stockton-skeleton/src/builders/pipeline.rs b/stockton-skeleton/src/builders/pipeline.rs
index 82673a2..af8d430 100644
--- a/stockton-skeleton/src/builders/pipeline.rs
+++ b/stockton-skeleton/src/builders/pipeline.rs
@@ -97,6 +97,7 @@ pub struct PipelineSpec {
#[builder(setter(strip_option), default)]
shader_tesselation: Option<(ShaderDesc, ShaderDesc)>,
+ #[builder(default = "vec![]")]
push_constants: Vec<(ShaderStageFlags, Range<u32>)>,
#[builder(default = "false")]
diff --git a/stockton-skeleton/src/builders/shader.rs b/stockton-skeleton/src/builders/shader.rs
index fde185d..be48951 100644
--- a/stockton-skeleton/src/builders/shader.rs
+++ b/stockton-skeleton/src/builders/shader.rs
@@ -1,8 +1,10 @@
use crate::types::*;
+pub use shaderc::ShaderKind;
+
use anyhow::{Context, Result};
use hal::pso::Specialization;
-use shaderc::{Compiler, ShaderKind};
+use shaderc::Compiler;
#[derive(Debug, Clone)]
pub struct ShaderDesc {
diff --git a/stockton-skeleton/src/context.rs b/stockton-skeleton/src/context.rs
index 943e0dc..6838fb6 100644
--- a/stockton-skeleton/src/context.rs
+++ b/stockton-skeleton/src/context.rs
@@ -34,8 +34,8 @@ use crate::{
error::{EnvironmentError, LockPoisoned, UsageError},
mem::MemoryPool,
queue_negotiator::{QueueFamilyNegotiator, QueueFamilySelector, SharedQueue},
+ session::Session,
types::*,
- session::Session
};
/// The actual data behind [`StatefulRenderingContext`]
diff --git a/stockton-skeleton/src/draw_passes/cons.rs b/stockton-skeleton/src/draw_passes/cons.rs
index f6c3d1b..9fb5d5d 100644
--- a/stockton-skeleton/src/draw_passes/cons.rs
+++ b/stockton-skeleton/src/draw_passes/cons.rs
@@ -2,7 +2,9 @@
//! Note that this can be extended to an arbitrary amount of draw passes.
use super::{Beginning, DrawPass, End, IntoDrawPass, Middle, Singular};
-use crate::{session::Session, context::RenderingContext, queue_negotiator::QueueFamilyNegotiator, types::*};
+use crate::{
+ context::RenderingContext, queue_negotiator::QueueFamilyNegotiator, session::Session, types::*,
+};
use anyhow::Result;
diff --git a/stockton-skeleton/src/draw_passes/mod.rs b/stockton-skeleton/src/draw_passes/mod.rs
index 9a13c73..17564fa 100644
--- a/stockton-skeleton/src/draw_passes/mod.rs
+++ b/stockton-skeleton/src/draw_passes/mod.rs
@@ -1,7 +1,9 @@
//! Traits and common draw passes.
use std::ops::Range;
-use crate::{context::RenderingContext, queue_negotiator::QueueFamilyNegotiator, types::*, session::Session};
+use crate::{
+ context::RenderingContext, queue_negotiator::QueueFamilyNegotiator, session::Session, types::*,
+};
use hal::{
image::Layout,
pass::{AttachmentLoadOp, AttachmentOps, AttachmentStoreOp},
diff --git a/stockton-skeleton/src/lib.rs b/stockton-skeleton/src/lib.rs
index d57c5f6..1e0d108 100644
--- a/stockton-skeleton/src/lib.rs
+++ b/stockton-skeleton/src/lib.rs
@@ -8,26 +8,26 @@ extern crate derive_builder;
pub mod buffers;
pub mod builders;
+pub mod components;
pub mod context;
pub mod draw_passes;
pub mod error;
pub mod mem;
pub mod queue_negotiator;
+pub mod session;
mod target;
pub mod texture;
pub mod types;
pub mod utils;
-pub mod components;
-pub mod session;
+pub use anyhow::Result;
pub use context::RenderingContext;
-pub use session::Session;
pub use draw_passes::{DrawPass, IntoDrawPass, PassPosition};
-pub use anyhow::Result;
+pub use session::Session;
+use anyhow::Context;
use draw_passes::Singular;
use std::mem::ManuallyDrop;
-use anyhow::{Context};
use winit::window::Window;
/// Renders a world to a window when you tell it to.
@@ -75,6 +75,7 @@ impl<DP: DrawPass<Singular>> Renderer<DP> {
}
Err((_e, c)) => {
// TODO: Try to detect if the error is actually surface related.
+
let c = c.attempt_recovery()?;
match c.draw_next_frame(session, &mut *self.draw_pass) {
Ok(c) => {
@@ -94,9 +95,11 @@ impl<DP: DrawPass<Singular>> Renderer<DP> {
// Safety: If this fails at any point, the ManuallyDrop won't be touched again, as Renderer will be dropped.
// Hence, we can always take from the ManuallyDrop
unsafe {
- let ctx = ManuallyDrop::take(&mut self.context).recreate_surface()?;
+ let ctx = ManuallyDrop::take(&mut self.context);
+ log::debug!("ctx");
+ let ctx = ctx.recreate_surface()?;
self.context = ManuallyDrop::new(ctx);
-
+ log::debug!("Finished resizing ctx");
let dp = ManuallyDrop::take(&mut self.draw_pass)
.handle_surface_change(session, &mut self.context)?;
self.draw_pass = ManuallyDrop::new(dp);
diff --git a/stockton-skeleton/src/target.rs b/stockton-skeleton/src/target.rs
index 23f56b9..68829b1 100644
--- a/stockton-skeleton/src/target.rs
+++ b/stockton-skeleton/src/target.rs
@@ -4,8 +4,8 @@
use crate::{
context::ContextProperties,
draw_passes::{DrawPass, Singular},
+ session::Session,
types::*,
- session::Session
};
use std::{
diff --git a/stockton-skeleton/src/texture/load.rs b/stockton-skeleton/src/texture/load.rs
index 80c332e..27498af 100644
--- a/stockton-skeleton/src/texture/load.rs
+++ b/stockton-skeleton/src/texture/load.rs
@@ -1,6 +1,6 @@
use std::sync::{Arc, RwLock};
-use super::{block::TexturesBlock, repo::BLOCK_SIZE, TextureResolver, LoadableImage};
+use super::{block::TexturesBlock, repo::BLOCK_SIZE, LoadableImage, TextureResolver};
use crate::{
buffers::{
image::{ImageSpec, SampledImage, COLOR_RESOURCES},
diff --git a/stockton-skeleton/src/texture/loader.rs b/stockton-skeleton/src/texture/loader.rs
index 6212492..0a98722 100644
--- a/stockton-skeleton/src/texture/loader.rs
+++ b/stockton-skeleton/src/texture/loader.rs
@@ -6,8 +6,7 @@ use super::{
load_image, QueuedLoad, TextureLoadConfig, TextureLoadError, FORMAT, LAYERS, RESOURCES,
},
repo::BLOCK_SIZE,
- TextureResolver,
- PIXEL_SIZE,
+ TextureResolver, PIXEL_SIZE,
};
use crate::{
buffers::image::SampledImage,