From 0b49557237fce283dae89ecad58d6b451f2b2f1d Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Mon, 27 Jan 2020 19:07:05 -0800 Subject: [PATCH] cleanup --- examples/simple_new_graph.rs | 1 - .../render_graph_2/resource_provider.rs | 2 +- src/render/render_graph_2/wgpu_renderer.rs | 55 +------------------ 3 files changed, 4 insertions(+), 54 deletions(-) diff --git a/examples/simple_new_graph.rs b/examples/simple_new_graph.rs index aff984b4f9..f7848bdc10 100644 --- a/examples/simple_new_graph.rs +++ b/examples/simple_new_graph.rs @@ -13,7 +13,6 @@ fn build_move_system() -> Box { for (mut translation, mut material) in person_query.iter_mut(world) { translation.0 += math::vec3(1.0, 0.0, 0.0) * time.delta_seconds; material.albedo = material.albedo + math::vec4(-time.delta_seconds, -time.delta_seconds, time.delta_seconds, 0.0); - println!("{}", translation.0); } }) } diff --git a/src/render/render_graph_2/resource_provider.rs b/src/render/render_graph_2/resource_provider.rs index 352affce1a..28844a3930 100644 --- a/src/render/render_graph_2/resource_provider.rs +++ b/src/render/render_graph_2/resource_provider.rs @@ -15,7 +15,7 @@ pub trait ResourceProvider { pub struct CameraResourceProvider; impl ResourceProvider for CameraResourceProvider { - fn initialize(&self, renderer: &mut dyn Renderer, world: &mut World) { + fn initialize(&self, _renderer: &mut dyn Renderer, _world: &mut World) { // TODO: create real buffer here } diff --git a/src/render/render_graph_2/wgpu_renderer.rs b/src/render/render_graph_2/wgpu_renderer.rs index b7d3ff5504..caa9ef8893 100644 --- a/src/render/render_graph_2/wgpu_renderer.rs +++ b/src/render/render_graph_2/wgpu_renderer.rs @@ -265,10 +265,10 @@ impl WgpuRenderer { binding: i as u32, resource: match &b.bind_type { BindType::Uniform { - dynamic, - properties, + dynamic: _, + properties: _, } => { - if let ResourceInfo::Buffer { size, buffer_usage } = resource_info { + if let ResourceInfo::Buffer { size, buffer_usage: _ } = resource_info { let buffer = self.buffers.get(&b.name).unwrap(); wgpu::BindingResource::Buffer { buffer: buffer, @@ -303,54 +303,6 @@ impl WgpuRenderer { bind_group_id } - fn setup_entity_shader_uniforms( - &mut self, - bind_group: &BindGroup, - world: &World, - entity: Entity, - shader_uniforms: &ShaderUniforms, - encoder: &mut wgpu::CommandEncoder, - ) { - // TODO: cache hash result in bind_group? - let mut hasher = DefaultHasher::new(); - bind_group.hash(&mut hasher); - let bind_group_id = hasher.finish(); - let bind_group_info = self.bind_groups.get(&bind_group_id).unwrap(); - for unset_uniform in bind_group_info.unset_uniforms.iter() { - let mut found_uniform = false; - for uniform_selector in shader_uniforms.uniform_selectors.iter().rev() { - let uniforms = uniform_selector(entity, world).unwrap_or_else(|| { - panic!( - "ShaderUniform selector points to a missing component. Uniform: {}", - unset_uniform - ) - }); - if let Some(bytes) = uniforms.get_uniform_bytes(unset_uniform) { - // TODO: validate bind_group layout vs shader uniform - let temp_buffer = self - .device - .create_buffer_with_data(bytes.as_slice(), wgpu::BufferUsage::COPY_SRC); - let uniform_buffer = self.buffers.get(unset_uniform).unwrap(); - - encoder.copy_buffer_to_buffer( - &temp_buffer, - 0, - uniform_buffer, - 0, - bytes.len() as u64, - ); - - found_uniform = true; - break; - } - } - - if !found_uniform { - panic!("ShaderUniform did not find a source for Uniform: {}. Consider adding a uniform selector to this entity's ShaderUniforms component.", unset_uniform); - } - } - } - fn setup_dynamic_entity_shader_uniforms(&mut self, world: &World, render_graph: &RenderGraph, encoder: &mut wgpu::CommandEncoder) { let mut dynamic_uniform_info = HashMap::new(); @@ -390,7 +342,6 @@ impl WgpuRenderer { // allocate uniform buffers for (name, info) in dynamic_uniform_info.iter() { let size = wgpu::BIND_BUFFER_ALIGNMENT * info.count; - println!("{} {} {}", name, info.size, info.count); if self.buffers.contains_key(name) { continue; }