-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Merged by Bors] - Update vendored Crevice to 0.8.0 + PR for arrays #3059
Closed
Closed
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Crevice Changelog | ||
|
||
## Unreleased Changes | ||
|
||
## [0.8.0] - 2021-10-26 | ||
* Added support for many math libraries directly: ([#37]) | ||
* cgmath 0.18, behind the `cgmath` feature | ||
* nalgebra 0.29, behind the `nalgebra` feature | ||
* glam 0.19, behind the `glam` feature | ||
* Added support for generating GLSL source from structs. ([#33]) | ||
* Fixed many, many subtle alignment bugs. ([#28], [#35]) | ||
* Disabled bool-based types temporarily ([#36]) | ||
* Renamed `AsStdN::StdNType` to `Output`. | ||
* Increased MSRV to 1.52.1. | ||
|
||
[#28]: https://github.com/LPGhatguy/crevice/issues/28 | ||
[#33]: https://github.com/LPGhatguy/crevice/pull/33 | ||
[#35]: https://github.com/LPGhatguy/crevice/pull/35 | ||
[#36]: https://github.com/LPGhatguy/crevice/issues/36 | ||
[#37]: https://github.com/LPGhatguy/crevice/pull/37 | ||
[0.8.0]: https://github.com/LPGhatguy/crevice/releases/tag/v0.8.0 | ||
|
||
## [0.7.1] - 2021-07-24 | ||
* Fixed broken crates.io release by publishing crevice-derive too. | ||
|
||
[0.7.1]: https://github.com/LPGhatguy/crevice/releases/tag/v0.7.1 | ||
|
||
## [0.7.0] - 2021-07-20 (Yanked) | ||
**This release was yanked due to an issue reported in [#32].** | ||
|
||
* Added `ivec`, `uvec`, and `bvec` structs ([#18]) | ||
* Improved padding behavior for structs and matrices ([#20]) | ||
* Implemented Crevice traits for more types ([#23]) | ||
* Added conversions from Std* types to AsStd* types ([#24]) | ||
* Added no_std support ([#25]) | ||
|
||
[#18]: https://github.com/LPGhatguy/crevice/pull/18 | ||
[#20]: https://github.com/LPGhatguy/crevice/pull/20 | ||
[#23]: https://github.com/LPGhatguy/crevice/pull/23 | ||
[#24]: https://github.com/LPGhatguy/crevice/pull/24 | ||
[#25]: https://github.com/LPGhatguy/crevice/pull/25 | ||
[#32]: https://github.com/LPGhatguy/crevice/issues/32 | ||
[0.7.0]: https://github.com/LPGhatguy/crevice/releases/tag/v0.7.0 | ||
|
||
## [0.6.0] - 2021-02-24 | ||
* Added `std430` support. Most APIs between `std140` and `std430` are the same! | ||
* Added the `WriteStd140` trait. This trait is more general than `AsStd140` and is automatically implemented for all existing `AsStd140` implementers. | ||
* Added `Writer::write_std140` to write a type that implements `Std140`. | ||
* Added `AsStd140::std140_size_static`. This is similar to the old size method, `std140_size`, but no longer requires a value to be passed. For size measurements that depend on a value, use `WriteStd140::std140_size` instead. | ||
* Deprecated `Writer::write_slice`, as `Writer::write` now accepts slices. | ||
* Changed bounds of some functions, like `Writer::write` to use `WriteStd140` instead of `AsStd140`. This should affect no existing consumers. | ||
* Moved `std140_size` from `AsStd140` to `WriteStd140`. Some existing consumers may need to import the other trait to access this m ethod. | ||
|
||
[0.6.0]: https://github.com/LPGhatguy/crevice/releases/tag/v0.6.0 | ||
|
||
## [0.5.0] - 2020-10-18 | ||
* Added f64-based std140 types: `DVec2`, `DVec3`, `DVec4`, `DMat2`, `DMat3`, and `DMat4`. | ||
* Added support for std140 structs with alignment greater than 16. | ||
* Fixed padding for std140 matrices; they were previously missing trailing padding. | ||
|
||
[0.5.0]: https://github.com/LPGhatguy/crevice/releases/tag/v0.5.0 | ||
|
||
## [0.4.0] - 2020-10-01 | ||
* Added `AsStd140::std140_size` for easily pre-sizing buffers. | ||
* `Writer::write` and `Sizer::add` now return the offset the value is or would be written to. | ||
* Added `std140::DynamicUniform` for aligning dynamic uniform members. | ||
* Added `Writer::write_slice` for writing multiple values in a row. | ||
|
||
[0.4.0]: https://github.com/LPGhatguy/crevice/releases/tag/v0.4.0 | ||
|
||
## [0.3.0] - 2020-09-22 | ||
* Added `Std140::as_bytes`, reducing the need to work with bytemuck directly. | ||
* Removed public re-export of bytemuck. | ||
|
||
[0.3.0]: https://github.com/LPGhatguy/crevice/releases/tag/v0.3.0 | ||
|
||
## [0.2.0] - 2020-09-22 | ||
* Added documentation for everything in the crate. | ||
* Removed `type_layout` being exposed except for internal tests. | ||
* Fixed alignment offset not taking into account previously added alignment. | ||
* Added `std140::Writer`, for writing dynamically laid out types to buffers. | ||
* Added `std140::Sizer`, for pre-calculating buffer sizes. | ||
|
||
[0.2.0]: https://github.com/LPGhatguy/crevice/releases/tag/v0.2.0 | ||
|
||
## [0.1.0] - 2020-09-18 | ||
* Initial MVP release | ||
|
||
[0.1.0]: https://github.com/LPGhatguy/crevice/releases/tag/v0.1.0 |
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 <[email protected]>"] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
[package] | ||
name = "crevice-derive" | ||
description = "Derive crate for the 'crevice' crate" | ||
version = "0.6.0" | ||
version = "0.8.0" | ||
edition = "2018" | ||
authors = ["Lucien Greathouse <[email protected]>"] | ||
documentation = "https://docs.rs/crevice-derive" | ||
homepage = "https://github.com/LPGhatguy/crevice" | ||
repository = "https://github.com/LPGhatguy/crevice" | ||
license = "MIT OR Apache-2.0" | ||
|
||
[features] | ||
default = [] | ||
|
||
# Enable methods that let you introspect into the generated structs. | ||
debug-methods = [] | ||
|
||
[lib] | ||
proc-macro = true | ||
|
||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifying a version here will make cargo use the non-vendored version when publishing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 3 dependencies on crevice in Bevy crates, it was the only one not specifying a version so I added it for consistency.
Before Bevy release, Cart will also have to rename it to "bevy_crevice" or something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That depends whether we even need to vendor it anymore. I think we should at least try it from crates.io after the recent rewrite and see if it fits our needs or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried, it's missing the array PR. once that's merged and released we wouldn't need to vendor it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! :)