-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update vendored Crevice to 0.8.0 + PR for arrays (#3059)
# Objective - Update vendor crevice to have the latest update from crevice 0.8.0 - Using https://github.com/ElectronicRU/crevice/tree/arrays which has the changes to make arrays work ## Solution - Also updated glam and hexasphere to only have one version of glam - From the original PR, using crevice to write GLSL code containing arrays would probably not work but it's not something used by Bevy
- Loading branch information
Showing
39 changed files
with
1,846 additions
and
668 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,36 @@ | ||
[package] | ||
name = "crevice" | ||
description = "Create GLSL-compatible versions of structs with explicitly-initialized padding" | ||
version = "0.6.0" | ||
edition = "2018" | ||
version = "0.8.0" | ||
edition = "2021" | ||
authors = ["Lucien Greathouse <me@lpghatguy.com>"] | ||
documentation = "https://docs.rs/crevice" | ||
homepage = "https://github.com/LPGhatguy/crevice" | ||
repository = "https://github.com/LPGhatguy/crevice" | ||
readme = "README.md" | ||
keywords = ["glsl", "std140", "std430"] | ||
license = "MIT OR Apache-2.0" | ||
# resolver = "2" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[features] | ||
default = ["std"] | ||
std = [] | ||
|
||
# [workspace] | ||
# members = ["crevice-derive", "crevice-tests"] | ||
# default-members = ["crevice-derive", "crevice-tests"] | ||
|
||
[dependencies] | ||
crevice-derive = { version = "0.6.0", path = "crevice-derive" } | ||
crevice-derive = { version = "0.8.0", path = "crevice-derive" } | ||
|
||
bytemuck = "1.4.1" | ||
mint = "0.5.5" | ||
glam = "0.15.1" | ||
mint = "0.5.8" | ||
|
||
cgmath = { version = "0.18.0", optional = true } | ||
glam = { version = "0.20.0", features = ["mint"], optional = true } | ||
nalgebra = { version = "0.29.0", features = ["mint"], optional = true } | ||
|
||
[dev-dependencies] | ||
crevice-derive = { version = "0.6.0", path = "crevice-derive" } | ||
insta = "0.16.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use proc_macro2::{Literal, TokenStream}; | ||
use quote::quote; | ||
use syn::{parse_quote, Data, DeriveInput, Fields, Path}; | ||
|
||
pub fn emit(input: DeriveInput) -> TokenStream { | ||
let fields = match &input.data { | ||
Data::Struct(data) => match &data.fields { | ||
Fields::Named(fields) => fields, | ||
Fields::Unnamed(_) => panic!("Tuple structs are not supported"), | ||
Fields::Unit => panic!("Unit structs are not supported"), | ||
}, | ||
Data::Enum(_) | Data::Union(_) => panic!("Only structs are supported"), | ||
}; | ||
|
||
let base_trait_path: Path = parse_quote!(::crevice::glsl::Glsl); | ||
let struct_trait_path: Path = parse_quote!(::crevice::glsl::GlslStruct); | ||
|
||
let name = input.ident; | ||
let name_str = Literal::string(&name.to_string()); | ||
|
||
let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl(); | ||
|
||
let glsl_fields = fields.named.iter().map(|field| { | ||
let field_ty = &field.ty; | ||
let field_name_str = Literal::string(&field.ident.as_ref().unwrap().to_string()); | ||
let field_as = quote! {<#field_ty as ::crevice::glsl::GlslArray>}; | ||
|
||
quote! { | ||
s.push_str("\t"); | ||
s.push_str(#field_as::NAME); | ||
s.push_str(" "); | ||
s.push_str(#field_name_str); | ||
<#field_as::ArraySize as ::crevice::glsl::DimensionList>::push_to_string(s); | ||
s.push_str(";\n"); | ||
} | ||
}); | ||
|
||
quote! { | ||
unsafe impl #impl_generics #base_trait_path for #name #ty_generics #where_clause { | ||
const NAME: &'static str = #name_str; | ||
} | ||
|
||
unsafe impl #impl_generics #struct_trait_path for #name #ty_generics #where_clause { | ||
fn enumerate_fields(s: &mut String) { | ||
#( #glsl_fields )* | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.