diff options
Diffstat (limited to 'client/src/shaders')
-rw-r--r-- | client/src/shaders/mod.rs | 21 | ||||
-rw-r--r-- | client/src/shaders/vertex_world_skin.wgsl | 4 |
2 files changed, 23 insertions, 2 deletions
diff --git a/client/src/shaders/mod.rs b/client/src/shaders/mod.rs new file mode 100644 index 0000000..42b2164 --- /dev/null +++ b/client/src/shaders/mod.rs @@ -0,0 +1,21 @@ +use log::info; +use wgpu::{Device, ShaderModule, include_wgsl}; + +pub struct SceneShaders { + pub fragment_pbr: ShaderModule, + pub vertex_world: ShaderModule, + pub vertex_world_skin: ShaderModule, +} + +impl SceneShaders { + pub fn load(device: &Device) -> Self { + info!("compiling shaders..."); + let s = Self { + fragment_pbr: device.create_shader_module(include_wgsl!("fragment_pbr.wgsl")), + vertex_world: device.create_shader_module(include_wgsl!("vertex_world.wgsl")), + vertex_world_skin: device.create_shader_module(include_wgsl!("vertex_world_skin.wgsl")), + }; + info!("done"); + s + } +} diff --git a/client/src/shaders/vertex_world_skin.wgsl b/client/src/shaders/vertex_world_skin.wgsl index 86250f1..288950d 100644 --- a/client/src/shaders/vertex_world_skin.wgsl +++ b/client/src/shaders/vertex_world_skin.wgsl @@ -33,8 +33,8 @@ struct PushConst { model_basis: mat3x3<f32>, } -var<uniform> joints: array<mat4x4<f32>>; -var<push_constant> pc: PushConst; +@group(3) @binding(0) var<uniform> joints: array<mat4x4<f32>, 128>; +var<push_constant> pc: PushConst; @vertex fn main(vi: VertexIn) -> VertexOut { |