mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-02-25 13:23:47 +00:00
glsl-out: More glsl versions (#191)
* Added support for glsl core version up to 400 * Added 330 to the list supported versions * Added links to all extensions and fixed a extension being wrongfully activated * Cleanup and check for image formats * Removed useless extension and location on layout * Added support for external functions and fixed global names * Typefier allow Scalars in distance and length * Addressed comments * Fixed extension appearing after body * Fixed entry point not being generated
This commit is contained in:
parent
d25ab1b1e8
commit
0aae8ae6f8
@ -149,15 +149,19 @@ fn main() {
|
||||
ShaderStage,
|
||||
};
|
||||
|
||||
let mut file = fs::OpenOptions::new()
|
||||
.write(true)
|
||||
.truncate(true)
|
||||
.create(true)
|
||||
.open(&args[2])
|
||||
.unwrap();
|
||||
let version = match args.get(3).map(|p| p.as_str()) {
|
||||
Some("core") => {
|
||||
Version::Desktop(args.get(4).and_then(|v| v.parse().ok()).unwrap_or(330))
|
||||
}
|
||||
Some("es") => {
|
||||
Version::Embedded(args.get(4).and_then(|v| v.parse().ok()).unwrap_or(310))
|
||||
}
|
||||
Some(_) => panic!("Unknown profile"),
|
||||
_ => Version::Embedded(310),
|
||||
};
|
||||
|
||||
let options = Options {
|
||||
version: Version::Embedded(310),
|
||||
version,
|
||||
entry_point: (
|
||||
match stage {
|
||||
"vert" => ShaderStage::Vertex,
|
||||
@ -169,7 +173,19 @@ fn main() {
|
||||
),
|
||||
};
|
||||
|
||||
glsl::write(&module, &mut file, options).unwrap();
|
||||
let mut file = fs::OpenOptions::new()
|
||||
.write(true)
|
||||
.truncate(true)
|
||||
.create(true)
|
||||
.open(&args[2])
|
||||
.unwrap();
|
||||
|
||||
glsl::write(&module, &mut file, options)
|
||||
.map_err(|e| {
|
||||
fs::remove_file(&args[2]).unwrap();
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
#[cfg(feature = "serialize")]
|
||||
"ron" => {
|
||||
|
858
src/back/glsl.rs
858
src/back/glsl.rs
File diff suppressed because it is too large
Load Diff
@ -247,11 +247,18 @@ impl Typifier {
|
||||
origin: crate::FunctionOrigin::External(ref name),
|
||||
ref arguments,
|
||||
} => match name.as_str() {
|
||||
"distance" | "length" | "dot" => match *self.get(arguments[0], types) {
|
||||
"distance" | "length" => match *self.get(arguments[0], types) {
|
||||
crate::TypeInner::Vector { kind, width, .. }
|
||||
| crate::TypeInner::Scalar { kind, width } => {
|
||||
Resolution::Value(crate::TypeInner::Scalar { kind, width })
|
||||
}
|
||||
ref other => panic!("Unexpected argument {:?} on {}", other, name),
|
||||
},
|
||||
"dot" => match *self.get(arguments[0], types) {
|
||||
crate::TypeInner::Vector { kind, width, .. } => {
|
||||
Resolution::Value(crate::TypeInner::Scalar { kind, width })
|
||||
}
|
||||
ref other => panic!("Unexpected argument {:?}", other),
|
||||
ref other => panic!("Unexpected argument {:?} on {}", other, name),
|
||||
},
|
||||
"atan2" | "cos" | "sin" | "normalize" | "max" | "reflect" | "pow" | "clamp"
|
||||
| "fclamp" | "mix" => self.resolutions[arguments[0].index()].clone(),
|
||||
|
Loading…
Reference in New Issue
Block a user