move shaders to subfolder
This commit is contained in:
@@ -19,7 +19,7 @@ impl ShaderData {
|
|||||||
let extension = src_path.extension().expect("File has no extension").to_str().unwrap();
|
let extension = src_path.extension().expect("File has no extension").to_str().unwrap();
|
||||||
|
|
||||||
// Create output path
|
// Create output path
|
||||||
let directory = src_path.parent().unwrap().join(".bin");
|
let directory = src_path.parent().unwrap().join("bin");
|
||||||
create_dir_all(directory.clone()).expect("Failed to create output directory");
|
create_dir_all(directory.clone()).expect("Failed to create output directory");
|
||||||
let spv_path = directory.join(filename).with_extension(format!("{}.spv", extension));
|
let spv_path = directory.join(filename).with_extension(format!("{}.spv", extension));
|
||||||
|
|
||||||
@@ -45,9 +45,9 @@ fn resolve_include(inc_name: &str, _inc_type: IncludeType, src_name: &str, _dept
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Load all shaders
|
// Load all shaders
|
||||||
let vert = glob("./src/**/*.vert").unwrap().filter_map(|p| ShaderData::load(p.unwrap(), ShaderKind::Vertex));
|
let vert = glob("./src/shaders/**/*.vert").unwrap().filter_map(|p| ShaderData::load(p.unwrap(), ShaderKind::Vertex));
|
||||||
let frag = glob("./src/**/*.frag").unwrap().filter_map(|p| ShaderData::load(p.unwrap(), ShaderKind::Fragment));
|
let frag = glob("./src/shaders/**/*.frag").unwrap().filter_map(|p| ShaderData::load(p.unwrap(), ShaderKind::Fragment));
|
||||||
let comp = glob("./src/**/*.comp").unwrap().filter_map(|p| ShaderData::load(p.unwrap(), ShaderKind::Compute));
|
let comp = glob("./src/shaders/**/*.comp").unwrap().filter_map(|p| ShaderData::load(p.unwrap(), ShaderKind::Compute));
|
||||||
let shaders = vert.chain(frag).chain(comp);
|
let shaders = vert.chain(frag).chain(comp);
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
|
|||||||
+2
-2
@@ -60,12 +60,12 @@ impl App {
|
|||||||
push_constant_ranges: &[],
|
push_constant_ranges: &[],
|
||||||
});
|
});
|
||||||
let vert_state = wgpu::VertexState { //vert
|
let vert_state = wgpu::VertexState { //vert
|
||||||
module: &device.create_shader_module(&wgpu::include_spirv!(".bin\\shader.vert.spv")),
|
module: &device.create_shader_module(&wgpu::include_spirv!("shaders\\bin\\shader.vert.spv")),
|
||||||
entry_point: "main",
|
entry_point: "main",
|
||||||
buffers: &[Vertex::desc()],
|
buffers: &[Vertex::desc()],
|
||||||
};
|
};
|
||||||
let frag_state = wgpu::FragmentState { // frag
|
let frag_state = wgpu::FragmentState { // frag
|
||||||
module: &device.create_shader_module(&wgpu::include_spirv!(".bin\\shader.frag.spv")),
|
module: &device.create_shader_module(&wgpu::include_spirv!("shaders\\bin\\shader.frag.spv")),
|
||||||
entry_point: "main",
|
entry_point: "main",
|
||||||
targets: &[wgpu::ColorTargetState {
|
targets: &[wgpu::ColorTargetState {
|
||||||
format: swapchain_desc.format,
|
format: swapchain_desc.format,
|
||||||
|
|||||||
Reference in New Issue
Block a user