216: Update to 2018 edition r=MaikKlein a=aloucks

Fixes #204 

217: Make handle and bitflags constructor functions const r=MaikKlein a=aloucks

Fixes #187

Co-authored-by: Aaron Loucks <aloucks@cofront.net>
This commit is contained in:
bors[bot] 2019-05-26 21:21:57 +00:00
commit 455adc6c1a
29 changed files with 84 additions and 93 deletions

View file

@ -8,6 +8,7 @@ repository = "https://github.com/MaikKlein/ash"
readme = "../README.md"
keywords = ["vulkan", "graphic"]
documentation = "https://docs.rs/ash"
edition = "2018"
[dependencies]
shared_library = "0.1.9"

View file

@ -1,10 +1,10 @@
#![allow(dead_code)]
use prelude::*;
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use std::mem;
use std::os::raw::c_void;
use std::ptr;
use vk;
use RawPtr;
#[allow(non_camel_case_types)]
pub trait DeviceV1_1: DeviceV1_0 {

View file

@ -1,5 +1,7 @@
use instance::Instance;
use prelude::*;
use crate::instance::Instance;
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use shared_library::dynamic_library::DynamicLibrary;
use std::error::Error;
use std::fmt;
@ -9,8 +11,6 @@ use std::os::raw::c_void;
use std::path::Path;
use std::ptr;
use std::sync::Arc;
use vk;
use RawPtr;
#[cfg(windows)]
const LIB_PATH: &'static str = "vulkan-1.dll";

View file

@ -23,9 +23,9 @@
*
**********************************************************************************************************************/
use crate::vk::*;
use std::fmt;
use std::os::raw::*;
use vk::*;
// Extension: `VK_AMD_gpa_interface`

View file

@ -1,9 +1,9 @@
#![allow(dead_code)]
use prelude::*;
use crate::prelude::*;
use crate::version::{DeviceV1_0, InstanceV1_0};
use crate::vk;
use std::ffi::CStr;
use std::mem;
use version::{DeviceV1_0, InstanceV1_0};
use vk;
#[derive(Clone)]
pub struct DebugMarker {

View file

@ -1,10 +1,10 @@
#![allow(dead_code)]
use prelude::*;
use crate::prelude::*;
use crate::version::{EntryV1_0, InstanceV1_0};
use crate::vk;
use crate::RawPtr;
use std::ffi::CStr;
use std::mem;
use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct DebugReport {

View file

@ -1,9 +1,9 @@
#![allow(dead_code)]
use prelude::*;
use crate::prelude::*;
use crate::version::{EntryV1_0, InstanceV1_0};
use crate::{vk, RawPtr};
use std::ffi::CStr;
use std::mem;
use version::{EntryV1_0, InstanceV1_0};
use {vk, RawPtr};
#[derive(Clone)]
pub struct DebugUtils {

View file

@ -1,10 +1,10 @@
#![allow(dead_code)]
use prelude::*;
use crate::prelude::*;
use crate::version::{EntryV1_0, InstanceV1_0};
use crate::vk;
use crate::RawPtr;
use std::ffi::CStr;
use std::mem;
use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct AndroidSurface {

View file

@ -1,10 +1,10 @@
#![allow(dead_code)]
use prelude::*;
use crate::prelude::*;
use crate::version::{DeviceV1_0, InstanceV1_0};
use crate::vk;
use crate::RawPtr;
use std::ffi::CStr;
use std::mem;
use version::{DeviceV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct DisplaySwapchain {

View file

@ -1,11 +1,11 @@
#![allow(dead_code)]
use prelude::*;
use crate::prelude::*;
use crate::version::{EntryV1_0, InstanceV1_0};
use crate::vk;
use crate::RawPtr;
use std::ffi::CStr;
use std::mem;
use std::ptr;
use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct Surface {

View file

@ -1,11 +1,11 @@
#![allow(dead_code)]
use prelude::*;
use crate::prelude::*;
use crate::version::{DeviceV1_0, InstanceV1_0};
use crate::vk;
use crate::RawPtr;
use std::ffi::CStr;
use std::mem;
use std::ptr;
use version::{DeviceV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct Swapchain {

View file

@ -1,10 +1,10 @@
#![allow(dead_code)]
use prelude::*;
use crate::prelude::*;
use crate::version::{EntryV1_0, InstanceV1_0};
use crate::vk;
use crate::RawPtr;
use std::ffi::CStr;
use std::mem;
use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct IOSSurface {

View file

@ -1,10 +1,10 @@
#![allow(dead_code)]
use prelude::*;
use crate::prelude::*;
use crate::version::{EntryV1_0, InstanceV1_0};
use crate::vk;
use crate::RawPtr;
use std::ffi::CStr;
use std::mem;
use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct MacOSSurface {

View file

@ -1,8 +1,8 @@
#![allow(dead_code)]
use crate::version::{DeviceV1_0, InstanceV1_0};
use crate::vk;
use std::ffi::CStr;
use std::mem;
use version::{DeviceV1_0, InstanceV1_0};
use vk;
#[derive(Clone)]
pub struct MeshShader {

View file

@ -1,10 +1,10 @@
#![allow(dead_code)]
use prelude::*;
use crate::prelude::*;
use crate::version::{DeviceV1_0, InstanceV1_0, InstanceV1_1};
use crate::vk;
use crate::RawPtr;
use std::ffi::CStr;
use std::mem;
use version::{DeviceV1_0, InstanceV1_0, InstanceV1_1};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct RayTracing {

View file

@ -1,11 +1,11 @@
#![allow(dead_code)]
use device::Device;
use prelude::*;
use crate::device::Device;
use crate::prelude::*;
use crate::vk;
use crate::RawPtr;
use std::mem;
use std::os::raw::c_char;
use std::ptr;
use vk;
use RawPtr;
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkInstance.html>"]
#[derive(Clone)]

View file

@ -23,11 +23,9 @@
//! ```
//!
extern crate shared_library;
pub use device::Device;
pub use entry::{Entry, EntryCustom, InstanceError, LoadingError};
pub use instance::Instance;
pub use crate::device::Device;
pub use crate::entry::{Entry, EntryCustom, InstanceError, LoadingError};
pub use crate::instance::Instance;
mod device;
mod entry;

View file

@ -1,2 +1,2 @@
use vk;
use crate::vk;
pub type VkResult<T> = Result<T, vk::Result>;

View file

@ -1,9 +1,9 @@
use crate::vk;
use std::iter::Iterator;
use std::marker::PhantomData;
use std::mem::size_of;
use std::os::raw::c_void;
use std::{io, slice};
use vk;
/// `Align` handles dynamic alignment. The is useful for dynamic uniform buffers where
/// the alignment might be different. For example a 4x4 f32 matrix has a size of 64 bytes

View file

@ -1,3 +1,3 @@
pub use device::{DeviceV1_0, DeviceV1_1};
pub use entry::{EntryV1_0, EntryV1_1};
pub use instance::{InstanceV1_0, InstanceV1_1};
pub use crate::device::{DeviceV1_0, DeviceV1_1};
pub use crate::entry::{EntryV1_0, EntryV1_1};
pub use crate::instance::{InstanceV1_0, InstanceV1_1};

View file

@ -18,7 +18,7 @@ pub(crate) unsafe fn ptr_chain_iter<T>(ptr: &mut T) -> impl Iterator<Item = *mut
pub trait Handle {
const TYPE: ObjectType;
fn as_raw(self) -> u64;
fn from_raw(u64) -> Self;
fn from_raw(_: u64) -> Self;
}
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VK_MAKE_VERSION.html>"]
#[macro_export]
@ -85,19 +85,19 @@ macro_rules! vk_bitflags_wrapped {
}
impl $name {
#[inline]
pub fn empty() -> $name {
pub const fn empty() -> $name {
$name(0)
}
#[inline]
pub fn all() -> $name {
pub const fn all() -> $name {
$name($all)
}
#[inline]
pub fn from_raw(x: $flag_type) -> Self {
pub const fn from_raw(x: $flag_type) -> Self {
$name(x)
}
#[inline]
pub fn as_raw(self) -> $flag_type {
pub const fn as_raw(self) -> $flag_type {
self.0
}
#[inline]
@ -199,7 +199,7 @@ macro_rules! handle_nondispatchable {
}
}
impl $name {
pub fn null() -> $name {
pub const fn null() -> $name {
$name(0)
}
}
@ -242,7 +242,7 @@ macro_rules! define_handle {
unsafe impl Send for $name {}
unsafe impl Sync for $name {}
impl $name {
pub fn null() -> Self {
pub const fn null() -> Self {
$name(::std::ptr::null_mut())
}
}

View file

@ -1,4 +1,4 @@
extern crate ash;
use ash;
use ash::vk::{PhysicalDeviceProperties, PipelineColorBlendStateCreateInfo};

View file

@ -1,4 +1,3 @@
extern crate ash;
use ash::vk;
#[test]

View file

@ -2,6 +2,7 @@
name = "examples"
version = "0.1.0"
authors = ["maik klein <maikklein@googlemail.com>"]
edition = "2018"
[dependencies]
winit = "0.16"

View file

@ -1,7 +1,3 @@
extern crate ash;
extern crate examples;
extern crate image;
use std::default::Default;
use std::ffi::CString;
use std::fs::File;

View file

@ -1,6 +1,3 @@
extern crate ash;
extern crate examples;
use ash::util::*;
use ash::vk;
use examples::*;

View file

@ -2,6 +2,7 @@
name = "generator"
version = "0.1.0"
authors = ["Maik Klein <maikklein@googlemail.com>"]
edition = "2018"
[dependencies]
vk-parse = "0.2"

View file

@ -1,4 +1,3 @@
extern crate generator;
use generator::write_source_code;
use std::path::Path;

View file

@ -1,14 +1,13 @@
#![recursion_limit = "256"]
extern crate heck;
extern crate itertools;
#[macro_use]
extern crate nom;
extern crate proc_macro2;
use proc_macro2;
#[macro_use]
extern crate quote;
extern crate syn;
pub extern crate vk_parse;
pub extern crate vkxml;
use syn;
pub use vk_parse;
pub use vkxml;
use heck::{CamelCase, ShoutySnakeCase, SnakeCase};
use itertools::Itertools;
@ -122,7 +121,7 @@ pub fn define_handle_macro() -> Tokens {
unsafe impl Sync for $name {}
impl $name{
pub fn null() -> Self{
pub const fn null() -> Self{
$name(::std::ptr::null_mut())
}
}
@ -163,7 +162,7 @@ pub fn handle_nondispatchable_macro() -> Tokens {
}
impl $name{
pub fn null() -> $name{
pub const fn null() -> $name{
$name(0)
}
}
@ -232,20 +231,20 @@ pub fn vk_bitflags_wrapped_macro() -> Tokens {
impl $name {
#[inline]
pub fn empty() -> $name {
pub const fn empty() -> $name {
$name(0)
}
#[inline]
pub fn all() -> $name {
pub const fn all() -> $name {
$name($all)
}
#[inline]
pub fn from_raw(x: $flag_type) -> Self { $name(x) }
pub const fn from_raw(x: $flag_type) -> Self { $name(x) }
#[inline]
pub fn as_raw(self) -> $flag_type { self.0 }
pub const fn as_raw(self) -> $flag_type { self.0 }
#[inline]
pub fn is_empty(self) -> bool {
@ -1432,7 +1431,7 @@ pub fn derive_setters(
_ => None,
});
let (has_next, is_next_const) = match members
let (has_next, _is_next_const) = match members
.clone()
.find(|field| field.param_ident().to_string() == "p_next")
{
@ -2275,7 +2274,7 @@ pub fn write_source_code(path: &Path) {
pub trait Handle {
const TYPE: ObjectType;
fn as_raw(self) -> u64;
fn from_raw(u64) -> Self;
fn from_raw(_: u64) -> Self;
}
#version_macros