Update gfx with new iterator API

This commit is contained in:
Dzmitry Malyshau 2021-02-02 11:22:39 -05:00
parent c139bbd9f6
commit fcbb21ea7c
3 changed files with 44 additions and 47 deletions

61
Cargo.lock generated
View file

@ -289,8 +289,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-auxil" name = "gfx-auxil"
version = "0.5.0" version = "0.8.0"
source = "git+https://github.com/gfx-rs/gfx#477f17957a54d024f0077584b68e308376cb05c6" source = "git+https://github.com/gfx-rs/gfx#457d3d7d6d7cf32926f63eefed54b750781dff18"
dependencies = [ dependencies = [
"fxhash", "fxhash",
"gfx-hal", "gfx-hal",
@ -299,8 +299,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-dx11" name = "gfx-backend-dx11"
version = "0.6.0" version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx#477f17957a54d024f0077584b68e308376cb05c6" source = "git+https://github.com/gfx-rs/gfx#457d3d7d6d7cf32926f63eefed54b750781dff18"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -320,8 +320,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-dx12" name = "gfx-backend-dx12"
version = "0.6.2" version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx#477f17957a54d024f0077584b68e308376cb05c6" source = "git+https://github.com/gfx-rs/gfx#457d3d7d6d7cf32926f63eefed54b750781dff18"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
@ -340,8 +340,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-empty" name = "gfx-backend-empty"
version = "0.6.0" version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx#477f17957a54d024f0077584b68e308376cb05c6" source = "git+https://github.com/gfx-rs/gfx#457d3d7d6d7cf32926f63eefed54b750781dff18"
dependencies = [ dependencies = [
"gfx-hal", "gfx-hal",
"log", "log",
@ -350,8 +350,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-gl" name = "gfx-backend-gl"
version = "0.6.0" version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx#477f17957a54d024f0077584b68e308376cb05c6" source = "git+https://github.com/gfx-rs/gfx#457d3d7d6d7cf32926f63eefed54b750781dff18"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -371,8 +371,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-metal" name = "gfx-backend-metal"
version = "0.6.0" version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx#477f17957a54d024f0077584b68e308376cb05c6" source = "git+https://github.com/gfx-rs/gfx#457d3d7d6d7cf32926f63eefed54b750781dff18"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -394,8 +394,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-vulkan" name = "gfx-backend-vulkan"
version = "0.6.5" version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx#477f17957a54d024f0077584b68e308376cb05c6" source = "git+https://github.com/gfx-rs/gfx#457d3d7d6d7cf32926f63eefed54b750781dff18"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"ash", "ash",
@ -413,8 +413,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-hal" name = "gfx-hal"
version = "0.6.0" version = "0.7.0"
source = "git+https://github.com/gfx-rs/gfx#477f17957a54d024f0077584b68e308376cb05c6" source = "git+https://github.com/gfx-rs/gfx#457d3d7d6d7cf32926f63eefed54b750781dff18"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"naga", "naga",
@ -455,9 +455,9 @@ dependencies = [
[[package]] [[package]]
name = "glow" name = "glow"
version = "0.7.1" version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3eac04632dc8c047fb70d658f8479583e1bb084859f67a150227769a10fc161f" checksum = "072136d2c3783f3a92f131acb227bc806d3886278e2a4dc1e9990ec89ef9e70b"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"slotmap", "slotmap",
@ -505,9 +505,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]] [[package]]
name = "inplace_it" name = "inplace_it"
version = "0.3.2" version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd01a2a73f2f399df96b22dc88ea687ef4d76226284e7531ae3c7ee1dc5cb534" checksum = "90953f308a79fe6d62a4643e51f848fbfddcd05975a38e69fdf4ab86a7baf7ca"
[[package]] [[package]]
name = "instant" name = "instant"
@ -538,8 +538,9 @@ dependencies = [
[[package]] [[package]]
name = "khronos-egl" name = "khronos-egl"
version = "3.0.0-beta" version = "3.0.0"
source = "git+https://github.com/timothee-haudebourg/khronos-egl?rev=4b769b8f2d068fa78db9285a8557cd11365fa314#4b769b8f2d068fa78db9285a8557cd11365fa314" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8020ff3b84f9ac87461216ad0501bc09b33c1cbe17404d8ea405160fd164bab"
dependencies = [ dependencies = [
"libc", "libc",
"libloading", "libloading",
@ -636,8 +637,8 @@ dependencies = [
[[package]] [[package]]
name = "metal" name = "metal"
version = "0.20.1" version = "0.21.0"
source = "git+https://github.com/gfx-rs/metal-rs?rev=ba08f5f98c70ab941020b8997936c9c75363b9aa#ba08f5f98c70ab941020b8997936c9c75363b9aa" source = "git+https://github.com/gfx-rs/metal-rs?rev=439c986eb7a9b91e88b61def2daa66e4043fcbef#439c986eb7a9b91e88b61def2daa66e4043fcbef"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"block", "block",
@ -649,8 +650,8 @@ dependencies = [
[[package]] [[package]]
name = "naga" name = "naga"
version = "0.2.0" version = "0.3.1"
source = "git+https://github.com/gfx-rs/naga?tag=gfx-6#6f5ff27701112abba35fa61e429e2916a157b0a1" source = "git+https://github.com/gfx-rs/naga?tag=gfx-9#c12003f5648fcade5f20c01debc4cb12bd47073e"
dependencies = [ dependencies = [
"bit-set", "bit-set",
"bitflags", "bitflags",
@ -835,8 +836,8 @@ dependencies = [
[[package]] [[package]]
name = "range-alloc" name = "range-alloc"
version = "0.1.1" version = "0.1.2"
source = "git+https://github.com/gfx-rs/gfx#477f17957a54d024f0077584b68e308376cb05c6" source = "git+https://github.com/gfx-rs/gfx#457d3d7d6d7cf32926f63eefed54b750781dff18"
[[package]] [[package]]
name = "raw-window-handle" name = "raw-window-handle"
@ -924,9 +925,9 @@ checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252"
[[package]] [[package]]
name = "spirv_cross" name = "spirv_cross"
version = "0.22.2" version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ebd49af36be83ecd6290b57147e2a0e26145b832634b17146d934b197ca3713" checksum = "06db6bd7b6518f761593783e2896eefe55e90455efc5f44511078ce0426ed418"
dependencies = [ dependencies = [
"cc", "cc",
"js-sys", "js-sys",

View file

@ -6,7 +6,7 @@ use hal::{
device::{Device, WaitFor}, device::{Device, WaitFor},
pool::CommandPool as _, pool::CommandPool as _,
pso::DescriptorPool, pso::DescriptorPool,
queue::{CommandQueue as _, QueueFamily}, queue::{Queue as _, QueueFamily},
window::{PresentMode, PresentationSurface as _, Surface as _}, window::{PresentMode, PresentationSurface as _, Surface as _},
{command as com, memory, pass, pso, queue}, {Features, Instance}, {command as com, memory, pass, pso, queue}, {Features, Instance},
}; };
@ -1558,8 +1558,7 @@ pub unsafe extern "C" fn gfxWaitForFences(
let fences = fence_slice let fences = fence_slice
.iter() .iter()
.filter(|fence| !fence.is_fake) .filter(|fence| !fence.is_fake)
.map(|fence| &fence.raw) .map(|fence| &fence.raw);
.collect::<Vec<_>>();
let wait_for = match waitAll { let wait_for = match waitAll {
VK_FALSE => WaitFor::Any, VK_FALSE => WaitFor::Any,
_ => WaitFor::All, _ => WaitFor::All,
@ -2713,17 +2712,14 @@ pub unsafe extern "C" fn gfxCreateDescriptorSetLayout(
let info = &*pCreateInfo; let info = &*pCreateInfo;
let layout_bindings = make_slice(info.pBindings, info.bindingCount as usize); let layout_bindings = make_slice(info.pBindings, info.bindingCount as usize);
let sampler_iter = layout_bindings let sampler_iter = layout_bindings.iter().flat_map(|binding| {
.iter() let slice = if binding.pImmutableSamplers.is_null() {
.flat_map(|binding| { &[]
let slice = if binding.pImmutableSamplers.is_null() { } else {
&[] slice::from_raw_parts(binding.pImmutableSamplers, binding.descriptorCount as _)
} else { };
slice::from_raw_parts(binding.pImmutableSamplers, binding.descriptorCount as _) slice.iter().map(|handle| &**handle)
}; });
slice.iter().map(|handle| &**handle)
})
.collect::<Vec<_>>();
let bindings = layout_bindings let bindings = layout_bindings
.iter() .iter()
@ -3982,7 +3978,7 @@ fn make_barriers<'a>(
raw_globals: &'a [VkMemoryBarrier], raw_globals: &'a [VkMemoryBarrier],
raw_buffers: &'a [VkBufferMemoryBarrier], raw_buffers: &'a [VkBufferMemoryBarrier],
raw_images: &'a [VkImageMemoryBarrier], raw_images: &'a [VkImageMemoryBarrier],
) -> Vec<memory::Barrier<'a, back::Backend>> { ) -> impl Iterator<Item = memory::Barrier<'a, back::Backend>> {
let globals = raw_globals.iter().flat_map(|b| { let globals = raw_globals.iter().flat_map(|b| {
let buf = let buf =
conv::map_buffer_access(b.srcAccessMask)..conv::map_buffer_access(b.dstAccessMask); conv::map_buffer_access(b.srcAccessMask)..conv::map_buffer_access(b.dstAccessMask);
@ -4031,7 +4027,7 @@ fn make_barriers<'a>(
}) })
}); });
globals.chain(buffers).chain(images).collect() globals.chain(buffers).chain(images)
} }
#[inline] #[inline]

View file

@ -101,7 +101,7 @@ impl<B: hal::Backend> Gpu<B> {
} }
pub struct Queue<B: hal::Backend> { pub struct Queue<B: hal::Backend> {
raw: B::CommandQueue, raw: B::Queue,
temp_semaphores: Vec<(VkPipelineStageFlags, VkSemaphore)>, temp_semaphores: Vec<(VkPipelineStageFlags, VkSemaphore)>,
} }