mirror of
https://github.com/italicsjenga/portability.git
synced 2024-11-22 23:11:30 +11:00
Implement vkCmdBeginRenderPass
This commit is contained in:
parent
8840b74646
commit
225764fc2d
|
@ -1,4 +1,4 @@
|
|||
use hal::{adapter, buffer, format, image, memory, pass, pso, window};
|
||||
use hal::{adapter, buffer, command, format, image, memory, pass, pso, window};
|
||||
|
||||
use std::mem;
|
||||
|
||||
|
@ -430,3 +430,13 @@ pub fn map_image_acces(access: VkAccessFlags) -> image::Access {
|
|||
|
||||
mask
|
||||
}
|
||||
|
||||
pub fn map_subpass_contents(contents: VkSubpassContents) -> command::SubpassContents {
|
||||
match contents {
|
||||
VkSubpassContents::VK_SUBPASS_CONTENTS_INLINE => command::SubpassContents::Inline,
|
||||
VkSubpassContents::VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS =>
|
||||
command::SubpassContents::SecondaryBuffers,
|
||||
|
||||
_ => panic!("Unexpected subpass contents: {:?}", contents),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ use hal::{
|
|||
};
|
||||
use hal::device::WaitFor;
|
||||
use hal::pool::RawCommandPool;
|
||||
use hal::command::RawCommandBuffer;
|
||||
use hal::command::{ClearValueRaw, RawCommandBuffer, Rect};
|
||||
use hal::queue::RawCommandQueue;
|
||||
|
||||
use std::ffi::CString;
|
||||
|
@ -1990,11 +1990,35 @@ pub extern "C" fn gfxCmdPushConstants(
|
|||
}
|
||||
#[inline]
|
||||
pub extern "C" fn gfxCmdBeginRenderPass(
|
||||
commandBuffer: VkCommandBuffer,
|
||||
mut commandBuffer: VkCommandBuffer,
|
||||
pRenderPassBegin: *const VkRenderPassBeginInfo,
|
||||
contents: VkSubpassContents,
|
||||
) {
|
||||
unimplemented!()
|
||||
let info = unsafe { &*pRenderPassBegin };
|
||||
|
||||
let render_area = Rect {
|
||||
x: info.renderArea.offset.x as _,
|
||||
y: info.renderArea.offset.y as _,
|
||||
w: info.renderArea.extent.width as _,
|
||||
h: info.renderArea.extent.height as _,
|
||||
};
|
||||
let clear_values = unsafe {
|
||||
slice::from_raw_parts(info.pClearValues, info.clearValueCount as _)
|
||||
.into_iter()
|
||||
.map(|cv| {
|
||||
// HAL and Vulkan clear value union sharing same memory representation
|
||||
mem::transmute::<_, ClearValueRaw>(*cv)
|
||||
})
|
||||
};
|
||||
let contents = conv::map_subpass_contents(contents);
|
||||
|
||||
commandBuffer.begin_renderpass_raw(
|
||||
&*info.renderPass,
|
||||
&*info.framebuffer,
|
||||
render_area,
|
||||
clear_values,
|
||||
contents,
|
||||
);
|
||||
}
|
||||
#[inline]
|
||||
pub extern "C" fn gfxCmdNextSubpass(commandBuffer: VkCommandBuffer, contents: VkSubpassContents) {
|
||||
|
|
|
@ -1290,7 +1290,16 @@ pub extern "C" fn vkCmdCopyQueryPoolResults(
|
|||
stride: VkDeviceSize,
|
||||
flags: VkQueryResultFlags,
|
||||
) {
|
||||
unimplemented!()
|
||||
gfxCmdCopyQueryPoolResults(
|
||||
commandBuffer,
|
||||
queryPool,
|
||||
firstQuery,
|
||||
queryCount,
|
||||
dstBuffer,
|
||||
dstOffset,
|
||||
stride,
|
||||
flags,
|
||||
)
|
||||
}
|
||||
#[no_mangle]
|
||||
pub extern "C" fn vkCmdPushConstants(
|
||||
|
@ -1301,7 +1310,7 @@ pub extern "C" fn vkCmdPushConstants(
|
|||
size: u32,
|
||||
pValues: *const ::std::os::raw::c_void,
|
||||
) {
|
||||
unimplemented!()
|
||||
gfxCmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues)
|
||||
}
|
||||
#[no_mangle]
|
||||
pub extern "C" fn vkCmdBeginRenderPass(
|
||||
|
@ -1309,15 +1318,15 @@ pub extern "C" fn vkCmdBeginRenderPass(
|
|||
pRenderPassBegin: *const VkRenderPassBeginInfo,
|
||||
contents: VkSubpassContents,
|
||||
) {
|
||||
unimplemented!()
|
||||
gfxCmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents)
|
||||
}
|
||||
#[no_mangle]
|
||||
pub extern "C" fn vkCmdNextSubpass(commandBuffer: VkCommandBuffer, contents: VkSubpassContents) {
|
||||
unimplemented!()
|
||||
gfxCmdNextSubpass(commandBuffer, contents)
|
||||
}
|
||||
#[no_mangle]
|
||||
pub extern "C" fn vkCmdEndRenderPass(commandBuffer: VkCommandBuffer) {
|
||||
unimplemented!()
|
||||
gfxCmdEndRenderPass(commandBuffer)
|
||||
}
|
||||
#[no_mangle]
|
||||
pub extern "C" fn vkCmdExecuteCommands(
|
||||
|
@ -1325,7 +1334,7 @@ pub extern "C" fn vkCmdExecuteCommands(
|
|||
commandBufferCount: u32,
|
||||
pCommandBuffers: *const VkCommandBuffer,
|
||||
) {
|
||||
unimplemented!()
|
||||
gfxCmdExecuteCommands(commandBuffer, commandBufferCount, pCommandBuffers)
|
||||
}
|
||||
#[no_mangle]
|
||||
pub extern "C" fn vkAcquireNextImageKHR(
|
||||
|
|
Loading…
Reference in a new issue