From 5597846018b36bcc8569d8c5c9efc6acc1788aba Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Mon, 13 May 2019 10:59:09 -0400 Subject: [PATCH] Update to gfx-hal 0.2 --- Cargo.lock | 80 +++++++++++++------------- wgpu-native/Cargo.toml | 14 ++--- wgpu-native/src/conv.rs | 102 +++++++++++++++++----------------- wgpu-native/src/device.rs | 35 ++++-------- wgpu-native/src/instance.rs | 3 +- wgpu-native/src/swap_chain.rs | 28 ++++++++-- 6 files changed, 130 insertions(+), 132 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2a04f2eed5..f01c7ba52a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -36,11 +36,9 @@ dependencies = [ [[package]] name = "ash" -version = "0.24.4" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", "shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -280,59 +278,61 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "gfx-backend-dx11" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx-hal 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx-hal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "range-alloc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "spirv_cross 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "winit 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winit 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)", "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gfx-backend-dx12" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "d3d12 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx-hal 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx-hal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "range-alloc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "spirv_cross 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "winit 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winit 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gfx-backend-empty" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gfx-hal 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winit 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx-hal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winit 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gfx-backend-metal" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)", + "copyless 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx-hal 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx-hal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "metal 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -341,29 +341,30 @@ dependencies = [ "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "spirv_cross 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "storage-map 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winit 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winit 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gfx-backend-vulkan" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ash 0.24.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ash 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx-hal 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx-hal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "winit 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winit 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)", "x11 2.18.1 (registry+https://github.com/rust-lang/crates.io-index)", "xcb 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gfx-hal" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -406,11 +407,6 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "lazy_static" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "lazy_static" version = "1.3.0" @@ -1106,18 +1102,18 @@ dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "copyless 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx-backend-dx11 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx-backend-dx12 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx-backend-empty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx-backend-metal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx-backend-vulkan 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx-hal 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx-backend-dx11 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx-backend-dx12 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx-backend-empty 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx-backend-metal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx-backend-vulkan 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx-hal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winit 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winit 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1170,11 +1166,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winit" -version = "0.18.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1250,7 +1247,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" "checksum approx 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" -"checksum ash 0.24.4 (registry+https://github.com/rust-lang/crates.io-index)" = "11f080bc0414ee1b6b959442cb36478d56c6e6b9bb2b04079a5048d9acc91a30" +"checksum ash 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)" = "003d1fb2eb12eb06d4a03dbe02eea67a9fac910fa97932ab9e3a75b96a1ea5e5" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" @@ -1282,16 +1279,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" -"checksum gfx-backend-dx11 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fe0bc43f1be34bfa182ed3575812848d72fb6e32315406adb98eeb0713f2a11a" -"checksum gfx-backend-dx12 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "15d8bb2edd39dba0e87c2058d665364d45efd08cdf8bfa895be792491a95fcb4" -"checksum gfx-backend-empty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "590c15369f88b88e4ea748da52b27a521a758a947b4aee995539c9f0cc1beb4c" -"checksum gfx-backend-metal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "66a0fa897619ea7f05e8841fe6214cf1b4e3f52d6a88ed51c2fbc6635a2d5517" -"checksum gfx-backend-vulkan 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "982c618fd9ddeea7e68b2d872b9b6cf13024fc7d4033ba90f0e54ac0d33c798f" -"checksum gfx-hal 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "84c470bce77fcaaea6854858682a99026ff796b880b0ca30511593a6b2bc77c0" +"checksum gfx-backend-dx11 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a2bec1f87711104e7d7bb86f128bcca0c2b19b1f30c3a28e33b5e1e01cddc15" +"checksum gfx-backend-dx12 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d43ea87ca07be86db3fc10810faf143d9c1a581412e8e24d9eb26bdf875fe658" +"checksum gfx-backend-empty 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "48d970b730c75da0e4905380e9af664e0ef46c5c4643fbacf637e114df047fb5" +"checksum gfx-backend-metal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d39d1a05e08367faa2006316d4420439fc5f82de63bc8706bab50b4eba7760c" +"checksum gfx-backend-vulkan 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "40aed111bb822e01f3569345eefc732c5b557b19d7905b0a865e553cf4e4e7ea" +"checksum gfx-hal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c045161572372465ebbcb0d33ee937b6ed8874a193148c053688a400b92b197c" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum ipc-channel 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79d98ee7dd1d2e796d254807fd86ea7189d07571aeaa74007603e29a79d15217" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)" = "c6785aa7dd976f5fbf3b71cfd9cd49d7f783c1ff565a858d71031c6c313aa5c6" @@ -1377,7 +1373,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum winit 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c57c15bd4c0ef18dff33e263e452abe32d00e2e05771cacaa410a14cc1c0776" +"checksum winit 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d233301129ddd33260b47f76900b50e154b7254546e2edba0e5468a1a5fe4de3" "checksum wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum x11 2.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39697e3123f715483d311b5826e254b6f3cfebdd83cf7ef3358f579c3d68e235" diff --git a/wgpu-native/Cargo.toml b/wgpu-native/Cargo.toml index f45a053768..f82d545409 100644 --- a/wgpu-native/Cargo.toml +++ b/wgpu-native/Cargo.toml @@ -29,13 +29,13 @@ copyless = "0.1" lazy_static = "1.1.0" log = "0.4" parking_lot = { version = "0.8" } -hal = { package = "gfx-hal", version = "0.1" } -gfx-backend-empty = { version = "0.1.1" } -gfx-backend-vulkan = { version = "0.1", optional = true } -gfx-backend-dx11 = { version = "0.1", optional = true } -gfx-backend-dx12 = { version = "0.1", optional = true } -gfx-backend-metal = { version = "0.1", optional = true } +hal = { package = "gfx-hal", version = "0.2" } +gfx-backend-empty = { version = "0.2" } +gfx-backend-vulkan = { version = "0.2", optional = true } +gfx-backend-dx11 = { version = "0.2", optional = true } +gfx-backend-dx12 = { version = "0.2", optional = true } +gfx-backend-metal = { version = "0.2", optional = true } #rendy-memory = { git = "https://github.com/rustgd/rendy", rev = "ce7dd7f", features = ["gfx-hal"] } serde = { version = "1.0", features = ["serde_derive"], optional = true } vec_map = "0.8" -winit = { version = "0.18", optional = true } +winit = { version = "0.19", optional = true } diff --git a/wgpu-native/src/conv.rs b/wgpu-native/src/conv.rs index 3451c0042d..dd752d9bf1 100644 --- a/wgpu-native/src/conv.rs +++ b/wgpu-native/src/conv.rs @@ -299,40 +299,40 @@ pub fn map_texture_format(texture_format: resource::TextureFormat) -> hal::forma // Normal 8 bit formats R8Unorm => H::R8Unorm, R8UnormSrgb => H::R8Srgb, - R8Snorm => H::R8Inorm, + R8Snorm => H::R8Snorm, R8Uint => H::R8Uint, - R8Sint => H::R8Int, + R8Sint => H::R8Sint, // Normal 16 bit formats R16Unorm => H::R16Unorm, - R16Snorm => H::R16Inorm, + R16Snorm => H::R16Snorm, R16Uint => H::R16Uint, - R16Sint => H::R16Int, - R16Float => H::R16Float, + R16Sint => H::R16Sint, + R16Float => H::R16Sfloat, Rg8Unorm => H::Rg8Unorm, Rg8UnormSrgb => H::Rg8Srgb, - Rg8Snorm => H::Rg8Inorm, + Rg8Snorm => H::Rg8Snorm, Rg8Uint => H::Rg8Uint, - Rg8Sint => H::Rg8Int, + Rg8Sint => H::Rg8Sint, // Packed 16 bit formats B5g6r5Unorm => H::B5g6r5Unorm, // Normal 32 bit formats R32Uint => H::R32Uint, - R32Sint => H::R32Int, - R32Float => H::R32Float, + R32Sint => H::R32Sint, + R32Float => H::R32Sfloat, Rg16Unorm => H::Rg16Unorm, - Rg16Snorm => H::Rg16Inorm, + Rg16Snorm => H::Rg16Snorm, Rg16Uint => H::Rg16Uint, - Rg16Sint => H::Rg16Int, - Rg16Float => H::Rg16Float, + Rg16Sint => H::Rg16Sint, + Rg16Float => H::Rg16Sfloat, Rgba8Unorm => H::Rgba8Unorm, Rgba8UnormSrgb => H::Rgba8Srgb, - Rgba8Snorm => H::Rgba8Inorm, + Rgba8Snorm => H::Rgba8Snorm, Rgba8Uint => H::Rgba8Uint, - Rgba8Sint => H::Rgba8Int, + Rgba8Sint => H::Rgba8Sint, Bgra8Unorm => H::Bgra8Unorm, Bgra8UnormSrgb => H::Bgra8Srgb, @@ -342,24 +342,24 @@ pub fn map_texture_format(texture_format: resource::TextureFormat) -> hal::forma // Normal 64 bit formats Rg32Uint => H::Rg32Uint, - Rg32Sint => H::Rg32Int, - Rg32Float => H::Rg32Float, + Rg32Sint => H::Rg32Sint, + Rg32Float => H::Rg32Sfloat, Rgba16Unorm => H::Rgba16Unorm, - Rgba16Snorm => H::Rgba16Inorm, + Rgba16Snorm => H::Rgba16Snorm, Rgba16Uint => H::Rgba16Uint, - Rgba16Sint => H::Rgba16Int, - Rgba16Float => H::Rgba16Float, + Rgba16Sint => H::Rgba16Sint, + Rgba16Float => H::Rgba16Sfloat, // Normal 128 bit formats Rgba32Uint => H::Rgba32Uint, - Rgba32Sint => H::Rgba32Int, - Rgba32Float => H::Rgba32Float, + Rgba32Sint => H::Rgba32Sint, + Rgba32Float => H::Rgba32Sfloat, // Depth and stencil formats D16Unorm => H::D16Unorm, - D32Float => H::D32Float, + D32Float => H::D32Sfloat, D24UnormS8Uint => H::D24UnormS8Uint, - D32FloatS8Uint => H::D32FloatS8Uint, + D32FloatS8Uint => H::D32SfloatS8Uint, } } @@ -371,51 +371,51 @@ pub fn map_vertex_format(vertex_format: pipeline::VertexFormat) -> hal::format:: Uchar2 => H::Rg8Uint, Uchar3 => H::Rgb8Uint, Uchar4 => H::Rgba8Uint, - Char => H::R8Int, - Char2 => H::Rg8Int, - Char3 => H::Rgb8Int, - Char4 => H::Rgba8Int, + Char => H::R8Sint, + Char2 => H::Rg8Sint, + Char3 => H::Rgb8Sint, + Char4 => H::Rgba8Sint, UcharNorm => H::R8Unorm, Uchar2Norm => H::Rg8Unorm, Uchar3Norm => H::Rgb8Unorm, Uchar4Norm => H::Rgba8Unorm, Uchar4NormBgra => H::Bgra8Unorm, - CharNorm => H::R8Inorm, - Char2Norm => H::Rg8Inorm, - Char3Norm => H::Rgb8Inorm, - Char4Norm => H::Rgba8Inorm, + CharNorm => H::R8Snorm, + Char2Norm => H::Rg8Snorm, + Char3Norm => H::Rgb8Snorm, + Char4Norm => H::Rgba8Snorm, Ushort => H::R16Uint, Ushort2 => H::Rg16Uint, Ushort3 => H::Rgb16Uint, Ushort4 => H::Rgba16Uint, - Short => H::R16Int, - Short2 => H::Rg16Int, - Short3 => H::Rgb16Int, - Short4 => H::Rgba16Int, + Short => H::R16Sint, + Short2 => H::Rg16Sint, + Short3 => H::Rgb16Sint, + Short4 => H::Rgba16Sint, UshortNorm => H::R16Unorm, Ushort2Norm => H::Rg16Unorm, Ushort3Norm => H::Rgb16Unorm, Ushort4Norm => H::Rgba16Unorm, - ShortNorm => H::R16Inorm, - Short2Norm => H::Rg16Inorm, - Short3Norm => H::Rgb16Inorm, - Short4Norm => H::Rgba16Inorm, - Half => H::R16Float, - Half2 => H::Rg16Float, - Half3 => H::Rgb16Float, - Half4 => H::Rgba16Float, - Float => H::R32Float, - Float2 => H::Rg32Float, - Float3 => H::Rgb32Float, - Float4 => H::Rgba32Float, + ShortNorm => H::R16Snorm, + Short2Norm => H::Rg16Snorm, + Short3Norm => H::Rgb16Snorm, + Short4Norm => H::Rgba16Snorm, + Half => H::R16Sfloat, + Half2 => H::Rg16Sfloat, + Half3 => H::Rgb16Sfloat, + Half4 => H::Rgba16Sfloat, + Float => H::R32Sfloat, + Float2 => H::Rg32Sfloat, + Float3 => H::Rgb32Sfloat, + Float4 => H::Rgba32Sfloat, Uint => H::R32Uint, Uint2 => H::Rg32Uint, Uint3 => H::Rgb32Uint, Uint4 => H::Rgba32Uint, - Int => H::R32Int, - Int2 => H::Rg32Int, - Int3 => H::Rgb32Int, - Int4 => H::Rgba32Int, + Int => H::R32Sint, + Int2 => H::Rg32Sint, + Int3 => H::Rgb32Sint, + Int4 => H::Rgba32Sint, } } diff --git a/wgpu-native/src/device.rs b/wgpu-native/src/device.rs index 0d17ab427d..3ed7442f6a 100644 --- a/wgpu-native/src/device.rs +++ b/wgpu-native/src/device.rs @@ -488,6 +488,7 @@ impl Device { count: 100, }, ], + hal::pso::DescriptorPoolCreateFlags::empty(), ) } .unwrap(), @@ -1446,11 +1447,7 @@ pub fn device_create_render_pipeline( .to_owned() .unwrap(), // TODO module: &shader_module_guard[desc.vertex_stage.module].raw, - specialization: hal::pso::Specialization { - // TODO - constants: &[], - data: &[], - }, + specialization: hal::pso::Specialization::EMPTY, }; let fragment = hal::pso::EntryPoint:: { entry: unsafe { ffi::CStr::from_ptr(desc.fragment_stage.entry_point) } @@ -1458,11 +1455,7 @@ pub fn device_create_render_pipeline( .to_owned() .unwrap(), // TODO module: &shader_module_guard[desc.fragment_stage.module].raw, - specialization: hal::pso::Specialization { - // TODO - constants: &[], - data: &[], - }, + specialization: hal::pso::Specialization::EMPTY, }; let shaders = hal::pso::GraphicsShaderSet { @@ -1490,8 +1483,8 @@ pub fn device_create_render_pipeline( binding: i as u32, stride: vb_state.stride, rate: match vb_state.step_mode { - pipeline::InputStepMode::Vertex => 0, - pipeline::InputStepMode::Instance => 1, + pipeline::InputStepMode::Vertex => hal::pso::VertexInputRate::Vertex, + pipeline::InputStepMode::Instance => hal::pso::VertexInputRate::Instance(1), }, }); let desc_atts = @@ -1618,11 +1611,7 @@ pub fn device_create_compute_pipeline( .to_owned() .unwrap(), // TODO module: &shader_module_guard[pipeline_stage.module].raw, - specialization: hal::pso::Specialization { - // TODO - constants: &[], - data: &[], - }, + specialization: hal::pso::Specialization::EMPTY, }; // TODO @@ -1671,7 +1660,7 @@ pub fn device_create_swap_chain( let mut surface_guard = HUB.surfaces.write(); let surface = &mut surface_guard[surface_id]; - let (caps, formats, _present_modes, composite_alphas) = { + let (caps, formats, _present_modes) = { let adapter_guard = HUB.adapters.read(); let adapter = &adapter_guard[device.adapter_id]; assert!(surface @@ -1687,7 +1676,8 @@ pub fn device_create_swap_chain( conv::map_texture_format(desc.format), num_frames, //TODO: configure? ); - config.composite_alpha = *composite_alphas.iter().next().unwrap(); + //TODO: check for supported + config.composite_alpha = hal::window::CompositeAlpha::OPAQUE; if let Some(formats) = formats { assert!( @@ -1737,7 +1727,7 @@ pub fn device_create_swap_chain( }, }; - let (raw, backbuffer) = unsafe { + let (raw, images) = unsafe { device .raw .create_swapchain(&mut surface.raw, config.with_image_usage(usage), old_raw) @@ -1756,11 +1746,6 @@ pub fn device_create_swap_chain( command_pool, }); - let images = match backbuffer { - hal::Backbuffer::Images(images) => images, - hal::Backbuffer::Framebuffer(_) => panic!("Deprecated API detected!"), - }; - images .into_iter() .map(|raw| resource::Texture { diff --git a/wgpu-native/src/instance.rs b/wgpu-native/src/instance.rs index 752a5e6fa9..539182f1f2 100644 --- a/wgpu-native/src/instance.rs +++ b/wgpu-native/src/instance.rs @@ -95,7 +95,8 @@ pub fn instance_create_surface_from_macos_layer( unimplemented!(); #[cfg(feature = "gfx-backend-metal")] - SurfaceHandle::new(HUB.instances.read()[instance_id].create_surface_from_layer(layer as *mut _)) + SurfaceHandle::new(HUB.instances.read()[instance_id] + .create_surface_from_layer(layer as *mut _, cfg!(debug_assertions))) } #[cfg(feature = "local")] diff --git a/wgpu-native/src/swap_chain.rs b/wgpu-native/src/swap_chain.rs index f4184c5334..0dab656ada 100644 --- a/wgpu-native/src/swap_chain.rs +++ b/wgpu-native/src/swap_chain.rs @@ -111,8 +111,13 @@ pub extern "C" fn wgpu_swap_chain_get_next_texture(swap_chain_id: SwapChainId) - let (image_index, device_id, descriptor) = { let mut surface_guard = HUB.surfaces.write(); let swap_chain = surface_guard[swap_chain_id].swap_chain.as_mut().unwrap(); - let sync = hal::FrameSync::Semaphore(&swap_chain.sem_available); - let result = unsafe { swap_chain.raw.acquire_image(!0, sync) }; + let result = unsafe { + swap_chain.raw.acquire_image( + !0, + Some(&swap_chain.sem_available), + None, + ) + }; ( result.ok(), swap_chain.device_id.value, @@ -136,11 +141,22 @@ pub extern "C" fn wgpu_swap_chain_get_next_texture(swap_chain_id: SwapChainId) - let swap_chain = surface_guard[swap_chain_id].swap_chain.as_mut().unwrap(); let image_index = match image_index { - Some(index) => index, - None => { - let sync = hal::FrameSync::Semaphore(&swap_chain.sem_available); - unsafe { swap_chain.raw.acquire_image(!0, sync) }.unwrap() + Some((index, suboptimal)) => { + if suboptimal.is_some() { + warn!("acquire_image: sub-optimal"); + } + index } + None => unsafe { + swap_chain.raw + .acquire_image( + !0, + Some(&swap_chain.sem_available), + None, + ) + .unwrap() + .0 + }, }; let device_guard = HUB.devices.read();