Obtain memory properties

This commit is contained in:
Dzmitry Malyshau 2018-09-14 09:06:44 -04:00
parent edc8980a9a
commit 7d8577cb90
5 changed files with 31 additions and 2 deletions

View File

@ -1,5 +1,25 @@
use hal;
use {CommandBuffer, CommandBufferHandle, ComputePassHandle};
pub struct ComputePass<B: hal::Backend> {
raw: B::CommandBuffer,
}
pub extern "C"
fn compute_pass_dispatch(
pass: ComputePassHandle, groups_x: u32, groups_y: u32, groups_z: u32
) {
unimplemented!()
}
pub extern "C"
fn compute_pass_end(pass: ComputePassHandle) -> CommandBufferHandle {
match pass.unbox() {
Some(pass) => CommandBufferHandle::new(CommandBuffer {
raw: pass.raw,
}),
None => CommandBufferHandle::null(),
}
}

View File

@ -1,6 +1,6 @@
use hal;
use {CommandBufferHandle, RenderPassHandle};
use {CommandBuffer, CommandBufferHandle, RenderPassHandle};
pub struct RenderPass<B: hal::Backend> {
@ -23,5 +23,10 @@ fn render_pass_draw_indexed(
pub extern "C"
fn render_pass_end(pass: RenderPassHandle) -> CommandBufferHandle {
unimplemented!()
match pass.unbox() {
Some(pass) => CommandBufferHandle::new(CommandBuffer {
raw: pass.raw,
}),
None => CommandBufferHandle::null(),
}
}

View File

@ -1,4 +1,5 @@
use hal::{self, Device as _Device};
use memory;
use {BufferHandle, CommandBufferHandle, DeviceHandle};
@ -17,6 +18,7 @@ pub struct CommandBufferDescriptor {
pub struct Device<B: hal::Backend> {
pub gpu: hal::Gpu<B>,
pub memory_properties: hal::MemoryProperties,
}
pub struct Buffer<B: hal::Backend> {

View File

@ -61,5 +61,6 @@ fn adapter_create_device(
let gpu = adapter.physical_device.open(&[(queue_family, &[1f32])]).unwrap();
DeviceHandle::new(Device {
gpu,
memory_properties: adapter.physical_device.memory_properties(),
})
}

View File

@ -5,6 +5,7 @@ extern crate gfx_backend_vulkan as back;
extern crate gfx_backend_dx12 as back;
#[cfg(feature = "gfx-backend-metal")]
extern crate gfx_backend_metal as back;
extern crate gfx_memory as memory;
mod command;
mod device;