parent
903f1a349d
commit
fafb5e52a6
@ -1,14 +1,28 @@
|
|||||||
use shade_runner as sr;
|
use shade_runner as sr;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
use shaderc::ShaderKind;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
let project_root = std::env::current_dir().expect("failed to get root directory");
|
||||||
|
|
||||||
// let project_root = std::env::current_dir().expect("failed to get root directory");
|
// Compile a vertex shader
|
||||||
// let mut vert_path = project_root.clone();
|
let mut vert_path = project_root.clone();
|
||||||
// vert_path.push(PathBuf::from("examples/shaders/vert.glsl"));
|
vert_path.push(PathBuf::from("examples/shaders/vert.glsl"));
|
||||||
// let mut frag_path = project_root.clone();
|
|
||||||
// frag_path.push(PathBuf::from("examples/shaders/frag.glsl"));
|
let vertex_shader = sr::load(vert_path, None, ShaderKind::Vertex, None)
|
||||||
// let shader = sr::load(vert_path, frag_path).expect("Failed to compile");
|
.expect("Failed to compile");
|
||||||
// let vulkano_entry = sr::parse(&shader).expect("failed to parse");
|
|
||||||
// dbg!(vulkano_entry);
|
|
||||||
|
// Compile a fragment shader
|
||||||
|
let mut frag_path = project_root.clone();
|
||||||
|
frag_path.push(PathBuf::from("examples/shaders/frag.glsl"));
|
||||||
|
|
||||||
|
let fragment_shader = sr::load(frag_path, None, ShaderKind::Fragment, None)
|
||||||
|
.expect("Failed to compile");
|
||||||
|
|
||||||
|
let vertex_entry = sr::parse(&vertex_shader).expect("failed to parse");
|
||||||
|
dbg!(vertex_entry);
|
||||||
|
|
||||||
|
let fragment_entry = sr::parse(&fragment_shader).expect("failed to parse");
|
||||||
|
dbg!(fragment_entry);
|
||||||
}
|
}
|
||||||
|
@ -1,345 +1,373 @@
|
|||||||
//use color_backtrace;
|
use color_backtrace;
|
||||||
//use difference::{Changeset, Difference};
|
use difference::{Changeset, Difference};
|
||||||
//use shade_runner::*;
|
use shade_runner::*;
|
||||||
//use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
//use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
//use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
//use vulkano::descriptor::descriptor::*;
|
use vulkano::descriptor::descriptor::*;
|
||||||
//use vulkano::descriptor::pipeline_layout::{PipelineLayoutDesc, PipelineLayoutDescPcRange};
|
use vulkano::descriptor::pipeline_layout::{PipelineLayoutDesc, PipelineLayoutDescPcRange};
|
||||||
//use vulkano::format::*;
|
use vulkano::format::*;
|
||||||
//use vulkano::pipeline::shader::ShaderInterfaceDefEntry;
|
use vulkano::pipeline::shader::ShaderInterfaceDefEntry;
|
||||||
//
|
use shaderc::ShaderKind;
|
||||||
//fn setup() {
|
|
||||||
// color_backtrace::install();
|
fn setup() {
|
||||||
//}
|
color_backtrace::install();
|
||||||
//
|
}
|
||||||
//fn difference(e: &str, t: &str) -> String {
|
|
||||||
// let diffs = Changeset::new(&e, &t, "");
|
fn difference(e: &str, t: &str) -> String {
|
||||||
// diffs
|
let diffs = Changeset::new(&e, &t, "");
|
||||||
// .diffs
|
diffs
|
||||||
// .iter()
|
.diffs
|
||||||
// .filter(|d| match d {
|
.iter()
|
||||||
// Difference::Add(_) => true,
|
.filter(|d| match d {
|
||||||
// Difference::Rem(_) => true,
|
Difference::Add(_) => true,
|
||||||
// _ => false,
|
Difference::Rem(_) => true,
|
||||||
// })
|
_ => false,
|
||||||
// .map(|d| match d {
|
})
|
||||||
// Difference::Add(a) => format!("add: {}", a),
|
.map(|d| match d {
|
||||||
// Difference::Rem(a) => format!("remove: {}", a),
|
Difference::Add(a) => format!("add: {}", a),
|
||||||
// _ => "".to_string(),
|
Difference::Rem(a) => format!("remove: {}", a),
|
||||||
// })
|
_ => "".to_string(),
|
||||||
// .collect::<Vec<String>>()
|
})
|
||||||
// .join("\n")
|
.collect::<Vec<String>>()
|
||||||
//}
|
.join("\n")
|
||||||
//
|
}
|
||||||
//fn descriptor_layout<T>(desc: &T) -> String
|
|
||||||
//where
|
fn descriptor_layout<T>(desc: &T) -> String
|
||||||
// T: PipelineLayoutDesc,
|
where
|
||||||
//{
|
T: PipelineLayoutDesc,
|
||||||
// let num_sets = desc.num_sets();
|
{
|
||||||
// let mut r = format!("{:?}", num_sets);
|
let num_sets = desc.num_sets();
|
||||||
// for n in 0..num_sets {
|
let mut r = format!("{:?}", num_sets);
|
||||||
// let num_bindings = desc.num_bindings_in_set(n);
|
for n in 0..num_sets {
|
||||||
// r = format!("{:?}{:?}", r, num_bindings);
|
let num_bindings = desc.num_bindings_in_set(n);
|
||||||
// for b in num_bindings {
|
r = format!("{:?}{:?}", r, num_bindings);
|
||||||
// r = format!("{:?}{:?}", r, desc.descriptor(n, b));
|
for b in num_bindings {
|
||||||
// }
|
r = format!("{:?}{:?}", r, desc.descriptor(n, b));
|
||||||
// }
|
}
|
||||||
// let num_push_constants = desc.num_push_constants_ranges();
|
}
|
||||||
// r = format!("{:?}{:?}", r, num_push_constants);
|
let num_push_constants = desc.num_push_constants_ranges();
|
||||||
// for i in 0..num_push_constants {
|
r = format!("{:?}{:?}", r, num_push_constants);
|
||||||
// r = format!("{:?}{:?}", r, desc.push_constants_range(i));
|
for i in 0..num_push_constants {
|
||||||
// }
|
r = format!("{:?}{:?}", r, desc.push_constants_range(i));
|
||||||
// r
|
}
|
||||||
//}
|
r
|
||||||
//
|
}
|
||||||
//fn parse<T>(vertex: T, fragment: T) -> shade_runner::Entry
|
|
||||||
//where
|
fn parse<T>(input: T, shader_kind: ShaderKind) -> shade_runner::Entry
|
||||||
// T: AsRef<Path>,
|
where
|
||||||
//{
|
T: AsRef<Path>,
|
||||||
// let project_root = std::env::current_dir().expect("failed to get root directory");
|
{
|
||||||
// let mut path = project_root.clone();
|
let project_root = std::env::current_dir().expect("failed to get root directory");
|
||||||
// path.push(PathBuf::from("tests/shaders/"));
|
let mut path = project_root.clone();
|
||||||
// let mut vertex_path = path.clone();
|
path.push(PathBuf::from("tests/shaders/"));
|
||||||
// vertex_path.push(vertex);
|
|
||||||
// let mut fragment_path = path.clone();
|
let mut shader_path = path.clone();
|
||||||
// fragment_path.push(fragment);
|
shader_path.push(input);
|
||||||
// let shader = shade_runner::load(vertex_path, fragment_path).expect("Failed to compile");
|
|
||||||
// shade_runner::parse(&shader).unwrap()
|
let shader = shade_runner::load(shader_path, None, shader_kind, None).expect("Failed to compile");
|
||||||
//}
|
|
||||||
//
|
shade_runner::parse(&shader).unwrap()
|
||||||
//fn do_test<T>(a: &T, b: &T)
|
}
|
||||||
//where
|
|
||||||
// T: std::fmt::Debug,
|
fn do_test<T>(a: &T, b: &T)
|
||||||
//{
|
where
|
||||||
// let a = format!("{:?}", a);
|
T: std::fmt::Debug,
|
||||||
// let b = format!("{:?}", b);
|
{
|
||||||
// assert_eq!(&a, &b, "\n\nDifference: {}", difference(&a, &b));
|
let a = format!("{:?}", a);
|
||||||
//}
|
let b = format!("{:?}", b);
|
||||||
//
|
assert_eq!(&a, &b, "\n\nDifference: {}", difference(&a, &b));
|
||||||
//#[test]
|
}
|
||||||
//fn test_shade1() {
|
|
||||||
// setup();
|
#[test]
|
||||||
// let target = Entry {
|
fn test_shade1() {
|
||||||
// compute_layout: Default::default(),
|
setup();
|
||||||
// frag_input: FragInput { inputs: Vec::new() },
|
let frag_target = Entry {
|
||||||
// frag_output: FragOutput {
|
input: Some(Input { inputs: Vec::new() }),
|
||||||
// outputs: vec![ShaderInterfaceDefEntry {
|
output: Some(Output {
|
||||||
// location: 0..1,
|
outputs: vec![ShaderInterfaceDefEntry {
|
||||||
// format: Format::R32G32B32A32Sfloat,
|
location: 0..1,
|
||||||
// name: Some(Cow::Borrowed("f_color")),
|
format: Format::R32G32B32A32Sfloat,
|
||||||
// }],
|
name: Some(Cow::Borrowed("f_color")),
|
||||||
// },
|
}],
|
||||||
// frag_layout: FragLayout {
|
}),
|
||||||
// layout_data: LayoutData {
|
layout: Layout {
|
||||||
// num_sets: 0,
|
layout_data: LayoutData {
|
||||||
// num_bindings: HashMap::new(),
|
num_sets: 0,
|
||||||
// descriptions: HashMap::new(),
|
num_bindings: HashMap::new(),
|
||||||
// num_constants: 0,
|
descriptions: HashMap::new(),
|
||||||
// pc_ranges: Vec::new(),
|
num_constants: 0,
|
||||||
// },
|
pc_ranges: Vec::new(),
|
||||||
// },
|
},
|
||||||
// vert_input: VertInput {
|
},
|
||||||
// inputs: vec![ShaderInterfaceDefEntry {
|
};
|
||||||
// location: 0..1,
|
|
||||||
// format: Format::R32G32Sfloat,
|
let vert_target = Entry {
|
||||||
// name: Some(Cow::Borrowed("position")),
|
input: Some(Input {
|
||||||
// }],
|
inputs: vec![ShaderInterfaceDefEntry {
|
||||||
// },
|
location: 0..1,
|
||||||
// vert_output: VertOutput {
|
format: Format::R32G32Sfloat,
|
||||||
// outputs: Vec::new(),
|
name: Some(Cow::Borrowed("position")),
|
||||||
// },
|
}],
|
||||||
// vert_layout: VertLayout {
|
}),
|
||||||
// layout_data: LayoutData {
|
output: Some(Output {
|
||||||
// num_sets: 0,
|
outputs: Vec::new(),
|
||||||
// num_bindings: HashMap::new(),
|
}),
|
||||||
// descriptions: HashMap::new(),
|
layout: Layout {
|
||||||
// num_constants: 0,
|
layout_data: LayoutData {
|
||||||
// pc_ranges: Vec::new(),
|
num_sets: 0,
|
||||||
// },
|
num_bindings: HashMap::new(),
|
||||||
// },
|
descriptions: HashMap::new(),
|
||||||
// };
|
num_constants: 0,
|
||||||
// let entry = parse("vert1.glsl", "frag1.glsl");
|
pc_ranges: Vec::new(),
|
||||||
// do_test(&entry, &target);
|
},
|
||||||
//}
|
},
|
||||||
//
|
};
|
||||||
//#[test]
|
|
||||||
//fn test_shade2() {
|
let vert_entry = parse("vert1.glsl", ShaderKind::Vertex);
|
||||||
// setup();
|
let frag_entry = parse("frag1.glsl", ShaderKind::Fragment);
|
||||||
// let target = Entry {
|
do_test(&vert_entry, &vert_target);
|
||||||
// compute_layout: Default::default(),
|
do_test(&frag_entry, &frag_target);
|
||||||
// frag_input: FragInput {
|
}
|
||||||
// inputs: vec![
|
|
||||||
// ShaderInterfaceDefEntry {
|
#[test]
|
||||||
// location: 0..1,
|
fn test_shade2() {
|
||||||
// format: Format::R32G32B32A32Sfloat,
|
setup();
|
||||||
// name: Some(Cow::Borrowed("cool")),
|
let frag_target = Entry {
|
||||||
// },
|
input: Some(Input {
|
||||||
// ShaderInterfaceDefEntry {
|
inputs: vec![
|
||||||
// location: 1..2,
|
ShaderInterfaceDefEntry {
|
||||||
// format: Format::R32G32Sfloat,
|
location: 0..1,
|
||||||
// name: Some(Cow::Borrowed("yep")),
|
format: Format::R32G32B32A32Sfloat,
|
||||||
// },
|
name: Some(Cow::Borrowed("cool")),
|
||||||
// ShaderInterfaceDefEntry {
|
},
|
||||||
// location: 2..3,
|
ShaderInterfaceDefEntry {
|
||||||
// format: Format::R32Sfloat,
|
location: 1..2,
|
||||||
// name: Some(Cow::Borrowed("monkey")),
|
format: Format::R32G32Sfloat,
|
||||||
// },
|
name: Some(Cow::Borrowed("yep")),
|
||||||
// ],
|
},
|
||||||
// },
|
ShaderInterfaceDefEntry {
|
||||||
// frag_output: FragOutput {
|
location: 2..3,
|
||||||
// outputs: vec![ShaderInterfaceDefEntry {
|
format: Format::R32Sfloat,
|
||||||
// location: 0..1,
|
name: Some(Cow::Borrowed("monkey")),
|
||||||
// format: Format::R32G32B32A32Sfloat,
|
},
|
||||||
// name: Some(Cow::Borrowed("f_color")),
|
],
|
||||||
// }],
|
}),
|
||||||
// },
|
output: Some(Output {
|
||||||
// frag_layout: FragLayout {
|
outputs: vec![ShaderInterfaceDefEntry {
|
||||||
// layout_data: LayoutData {
|
location: 0..1,
|
||||||
// num_sets: 0,
|
format: Format::R32G32B32A32Sfloat,
|
||||||
// num_bindings: HashMap::new(),
|
name: Some(Cow::Borrowed("f_color")),
|
||||||
// descriptions: HashMap::new(),
|
}],
|
||||||
// num_constants: 0,
|
}),
|
||||||
// pc_ranges: Vec::new(),
|
layout: Layout {
|
||||||
// },
|
layout_data: LayoutData {
|
||||||
// },
|
num_sets: 0,
|
||||||
// vert_input: VertInput {
|
num_bindings: HashMap::new(),
|
||||||
// inputs: vec![ShaderInterfaceDefEntry {
|
descriptions: HashMap::new(),
|
||||||
// location: 0..1,
|
num_constants: 0,
|
||||||
// format: Format::R32G32Sfloat,
|
pc_ranges: Vec::new(),
|
||||||
// name: Some(Cow::Borrowed("position")),
|
},
|
||||||
// }],
|
},
|
||||||
// },
|
};
|
||||||
// vert_output: VertOutput {
|
|
||||||
// outputs: vec![
|
let vert_target = Entry {
|
||||||
// ShaderInterfaceDefEntry {
|
input: Some(Input {
|
||||||
// location: 0..1,
|
inputs: vec![ShaderInterfaceDefEntry {
|
||||||
// format: Format::R32G32B32A32Sfloat,
|
location: 0..1,
|
||||||
// name: Some(Cow::Borrowed("cool")),
|
format: Format::R32G32Sfloat,
|
||||||
// },
|
name: Some(Cow::Borrowed("position")),
|
||||||
// ShaderInterfaceDefEntry {
|
}],
|
||||||
// location: 1..2,
|
}),
|
||||||
// format: Format::R32G32Sfloat,
|
output: Some(Output {
|
||||||
// name: Some(Cow::Borrowed("yep")),
|
outputs: vec![
|
||||||
// },
|
ShaderInterfaceDefEntry {
|
||||||
// ShaderInterfaceDefEntry {
|
location: 0..1,
|
||||||
// location: 2..3,
|
format: Format::R32G32B32A32Sfloat,
|
||||||
// format: Format::R32Sfloat,
|
name: Some(Cow::Borrowed("cool")),
|
||||||
// name: Some(Cow::Borrowed("monkey")),
|
},
|
||||||
// },
|
ShaderInterfaceDefEntry {
|
||||||
// ],
|
location: 1..2,
|
||||||
// },
|
format: Format::R32G32Sfloat,
|
||||||
// vert_layout: VertLayout {
|
name: Some(Cow::Borrowed("yep")),
|
||||||
// layout_data: LayoutData {
|
},
|
||||||
// num_sets: 0,
|
ShaderInterfaceDefEntry {
|
||||||
// num_bindings: HashMap::new(),
|
location: 2..3,
|
||||||
// descriptions: HashMap::new(),
|
format: Format::R32Sfloat,
|
||||||
// num_constants: 0,
|
name: Some(Cow::Borrowed("monkey")),
|
||||||
// pc_ranges: Vec::new(),
|
},
|
||||||
// },
|
],
|
||||||
// },
|
}),
|
||||||
// };
|
layout: Layout {
|
||||||
// let entry = parse("vert2.glsl", "frag2.glsl");
|
layout_data: LayoutData {
|
||||||
// do_test(&entry, &target);
|
num_sets: 0,
|
||||||
//}
|
num_bindings: HashMap::new(),
|
||||||
//
|
descriptions: HashMap::new(),
|
||||||
//#[test]
|
num_constants: 0,
|
||||||
//fn test_shade3() {
|
pc_ranges: Vec::new(),
|
||||||
// setup();
|
},
|
||||||
// let target = Entry {
|
},
|
||||||
// compute_layout: Default::default(),
|
};
|
||||||
// frag_input: FragInput { inputs: Vec::new() },
|
|
||||||
// frag_output: FragOutput {
|
let vert_entry = parse("vert2.glsl", ShaderKind::Vertex);
|
||||||
// outputs: vec![ShaderInterfaceDefEntry {
|
let frag_entry = parse("frag2.glsl", ShaderKind::Fragment);
|
||||||
// location: 0..1,
|
do_test(&vert_entry, &vert_target);
|
||||||
// format: Format::R32G32B32A32Sfloat,
|
do_test(&frag_entry, &frag_target);
|
||||||
// name: Some(Cow::Borrowed("f_color")),
|
}
|
||||||
// }],
|
|
||||||
// },
|
#[test]
|
||||||
// frag_layout: FragLayout {
|
fn test_shade3() {
|
||||||
// layout_data: LayoutData {
|
setup();
|
||||||
// num_sets: 1,
|
let frag_target = Entry {
|
||||||
// num_bindings: vec![(0, 1)].into_iter().collect(),
|
input: Some(Input { inputs: Vec::new() }),
|
||||||
// descriptions: vec![(
|
output: Some(Output {
|
||||||
// 0,
|
outputs: vec![ShaderInterfaceDefEntry {
|
||||||
// vec![(
|
location: 0..1,
|
||||||
// 0,
|
format: Format::R32G32B32A32Sfloat,
|
||||||
// DescriptorDesc {
|
name: Some(Cow::Borrowed("f_color")),
|
||||||
// ty: DescriptorDescTy::CombinedImageSampler(DescriptorImageDesc {
|
}],
|
||||||
// sampled: true,
|
}),
|
||||||
// dimensions: DescriptorImageDescDimensions::TwoDimensional,
|
layout: Layout {
|
||||||
// format: None,
|
layout_data: LayoutData {
|
||||||
// multisampled: false,
|
num_sets: 1,
|
||||||
// array_layers: DescriptorImageDescArray::NonArrayed,
|
num_bindings: vec![(0, 1)].into_iter().collect(),
|
||||||
// }),
|
descriptions: vec![(
|
||||||
// array_count: 1,
|
0,
|
||||||
// stages: ShaderStages {
|
vec![(
|
||||||
// fragment: true,
|
0,
|
||||||
// ..ShaderStages::none()
|
DescriptorDesc {
|
||||||
// },
|
ty: DescriptorDescTy::CombinedImageSampler(DescriptorImageDesc {
|
||||||
// readonly: true,
|
sampled: true,
|
||||||
// },
|
dimensions: DescriptorImageDescDimensions::TwoDimensional,
|
||||||
// )]
|
format: None,
|
||||||
// .into_iter()
|
multisampled: false,
|
||||||
// .collect(),
|
array_layers: DescriptorImageDescArray::NonArrayed,
|
||||||
// )]
|
}),
|
||||||
// .into_iter()
|
array_count: 1,
|
||||||
// .collect(),
|
stages: ShaderStages {
|
||||||
// num_constants: 0,
|
fragment: true,
|
||||||
// pc_ranges: Vec::new(),
|
..ShaderStages::none()
|
||||||
// },
|
},
|
||||||
// },
|
readonly: true,
|
||||||
// vert_input: VertInput {
|
},
|
||||||
// inputs: vec![ShaderInterfaceDefEntry {
|
)]
|
||||||
// location: 0..1,
|
.into_iter()
|
||||||
// format: Format::R32G32Sfloat,
|
.collect(),
|
||||||
// name: Some(Cow::Borrowed("position")),
|
)]
|
||||||
// }],
|
.into_iter()
|
||||||
// },
|
.collect(),
|
||||||
// vert_output: VertOutput {
|
num_constants: 0,
|
||||||
// outputs: Vec::new(),
|
pc_ranges: Vec::new(),
|
||||||
// },
|
},
|
||||||
// vert_layout: VertLayout {
|
},
|
||||||
// layout_data: LayoutData {
|
};
|
||||||
// num_sets: 0,
|
let vert_target = Entry {
|
||||||
// num_bindings: HashMap::new(),
|
input: Some(Input {
|
||||||
// descriptions: HashMap::new(),
|
inputs: vec![ShaderInterfaceDefEntry {
|
||||||
// num_constants: 0,
|
location: 0..1,
|
||||||
// pc_ranges: Vec::new(),
|
format: Format::R32G32Sfloat,
|
||||||
// },
|
name: Some(Cow::Borrowed("position")),
|
||||||
// },
|
}],
|
||||||
// };
|
}),
|
||||||
// let entry = parse("vert3.glsl", "frag3.glsl");
|
output: Some(Output {
|
||||||
// do_test(&entry.frag_input, &target.frag_input);
|
outputs: Vec::new(),
|
||||||
// do_test(&entry.frag_output, &target.frag_output);
|
}),
|
||||||
// do_test(&entry.vert_input, &target.vert_input);
|
layout: Layout {
|
||||||
// do_test(&entry.vert_output, &target.vert_output);
|
layout_data: LayoutData {
|
||||||
// do_test(
|
num_sets: 0,
|
||||||
// &descriptor_layout(&entry.frag_layout),
|
num_bindings: HashMap::new(),
|
||||||
// &descriptor_layout(&target.frag_layout),
|
descriptions: HashMap::new(),
|
||||||
// );
|
num_constants: 0,
|
||||||
// do_test(
|
pc_ranges: Vec::new(),
|
||||||
// &descriptor_layout(&entry.vert_layout),
|
},
|
||||||
// &descriptor_layout(&target.vert_layout),
|
},
|
||||||
// );
|
};
|
||||||
//}
|
|
||||||
//
|
let vert_entry = parse("vert3.glsl", ShaderKind::Vertex);
|
||||||
//#[test]
|
let frag_entry = parse("frag3.glsl", ShaderKind::Fragment);
|
||||||
//fn test_shade4() {
|
|
||||||
// setup();
|
do_test(&vert_entry.input, &vert_target.input);
|
||||||
// let target = Entry {
|
do_test(&vert_entry.output, &vert_target.output);
|
||||||
// compute_layout: Default::default(),
|
|
||||||
// frag_input: FragInput { inputs: Vec::new() },
|
do_test(&frag_entry.input, &frag_target.input);
|
||||||
// frag_output: FragOutput {
|
do_test(&frag_entry.output, &frag_target.output);
|
||||||
// outputs: vec![ShaderInterfaceDefEntry {
|
|
||||||
// location: 0..1,
|
do_test(
|
||||||
// format: Format::R32G32B32A32Sfloat,
|
&descriptor_layout(&frag_entry.layout),
|
||||||
// name: Some(Cow::Borrowed("f_color")),
|
&descriptor_layout(&frag_target.layout),
|
||||||
// }],
|
);
|
||||||
// },
|
do_test(
|
||||||
// frag_layout: FragLayout {
|
&descriptor_layout(&vert_entry.layout),
|
||||||
// layout_data: LayoutData {
|
&descriptor_layout(&vert_target.layout),
|
||||||
// num_sets: 0,
|
);
|
||||||
// num_bindings: HashMap::new(),
|
}
|
||||||
// descriptions: HashMap::new(),
|
|
||||||
// num_constants: 1,
|
#[test]
|
||||||
// pc_ranges: vec![PipelineLayoutDescPcRange {
|
fn test_shade4() {
|
||||||
// offset: 0,
|
setup();
|
||||||
// size: 16,
|
let frag_target = Entry {
|
||||||
// stages: ShaderStages {
|
input: Some(Input { inputs: Vec::new() }),
|
||||||
// fragment: true,
|
output: Some(Output {
|
||||||
// ..ShaderStages::none()
|
outputs: vec![ShaderInterfaceDefEntry {
|
||||||
// },
|
location: 0..1,
|
||||||
// }],
|
format: Format::R32G32B32A32Sfloat,
|
||||||
// },
|
name: Some(Cow::Borrowed("f_color")),
|
||||||
// },
|
}],
|
||||||
// vert_input: VertInput {
|
}),
|
||||||
// inputs: vec![ShaderInterfaceDefEntry {
|
layout: Layout {
|
||||||
// location: 0..1,
|
layout_data: LayoutData {
|
||||||
// format: Format::R32G32Sfloat,
|
num_sets: 0,
|
||||||
// name: Some(Cow::Borrowed("position")),
|
num_bindings: HashMap::new(),
|
||||||
// }],
|
descriptions: HashMap::new(),
|
||||||
// },
|
num_constants: 1,
|
||||||
// vert_output: VertOutput {
|
pc_ranges: vec![PipelineLayoutDescPcRange {
|
||||||
// outputs: Vec::new(),
|
offset: 0,
|
||||||
// },
|
size: 16,
|
||||||
// vert_layout: VertLayout {
|
stages: ShaderStages {
|
||||||
// layout_data: LayoutData {
|
fragment: true,
|
||||||
// num_sets: 0,
|
..ShaderStages::none()
|
||||||
// num_bindings: HashMap::new(),
|
},
|
||||||
// descriptions: HashMap::new(),
|
}],
|
||||||
// num_constants: 0,
|
},
|
||||||
// pc_ranges: Vec::new(),
|
},
|
||||||
// },
|
};
|
||||||
// },
|
let vert_target = Entry {
|
||||||
// };
|
input: Some(Input {
|
||||||
// let entry = parse("vert4.glsl", "frag4.glsl");
|
inputs: vec![ShaderInterfaceDefEntry {
|
||||||
// do_test(&entry.frag_input, &target.frag_input);
|
location: 0..1,
|
||||||
// do_test(&entry.frag_output, &target.frag_output);
|
format: Format::R32G32Sfloat,
|
||||||
// do_test(&entry.vert_input, &target.vert_input);
|
name: Some(Cow::Borrowed("position")),
|
||||||
// do_test(&entry.vert_output, &target.vert_output);
|
}],
|
||||||
// do_test(
|
}),
|
||||||
// &descriptor_layout(&entry.frag_layout),
|
output: Some(Output {
|
||||||
// &descriptor_layout(&target.frag_layout),
|
outputs: Vec::new(),
|
||||||
// );
|
}),
|
||||||
//}
|
layout: Layout {
|
||||||
|
layout_data: LayoutData {
|
||||||
|
num_sets: 0,
|
||||||
|
num_bindings: HashMap::new(),
|
||||||
|
descriptions: HashMap::new(),
|
||||||
|
num_constants: 0,
|
||||||
|
pc_ranges: Vec::new(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
let vert_entry = parse("vert4.glsl", ShaderKind::Vertex);
|
||||||
|
let frag_entry = parse("frag4.glsl", ShaderKind::Fragment);
|
||||||
|
|
||||||
|
do_test(&vert_entry.input, &vert_target.input);
|
||||||
|
do_test(&vert_entry.output, &vert_target.output);
|
||||||
|
|
||||||
|
do_test(&frag_entry.input, &frag_target.input);
|
||||||
|
do_test(&frag_entry.output, &frag_target.output);
|
||||||
|
|
||||||
|
do_test(
|
||||||
|
&descriptor_layout(&frag_entry.layout),
|
||||||
|
&descriptor_layout(&frag_target.layout),
|
||||||
|
);
|
||||||
|
do_test(
|
||||||
|
&descriptor_layout(&vert_entry.layout),
|
||||||
|
&descriptor_layout(&vert_target.layout),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Loading…
Reference in new issue