mirror of
https://github.com/italicsjenga/portability.git
synced 2025-02-17 06:37:43 +11:00
commit
c049bac241
2 changed files with 18 additions and 12 deletions
|
@ -1,4 +1,4 @@
|
||||||
use hal::{adapter, buffer, command, format, image, memory, pass, pso, window};
|
use hal::{buffer, command, error, format, image, memory, pass, pso, window};
|
||||||
use hal::{PatchSize, Primitive};
|
use hal::{PatchSize, Primitive};
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
@ -355,8 +355,8 @@ pub fn map_pipeline_stage_flags(stages: VkPipelineStageFlags) -> pso::PipelineSt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn map_err_device_creation(err: adapter::DeviceCreationError) -> VkResult {
|
pub fn map_err_device_creation(err: error::DeviceCreationError) -> VkResult {
|
||||||
use hal::adapter::DeviceCreationError::*;
|
use hal::error::DeviceCreationError::*;
|
||||||
|
|
||||||
match err {
|
match err {
|
||||||
OutOfHostMemory => VkResult::VK_ERROR_OUT_OF_HOST_MEMORY,
|
OutOfHostMemory => VkResult::VK_ERROR_OUT_OF_HOST_MEMORY,
|
||||||
|
@ -523,3 +523,9 @@ pub fn map_blend_op(
|
||||||
) -> pso::BlendOp {
|
) -> pso::BlendOp {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn map_cmd_buffer_usage(flags: VkCommandBufferUsageFlags) -> command::CommandBufferFlags {
|
||||||
|
// Vulkan and HAL flags are equal
|
||||||
|
unsafe { mem::transmute(flags as u16) }
|
||||||
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ use hal::{
|
||||||
};
|
};
|
||||||
use hal::device::WaitFor;
|
use hal::device::WaitFor;
|
||||||
use hal::pool::RawCommandPool;
|
use hal::pool::RawCommandPool;
|
||||||
use hal::command::{ClearValueRaw, RawCommandBuffer, Rect, Viewport};
|
use hal::command::{ClearValueRaw, RawCommandBuffer, RawLevel, Rect, Viewport};
|
||||||
use hal::queue::RawCommandQueue;
|
use hal::queue::RawCommandQueue;
|
||||||
|
|
||||||
use std::ffi::{CStr, CString};
|
use std::ffi::{CStr, CString};
|
||||||
|
@ -1934,13 +1934,15 @@ pub extern "C" fn gfxAllocateCommandBuffers(
|
||||||
pCommandBuffers: *mut VkCommandBuffer,
|
pCommandBuffers: *mut VkCommandBuffer,
|
||||||
) -> VkResult {
|
) -> VkResult {
|
||||||
let info = unsafe { &mut *(pAllocateInfo as *mut VkCommandBufferAllocateInfo) };
|
let info = unsafe { &mut *(pAllocateInfo as *mut VkCommandBufferAllocateInfo) };
|
||||||
assert_eq!(
|
let level = match info.level {
|
||||||
info.level,
|
VkCommandBufferLevel::VK_COMMAND_BUFFER_LEVEL_PRIMARY => RawLevel::Primary,
|
||||||
VkCommandBufferLevel::VK_COMMAND_BUFFER_LEVEL_PRIMARY
|
VkCommandBufferLevel::VK_COMMAND_BUFFER_LEVEL_SECONDARY => RawLevel::Secondary,
|
||||||
); //TODO
|
level => panic!("Unexpected command buffer lvel: {:?}", level),
|
||||||
|
};
|
||||||
|
|
||||||
let count = info.commandBufferCount as usize;
|
let count = info.commandBufferCount as usize;
|
||||||
|
|
||||||
let cmd_bufs = info.commandPool.allocate(count);
|
let cmd_bufs = info.commandPool.allocate(count, level);
|
||||||
|
|
||||||
let output = unsafe { slice::from_raw_parts_mut(pCommandBuffers, count) };
|
let output = unsafe { slice::from_raw_parts_mut(pCommandBuffers, count) };
|
||||||
for (out, cmd_buf) in output.iter_mut().zip(cmd_bufs) {
|
for (out, cmd_buf) in output.iter_mut().zip(cmd_bufs) {
|
||||||
|
@ -1968,9 +1970,7 @@ pub extern "C" fn gfxBeginCommandBuffer(
|
||||||
mut commandBuffer: VkCommandBuffer,
|
mut commandBuffer: VkCommandBuffer,
|
||||||
pBeginInfo: *const VkCommandBufferBeginInfo,
|
pBeginInfo: *const VkCommandBufferBeginInfo,
|
||||||
) -> VkResult {
|
) -> VkResult {
|
||||||
assert_eq!(unsafe { (*pBeginInfo).flags }, 0); // TODO
|
commandBuffer.begin(conv::map_cmd_buffer_usage(unsafe { (*pBeginInfo).flags }));
|
||||||
|
|
||||||
commandBuffer.begin();
|
|
||||||
|
|
||||||
VkResult::VK_SUCCESS
|
VkResult::VK_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue