mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-21 22:34:43 +00:00
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:
parent
34eeea6b52
commit
9a08414054
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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!{ () }
|
||||
|
@ -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;)+) => (
|
||||
|
@ -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),
|
||||
|
@ -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() {
|
||||
|
@ -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 {
|
||||
|
@ -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.
|
||||
///
|
||||
|
@ -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 {
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user