15: Export dummy vulkan functions to fix linking of lunarg API samples r=kvark a=msiglreith

Export a lot more functions which are required for getting lunarg API samples to link (don't run yet as some functions are not implemented so far).

+ format everything with rustfmt-nightly
This commit is contained in:
bors[bot] 2018-01-04 20:00:47 +00:00
commit 05c1d5387f
5 changed files with 2254 additions and 864 deletions

View file

@ -1,4 +1,3 @@
use hal::{adapter, buffer, format, image, memory, window}; use hal::{adapter, buffer, format, image, memory, window};
use std::mem; use std::mem;
@ -117,8 +116,10 @@ fn map_swizzle_component(
pub fn map_subresource_range(subresource: VkImageSubresourceRange) -> image::SubresourceRange { pub fn map_subresource_range(subresource: VkImageSubresourceRange) -> image::SubresourceRange {
image::SubresourceRange { image::SubresourceRange {
aspects: map_aspect(subresource.aspectMask), aspects: map_aspect(subresource.aspectMask),
levels: subresource.baseMipLevel as _ .. (subresource.baseMipLevel+subresource.levelCount) as _, levels: subresource.baseMipLevel as _
layers: subresource.baseArrayLayer as _ .. (subresource.baseArrayLayer+subresource.layerCount) as _, ..(subresource.baseMipLevel + subresource.levelCount) as _,
layers: subresource.baseArrayLayer as _
..(subresource.baseArrayLayer + subresource.layerCount) as _,
} }
} }
@ -151,12 +152,8 @@ pub fn map_image_kind(
assert!(!is_cube || array_layers % 6 == 0); assert!(!is_cube || array_layers % 6 == 0);
match ty { match ty {
VkImageType::VK_IMAGE_TYPE_1D => { VkImageType::VK_IMAGE_TYPE_1D => image::Kind::D1(extent.width as _),
image::Kind::D1(extent.width as _) VkImageType::VK_IMAGE_TYPE_1D => image::Kind::D1Array(extent.width as _, array_layers as _),
}
VkImageType::VK_IMAGE_TYPE_1D => {
image::Kind::D1Array(extent.width as _, array_layers as _)
}
VkImageType::VK_IMAGE_TYPE_2D if array_layers == 1 => { VkImageType::VK_IMAGE_TYPE_2D if array_layers == 1 => {
image::Kind::D2(extent.width as _, extent.height as _, map_aa_mode(samples)) image::Kind::D2(extent.width as _, extent.height as _, map_aa_mode(samples))
} }
@ -166,14 +163,12 @@ pub fn map_image_kind(
VkImageType::VK_IMAGE_TYPE_2D if is_cube => { VkImageType::VK_IMAGE_TYPE_2D if is_cube => {
image::Kind::CubeArray(extent.width as _, (array_layers / 6) as _) image::Kind::CubeArray(extent.width as _, (array_layers / 6) as _)
} }
VkImageType::VK_IMAGE_TYPE_2D => { VkImageType::VK_IMAGE_TYPE_2D => image::Kind::D2Array(
image::Kind::D2Array( extent.width as _,
extent.width as _, extent.height as _,
extent.height as _, array_layers as _,
array_layers as _, map_aa_mode(samples),
map_aa_mode(samples), ),
)
}
VkImageType::VK_IMAGE_TYPE_3D => { VkImageType::VK_IMAGE_TYPE_3D => {
image::Kind::D3(extent.width as _, extent.height as _, extent.depth as _) image::Kind::D3(extent.width as _, extent.height as _, extent.depth as _)
} }

View file

@ -1,7 +1,6 @@
use VK_NULL_HANDLE; use VK_NULL_HANDLE;
use std::{fmt, ops}; use std::{fmt, ops};
#[repr(C)] #[repr(C)]
pub struct Handle<T>(*mut T); pub struct Handle<T>(*mut T);
@ -31,7 +30,7 @@ impl<T> Copy for Handle<T> {}
impl<T> ops::Deref for Handle<T> { impl<T> ops::Deref for Handle<T> {
type Target = T; type Target = T;
fn deref(&self) -> &T { fn deref(&self) -> &T {
unsafe { & *self.0 } unsafe { &*self.0 }
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -22,8 +22,9 @@ macro_rules! proc_addr {
} }
#[no_mangle] #[no_mangle]
pub extern fn vk_icdGetInstanceProcAddr( pub extern "C" fn vk_icdGetInstanceProcAddr(
instance: VkInstance, pName: *const ::std::os::raw::c_char, instance: VkInstance,
pName: *const ::std::os::raw::c_char,
) -> PFN_vkVoidFunction { ) -> PFN_vkVoidFunction {
let name = unsafe { CStr::from_ptr(pName) }; let name = unsafe { CStr::from_ptr(pName) };
let name = match name.to_str() { let name = match name.to_str() {
@ -38,7 +39,7 @@ pub extern fn vk_icdGetInstanceProcAddr(
} }
#[no_mangle] #[no_mangle]
pub extern fn vk_icdNegotiateLoaderICDInterfaceVersion( pub extern "C" fn vk_icdNegotiateLoaderICDInterfaceVersion(
pSupportedVersion: *mut ::std::os::raw::c_uint, pSupportedVersion: *mut ::std::os::raw::c_uint,
) -> VkResult { ) -> VkResult {
let supported_version = unsafe { &mut *pSupportedVersion }; let supported_version = unsafe { &mut *pSupportedVersion };
@ -50,9 +51,9 @@ pub extern fn vk_icdNegotiateLoaderICDInterfaceVersion(
} }
#[no_mangle] #[no_mangle]
pub extern fn vk_icdGetPhysicalDeviceProcAddr( pub extern "C" fn vk_icdGetPhysicalDeviceProcAddr(
instance: VkInstance, pName: *const ::std::os::raw::c_char, instance: VkInstance,
pName: *const ::std::os::raw::c_char,
) -> PFN_vkVoidFunction { ) -> PFN_vkVoidFunction {
unimplemented!() unimplemented!()
} }

File diff suppressed because it is too large Load diff