Skip to content

Commit

Permalink
format examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sytherax committed Jul 28, 2024
1 parent 61e6f76 commit b823857
Show file tree
Hide file tree
Showing 2 changed files with 311 additions and 304 deletions.
51 changes: 26 additions & 25 deletions example/build.rs
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
use miette::{IntoDiagnostic, Result};
use wgsl_bindgen::qs::quote;
use wgsl_bindgen::{
qs::quote, GlamWgslTypeMap, Regex, WgslBindgenOptionBuilder, WgslShaderSourceType,
WgslTypeSerializeStrategy,
GlamWgslTypeMap, Regex, WgslBindgenOptionBuilder, WgslShaderSourceType,
WgslTypeSerializeStrategy,
};

fn main() -> Result<()> {
WgslBindgenOptionBuilder::default()
.workspace_root("shaders")
.add_entry_point("shaders/testbed.wgsl")
.add_entry_point("shaders/triangle.wgsl")
.skip_hash_check(true)
.serialization_strategy(WgslTypeSerializeStrategy::Bytemuck)
.type_map(GlamWgslTypeMap)
.override_struct_field_type(
[("utils::types::VectorsU32", "a", quote!(crate::MyTwoU32))].map(Into::into),
)
.add_override_struct_mapping(("utils::types::Scalars", quote!(crate::MyScalars)))
.add_custom_padding_field_regexp(Regex::new("_pad.*").unwrap())
.short_constructor(2)
.shader_source_type(
WgslShaderSourceType::UseComposerWithPath
| WgslShaderSourceType::UseComposerEmbed
| WgslShaderSourceType::UseEmbed,
)
.derive_serde(false)
.output("src/shader_bindings.rs")
.build()?
.generate()
.into_diagnostic()
WgslBindgenOptionBuilder::default()
.workspace_root("shaders")
.add_entry_point("shaders/testbed.wgsl")
.add_entry_point("shaders/triangle.wgsl")
.skip_hash_check(true)
.serialization_strategy(WgslTypeSerializeStrategy::Bytemuck)
.type_map(GlamWgslTypeMap)
.override_struct_field_type(
[("utils::types::VectorsU32", "a", quote!(crate::MyTwoU32))].map(Into::into),
)
.add_override_struct_mapping(("utils::types::Scalars", quote!(crate::MyScalars)))
.add_custom_padding_field_regexp(Regex::new("_pad.*").unwrap())
.short_constructor(2)
.shader_source_type(
WgslShaderSourceType::UseComposerWithPath
| WgslShaderSourceType::UseComposerEmbed
| WgslShaderSourceType::UseEmbed,
)
.derive_serde(false)
.output("src/shader_bindings.rs")
.build()?
.generate()
.into_diagnostic()
}
Loading

0 comments on commit b823857

Please sign in to comment.