wgsl include preprocessor; refactor pbr

This commit is contained in:
Lauri Räsänen 2023-01-25 05:34:01 +02:00
parent 6040a4430a
commit a4e56e8d58
10 changed files with 115 additions and 64 deletions

View file

@ -10,6 +10,7 @@ use super::light::{DrawLight, LightUniform};
use super::model::{DrawModel, Model, ModelVertex, Vertex};
use super::resources;
use super::texture::Texture;
use crate::shaders::preprocessor::preprocess_wgsl;
const NUM_INSTANCES_PER_ROW: u32 = 1;
@ -275,7 +276,7 @@ impl State {
});
let shader = wgpu::ShaderModuleDescriptor {
label: Some("Normal Shader"),
source: wgpu::ShaderSource::Wgsl(include_str!("../shaders/test.wgsl").into()),
source: preprocess_wgsl("test.wgsl"),
};
create_render_pipeline(
&device,
@ -295,7 +296,7 @@ impl State {
});
let shader = wgpu::ShaderModuleDescriptor {
label: Some("Light Shader"),
source: wgpu::ShaderSource::Wgsl(include_str!("../shaders/light.wgsl").into()),
source: preprocess_wgsl("light.wgsl"),
};
create_render_pipeline(
&device,