fixed validation errors when creating pipelines

This commit is contained in:
Imbris 2020-11-29 23:22:13 -05:00 committed by Avi Weinstock
parent f67fce54fe
commit 2d418f3d69
15 changed files with 34 additions and 29 deletions

View File

@ -285,9 +285,9 @@ vec3 lod_pos(vec2 pos, vec2 focus_pos) {
}
#ifdef HAS_LOD_FULL_INFO
layout(set = 0, binding = 15)
layout(set = 0, binding = 14)
uniform texture2D t_map;
layout(set = 0, binding = 16)
layout(set = 0, binding = 15)
uniform sampler s_map;
vec3 lod_col(vec2 pos) {

View File

@ -2,7 +2,7 @@
#define RANDOM_GLSL
layout(set = 0, binding = 1) uniform texture2D t_noise;
layout(set = 0, binding = 1) uniform sampler s_noise;
layout(set = 0, binding = 2) uniform sampler s_noise;
float hash(vec4 p) {
p = fract(p * 0.3183099 + 0.1) - fract(p + 23.22121);

View File

@ -15,18 +15,18 @@ uniform u_light_shadows {
};
// Use with sampler2DShadow
layout(set = 0, binding = 13)
layout(set = 0, binding = 12)
uniform texture2D t_directed_shadow_maps;
layout(set = 0, binding = 14)
layout(set = 0, binding = 13)
uniform sampler s_directed_shadow_maps;
// uniform sampler2DArrayShadow t_directed_shadow_maps;
// uniform samplerCubeArrayShadow t_shadow_maps;
// uniform samplerCubeArray t_shadow_maps;
// Use with samplerCubeShadow
layout(set = 0, binding = 11)
layout(set = 0, binding = 10)
uniform textureCube t_point_shadow_maps;
layout(set = 0, binding = 12)
layout(set = 0, binding = 11)
uniform sampler s_point_shadow_maps;
// uniform samplerCube t_shadow_maps;

View File

@ -16,7 +16,9 @@
#define LIGHTING_DISTRIBUTION LIGHTING_DISTRIBUTION_BECKMANN
#include <lod.glsl> // includes sky, globals
#include <globals.glsl>
#include <sky.glsl>
#include <lod.glsl>
layout(location = 0) in vec3 f_pos;

View File

@ -139,6 +139,7 @@ impl CloudsPipeline {
layout: &CloudsLayout,
aa_mode: AaMode,
) -> Self {
common::span!(_guard, "CloudsPipeline::new");
let render_pipeline_layout =
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("Clouds pipeline layout"),

View File

@ -181,6 +181,7 @@ impl FigurePipeline {
layout: &FigureLayout,
aa_mode: AaMode,
) -> Self {
common::span!(_guard, "FigurePipeline::new");
let render_pipeline_layout =
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("Figure pipeline layout"),

View File

@ -90,6 +90,7 @@ impl FluidPipeline {
terrain_layout: &TerrainLayout,
aa_mode: AaMode,
) -> Self {
common::span!(_guard, "FluidPipeline::new");
let render_pipeline_layout =
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("Fluid pipeline layout"),

View File

@ -316,26 +316,19 @@ impl GlobalsLayouts {
count: None,
},
// light shadows
// TODO: should this be a uniform?
wgpu::BindGroupLayoutEntry {
binding: 9,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::SampledTexture {
component_type: wgpu::TextureComponentType::Float,
dimension: wgpu::TextureViewDimension::D2,
multisampled: false,
// TODO: is this relevant?
ty: wgpu::BindingType::UniformBuffer {
dynamic: false,
min_binding_size: None,
},
count: None,
},
wgpu::BindGroupLayoutEntry {
binding: 10,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::Sampler { comparison: false },
count: None,
},
// point shadow_maps
wgpu::BindGroupLayoutEntry {
binding: 11,
binding: 10,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::SampledTexture {
component_type: wgpu::TextureComponentType::Float,
@ -345,14 +338,14 @@ impl GlobalsLayouts {
count: None,
},
wgpu::BindGroupLayoutEntry {
binding: 12,
binding: 11,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::Sampler { comparison: false },
count: None,
},
// directed shadow maps
wgpu::BindGroupLayoutEntry {
binding: 13,
binding: 12,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::SampledTexture {
component_type: wgpu::TextureComponentType::Float,
@ -362,14 +355,14 @@ impl GlobalsLayouts {
count: None,
},
wgpu::BindGroupLayoutEntry {
binding: 14,
binding: 13,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::Sampler { comparison: false },
count: None,
},
// lod map (t_map)
wgpu::BindGroupLayoutEntry {
binding: 15,
binding: 14,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::SampledTexture {
component_type: wgpu::TextureComponentType::Float,
@ -379,7 +372,7 @@ impl GlobalsLayouts {
count: None,
},
wgpu::BindGroupLayoutEntry {
binding: 16,
binding: 15,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
ty: wgpu::BindingType::Sampler { comparison: false },
count: None,

View File

@ -152,8 +152,7 @@ impl Instance {
fn desc<'a>() -> wgpu::VertexBufferDescriptor<'a> {
use std::mem;
const ATTRIBUTES: [wgpu::VertexAttributeDescriptor; 5] =
wgpu::vertex_attr_array![0 => Float, 1 => Float, 2 => Float, 3 => Int, 4 => Float3];
const ATTRIBUTES: [wgpu::VertexAttributeDescriptor; 6] = wgpu::vertex_attr_array![2 => Float, 3 => Float, 4 => Float, 5 => Int, 6 => Float3, 7 => Float3];
wgpu::VertexBufferDescriptor {
stride: mem::size_of::<Self>() as wgpu::BufferAddress,
step_mode: wgpu::InputStepMode::Instance,
@ -179,6 +178,7 @@ impl ParticlePipeline {
global_layout: &GlobalsLayouts,
aa_mode: AaMode,
) -> Self {
common::span!(_guard, "ParticlePipeline::new");
let render_pipeline_layout =
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("Particle pipeline layout"),

View File

@ -135,6 +135,7 @@ impl PostProcessPipeline {
layout: &PostProcessLayout,
aa_mode: AaMode,
) -> Self {
common::span!(_guard, "PostProcessPipeline::new");
let render_pipeline_layout =
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("Post process pipeline layout"),

View File

@ -22,6 +22,7 @@ impl Locals {
pub fn default() -> Self { Self::new(Mat4::identity(), Mat4::identity()) }
// TODO: unused?
fn layout(device: &wgpu::Device) -> wgpu::BindGroupLayout {
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
label: None,
@ -114,6 +115,8 @@ impl ShadowFigurePipeline {
layout: &ShadowLayout,
aa_mode: AaMode,
) -> Self {
common::span!(_guard, "new");
tracing::error!("test");
let render_pipeline_layout =
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("Shadow figure pipeline layout"),

View File

@ -35,6 +35,7 @@ impl SkyboxPipeline {
layouts: &GlobalsLayouts,
aa_mode: AaMode,
) -> Self {
common::span!(_guard, "SkyboxPipeline::new");
let render_pipeline_layout =
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("Skybox pipeline layout"),

View File

@ -111,7 +111,7 @@ impl Instance {
fn desc<'a>() -> wgpu::VertexBufferDescriptor<'a> {
use std::mem;
const ATTRIBUTES: [wgpu::VertexAttributeDescriptor; 6] = wgpu::vertex_attr_array![0 => Uint, 1 => Float4,2 => Float4, 3 => Float4,4 => Float4, 5 => Float];
const ATTRIBUTES: [wgpu::VertexAttributeDescriptor; 7] = wgpu::vertex_attr_array![3 => Uint, 4 => Float4, 5 => Float4, 6 => Float4,7 => Float4, 8 => Float4, 9 => Float];
wgpu::VertexBufferDescriptor {
stride: mem::size_of::<Self>() as wgpu::BufferAddress,
step_mode: wgpu::InputStepMode::Instance,
@ -224,6 +224,7 @@ impl SpritePipeline {
terrain_layout: &TerrainLayout,
aa_mode: AaMode,
) -> Self {
common::span!(_guard, "SpritePipeline::new");
let render_pipeline_layout =
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("Sprite pipeline layout"),

View File

@ -207,6 +207,7 @@ impl TerrainPipeline {
layout: &TerrainLayout,
aa_mode: AaMode,
) -> Self {
common::span!(_guard, "TerrainPipeline::new");
let render_pipeline_layout =
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("Terrain pipeline layout"),

View File

@ -1946,7 +1946,7 @@ fn create_pipelines(
.concat();
let fluid_pipeline = fluid::FluidPipeline::new(
device,
&terrain_vert,
&create_shader("fluid-vert", ShaderKind::Vertex)?,
&create_shader(&selected_fluid_shader, ShaderKind::Fragment)?,
sc_desc,
&layouts.global,