Update gfx to unborrowed APIs

This commit is contained in:
Dzmitry Malyshau
2021-01-18 14:26:52 -05:00
parent 14d1a4f222
commit 7f8c776a85
8 changed files with 56 additions and 43 deletions

21
Cargo.lock generated
View File

@@ -476,7 +476,7 @@ dependencies = [
[[package]]
name = "gfx-auxil"
version = "0.5.0"
source = "git+https://github.com/gfx-rs/gfx?rev=696947377a0ce5ba8a15a2e06ff97ed69c04f00a#696947377a0ce5ba8a15a2e06ff97ed69c04f00a"
source = "git+https://github.com/gfx-rs/gfx?rev=477f17957a54d024f0077584b68e308376cb05c6#477f17957a54d024f0077584b68e308376cb05c6"
dependencies = [
"fxhash",
"gfx-hal",
@@ -486,7 +486,7 @@ dependencies = [
[[package]]
name = "gfx-backend-dx11"
version = "0.6.0"
source = "git+https://github.com/gfx-rs/gfx?rev=696947377a0ce5ba8a15a2e06ff97ed69c04f00a#696947377a0ce5ba8a15a2e06ff97ed69c04f00a"
source = "git+https://github.com/gfx-rs/gfx?rev=477f17957a54d024f0077584b68e308376cb05c6#477f17957a54d024f0077584b68e308376cb05c6"
dependencies = [
"arrayvec",
"bitflags",
@@ -507,7 +507,7 @@ dependencies = [
[[package]]
name = "gfx-backend-dx12"
version = "0.6.2"
source = "git+https://github.com/gfx-rs/gfx?rev=696947377a0ce5ba8a15a2e06ff97ed69c04f00a#696947377a0ce5ba8a15a2e06ff97ed69c04f00a"
source = "git+https://github.com/gfx-rs/gfx?rev=477f17957a54d024f0077584b68e308376cb05c6#477f17957a54d024f0077584b68e308376cb05c6"
dependencies = [
"arrayvec",
"bit-set",
@@ -527,7 +527,7 @@ dependencies = [
[[package]]
name = "gfx-backend-empty"
version = "0.6.0"
source = "git+https://github.com/gfx-rs/gfx?rev=696947377a0ce5ba8a15a2e06ff97ed69c04f00a#696947377a0ce5ba8a15a2e06ff97ed69c04f00a"
source = "git+https://github.com/gfx-rs/gfx?rev=477f17957a54d024f0077584b68e308376cb05c6#477f17957a54d024f0077584b68e308376cb05c6"
dependencies = [
"gfx-hal",
"log",
@@ -537,7 +537,7 @@ dependencies = [
[[package]]
name = "gfx-backend-gl"
version = "0.6.0"
source = "git+https://github.com/gfx-rs/gfx?rev=696947377a0ce5ba8a15a2e06ff97ed69c04f00a#696947377a0ce5ba8a15a2e06ff97ed69c04f00a"
source = "git+https://github.com/gfx-rs/gfx?rev=477f17957a54d024f0077584b68e308376cb05c6#477f17957a54d024f0077584b68e308376cb05c6"
dependencies = [
"arrayvec",
"bitflags",
@@ -551,7 +551,6 @@ dependencies = [
"naga",
"parking_lot",
"raw-window-handle",
"smallvec",
"spirv_cross",
"wasm-bindgen",
"web-sys",
@@ -560,7 +559,7 @@ dependencies = [
[[package]]
name = "gfx-backend-metal"
version = "0.6.0"
source = "git+https://github.com/gfx-rs/gfx?rev=696947377a0ce5ba8a15a2e06ff97ed69c04f00a#696947377a0ce5ba8a15a2e06ff97ed69c04f00a"
source = "git+https://github.com/gfx-rs/gfx?rev=477f17957a54d024f0077584b68e308376cb05c6#477f17957a54d024f0077584b68e308376cb05c6"
dependencies = [
"arrayvec",
"bitflags",
@@ -584,7 +583,7 @@ dependencies = [
[[package]]
name = "gfx-backend-vulkan"
version = "0.6.5"
source = "git+https://github.com/gfx-rs/gfx?rev=696947377a0ce5ba8a15a2e06ff97ed69c04f00a#696947377a0ce5ba8a15a2e06ff97ed69c04f00a"
source = "git+https://github.com/gfx-rs/gfx?rev=477f17957a54d024f0077584b68e308376cb05c6#477f17957a54d024f0077584b68e308376cb05c6"
dependencies = [
"arrayvec",
"ash",
@@ -604,7 +603,7 @@ dependencies = [
[[package]]
name = "gfx-hal"
version = "0.6.0"
source = "git+https://github.com/gfx-rs/gfx?rev=696947377a0ce5ba8a15a2e06ff97ed69c04f00a#696947377a0ce5ba8a15a2e06ff97ed69c04f00a"
source = "git+https://github.com/gfx-rs/gfx?rev=477f17957a54d024f0077584b68e308376cb05c6#477f17957a54d024f0077584b68e308376cb05c6"
dependencies = [
"bitflags",
"naga",
@@ -768,7 +767,7 @@ dependencies = [
[[package]]
name = "khronos-egl"
version = "3.0.0-beta"
source = "git+https://github.com/timothee-haudebourg/khronos-egl?rev=9568b2ee3b02f2c17cc9479f824db16daecf1664#9568b2ee3b02f2c17cc9479f824db16daecf1664"
source = "git+https://github.com/timothee-haudebourg/khronos-egl?rev=4b769b8f2d068fa78db9285a8557cd11365fa314#4b769b8f2d068fa78db9285a8557cd11365fa314"
dependencies = [
"libc",
"libloading",
@@ -1197,7 +1196,7 @@ dependencies = [
[[package]]
name = "range-alloc"
version = "0.1.1"
source = "git+https://github.com/gfx-rs/gfx?rev=696947377a0ce5ba8a15a2e06ff97ed69c04f00a#696947377a0ce5ba8a15a2e06ff97ed69c04f00a"
source = "git+https://github.com/gfx-rs/gfx?rev=477f17957a54d024f0077584b68e308376cb05c6#477f17957a54d024f0077584b68e308376cb05c6"
[[package]]
name = "raw-window-handle"

View File

@@ -36,24 +36,24 @@ thiserror = "1"
gpu-alloc = { git = "https://github.com/zakarumych/gpu-alloc", rev = "15f4fe2cebbd0bf9ab446757a8e370e0adf4c502", features = ["tracing"] }
gpu-descriptor = { git = "https://github.com/zakarumych/gpu-descriptor", rev = "aa092613889f03f8254d6f7278d08c655324c7c7", features = ["tracing"] }
hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "696947377a0ce5ba8a15a2e06ff97ed69c04f00a" }
gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "696947377a0ce5ba8a15a2e06ff97ed69c04f00a" }
hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "477f17957a54d024f0077584b68e308376cb05c6" }
gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "477f17957a54d024f0077584b68e308376cb05c6" }
[target.'cfg(all(not(target_arch = "wasm32"), all(unix, not(target_os = "ios"), not(target_os = "macos"))))'.dependencies]
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "696947377a0ce5ba8a15a2e06ff97ed69c04f00a", features = ["naga"] }
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "696947377a0ce5ba8a15a2e06ff97ed69c04f00a", features = ["naga"] }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "477f17957a54d024f0077584b68e308376cb05c6", features = ["naga"] }
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "477f17957a54d024f0077584b68e308376cb05c6", features = ["naga"] }
[target.'cfg(all(not(target_arch = "wasm32"), any(target_os = "ios", target_os = "macos")))'.dependencies]
gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "696947377a0ce5ba8a15a2e06ff97ed69c04f00a", features = ["naga"] }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "696947377a0ce5ba8a15a2e06ff97ed69c04f00a", optional = true }
gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "477f17957a54d024f0077584b68e308376cb05c6", features = ["naga"] }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "477f17957a54d024f0077584b68e308376cb05c6", optional = true }
[target.'cfg(all(not(target_arch = "wasm32"), windows))'.dependencies]
gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "696947377a0ce5ba8a15a2e06ff97ed69c04f00a" }
gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "696947377a0ce5ba8a15a2e06ff97ed69c04f00a" }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "696947377a0ce5ba8a15a2e06ff97ed69c04f00a", features = ["naga"] }
gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "477f17957a54d024f0077584b68e308376cb05c6" }
gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "477f17957a54d024f0077584b68e308376cb05c6" }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "477f17957a54d024f0077584b68e308376cb05c6", features = ["naga"] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "696947377a0ce5ba8a15a2e06ff97ed69c04f00a", features = ["naga"] }
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "477f17957a54d024f0077584b68e308376cb05c6", features = ["naga"] }
[dependencies.naga]
git = "https://github.com/gfx-rs/naga"

View File

@@ -555,7 +555,7 @@ impl RenderBundle {
&pipeline_layout_guard[pipeline_layout_id.unwrap()].raw,
index as usize,
iter::once(bind_group.raw.raw()),
&offsets[..num_dynamic_offsets as usize],
offsets.iter().take(num_dynamic_offsets as usize).cloned(),
);
offsets = &offsets[num_dynamic_offsets as usize..];
}

View File

@@ -343,7 +343,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
&pipeline_layout_guard[pipeline_layout_id].raw,
index as usize,
bind_groups,
&temp_offsets,
temp_offsets.iter().cloned(),
);
}
}

View File

@@ -805,11 +805,15 @@ impl<'a, B: GfxBackend> RenderPassInfo<'a, B> {
let all = entry
.key()
.all()
.map(|(at, _)| at)
.map(|(at, _)| at.clone())
.collect::<AttachmentDataVec<_>>();
let pass = unsafe { device.raw.create_render_pass(all, iter::once(subpass), &[]) }
.unwrap();
let pass = unsafe {
device
.raw
.create_render_pass(all, iter::once(subpass), iter::empty())
}
.unwrap();
entry.insert(pass)
}
};
@@ -932,7 +936,7 @@ impl<'a, B: GfxBackend> RenderPassInfo<'a, B> {
attachments,
hal::command::SubpassContents::Inline,
);
raw.set_scissors(0, iter::once(&rect));
raw.set_scissors(0, iter::once(rect));
raw.set_viewports(
0,
iter::once(hal::pso::Viewport {
@@ -1135,7 +1139,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
&pipeline_layout_guard[pipeline_layout_id].raw,
index as usize,
bind_groups,
&temp_offsets,
temp_offsets.iter().cloned(),
);
}
};

View File

@@ -145,7 +145,9 @@ impl<B: hal::Backend>
sets: &mut impl Extend<B::DescriptorSet>,
) -> Result<(), gpu_descriptor::DeviceAllocationError> {
use gpu_descriptor::DeviceAllocationError as Dae;
match hal::pso::DescriptorPool::allocate(pool, layouts, sets) {
//TODO: https://github.com/zakarumych/gpu-descriptor/pull/10
let temp_layouts = layouts.collect::<Vec<_>>();
match hal::pso::DescriptorPool::allocate(pool, temp_layouts, sets) {
Ok(()) => Ok(()),
Err(hal::pso::AllocationError::OutOfMemory(oom)) => Err(match oom {
hal::device::OutOfMemory::Host => Dae::OutOfHostMemory,

View File

@@ -1060,10 +1060,13 @@ impl<B: GfxBackend> Device<B> {
};
let all = key
.all()
.map(|(at, _)| at)
.map(|(at, _)| at.clone())
.collect::<AttachmentDataVec<_>>();
unsafe { self.raw.create_render_pass(all, iter::once(subpass), &[]) }
unsafe {
self.raw
.create_render_pass(all, iter::once(subpass), iter::empty())
}
}
fn deduplicate_bind_group_layout(

View File

@@ -619,20 +619,25 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
.raw
.create_fence(false)
.or(Err(DeviceError::OutOfMemory))?;
let submission = hal::queue::Submission {
command_buffers: pending_write_command_buffer.as_ref().into_iter().chain(
command_buffer_ids
.iter()
.flat_map(|&cmb_id| &command_buffer_guard.get(cmb_id).unwrap().raw),
),
wait_semaphores: Vec::new(),
signal_semaphores: signal_swapchain_semaphores
.into_iter()
.map(|sc_id| &swap_chain_guard[sc_id].semaphore),
};
let mut command_buffers = pending_write_command_buffer
.as_ref()
.into_iter()
.collect::<Vec<_>>();
for &cmd_buf_id in command_buffer_ids {
let cmd_buf = command_buffer_guard.get(cmd_buf_id).unwrap();
command_buffers.extend(cmd_buf.raw.iter());
}
let signal_semaphores = signal_swapchain_semaphores
.into_iter()
.map(|sc_id| &swap_chain_guard[sc_id].semaphore);
unsafe {
device.queue_group.queues[0].submit(submission, Some(&mut fence));
device.queue_group.queues[0].submit(
command_buffers,
iter::empty(),
signal_semaphores,
Some(&mut fence),
);
}
fence
};