Marks all functions that take an allocator as 'unsafe'
This commit is contained in:
parent
3db84ba1eb
commit
e6415a91df
112
src/device.rs
112
src/device.rs
|
@ -144,10 +144,10 @@ impl Device {
|
|||
descriptor_copies.as_ptr());
|
||||
}
|
||||
|
||||
pub fn create_sampler(&self,
|
||||
create_info: &vk::SamplerCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::Sampler> {
|
||||
pub unsafe fn create_sampler(&self,
|
||||
create_info: &vk::SamplerCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::Sampler> {
|
||||
unsafe {
|
||||
let mut sampler = mem::uninitialized();
|
||||
let err_code = self.device_fn
|
||||
|
@ -219,7 +219,7 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_descriptor_set_layout(&self,
|
||||
pub unsafe fn create_descriptor_set_layout(&self,
|
||||
create_info: &vk::DescriptorSetLayoutCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::DescriptorSetLayout> {
|
||||
|
@ -247,10 +247,10 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_descriptor_pool(&self,
|
||||
create_info: &vk::DescriptorPoolCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::DescriptorPool> {
|
||||
pub unsafe fn create_descriptor_pool(&self,
|
||||
create_info: &vk::DescriptorPoolCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::DescriptorPool> {
|
||||
unsafe {
|
||||
let mut pool = mem::uninitialized();
|
||||
let err_code = self.device_fn
|
||||
|
@ -388,10 +388,10 @@ impl Device {
|
|||
viewports.as_ptr());
|
||||
}
|
||||
|
||||
pub fn create_semaphore(&self,
|
||||
create_info: &vk::SemaphoreCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::Semaphore> {
|
||||
pub unsafe fn create_semaphore(&self,
|
||||
create_info: &vk::SemaphoreCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::Semaphore> {
|
||||
unsafe {
|
||||
let mut semaphore = mem::uninitialized();
|
||||
let err_code = self.device_fn
|
||||
|
@ -406,7 +406,7 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_graphics_pipelines(&self,
|
||||
pub unsafe fn create_graphics_pipelines(&self,
|
||||
pipeline_cache: vk::PipelineCache,
|
||||
create_infos: &[vk::GraphicsPipelineCreateInfo],
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
|
@ -428,10 +428,10 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_buffer(&self,
|
||||
create_info: &vk::BufferCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::Buffer> {
|
||||
pub unsafe fn create_buffer(&self,
|
||||
create_info: &vk::BufferCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::Buffer> {
|
||||
unsafe {
|
||||
let mut buffer = mem::uninitialized();
|
||||
let err_code = self.device_fn
|
||||
|
@ -505,10 +505,10 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_device_queue(&self,
|
||||
queue_family_index: vk::uint32_t,
|
||||
queue_index: vk::uint32_t)
|
||||
-> vk::Queue {
|
||||
pub unsafe fn get_device_queue(&self,
|
||||
queue_family_index: vk::uint32_t,
|
||||
queue_index: vk::uint32_t)
|
||||
-> vk::Queue {
|
||||
unsafe {
|
||||
let mut queue = mem::uninitialized();
|
||||
self.device_fn
|
||||
|
@ -537,10 +537,10 @@ impl Device {
|
|||
image_memory_barriers.as_ptr());
|
||||
}
|
||||
|
||||
pub fn create_render_pass(&self,
|
||||
create_info: &vk::RenderPassCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::RenderPass> {
|
||||
pub unsafe fn create_render_pass(&self,
|
||||
create_info: &vk::RenderPassCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::RenderPass> {
|
||||
unsafe {
|
||||
let mut renderpass = mem::uninitialized();
|
||||
let err_code = self.device_fn
|
||||
|
@ -576,11 +576,11 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn wait_for_fences(&self,
|
||||
fences: &[vk::Fence],
|
||||
wait_all: bool,
|
||||
timeout: vk::uint64_t)
|
||||
-> VkResult<()> {
|
||||
pub unsafe fn wait_for_fences(&self,
|
||||
fences: &[vk::Fence],
|
||||
wait_all: bool,
|
||||
timeout: vk::uint64_t)
|
||||
-> VkResult<()> {
|
||||
unsafe {
|
||||
let err_code = self.device_fn
|
||||
.wait_for_fences(self.handle,
|
||||
|
@ -595,7 +595,7 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn queue_wait_idle(&self, queue: vk::Queue) -> VkResult<()> {
|
||||
pub unsafe fn queue_wait_idle(&self, queue: vk::Queue) -> VkResult<()> {
|
||||
unsafe {
|
||||
let err_code = self.device_fn.queue_wait_idle(queue);
|
||||
match err_code {
|
||||
|
@ -633,10 +633,10 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_image_view(&self,
|
||||
create_info: &vk::ImageViewCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::ImageView> {
|
||||
pub unsafe fn create_image_view(&self,
|
||||
create_info: &vk::ImageViewCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::ImageView> {
|
||||
unsafe {
|
||||
let mut image_view = mem::uninitialized();
|
||||
let err_code = self.device_fn
|
||||
|
@ -665,10 +665,10 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_command_pool(&self,
|
||||
create_info: &vk::CommandPoolCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::CommandPool> {
|
||||
pub unsafe fn create_command_pool(&self,
|
||||
create_info: &vk::CommandPoolCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::CommandPool> {
|
||||
unsafe {
|
||||
let mut pool = mem::uninitialized();
|
||||
let err_code = self.device_fn
|
||||
|
@ -683,10 +683,10 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_image(&self,
|
||||
create_info: &vk::ImageCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::Image> {
|
||||
pub unsafe fn create_image(&self,
|
||||
create_info: &vk::ImageCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::Image> {
|
||||
unsafe {
|
||||
let mut image = mem::uninitialized();
|
||||
let err_code = self.device_fn
|
||||
|
@ -719,10 +719,10 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn allocate_memory(&self,
|
||||
create_info: &vk::MemoryAllocateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::DeviceMemory> {
|
||||
pub unsafe fn allocate_memory(&self,
|
||||
create_info: &vk::MemoryAllocateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::DeviceMemory> {
|
||||
unsafe {
|
||||
let mut memory = mem::uninitialized();
|
||||
let err_code = self.device_fn
|
||||
|
@ -737,10 +737,10 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_shader_module(&self,
|
||||
create_info: &vk::ShaderModuleCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::ShaderModule> {
|
||||
pub unsafe fn create_shader_module(&self,
|
||||
create_info: &vk::ShaderModuleCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::ShaderModule> {
|
||||
unsafe {
|
||||
let mut shader = mem::uninitialized();
|
||||
let err_code = self.device_fn
|
||||
|
@ -755,10 +755,10 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_fence(&self,
|
||||
create_info: &vk::FenceCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::Fence> {
|
||||
pub unsafe fn create_fence(&self,
|
||||
create_info: &vk::FenceCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::Fence> {
|
||||
unsafe {
|
||||
let mut fence = mem::uninitialized();
|
||||
let err_code = self.device_fn
|
||||
|
|
|
@ -5,6 +5,7 @@ use vk;
|
|||
use instance::Instance;
|
||||
use shared_library::dynamic_library::DynamicLibrary;
|
||||
use std::path::Path;
|
||||
use ::RawPtr;
|
||||
|
||||
#[cfg(windows)]
|
||||
fn get_path() -> &'static Path {
|
||||
|
@ -73,7 +74,6 @@ impl Entry {
|
|||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> Result<Instance, InstanceError> {
|
||||
unsafe {
|
||||
use ::RawPtr;
|
||||
let mut instance: vk::Instance = mem::uninitialized();
|
||||
let err_code = self.entry_fn.create_instance(create_info,
|
||||
allocation_callbacks.as_raw_ptr(),
|
||||
|
|
|
@ -5,6 +5,7 @@ use instance::Instance;
|
|||
use entry::Entry;
|
||||
use vk;
|
||||
use std::ffi::CStr;
|
||||
use ::RawPtr;
|
||||
|
||||
pub struct DebugReport {
|
||||
handle: vk::Instance,
|
||||
|
@ -24,23 +25,25 @@ impl DebugReport {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn name() -> &'static CStr{
|
||||
pub fn name() -> &'static CStr {
|
||||
CStr::from_bytes_with_nul(b"VK_EXT_debug_report\0").expect("Wrong extension string")
|
||||
}
|
||||
|
||||
pub unsafe fn destroy_debug_report_callback_ext(&self, debug: vk::DebugReportCallbackEXT) {
|
||||
self.debug_report_fn.destroy_debug_report_callback_ext(self.handle, debug, ptr::null());
|
||||
pub unsafe fn destroy_debug_report_callback_ext(&self, debug: vk::DebugReportCallbackEXT, allocation_callbacks: Option<&vk::AllocationCallbacks>) {
|
||||
self.debug_report_fn.destroy_debug_report_callback_ext(self.handle,
|
||||
debug,
|
||||
allocation_callbacks.as_raw_ptr());
|
||||
}
|
||||
|
||||
pub fn create_debug_report_callback_ext(&self,
|
||||
create_info: &vk::DebugReportCallbackCreateInfoEXT)
|
||||
pub unsafe fn create_debug_report_callback_ext(&self,
|
||||
create_info: &vk::DebugReportCallbackCreateInfoEXT, allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::DebugReportCallbackEXT> {
|
||||
unsafe {
|
||||
let mut debug_cb = mem::uninitialized();
|
||||
let err_code = self.debug_report_fn
|
||||
.create_debug_report_callback_ext(self.handle,
|
||||
create_info,
|
||||
ptr::null(),
|
||||
allocation_callbacks.as_raw_ptr(),
|
||||
&mut debug_cb);
|
||||
match err_code {
|
||||
vk::Result::Success => Ok(debug_cb),
|
||||
|
|
|
@ -5,6 +5,7 @@ use instance::Instance;
|
|||
use device::Device;
|
||||
use vk;
|
||||
use std::ffi::CStr;
|
||||
use ::RawPtr;
|
||||
|
||||
pub struct Swapchain {
|
||||
handle: vk::Device,
|
||||
|
@ -22,12 +23,15 @@ impl Swapchain {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn name() -> &'static CStr{
|
||||
pub fn name() -> &'static CStr {
|
||||
CStr::from_bytes_with_nul(b"VK_KHR_swapchain\0").expect("Wrong extension string")
|
||||
}
|
||||
|
||||
pub unsafe fn destroy_swapchain_khr(&self, swapchain: vk::SwapchainKHR) {
|
||||
self.swapchain_fn.destroy_swapchain_khr(self.handle, swapchain, ptr::null());
|
||||
pub unsafe fn destroy_swapchain_khr(&self,
|
||||
swapchain: vk::SwapchainKHR,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>) {
|
||||
self.swapchain_fn
|
||||
.destroy_swapchain_khr(self.handle, swapchain, allocation_callbacks.as_raw_ptr());
|
||||
}
|
||||
|
||||
pub unsafe fn acquire_next_image_khr(&self,
|
||||
|
@ -50,13 +54,17 @@ impl Swapchain {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_swapchain_khr(&self,
|
||||
create_info: &vk::SwapchainCreateInfoKHR)
|
||||
-> VkResult<vk::SwapchainKHR> {
|
||||
pub unsafe fn create_swapchain_khr(&self,
|
||||
create_info: &vk::SwapchainCreateInfoKHR,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::SwapchainKHR> {
|
||||
unsafe {
|
||||
let mut swapchain = mem::uninitialized();
|
||||
let err_code = self.swapchain_fn
|
||||
.create_swapchain_khr(self.handle, create_info, ptr::null(), &mut swapchain);
|
||||
.create_swapchain_khr(self.handle,
|
||||
create_info,
|
||||
allocation_callbacks.as_raw_ptr(),
|
||||
&mut swapchain);
|
||||
match err_code {
|
||||
vk::Result::Success => Ok(swapchain),
|
||||
_ => Err(err_code),
|
||||
|
|
|
@ -5,6 +5,7 @@ use instance::Instance;
|
|||
use entry::Entry;
|
||||
use vk;
|
||||
use std::ffi::CStr;
|
||||
use ::RawPtr;
|
||||
|
||||
pub struct Win32Surface {
|
||||
pub handle: vk::Instance,
|
||||
|
@ -24,17 +25,21 @@ impl Win32Surface {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn name() -> &'static CStr{
|
||||
pub fn name() -> &'static CStr {
|
||||
CStr::from_bytes_with_nul(b"VK_KHR_win32_surface\0").expect("Wrong extension string")
|
||||
}
|
||||
|
||||
pub fn create_win32_surface_khr(&self,
|
||||
create_info: &vk::Win32SurfaceCreateInfoKHR)
|
||||
-> VkResult<vk::SurfaceKHR> {
|
||||
pub unsafe fn create_win32_surface_khr(&self,
|
||||
create_info: &vk::Win32SurfaceCreateInfoKHR,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::SurfaceKHR> {
|
||||
unsafe {
|
||||
let mut surface = mem::uninitialized();
|
||||
let err_code = self.win32_surface_fn
|
||||
.create_win32_surface_khr(self.handle, create_info, ptr::null(), &mut surface);
|
||||
.create_win32_surface_khr(self.handle,
|
||||
create_info,
|
||||
allocation_callbacks.as_raw_ptr(),
|
||||
&mut surface);
|
||||
match err_code {
|
||||
vk::Result::Success => Ok(surface),
|
||||
_ => Err(err_code),
|
||||
|
|
|
@ -5,6 +5,7 @@ use instance::Instance;
|
|||
use entry::Entry;
|
||||
use vk;
|
||||
use std::ffi::CStr;
|
||||
use ::RawPtr;
|
||||
|
||||
pub struct XlibSurface {
|
||||
pub handle: vk::Instance,
|
||||
|
@ -24,17 +25,18 @@ impl XlibSurface {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn name() -> &'static CStr{
|
||||
pub fn name() -> &'static CStr {
|
||||
CStr::from_bytes_with_nul(b"VK_KHR_xlib_surface\0").expect("Wrong extension string")
|
||||
}
|
||||
|
||||
pub fn create_xlib_surface_khr(&self,
|
||||
create_info: &vk::XlibSurfaceCreateInfoKHR)
|
||||
pub unsafe fn create_xlib_surface_khr(&self,
|
||||
create_info: &vk::XlibSurfaceCreateInfoKHR,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::SurfaceKHR> {
|
||||
unsafe {
|
||||
let mut surface = mem::uninitialized();
|
||||
let err_code = self.xlib_surface_fn
|
||||
.create_xlib_surface_khr(self.handle, create_info, ptr::null(), &mut surface);
|
||||
.create_xlib_surface_khr(self.handle, create_info, allocation_callbacks.as_raw_ptr(), &mut surface);
|
||||
match err_code {
|
||||
vk::Result::Success => Ok(surface),
|
||||
_ => Err(err_code),
|
||||
|
|
|
@ -30,7 +30,7 @@ impl Instance {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_device(&self,
|
||||
pub unsafe fn create_device(&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
create_info: &vk::DeviceCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
|
|
Loading…
Reference in a new issue