Upgrade vulkano-win and vulkano-shaders to rust 2018 (#1134)

* Upgrade vulkano-shaders to rust 2018
* Upgrade vulkano-win to rust 2018
This commit is contained in:
Lucas Kent 2018-12-11 18:26:04 +11:00 committed by GitHub
parent 34eeea6b52
commit 9a08414054
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 35 additions and 54 deletions

View File

@ -7,15 +7,12 @@
// notice may not be copied, modified, or distributed except
// according to those terms.
#[macro_use]
extern crate vulkano;
#[derive(Copy, Clone)]
pub struct Vertex {
position: (f32, f32, f32)
}
impl_vertex!(Vertex, position);
vulkano::impl_vertex!(Vertex, position);
pub const VERTICES: [Vertex; 531] = [
Vertex { position: (0.0, 0.0, 0.0) }, // dummy vector because in the original model indices
@ -557,7 +554,7 @@ pub struct Normal {
normal: (f32, f32, f32)
}
impl_vertex!(Normal, normal);
vulkano::impl_vertex!(Normal, normal);
pub const NORMALS: [Normal; 531] = [
Normal { normal: (0.0, 0.0, 0.0) }, // dummy vector because in the original model indices

View File

@ -1,6 +1,7 @@
[package]
name = "vulkano-shaders"
version = "0.11.1"
edition = "2018"
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>", "The vulkano contributors"]
repository = "https://github.com/vulkano-rs/vulkano"
description = "Shaders rust code generation macro"

View File

@ -15,17 +15,17 @@ use proc_macro2::{Span, TokenStream};
use shaderc::{Compiler, CompileOptions};
pub use shaderc::{CompilationArtifact, ShaderKind, IncludeType, ResolvedInclude};
pub use parse::ParseError;
pub use crate::parse::ParseError;
use parse::Instruction;
use enums::Capability;
use crate::parse::Instruction;
use crate::enums::Capability;
use parse;
use entry_point;
use structs;
use descriptor_sets;
use spec_consts;
use read_file_to_string;
use crate::parse;
use crate::entry_point;
use crate::structs;
use crate::descriptor_sets;
use crate::spec_consts;
use crate::read_file_to_string;
fn include_callback(requested_source_path_raw: &str, directive_type: IncludeType,
contained_within_path_raw: &str, recursion_depth: usize,

View File

@ -11,9 +11,9 @@ use std::cmp;
use proc_macro2::TokenStream;
use enums::{Dim, Decoration, StorageClass, ImageFormat};
use parse::{Instruction, Spirv};
use spirv_search;
use crate::enums::{Dim, Decoration, StorageClass, ImageFormat};
use crate::parse::{Instruction, Spirv};
use crate::spirv_search;
pub fn write_descriptor_sets(doc: &Spirv) -> TokenStream {
// TODO: not implemented correctly
@ -61,7 +61,7 @@ pub fn write_descriptor_sets(doc: &Spirv) -> TokenStream {
_ => continue,
};
let (_, size, _) = ::structs::type_from_id(doc, type_id);
let (_, size, _) = crate::structs::type_from_id(doc, type_id);
let size = size.expect("Found runtime-sized push constants");
push_constants_size = cmp::max(push_constants_size, size);
}

View File

@ -10,9 +10,9 @@
use syn::Ident;
use proc_macro2::{Span, TokenStream};
use enums::{StorageClass, ExecutionModel, ExecutionMode, Decoration};
use parse::{Instruction, Spirv};
use spirv_search;
use crate::enums::{StorageClass, ExecutionModel, ExecutionMode, Decoration};
use crate::parse::{Instruction, Spirv};
use crate::spirv_search;
pub fn write_entry_point(doc: &Spirv, instruction: &Instruction) -> (TokenStream, TokenStream) {
let (execution, id, ep_name, interface) = match instruction {
@ -47,7 +47,7 @@ pub fn write_entry_point(doc: &Spirv, instruction: &Instruction) -> (TokenStream
ignore_first_array_out
);
let spec_consts_struct = if ::spec_consts::has_specialization_constants(doc) {
let spec_consts_struct = if crate::spec_consts::has_specialization_constants(doc) {
quote!{ SpecializationConstants }
} else {
quote!{ () }

View File

@ -10,7 +10,7 @@
#![allow(dead_code)]
#![allow(non_camel_case_types)]
use parse::ParseError;
use crate::parse::ParseError;
macro_rules! enumeration {
($(typedef enum $unused:ident { $($elem:ident = $value:expr,)+ } $name:ident;)+) => (

View File

@ -4,9 +4,6 @@
//! # Basic usage
//!
//! ```
//! extern crate vulkano;
//! extern crate vulkano_shaders;
//!
//! mod vs {
//! vulkano_shaders::shader!{
//! ty: "vertex",
@ -67,8 +64,6 @@
//! you could do something like this:
//!
//! ```
//! # extern crate vulkano_shaders;
//! # extern crate vulkano;
//! # fn main() {}
//! # use std::sync::Arc;
//! # use vulkano::OomError;
@ -158,11 +153,8 @@
#![recursion_limit = "1024"]
#[macro_use] extern crate quote;
extern crate shaderc;
extern crate proc_macro;
extern crate proc_macro2;
#[macro_use] extern crate syn;
extern crate proc_macro;
use std::env;
use std::fs::File;
@ -181,7 +173,7 @@ mod spec_consts;
mod structs;
mod spirv_search;
use codegen::ShaderKind;
use crate::codegen::ShaderKind;
enum SourceKind {
Src(String),

View File

@ -7,7 +7,7 @@
// notice may not be copied, modified, or distributed except
// according to those terms.
use enums::*;
use crate::enums::*;
/// Parses a SPIR-V document from a list of words.
pub fn parse_spirv(i: &[u32]) -> Result<Spirv, ParseError> {
@ -526,7 +526,7 @@ impl Spirv {
#[cfg(test)]
mod test {
use parse;
use crate::parse;
#[test]
fn test() {

View File

@ -12,10 +12,10 @@ use std::mem;
use syn::Ident;
use proc_macro2::{Span, TokenStream};
use enums::Decoration;
use parse::{Instruction, Spirv};
use spirv_search;
use structs;
use crate::enums::Decoration;
use crate::parse::{Instruction, Spirv};
use crate::spirv_search;
use crate::structs;
/// Returns true if the document has specialization constants.
pub fn has_specialization_constants(doc: &Spirv) -> bool {

View File

@ -7,8 +7,8 @@
// notice may not be copied, modified, or distributed except
// according to those terms.
use parse::{Instruction, Spirv};
use enums::Decoration;
use crate::parse::{Instruction, Spirv};
use crate::enums::Decoration;
/// Returns the vulkano `Format` and number of occupied locations from an id.
///

View File

@ -12,9 +12,9 @@ use std::mem;
use syn::Ident;
use proc_macro2::{Span, TokenStream};
use parse::{Instruction, Spirv};
use enums::Decoration;
use spirv_search;
use crate::parse::{Instruction, Spirv};
use crate::enums::Decoration;
use crate::spirv_search;
/// Translates all the structs that are contained in the SPIR-V document as Rust structs.
pub fn write_structs(doc: &Spirv) -> TokenStream {

View File

@ -1,6 +1,7 @@
[package]
name = "vulkano-win"
version = "0.11.1"
edition = "2018"
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>", "The vulkano contributors"]
repository = "https://github.com/vulkano-rs/vulkano"
description = "Link between vulkano and winit"

View File

@ -1,15 +1,5 @@
#![doc(html_logo_url = "https://raw.githubusercontent.com/vulkano-rs/vulkano/master/logo.png")]
extern crate vulkano;
extern crate winit;
#[cfg(target_os = "macos")]
extern crate objc;
#[cfg(target_os = "macos")]
extern crate cocoa;
#[cfg(target_os = "macos")]
extern crate metal;
use std::borrow::Borrow;
use std::error;
use std::fmt;