From 12bf2f3302efc9042f12ca17104928c35700c229 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 21 Jan 2025 22:00:39 +0100 Subject: split shaders to individual files --- client/src/ui.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'client/src/ui.rs') diff --git a/client/src/ui.rs b/client/src/ui.rs index 92de3c8..78ca29d 100644 --- a/client/src/ui.rs +++ b/client/src/ui.rs @@ -75,7 +75,9 @@ pub enum UiEvent { impl UiRenderer { pub fn new(device: Arc, queue: Arc, format: TextureFormat) -> Self { - let module = device.create_shader_module(include_wgsl!("ui.wgsl")); + let frag_shader = device.create_shader_module(include_wgsl!("shaders/fragment_ui.wgsl")); + let vert_shader = device.create_shader_module(include_wgsl!("shaders/vertex_ui.wgsl")); + let bind_group_layout = device.create_bind_group_layout(&BindGroupLayoutDescriptor { entries: &[ BindGroupLayoutEntry { @@ -109,8 +111,8 @@ impl UiRenderer { label: None, layout: Some(&pipeline_layout), fragment: Some(FragmentState { - module: &module, - entry_point: Some("fs_main"), + module: &frag_shader, + entry_point: Some("main"), targets: &[Some(ColorTargetState { blend: Some(BlendState::PREMULTIPLIED_ALPHA_BLENDING), format, @@ -119,8 +121,8 @@ impl UiRenderer { compilation_options: PipelineCompilationOptions::default(), }), vertex: VertexState { - module: &module, - entry_point: Some("vs_main"), + module: &vert_shader, + entry_point: Some("main"), buffers: &[VertexBufferLayout { array_stride: size_of::() as u64, step_mode: VertexStepMode::Vertex, -- cgit v1.2.3-70-g09d2