From e8dfc0081b027d5c1ab92cffddfbecdaea7db88b Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Mon, 20 Jan 2020 02:03:05 -0800 Subject: [PATCH] supress warnings --- src/render/render_graph_2/draw_target.rs | 8 +++---- src/render/render_graph_2/mod.rs | 24 +------------------ .../render_graph_2/pipelines/forward/mod.rs | 2 +- src/render/render_graph_2/wgpu_renderer.rs | 4 ++-- 4 files changed, 8 insertions(+), 30 deletions(-) diff --git a/src/render/render_graph_2/draw_target.rs b/src/render/render_graph_2/draw_target.rs index b14de073c1..888b185aa2 100644 --- a/src/render/render_graph_2/draw_target.rs +++ b/src/render/render_graph_2/draw_target.rs @@ -10,12 +10,12 @@ use crate::{ // A set of draw calls. ex: get + draw meshes, get + draw instanced meshes, draw ui meshes, etc pub type DrawTarget = fn(world: &World, render_pass: &mut dyn RenderPass); -pub fn mesh_draw_target(world: &World, render_pass: &mut dyn RenderPass) { +pub fn mesh_draw_target(world: &World, _render_pass: &mut dyn RenderPass) { let mut mesh_storage = world.resources.get_mut::>().unwrap(); let mut last_mesh_id = None; let mesh_query = <(Read, Read>)>::query().filter(!component::()); - for (material, mesh) in mesh_query.iter(world) { + for (_material, mesh) in mesh_query.iter(world) { let current_mesh_id = mesh.id; let mut should_load_mesh = last_mesh_id == None; @@ -24,14 +24,14 @@ pub fn mesh_draw_target(world: &World, render_pass: &mut dyn RenderPass) { } if should_load_mesh { - if let Some(mesh_asset) = mesh_storage.get(mesh.id) { + if let Some(_mesh_asset) = mesh_storage.get(mesh.id) { // render_pass.load_mesh(mesh.id, mesh_asset); // render_pass.set_index_buffer(mesh_asset.index_buffer.as_ref().unwrap(), 0); // render_pass.set_vertex_buffers(0, &[(&mesh_asset.vertex_buffer.as_ref().unwrap(), 0)]); }; } - if let Some(ref mesh_asset) = mesh_storage.get(mesh.id) { + if let Some(ref _mesh_asset) = mesh_storage.get(mesh.id) { // pass.set_bind_group(1, material.bind_group.as_ref().unwrap(), &[]); // pass.draw_indexed(0..mesh_asset.indices.len() as u32, 0, 0..1); }; diff --git a/src/render/render_graph_2/mod.rs b/src/render/render_graph_2/mod.rs index dba455f4ca..f689ea9dee 100644 --- a/src/render/render_graph_2/mod.rs +++ b/src/render/render_graph_2/mod.rs @@ -13,26 +13,4 @@ pub use pass::*; pub use renderer::*; pub use shader::*; pub use render_graph::*; -pub use draw_target::*; - -// a named graphics resource provided by a resource provider -pub struct Resource { - resource_type: ResourceType, - name: String, -} - -// a resource type -enum ResourceType { - Texture, - Buffer, - Sampler, -} - -// impl Into for StandardMaterial - -// manages a specific named resource in a RenderGraph. [my_texture_name: TextureView]--> -// updates resources based on events like "resize" or "update" -// if there are no resources in use, dont run allocate resource provider resources on gpu -trait ResourceProvider { - fn get_resources(&self) -> &[Resource]; -} \ No newline at end of file +pub use draw_target::*; \ No newline at end of file diff --git a/src/render/render_graph_2/pipelines/forward/mod.rs b/src/render/render_graph_2/pipelines/forward/mod.rs index 77fbdea71d..3642bad1f6 100644 --- a/src/render/render_graph_2/pipelines/forward/mod.rs +++ b/src/render/render_graph_2/pipelines/forward/mod.rs @@ -3,7 +3,7 @@ use crate::render::{ { render_graph_2::{ mesh_draw_target, PassDescriptor, PipelineDescriptor, RenderGraphBuilder, - RenderPassColorAttachmentDescriptor, RenderPassDepthStencilAttachmentDescriptor, + RenderPassColorAttachmentDescriptor, resource, }, shader::{Shader, ShaderStage}, diff --git a/src/render/render_graph_2/wgpu_renderer.rs b/src/render/render_graph_2/wgpu_renderer.rs index b7609b1047..63f41a1a43 100644 --- a/src/render/render_graph_2/wgpu_renderer.rs +++ b/src/render/render_graph_2/wgpu_renderer.rs @@ -191,11 +191,11 @@ impl Renderer for WgpuRenderer { } fn resize(&mut self, world: &mut World, width: u32, height: u32) { + self.swap_chain_descriptor.width = width; + self.swap_chain_descriptor.height = height; let swap_chain = self .device .create_swap_chain(self.surface.as_ref().unwrap(), &self.swap_chain_descriptor); - self.swap_chain_descriptor.width = width; - self.swap_chain_descriptor.height = height; // WgpuRenderer can't own swap_chain without creating lifetime ergonomics issues world.resources.insert(swap_chain);