mirror of
https://github.com/italicsjenga/portability.git
synced 2024-11-23 07:21:31 +11:00
Merge #33
33: Base on gfx-rs master revision r=kvark a=kvark Closes https://github.com/gfx-rs/gfx/issues/1819
This commit is contained in:
commit
28e1318314
|
@ -16,15 +16,14 @@ lazy_static = "1.0"
|
||||||
|
|
||||||
[dependencies.gfx-hal]
|
[dependencies.gfx-hal]
|
||||||
git = "https://github.com/gfx-rs/gfx"
|
git = "https://github.com/gfx-rs/gfx"
|
||||||
branch = "portable"
|
rev = "14a0d6c0976cdbc882a6f63bced18a9b2bf13f5f"
|
||||||
|
|
||||||
[dependencies.gfx-backend-vulkan]
|
[dependencies.gfx-backend-vulkan]
|
||||||
git = "https://github.com/gfx-rs/gfx"
|
git = "https://github.com/gfx-rs/gfx"
|
||||||
branch = "portable"
|
rev = "14a0d6c0976cdbc882a6f63bced18a9b2bf13f5f"
|
||||||
features = ["portable"]
|
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies.gfx-backend-dx12]
|
[target.'cfg(windows)'.dependencies.gfx-backend-dx12]
|
||||||
git = "https://github.com/gfx-rs/gfx"
|
git = "https://github.com/gfx-rs/gfx"
|
||||||
branch = "portable"
|
rev = "14a0d6c0976cdbc882a6f63bced18a9b2bf13f5f"
|
||||||
optional = true
|
optional = true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use VK_NULL_HANDLE;
|
use VK_NULL_HANDLE;
|
||||||
use std::{fmt, ops};
|
use std::{borrow, fmt, ops};
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct Handle<T>(*mut T);
|
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> {
|
impl<T> fmt::Debug for Handle<T> {
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(formatter, "Handle({:p})", self.0)
|
write!(formatter, "Handle({:p})", self.0)
|
||||||
|
|
|
@ -276,7 +276,7 @@ pub extern "C" fn gfxCreateDevice(
|
||||||
let request_infos = queue_infos
|
let request_infos = queue_infos
|
||||||
.iter()
|
.iter()
|
||||||
.map(|info| {
|
.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])
|
(family, vec![1.0; info.queueCount as usize])
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
@ -417,11 +417,8 @@ pub extern "C" fn gfxQueueSubmit(
|
||||||
assert_eq!(submitCount, 1); // TODO;
|
assert_eq!(submitCount, 1); // TODO;
|
||||||
|
|
||||||
let submission = unsafe { *pSubmits };
|
let submission = unsafe { *pSubmits };
|
||||||
let cmd_buffers = unsafe {
|
let cmd_slice = unsafe {
|
||||||
slice::from_raw_parts(submission.pCommandBuffers, submission.commandBufferCount as _)
|
slice::from_raw_parts(submission.pCommandBuffers, submission.commandBufferCount as _)
|
||||||
.into_iter()
|
|
||||||
.map(|cmd_buffer| **cmd_buffer)
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
};
|
};
|
||||||
let wait_semaphores = unsafe {
|
let wait_semaphores = unsafe {
|
||||||
let semaphores = slice::from_raw_parts(submission.pWaitSemaphores, submission.waitSemaphoreCount as _);
|
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 {
|
let submission = hal::queue::RawSubmission {
|
||||||
cmd_buffers: &cmd_buffers,
|
cmd_buffers: cmd_slice.iter().cloned(),
|
||||||
wait_semaphores: &wait_semaphores,
|
wait_semaphores: &wait_semaphores,
|
||||||
signal_semaphores: &signal_semaphores,
|
signal_semaphores: &signal_semaphores,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue