@@ -123,7 +123,7 @@ pub enum SpirvBuilderError {
123123
124124const SPIRV_TARGET_PREFIX : & str = "spirv-unknown-" ;
125125
126- #[ derive( Debug , PartialEq , Eq , Clone , Copy , Default ) ]
126+ #[ derive( Debug , PartialEq , Eq , Clone , Copy , Default , serde :: Deserialize , serde :: Serialize ) ]
127127pub enum MetadataPrintout {
128128 /// Print no cargo metadata.
129129 None ,
@@ -136,7 +136,7 @@ pub enum MetadataPrintout {
136136 Full ,
137137}
138138
139- #[ derive( Debug , PartialEq , Eq , Clone , Copy , Default ) ]
139+ #[ derive( Debug , PartialEq , Eq , Clone , Copy , Default , serde :: Deserialize , serde :: Serialize ) ]
140140pub enum SpirvMetadata {
141141 /// Strip all names and other debug information from SPIR-V output.
142142 #[ default]
@@ -149,7 +149,7 @@ pub enum SpirvMetadata {
149149}
150150
151151/// Strategy used to handle Rust `panic!`s in shaders compiled to SPIR-V.
152- #[ derive( Debug , PartialEq , Eq , Clone , Copy , Default ) ]
152+ #[ derive( Debug , PartialEq , Eq , Clone , Copy , Default , serde :: Deserialize , serde :: Serialize ) ]
153153pub enum ShaderPanicStrategy {
154154 /// Return from shader entry-point with no side-effects **(default)**.
155155 ///
@@ -232,7 +232,7 @@ pub enum ShaderPanicStrategy {
232232
233233/// Options for specifying the behavior of the validator
234234/// Copied from `spirv-tools/src/val.rs` struct `ValidatorOptions`, with some fields disabled.
235- #[ derive( Default , Clone ) ]
235+ #[ derive( Default , Clone , serde :: Deserialize , serde :: Serialize ) ]
236236pub struct ValidatorOptions {
237237 /// Record whether or not the validator should relax the rules on types for
238238 /// stores to structs. When relaxed, it will allow a type mismatch as long as
@@ -301,7 +301,7 @@ pub struct ValidatorOptions {
301301
302302/// Options for specifying the behavior of the optimizer
303303/// Copied from `spirv-tools/src/opt.rs` struct `Options`, with some fields disabled.
304- #[ derive( Default , Clone ) ]
304+ #[ derive( Default , Clone , serde :: Deserialize , serde :: Serialize ) ]
305305pub struct OptimizerOptions {
306306 // /// Records the validator options that should be passed to the validator,
307307 // /// the validator will run with the options before optimizer.
@@ -316,7 +316,7 @@ pub struct OptimizerOptions {
316316}
317317
318318/// Cargo features specification for building the shader crate.
319- #[ derive( Default ) ]
319+ #[ derive( Default , Clone , serde :: Deserialize , serde :: Serialize ) ]
320320pub struct ShaderCrateFeatures {
321321 /// Set --default-features for the target shader crate.
322322 pub default_features : Option < bool > ,
@@ -325,6 +325,7 @@ pub struct ShaderCrateFeatures {
325325}
326326
327327#[ non_exhaustive]
328+ #[ derive( Clone , serde:: Deserialize , serde:: Serialize ) ]
328329pub struct SpirvBuilder {
329330 pub path_to_crate : Option < PathBuf > ,
330331 /// Whether to print build.rs cargo metadata (e.g. cargo:rustc-env=var=val). Defaults to [`MetadataPrintout::Full`].
0 commit comments