Remove unused waves texture

This commit is contained in:
Imbris 2021-04-26 19:41:11 -04:00 committed by Avi Weinstock
parent ebe063442a
commit af1962f11c
11 changed files with 13 additions and 118 deletions

View File

@ -37,18 +37,13 @@ layout(location = 1) flat in uint f_pos_norm;
// ShadowLocals shadowMats[/*MAX_LAYER_FACES*/192];
// };
layout(std140, set = 3, binding = 0)
layout(std140, set = 2, binding = 0)
uniform u_locals {
vec3 model_offs;
float load_time;
ivec4 atlas_offs;
};
layout(set = 2, binding = 0)
uniform texture2D t_waves;
layout(set = 2, binding = 1)
uniform sampler s_waves;
layout(location = 0) out vec4 tgt_color;
#include <sky.glsl>

View File

@ -39,18 +39,13 @@ layout(location = 1) flat in uint f_pos_norm;
// ShadowLocals shadowMats[/*MAX_LAYER_FACES*/192];
//};
layout(std140, set = 3, binding = 0)
layout(std140, set = 2, binding = 0)
uniform u_locals {
vec3 model_offs;
float load_time;
ivec4 atlas_offs;
};
layout(set = 2, binding = 0)
uniform texture2D t_waves;
layout(set = 2, binding = 1)
uniform sampler s_waves;
layout(location = 0) out vec4 tgt_color;
#include <cloud.glsl>

View File

@ -23,7 +23,7 @@
layout(location = 0) in uint v_pos_norm;
// in uint v_col_light;
layout(std140, set = 3, binding = 0)
layout(std140, set = 2, binding = 0)
uniform u_locals {
vec3 model_offs;
float load_time;

BIN
assets/voxygen/texture/waves.png (Stored with Git LFS)

Binary file not shown.

View File

@ -25,7 +25,7 @@ pub use self::{
BoneData as FigureBoneData, BoneMeshes, FigureLayout, FigureModel,
Locals as FigureLocals,
},
fluid::{BindGroup as FluidWaves, Vertex as FluidVertex},
fluid::Vertex as FluidVertex,
lod_terrain::{LodData, Vertex as LodTerrainVertex},
particle::{Instance as ParticleInstance, Vertex as ParticleVertex},
postprocess::Locals as PostProcessLocals,

View File

@ -1,4 +1,4 @@
use super::super::{AaMode, GlobalsLayouts, TerrainLayout, Texture, Vertex as VertexTrait};
use super::super::{AaMode, GlobalsLayouts, TerrainLayout, Vertex as VertexTrait};
use bytemuck::{Pod, Zeroable};
use std::mem;
use vek::*;
@ -47,65 +47,6 @@ impl VertexTrait for Vertex {
const STRIDE: wgpu::BufferAddress = mem::size_of::<Self>() as wgpu::BufferAddress;
}
pub struct BindGroup {
pub(in super::super) bind_group: wgpu::BindGroup,
waves: Texture,
}
pub struct FluidLayout {
pub waves: wgpu::BindGroupLayout,
}
impl FluidLayout {
pub fn new(device: &wgpu::Device) -> Self {
Self {
waves: device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
label: None,
entries: &[
wgpu::BindGroupLayoutEntry {
binding: 0,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::Texture {
sample_type: wgpu::TextureSampleType::Float { filterable: true },
view_dimension: wgpu::TextureViewDimension::D2,
multisampled: false,
},
count: None,
},
wgpu::BindGroupLayoutEntry {
binding: 1,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::Sampler {
filtering: true,
comparison: false,
},
count: None,
},
],
}),
}
}
pub fn bind(&self, device: &wgpu::Device, waves: Texture) -> BindGroup {
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
label: None,
layout: &self.waves,
entries: &[
wgpu::BindGroupEntry {
binding: 0,
resource: wgpu::BindingResource::TextureView(&waves.view),
},
wgpu::BindGroupEntry {
binding: 1,
resource: wgpu::BindingResource::Sampler(&waves.sampler),
},
],
});
BindGroup { bind_group, waves }
}
}
pub struct FluidPipeline {
pub pipeline: wgpu::RenderPipeline,
}
@ -116,7 +57,6 @@ impl FluidPipeline {
vs_module: &wgpu::ShaderModule,
fs_module: &wgpu::ShaderModule,
global_layout: &GlobalsLayouts,
layout: &FluidLayout,
terrain_layout: &TerrainLayout,
aa_mode: AaMode,
) -> Self {
@ -128,7 +68,6 @@ impl FluidPipeline {
bind_group_layouts: &[
&global_layout.globals,
&global_layout.shadow_textures,
&layout.waves,
&terrain_layout.locals,
],
});

View File

@ -21,7 +21,7 @@ use super::{
mesh::Mesh,
model::{DynamicModel, Model},
pipelines::{
blit, clouds, figure, fluid, postprocess, shadow, sprite, terrain, ui, GlobalsBindGroup,
blit, clouds, figure, postprocess, shadow, sprite, terrain, ui, GlobalsBindGroup,
GlobalsLayouts, ShadowTexturesBindGroup,
},
texture::Texture,
@ -49,7 +49,6 @@ struct Layouts {
clouds: clouds::CloudsLayout,
figure: figure::FigureLayout,
fluid: fluid::FluidLayout,
postprocess: postprocess::PostProcessLayout,
shadow: shadow::ShadowLayout,
sprite: sprite::SpriteLayout,
@ -266,7 +265,6 @@ impl Renderer {
let clouds = clouds::CloudsLayout::new(&device);
let figure = figure::FigureLayout::new(&device);
let fluid = fluid::FluidLayout::new(&device);
let postprocess = postprocess::PostProcessLayout::new(&device);
let shadow = shadow::ShadowLayout::new(&device);
let sprite = sprite::SpriteLayout::new(&device);
@ -279,7 +277,6 @@ impl Renderer {
clouds,
figure,
fluid,
postprocess,
shadow,
sprite,

View File

@ -2,7 +2,7 @@ use super::{
super::{
buffer::Buffer,
pipelines::{
figure, fluid, lod_terrain, shadow, sprite, terrain, ui, ColLights, GlobalModel,
figure, lod_terrain, shadow, sprite, terrain, ui, ColLights, GlobalModel,
GlobalsBindGroup,
},
texture::Texture,
@ -87,8 +87,4 @@ impl Renderer {
pub fn sprite_bind_col_light(&self, col_light: Texture) -> ColLights<sprite::Locals> {
self.layouts.global.bind_col_light(&self.device, col_light)
}
pub fn fluid_bind_waves(&self, texture: Texture) -> fluid::BindGroup {
self.layouts.fluid.bind(&self.device, texture)
}
}

View File

@ -584,15 +584,11 @@ impl<'pass> FirstPassDrawer<'pass> {
}
}
pub fn draw_fluid<'data: 'pass>(
&mut self,
waves: &'data fluid::BindGroup,
) -> FluidDrawer<'_, 'pass> {
pub fn draw_fluid<'data: 'pass>(&mut self) -> FluidDrawer<'_, 'pass> {
let mut render_pass = self.render_pass.scope("fluid", self.borrow.device);
render_pass.set_pipeline(&self.pipelines.fluid.pipeline);
set_quad_index_buffer::<fluid::Vertex>(&mut render_pass, &self.borrow);
render_pass.set_bind_group(2, &waves.bind_group, &[]);
FluidDrawer { render_pass }
}
@ -717,7 +713,7 @@ impl<'pass_ref, 'pass: 'pass_ref> FluidDrawer<'pass_ref, 'pass> {
locals: &'data terrain::BoundLocals,
) {
self.render_pass.set_vertex_buffer(0, model.buf().slice(..));
self.render_pass.set_bind_group(3, &locals.bind_group, &[]);
self.render_pass.set_bind_group(2, &locals.bind_group, &[]);
self.render_pass
.draw_indexed(0..model.len() as u32 / 4 * 6, 0, 0..1);
}

View File

@ -439,7 +439,6 @@ fn create_ingame_and_shadow_pipelines(
&shaders.fluid_vert,
&shaders.fluid_frag,
&layouts.global,
&layouts.fluid,
&layouts.terrain,
mode.aa,
)

View File

@ -11,9 +11,9 @@ use crate::{
render::{
create_sprite_verts_buffer,
pipelines::{self, ColLights},
Buffer, ColLightInfo, FirstPassDrawer, FluidVertex, FluidWaves, GlobalModel, Instances,
LodData, Mesh, Model, RenderError, Renderer, SpriteGlobalsBindGroup, SpriteInstance,
SpriteVertex, TerrainLocals, TerrainShadowDrawer, TerrainVertex, SPRITE_VERT_PAGE_SIZE,
Buffer, ColLightInfo, FirstPassDrawer, FluidVertex, GlobalModel, Instances, LodData, Mesh,
Model, RenderError, Renderer, SpriteGlobalsBindGroup, SpriteInstance, SpriteVertex,
TerrainLocals, TerrainShadowDrawer, TerrainVertex, SPRITE_VERT_PAGE_SIZE,
},
};
@ -360,7 +360,6 @@ pub struct Terrain<V: RectRasterableVol = TerrainChunk> {
/// for any particular chunk; look at the `texture` field in
/// `TerrainChunkData` for that.
col_lights: Arc<ColLights<pipelines::terrain::Locals>>,
waves: FluidWaves,
phantom: PhantomData<V>,
}
@ -590,24 +589,6 @@ impl<V: RectRasterableVol> Terrain<V> {
&sprite_render_context.sprite_verts_buffer,
),
col_lights: Arc::new(col_lights),
waves: {
let waves_tex = renderer
.create_texture(
// TODO: actually this is unused, remove?
// TODO: re-add alpha channel?
&image::DynamicImage::ImageRgba8(
assets::Image::load_expect("voxygen.texture.waves")
.read()
.0
.to_rgba8(),
),
Some(wgpu::FilterMode::Linear),
Some(wgpu::AddressMode::Repeat),
)
.expect("Failed to create wave texture");
renderer.fluid_bind_waves(waves_tex)
},
phantom: PhantomData,
}
}
@ -1599,7 +1580,7 @@ impl<V: RectRasterableVol> Terrain<V> {
// Translucent
span!(guard, "Fluid chunks");
let mut fluid_drawer = drawer.draw_fluid(&self.waves);
let mut fluid_drawer = drawer.draw_fluid();
chunk_iter
.filter(|(_, chunk)| chunk.visible.is_visible())
.filter_map(|(_, chunk)| {