preprocess: allow shadersource to be serializable with serde
This commit is contained in:
parent
1676150858
commit
5ede061975
|
@ -16,10 +16,12 @@ thiserror = "1.0.37"
|
||||||
nom = "7.1.1"
|
nom = "7.1.1"
|
||||||
librashader-common = { path = "../librashader-common", version = "0.4.5" }
|
librashader-common = { path = "../librashader-common", version = "0.4.5" }
|
||||||
encoding_rs = "0.8.31"
|
encoding_rs = "0.8.31"
|
||||||
|
serde = { version = "1.0", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = [ "line_directives" ]
|
default = [ "line_directives" ]
|
||||||
line_directives = []
|
line_directives = []
|
||||||
|
serde = ["dep:serde", "serde/derive", "librashader-common/serde"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
glob = "0.3.1"
|
glob = "0.3.1"
|
||||||
|
|
|
@ -21,6 +21,7 @@ use std::path::Path;
|
||||||
|
|
||||||
/// The source file for a single shader pass.
|
/// The source file for a single shader pass.
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct ShaderSource {
|
pub struct ShaderSource {
|
||||||
/// The source contents for the vertex shader.
|
/// The source contents for the vertex shader.
|
||||||
pub vertex: String,
|
pub vertex: String,
|
||||||
|
@ -40,6 +41,7 @@ pub struct ShaderSource {
|
||||||
|
|
||||||
/// A user tweakable parameter for the shader as declared in source.
|
/// A user tweakable parameter for the shader as declared in source.
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct ShaderParameter {
|
pub struct ShaderParameter {
|
||||||
/// The name of the parameter.
|
/// The name of the parameter.
|
||||||
pub id: ShortString,
|
pub id: ShortString,
|
||||||
|
|
Loading…
Reference in a new issue