notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 7ac7dc20993ddf89e6c3e0408eaf55a8ed959c14
parent f3f1b69211d442bbf4ca1452813b090edabe0ad4
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 23 Feb 2026 13:23:06 -0800

renderbud: fix clippy warnings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Diffstat:
Mcrates/renderbud/src/ibl.rs | 37++++---------------------------------
Mcrates/renderbud/src/lib.rs | 10++--------
Mcrates/renderbud/src/material.rs | 4++--
Mcrates/renderbud/src/model.rs | 6+++---
Mcrates/renderbud/src/world.rs | 10+++++-----
5 files changed, 16 insertions(+), 51 deletions(-)

diff --git a/crates/renderbud/src/ibl.rs b/crates/renderbud/src/ibl.rs @@ -1,11 +1,5 @@ use rayon::prelude::*; -use std::path::Path; - pub struct IblData { - pub irradiance_view: wgpu::TextureView, - pub prefiltered_view: wgpu::TextureView, - pub brdf_lut_view: wgpu::TextureView, - pub sampler: wgpu::Sampler, pub bindgroup: wgpu::BindGroup, } @@ -108,13 +102,7 @@ pub fn create_test_ibl( ], }); - IblData { - irradiance_view, - prefiltered_view, - brdf_lut_view, - sampler, - bindgroup, - } + IblData { bindgroup } } /// Creates a simple gradient cubemap for testing IBL pipeline. @@ -300,17 +288,6 @@ fn create_test_prefiltered_cubemap( }) } -/// Load an HDR environment map from an equirectangular panorama file. -pub fn load_hdr_ibl( - device: &wgpu::Device, - queue: &wgpu::Queue, - layout: &wgpu::BindGroupLayout, - path: impl AsRef<Path>, -) -> Result<IblData, image::ImageError> { - let img = image::open(path)?.into_rgb32f(); - load_hdr_ibl_from_image(device, queue, layout, img) -} - /// Load an HDR environment map from raw bytes (e.g. from `include_bytes!`). pub fn load_hdr_ibl_from_bytes( device: &wgpu::Device, @@ -376,13 +353,7 @@ fn load_hdr_ibl_from_image( ], }); - Ok(IblData { - irradiance_view, - prefiltered_view, - brdf_lut_view, - sampler, - bindgroup, - }) + Ok(IblData { bindgroup }) } /// Convert equirectangular panorama to irradiance cubemap (with hemisphere convolution). @@ -736,12 +707,12 @@ fn hammersley(i: u32, n: u32) -> (f32, f32) { /// Van der Corput radical inverse fn radical_inverse_vdc(mut bits: u32) -> f32 { - bits = (bits << 16) | (bits >> 16); + bits = bits.rotate_right(16); bits = ((bits & 0x55555555) << 1) | ((bits & 0xAAAAAAAA) >> 1); bits = ((bits & 0x33333333) << 2) | ((bits & 0xCCCCCCCC) >> 2); bits = ((bits & 0x0F0F0F0F) << 4) | ((bits & 0xF0F0F0F0) >> 4); bits = ((bits & 0x00FF00FF) << 8) | ((bits & 0xFF00FF00) >> 8); - bits as f32 * 2.3283064365386963e-10 // 0x100000000 + bits as f32 * 2.328_306_4e-10 // 0x100000000 } /// Importance sample the GGX NDF to get a half-vector in tangent space diff --git a/crates/renderbud/src/lib.rs b/crates/renderbud/src/lib.rs @@ -120,16 +120,13 @@ pub struct Renderer { grid_pipeline: wgpu::RenderPipeline, shadow_pipeline: wgpu::RenderPipeline, - shadow_tex: wgpu::Texture, shadow_view: wgpu::TextureView, - shadow_sampler: wgpu::Sampler, shadow_globals_bg: wgpu::BindGroup, world: World, camera_mode: CameraMode, globals: GpuData<Globals>, - globals_bgl: wgpu::BindGroupLayout, object_buf: DynamicObjectBuffer, material: GpuData<MaterialUniform>, @@ -264,7 +261,7 @@ fn make_dynamic_object_buffer( // Alignment for dynamic uniform buffer offsets (typically 256) let align = device.limits().min_uniform_buffer_offset_alignment as u64; let obj_size = std::mem::size_of::<ObjectUniform>() as u64; - let stride = ((obj_size + align - 1) / align) * align; + let stride = obj_size.div_ceil(align) * align; let total_size = stride * MAX_SCENE_OBJECTS as u64; let buffer = device.create_buffer(&wgpu::BufferDescriptor { @@ -329,7 +326,7 @@ impl Renderer { source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()), }); - let (shadow_tex, shadow_view, shadow_sampler) = create_shadow_map(device); + let (_shadow_tex, shadow_view, shadow_sampler) = create_shadow_map(device); let globals_bgl = make_globals_bgl(device); let globals = make_global_gpudata( device, @@ -595,12 +592,9 @@ impl Renderer { skybox_pipeline, grid_pipeline, shadow_pipeline, - shadow_tex, shadow_view, - shadow_sampler, shadow_globals_bg, globals, - globals_bgl, object_buf, material, material_bgl, diff --git a/crates/renderbud/src/material.rs b/crates/renderbud/src/material.rs @@ -13,8 +13,8 @@ pub struct MaterialUniform { } pub struct MaterialGpu { - pub uniform: MaterialUniform, - pub buffer: wgpu::Buffer, + pub _uniform: MaterialUniform, + pub _buffer: wgpu::Buffer, pub bindgroup: wgpu::BindGroup, } diff --git a/crates/renderbud/src/model.rs b/crates/renderbud/src/model.rs @@ -365,7 +365,7 @@ pub fn load_gltf_model( bounds.include_point(Vec3::new(pos[0], pos[1], pos[2])); verts.push(Vertex { - pos: pos, + pos, normal: normals[i], uv: uvs[i], tangent: [0.0, 0.0, 0.0, 0.0], @@ -512,8 +512,8 @@ fn make_material_gpu( }); MaterialGpu { - uniform, - buffer, + _uniform: uniform, + _buffer: buffer, bindgroup, } } diff --git a/crates/renderbud/src/world.rs b/crates/renderbud/src/world.rs @@ -215,11 +215,11 @@ impl World { let id = NodeId { index, generation }; - if let Some(p) = parent { - if self.is_valid(p) { - self.nodes[index as usize].parent = Some(p); - self.attach_child(p, id); - } + if let Some(p) = parent + && self.is_valid(p) + { + self.nodes[index as usize].parent = Some(p); + self.attach_child(p, id); } id