Ash runner: fix crash on resize/minimize and add shader hot reloading (#299)

* window resizing and hot reloading

* remove windows paths and fix viewport creation

* readd spirv tools features

* re-remove features

* and add them again

* CI fix

* proper-resizing-and-validation-fixes

* linux validation fix

* fix zero height halting rendering

rendering wasn't getting unpaused after being set to zero height and then made larger again

* fix wgpu crash on laptops with both dedi and integrated GPUs

This fix still requires the user to set their default GPU to their dedicated one.

* METAL or VULKAN backend bit

* rebuild pipelines after updating shaders

* use spirv-builder, resolve merge conflict

* fmt
This commit is contained in:
Henno 2020-12-16 12:41:48 -05:00 committed by GitHub
parent a2a2e3917e
commit bc4c07e54f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1205 additions and 830 deletions

2
Cargo.lock generated
View File

@ -615,6 +615,8 @@ dependencies = [
"ash-molten",
"ash-window",
"cfg-if 1.0.0",
"serde",
"serde_json",
"shared",
"spirv-builder",
"structopt",

View File

@ -13,15 +13,16 @@ use-installed-tools = ["spirv-builder/use-installed-tools"]
use-compiled-tools = ["spirv-builder/use-compiled-tools"]
[dependencies]
shared = { path = "../../shaders/shared" }
ash = "0.31"
ash-window = "0.5"
cfg-if = "1.0.0"
structopt = "0.3.20"
winit = "0.23.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
structopt = "0.3.20"
cfg-if = "1.0.0"
shared = { path = "../../shaders/shared" }
spirv-builder = { path = "../../../crates/spirv-builder", default-features = false }
[target.'cfg(target_os = "macos")'.dependencies]
ash-molten = { version = "0.7", features = ["pre-built"] }
[build-dependencies]
spirv-builder = { path = "../../../crates/spirv-builder", default-features = false }

View File

@ -1,10 +0,0 @@
use spirv_builder::SpirvBuilder;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
// This will set the env var `sky-shader.spv` to a spir-v file that can be include!()'d
SpirvBuilder::new("../../shaders/sky-shader")
.spirv_version(1, 3)
.build()?;
Ok(())
}

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@ async fn run(
swapchain_format: wgpu::TextureFormat,
) {
let size = window.inner_size();
let instance = wgpu::Instance::new(wgpu::BackendBit::PRIMARY);
let instance = wgpu::Instance::new(wgpu::BackendBit::VULKAN | wgpu::BackendBit::METAL);
// Wait for Resumed event on Android; the surface is only needed early to
// find an adapter that can render to this surface.