forked from bevyengine/bevy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare crevice for vendored release (bevyengine#3394)
# Objective - Our crevice is still called "crevice", which we can't use for a release - Users would need to use our "crevice" directly to be able to use the derive macro ## Solution - Rename crevice to bevy_crevice, and crevice-derive to bevy-crevice-derive - Re-export it from bevy_render, and use it from bevy_render everywhere - Fix derive macro to work either from bevy_render, from bevy_crevice, or from bevy ## Remaining - It is currently re-exported as `bevy::render::bevy_crevice`, is it the path we want? - After a brief suggestion to Cart, I changed the version to follow Bevy version instead of crevice, do we want that? - Crevice README.md need to be updated - in the `Cargo.toml`, there are a few things to change. How do we want to change them? How do we keep attributions to original Crevice? ``` authors = ["Lucien Greathouse <[email protected]>"] documentation = "https://docs.rs/crevice" homepage = "https://github.com/LPGhatguy/crevice" repository = "https://github.com/LPGhatguy/crevice" ``` Co-authored-by: François <[email protected]> Co-authored-by: Carter Anderson <[email protected]>
- Loading branch information
1 parent
aeba9fa
commit 79d36e7
Showing
55 changed files
with
161 additions
and
117 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
[package] | ||
name = "crevice" | ||
description = "Create GLSL-compatible versions of structs with explicitly-initialized padding" | ||
version = "0.8.0" | ||
name = "bevy_crevice" | ||
description = "Create GLSL-compatible versions of structs with explicitly-initialized padding (Bevy version)" | ||
version = "0.5.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" | ||
repository = "https://github.com/bevyengine/bevy" | ||
readme = "README.md" | ||
keywords = ["glsl", "std140", "std430"] | ||
license = "MIT OR Apache-2.0" | ||
|
@@ -23,7 +23,7 @@ std = [] | |
# default-members = ["crevice-derive", "crevice-tests"] | ||
|
||
[dependencies] | ||
crevice-derive = { version = "0.8.0", path = "crevice-derive" } | ||
bevy-crevice-derive = { version = "0.5.0", path = "bevy-crevice-derive" } | ||
|
||
bytemuck = "1.4.1" | ||
mint = "0.5.8" | ||
|
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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,12 +1,12 @@ | ||
[package] | ||
name = "crevice-derive" | ||
description = "Derive crate for the 'crevice' crate" | ||
version = "0.8.0" | ||
name = "bevy-crevice-derive" | ||
description = "Derive crate for the 'crevice' crate (Bevy version)" | ||
version = "0.5.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" | ||
repository = "https://github.com/bevyengine/bevy" | ||
license = "MIT OR Apache-2.0" | ||
|
||
[features] | ||
|
@@ -24,3 +24,4 @@ proc-macro = true | |
syn = "1.0.40" | ||
quote = "1.0.7" | ||
proc-macro2 = "1.0.21" | ||
bevy_macro_utils = { path = "../../bevy_macro_utils", version = "0.5.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
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,60 @@ | ||
mod glsl; | ||
mod layout; | ||
|
||
use bevy_macro_utils::BevyManifest; | ||
use proc_macro::TokenStream as CompilerTokenStream; | ||
|
||
use syn::{parse_macro_input, DeriveInput, Path}; | ||
|
||
#[proc_macro_derive(AsStd140)] | ||
pub fn derive_as_std140(input: CompilerTokenStream) -> CompilerTokenStream { | ||
let input = parse_macro_input!(input as DeriveInput); | ||
let expanded = layout::emit(input, "Std140", "std140", 16); | ||
|
||
CompilerTokenStream::from(expanded) | ||
} | ||
|
||
#[proc_macro_derive(AsStd430)] | ||
pub fn derive_as_std430(input: CompilerTokenStream) -> CompilerTokenStream { | ||
let input = parse_macro_input!(input as DeriveInput); | ||
let expanded = layout::emit(input, "Std430", "std430", 0); | ||
|
||
CompilerTokenStream::from(expanded) | ||
} | ||
|
||
#[proc_macro_derive(GlslStruct)] | ||
pub fn derive_glsl_struct(input: CompilerTokenStream) -> CompilerTokenStream { | ||
let input = parse_macro_input!(input as DeriveInput); | ||
let expanded = glsl::emit(input); | ||
|
||
CompilerTokenStream::from(expanded) | ||
} | ||
|
||
const BEVY: &str = "bevy"; | ||
const BEVY_CREVICE: &str = "bevy_crevice"; | ||
const BEVY_RENDER: &str = "bevy_render"; | ||
|
||
fn bevy_crevice_path() -> Path { | ||
let bevy_manifest = BevyManifest::default(); | ||
bevy_manifest | ||
.maybe_get_path(crate::BEVY) | ||
.map(|bevy_path| { | ||
let mut segments = bevy_path.segments; | ||
segments.push(BevyManifest::parse_str("render")); | ||
segments.push(BevyManifest::parse_str("render_resource")); | ||
Path { | ||
leading_colon: None, | ||
segments, | ||
} | ||
}) | ||
.or_else(|| bevy_manifest.maybe_get_path(crate::BEVY_RENDER)) | ||
.map(|bevy_render_path| { | ||
let mut segments = bevy_render_path.segments; | ||
segments.push(BevyManifest::parse_str("render_resource")); | ||
Path { | ||
leading_colon: None, | ||
segments, | ||
} | ||
}) | ||
.unwrap_or_else(|| bevy_manifest.get_path(crate::BEVY_CREVICE)) | ||
} |
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
Oops, something went wrong.