(
device: &wgpu::Device,
color_format: wgpu::TextureFormat,
sample_count: u32,
camera_bgl: &wgpu::BindGroupLayout,
camera_3d_bgl: &wgpu::BindGroupLayout,
| 260 | // Render pipelines depend on color format, sample count, and the scene depth |
| 261 | // format (derived from the sample count), so set_sample_count rebuilds them |
| 262 | // through this shared helper without touching simulation state. |
| 263 | #[allow(clippy::too_many_arguments)] |
| 264 | fn create_water_render_pipelines( |
| 265 | device: &wgpu::Device, |
| 266 | color_format: wgpu::TextureFormat, |
| 267 | sample_count: u32, |
| 268 | render_bgl: &wgpu::BindGroupLayout, |
| 269 | depth_bgl: &wgpu::BindGroupLayout, |
| 270 | camera_bgl: &wgpu::BindGroupLayout, |
| 271 | camera_3d_bgl: &wgpu::BindGroupLayout, |
| 272 | ) -> (wgpu::RenderPipeline, wgpu::RenderPipeline) { |
| 273 | let render_wgsl = water_render_wgsl(); |
| 274 | let render_shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { |
| 275 | label: Some("perro_water_render_shader"), |
| 276 | source: wgpu::ShaderSource::Wgsl(render_wgsl.into()), |
| 277 | }); |
| 278 | let render_shader_3d = device.create_shader_module(wgpu::ShaderModuleDescriptor { |
| 279 | label: Some("perro_water_3d_render_shader"), |
| 280 | source: wgpu::ShaderSource::Wgsl(WATER_3D_RENDER_WGSL.into()), |
| 281 | }); |
| 282 | let render_layout_2d = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { |
| 283 | label: Some("perro_water_2d_render_layout"), |
| 284 | bind_group_layouts: &[Some(render_bgl), Some(camera_bgl)], |
| 285 | immediate_size: 0, |
| 286 | }); |
| 287 | let render_layout_3d = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { |
| 288 | label: Some("perro_water_3d_render_layout"), |
| 289 | bind_group_layouts: &[Some(render_bgl), Some(camera_3d_bgl), Some(depth_bgl)], |
| 290 | immediate_size: 0, |
| 291 | }); |
| 292 | let render_pipeline_2d = crate::pipeline_cache::create_render_pipeline( |
| 293 | device, |
| 294 | wgpu::RenderPipelineDescriptor { |
| 295 | label: Some("perro_water_2d_pipeline"), |
| 296 | layout: Some(&render_layout_2d), |
| 297 | vertex: wgpu::VertexState { |
| 298 | module: &render_shader, |
| 299 | entry_point: Some("vs_water_2d"), |
| 300 | buffers: &[], |
| 301 | compilation_options: wgpu::PipelineCompilationOptions::default(), |
| 302 | }, |
| 303 | fragment: Some(wgpu::FragmentState { |
| 304 | module: &render_shader, |
| 305 | entry_point: Some("fs_water_2d"), |
| 306 | targets: &[Some(wgpu::ColorTargetState { |
| 307 | format: color_format, |
| 308 | blend: Some(wgpu::BlendState::ALPHA_BLENDING), |
| 309 | write_mask: wgpu::ColorWrites::ALL, |
| 310 | })], |
| 311 | compilation_options: wgpu::PipelineCompilationOptions::default(), |
| 312 | }), |
| 313 | primitive: wgpu::PrimitiveState { |
| 314 | topology: wgpu::PrimitiveTopology::TriangleList, |
| 315 | strip_index_format: None, |
| 316 | front_face: wgpu::FrontFace::Ccw, |
| 317 | cull_mode: None, |
| 318 | polygon_mode: wgpu::PolygonMode::Fill, |
| 319 | unclipped_depth: false, |
nothing calls this directly
no test coverage detected