Remove unused shadow bind group from the cloud pipeline

This commit is contained in:
Imbris 2021-04-25 21:54:55 -04:00
parent c381059e28
commit 7f9ba17dee
3 changed files with 12 additions and 21 deletions

View File

@ -22,19 +22,19 @@
#include <srgb.glsl>
#include <cloud.glsl>
layout(set = 2, binding = 0)
layout(set = 1, binding = 0)
uniform texture2D t_src_color;
layout(set = 2, binding = 1)
layout(set = 1, binding = 1)
uniform sampler s_src_color;
layout(set = 2, binding = 2)
layout(set = 1, binding = 2)
uniform texture2D t_src_depth;
layout(set = 2, binding = 3)
layout(set = 1, binding = 3)
uniform sampler s_src_depth;
layout(location = 0) in vec2 uv;
layout (std140, set = 2, binding = 4)
layout (std140, set = 1, binding = 4)
uniform u_locals {
mat4 proj_mat_inv;
mat4 view_mat_inv;

View File

@ -42,7 +42,7 @@ impl CloudsLayout {
// Color source
wgpu::BindGroupLayoutEntry {
binding: 0,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
visibility: wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::Texture {
sample_type: wgpu::TextureSampleType::Float { filterable: true },
view_dimension: wgpu::TextureViewDimension::D2,
@ -52,7 +52,7 @@ impl CloudsLayout {
},
wgpu::BindGroupLayoutEntry {
binding: 1,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
visibility: wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::Sampler {
filtering: true,
comparison: false,
@ -62,7 +62,7 @@ impl CloudsLayout {
// Depth source
wgpu::BindGroupLayoutEntry {
binding: 2,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
visibility: wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::Texture {
sample_type: wgpu::TextureSampleType::Float { filterable: true },
view_dimension: wgpu::TextureViewDimension::D2,
@ -72,7 +72,7 @@ impl CloudsLayout {
},
wgpu::BindGroupLayoutEntry {
binding: 3,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
visibility: wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::Sampler {
filtering: true,
comparison: false,
@ -82,7 +82,7 @@ impl CloudsLayout {
// Locals
wgpu::BindGroupLayoutEntry {
binding: 4,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
visibility: wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::Buffer {
ty: wgpu::BufferBindingType::Uniform,
has_dynamic_offset: false,
@ -153,11 +153,7 @@ impl CloudsPipeline {
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("Clouds pipeline layout"),
push_constant_ranges: &[],
bind_group_layouts: &[
&global_layout.globals,
&global_layout.shadow_textures,
&layout.layout,
],
bind_group_layouts: &[&global_layout.globals, &layout.layout],
});
let samples = match aa_mode {

View File

@ -202,9 +202,6 @@ impl<'frame> Drawer<'frame> {
/// Returns None if the clouds pipeline is not available
pub fn second_pass(&mut self) -> Option<SecondPassDrawer> {
let pipeline = &self.borrow.pipelines.all()?.clouds;
// Note: this becomes Some once pipeline creation is complete even if shadows
// are not enabled
let shadow = self.borrow.shadow?;
let encoder = self.encoder.as_mut().unwrap();
let device = self.borrow.device;
@ -223,8 +220,6 @@ impl<'frame> Drawer<'frame> {
});
render_pass.set_bind_group(0, &self.globals.bind_group, &[]);
// TODO: what are shadows used for here????
render_pass.set_bind_group(1, &shadow.bind.bind_group, &[]);
Some(SecondPassDrawer {
render_pass,
@ -743,7 +738,7 @@ impl<'pass> SecondPassDrawer<'pass> {
pub fn draw_clouds(&mut self) {
self.render_pass.set_pipeline(&self.pipeline.pipeline);
self.render_pass
.set_bind_group(2, &self.borrow.locals.clouds_bind.bind_group, &[]);
.set_bind_group(1, &self.borrow.locals.clouds_bind.bind_group, &[]);
self.render_pass.draw(0..3, 0..1);
}
}