diff options
Diffstat (limited to 'client/src/render/scene')
-rw-r--r-- | client/src/render/scene/demand_map.rs | 6 | ||||
-rw-r--r-- | client/src/render/scene/draw.rs | 2 | ||||
-rw-r--r-- | client/src/render/scene/mod.rs | 24 | ||||
-rw-r--r-- | client/src/render/scene/textures.rs | 10 |
4 files changed, 22 insertions, 20 deletions
diff --git a/client/src/render/scene/demand_map.rs b/client/src/render/scene/demand_map.rs index c27eaac..dc73142 100644 --- a/client/src/render/scene/demand_map.rs +++ b/client/src/render/scene/demand_map.rs @@ -29,6 +29,12 @@ struct DemandMapState<K, V> { needed: HashSet<K>, size_metric: usize, } +impl<K: Hash + Eq + Clone, V: Clone> Default for DemandMap<K, V> { + fn default() -> Self { + Self::new() + } +} + impl<K: Hash + Eq + Clone, V: Clone> DemandMap<K, V> { pub fn new() -> Self { Self { diff --git a/client/src/render/scene/draw.rs b/client/src/render/scene/draw.rs index 1109401..b2bf19e 100644 --- a/client/src/render/scene/draw.rs +++ b/client/src/render/scene/draw.rs @@ -53,7 +53,7 @@ impl ScenePipeline { }, })], depth_stencil_attachment: Some(RenderPassDepthStencilAttachment { - view: &depth, + view: depth, depth_ops: Some(Operations { load: LoadOp::Clear(1.), store: StoreOp::Store, diff --git a/client/src/render/scene/mod.rs b/client/src/render/scene/mod.rs index 16eecfc..7743409 100644 --- a/client/src/render/scene/mod.rs +++ b/client/src/render/scene/mod.rs @@ -293,13 +293,11 @@ impl ScenePreparer { }) { tex_albedo = Some(bg) } - } else { - if let Some((_tex, bg)) = self - .placeholder_textures - .try_get(TextureIdentityKind::Multiply) - { - tex_albedo = Some(bg) - } + } else if let Some((_tex, bg)) = self + .placeholder_textures + .try_get(TextureIdentityKind::Multiply) + { + tex_albedo = Some(bg) } let mut tex_normal = None; if let Some(normalres) = part.tex_normal { @@ -309,13 +307,11 @@ impl ScenePreparer { }) { tex_normal = Some(bg) } - } else { - if let Some((_tex, bg)) = self - .placeholder_textures - .try_get(TextureIdentityKind::Normal) - { - tex_normal = Some(bg) - } + } else if let Some((_tex, bg)) = self + .placeholder_textures + .try_get(TextureIdentityKind::Normal) + { + tex_normal = Some(bg) } let material = self.materials.try_get({ diff --git a/client/src/render/scene/textures.rs b/client/src/render/scene/textures.rs index 4f2b01c..462cb53 100644 --- a/client/src/render/scene/textures.rs +++ b/client/src/render/scene/textures.rs @@ -27,8 +27,8 @@ use std::{ use wgpu::{ AddressMode, BindGroup, BindGroupDescriptor, BindGroupEntry, BindGroupLayout, BindingResource, Color, ColorTargetState, ColorWrites, CommandEncoderDescriptor, Device, Extent3d, FilterMode, - ImageDataLayout, LoadOp, Operations, Queue, RenderPassColorAttachment, RenderPassDescriptor, - RenderPipeline, SamplerDescriptor, StoreOp, Texture, TextureAspect, TextureDescriptor, + LoadOp, Operations, Queue, RenderPassColorAttachment, RenderPassDescriptor, RenderPipeline, + SamplerDescriptor, StoreOp, TexelCopyBufferLayout, Texture, TextureAspect, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages, TextureViewDescriptor, include_wgsl, }; @@ -193,7 +193,7 @@ fn create_texture( }); let bind_group = device.create_bind_group(&BindGroupDescriptor { label: None, - layout: &bgl, + layout: bgl, entries: &[ BindGroupEntry { binding: 0, @@ -246,7 +246,7 @@ fn create_texture( queue.write_texture( texture.as_image_copy(), data, - ImageDataLayout { + TexelCopyBufferLayout { bytes_per_row: Some(width * 4), rows_per_image: None, offset: 0, @@ -287,7 +287,7 @@ fn create_texture( occlusion_query_set: None, }); - rpass.set_pipeline(&mip_pipeline); + rpass.set_pipeline(mip_pipeline); rpass.set_bind_group(0, &mip_bind_group, &[]); rpass.draw(0..3, 0..1); } |