Marks all functions that take an allocator as 'unsafe'
This commit is contained in:
parent
3db84ba1eb
commit
e6415a91df
|
@ -144,7 +144,7 @@ impl Device {
|
|||
descriptor_copies.as_ptr());
|
||||
}
|
||||
|
||||
pub fn create_sampler(&self,
|
||||
pub unsafe fn create_sampler(&self,
|
||||
create_info: &vk::SamplerCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::Sampler> {
|
||||
|
@ -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,7 +247,7 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_descriptor_pool(&self,
|
||||
pub unsafe fn create_descriptor_pool(&self,
|
||||
create_info: &vk::DescriptorPoolCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::DescriptorPool> {
|
||||
|
@ -388,7 +388,7 @@ impl Device {
|
|||
viewports.as_ptr());
|
||||
}
|
||||
|
||||
pub fn create_semaphore(&self,
|
||||
pub unsafe fn create_semaphore(&self,
|
||||
create_info: &vk::SemaphoreCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::Semaphore> {
|
||||
|
@ -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,7 +428,7 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_buffer(&self,
|
||||
pub unsafe fn create_buffer(&self,
|
||||
create_info: &vk::BufferCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::Buffer> {
|
||||
|
@ -505,7 +505,7 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_device_queue(&self,
|
||||
pub unsafe fn get_device_queue(&self,
|
||||
queue_family_index: vk::uint32_t,
|
||||
queue_index: vk::uint32_t)
|
||||
-> vk::Queue {
|
||||
|
@ -537,7 +537,7 @@ impl Device {
|
|||
image_memory_barriers.as_ptr());
|
||||
}
|
||||
|
||||
pub fn create_render_pass(&self,
|
||||
pub unsafe fn create_render_pass(&self,
|
||||
create_info: &vk::RenderPassCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::RenderPass> {
|
||||
|
@ -576,7 +576,7 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn wait_for_fences(&self,
|
||||
pub unsafe fn wait_for_fences(&self,
|
||||
fences: &[vk::Fence],
|
||||
wait_all: bool,
|
||||
timeout: vk::uint64_t)
|
||||
|
@ -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,7 +633,7 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_image_view(&self,
|
||||
pub unsafe fn create_image_view(&self,
|
||||
create_info: &vk::ImageViewCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::ImageView> {
|
||||
|
@ -665,7 +665,7 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_command_pool(&self,
|
||||
pub unsafe fn create_command_pool(&self,
|
||||
create_info: &vk::CommandPoolCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::CommandPool> {
|
||||
|
@ -683,7 +683,7 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_image(&self,
|
||||
pub unsafe fn create_image(&self,
|
||||
create_info: &vk::ImageCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::Image> {
|
||||
|
@ -719,7 +719,7 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn allocate_memory(&self,
|
||||
pub unsafe fn allocate_memory(&self,
|
||||
create_info: &vk::MemoryAllocateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::DeviceMemory> {
|
||||
|
@ -737,7 +737,7 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_shader_module(&self,
|
||||
pub unsafe fn create_shader_module(&self,
|
||||
create_info: &vk::ShaderModuleCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::ShaderModule> {
|
||||
|
@ -755,7 +755,7 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_fence(&self,
|
||||
pub unsafe fn create_fence(&self,
|
||||
create_info: &vk::FenceCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>)
|
||||
-> VkResult<vk::Fence> {
|
||||
|
|
|
@ -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)
|
||||
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)
|
||||
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