supress warnings

This commit is contained in:
Carter Anderson 2020-01-20 02:03:05 -08:00
parent d7bd49694b
commit e8dfc0081b
4 changed files with 8 additions and 30 deletions

View file

@ -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::<AssetStorage<Mesh>>().unwrap();
let mut last_mesh_id = None;
let mesh_query =
<(Read<ShaderMaterials>, Read<Handle<Mesh>>)>::query().filter(!component::<Instanced>());
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);
};

View file

@ -14,25 +14,3 @@ 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<ShaderMaterial> 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];
}

View file

@ -3,7 +3,7 @@ use crate::render::{
{
render_graph_2::{
mesh_draw_target, PassDescriptor, PipelineDescriptor, RenderGraphBuilder,
RenderPassColorAttachmentDescriptor, RenderPassDepthStencilAttachmentDescriptor,
RenderPassColorAttachmentDescriptor,
resource,
},
shader::{Shader, ShaderStage},

View file

@ -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);