Base on gfx-rs master revision

This commit is contained in:
Dzmitry Malyshau 2018-02-16 10:31:10 -05:00
parent a7806c4b10
commit 7d7a0f9e44
3 changed files with 13 additions and 11 deletions

View file

@ -16,15 +16,14 @@ lazy_static = "1.0"
[dependencies.gfx-hal]
git = "https://github.com/gfx-rs/gfx"
branch = "portable"
rev = "14a0d6c0976cdbc882a6f63bced18a9b2bf13f5f"
[dependencies.gfx-backend-vulkan]
git = "https://github.com/gfx-rs/gfx"
branch = "portable"
features = ["portable"]
rev = "14a0d6c0976cdbc882a6f63bced18a9b2bf13f5f"
optional = true
[target.'cfg(windows)'.dependencies.gfx-backend-dx12]
git = "https://github.com/gfx-rs/gfx"
branch = "portable"
rev = "14a0d6c0976cdbc882a6f63bced18a9b2bf13f5f"
optional = true

View file

@ -1,5 +1,5 @@
use VK_NULL_HANDLE;
use std::{fmt, ops};
use std::{borrow, fmt, ops};
#[repr(C)]
pub struct Handle<T>(*mut T);
@ -40,6 +40,12 @@ impl<T> ops::DerefMut for Handle<T> {
}
}
impl<T> borrow::Borrow<T> for Handle<T> {
fn borrow(&self) -> &T {
unsafe { &*self.0 }
}
}
impl<T> fmt::Debug for Handle<T> {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "Handle({:p})", self.0)

View file

@ -276,7 +276,7 @@ pub extern "C" fn gfxCreateDevice(
let request_infos = queue_infos
.iter()
.map(|info| {
let family = adapter.queue_families[info.queueFamilyIndex as usize].clone();
let family = &adapter.queue_families[info.queueFamilyIndex as usize];
(family, vec![1.0; info.queueCount as usize])
})
.collect::<Vec<_>>();
@ -417,11 +417,8 @@ pub extern "C" fn gfxQueueSubmit(
assert_eq!(submitCount, 1); // TODO;
let submission = unsafe { *pSubmits };
let cmd_buffers = unsafe {
let cmd_slice = unsafe {
slice::from_raw_parts(submission.pCommandBuffers, submission.commandBufferCount as _)
.into_iter()
.map(|cmd_buffer| **cmd_buffer)
.collect::<Vec<_>>()
};
let wait_semaphores = unsafe {
let semaphores = slice::from_raw_parts(submission.pWaitSemaphores, submission.waitSemaphoreCount as _);
@ -440,7 +437,7 @@ pub extern "C" fn gfxQueueSubmit(
};
let submission = hal::queue::RawSubmission {
cmd_buffers: &cmd_buffers,
cmd_buffers: cmd_slice.iter().cloned(),
wait_semaphores: &wait_semaphores,
signal_semaphores: &signal_semaphores,
};