summaryrefslogtreecommitdiff
path: root/client/src/shaders
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-01-22 00:23:58 +0100
committermetamuffin <metamuffin@disroot.org>2025-01-22 00:23:58 +0100
commit0612ce58890741428f10c73a63bcb417dcd43a9f (patch)
treea06a6d180722cc3adc35d6a8e30789773b56d508 /client/src/shaders
parent13eb6abfe0e766e432a2f08d58fa9f5a6c5026e7 (diff)
downloadweareserver-0612ce58890741428f10c73a63bcb417dcd43a9f.tar
weareserver-0612ce58890741428f10c73a63bcb417dcd43a9f.tar.bz2
weareserver-0612ce58890741428f10c73a63bcb417dcd43a9f.tar.zst
generalize pipeline configuration in preparation for skinning
Diffstat (limited to 'client/src/shaders')
-rw-r--r--client/src/shaders/mod.rs21
-rw-r--r--client/src/shaders/vertex_world_skin.wgsl4
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 {