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 #ifdef HAS_LOD_FULL_INFO
layout(set = 0, binding = 15) layout(set = 0, binding = 14)
uniform texture2D t_map; uniform texture2D t_map;
layout(set = 0, binding = 16) layout(set = 0, binding = 15)
uniform sampler s_map; uniform sampler s_map;
vec3 lod_col(vec2 pos) { vec3 lod_col(vec2 pos) {

View File

@ -2,7 +2,7 @@
#define RANDOM_GLSL #define RANDOM_GLSL
layout(set = 0, binding = 1) uniform texture2D t_noise; 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) { float hash(vec4 p) {
p = fract(p * 0.3183099 + 0.1) - fract(p + 23.22121); p = fract(p * 0.3183099 + 0.1) - fract(p + 23.22121);

View File

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

View File

@ -16,7 +16,9 @@
#define LIGHTING_DISTRIBUTION LIGHTING_DISTRIBUTION_BECKMANN #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; layout(location = 0) in vec3 f_pos;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -111,7 +111,7 @@ impl Instance {
fn desc<'a>() -> wgpu::VertexBufferDescriptor<'a> { fn desc<'a>() -> wgpu::VertexBufferDescriptor<'a> {
use std::mem; 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 { wgpu::VertexBufferDescriptor {
stride: mem::size_of::<Self>() as wgpu::BufferAddress, stride: mem::size_of::<Self>() as wgpu::BufferAddress,
step_mode: wgpu::InputStepMode::Instance, step_mode: wgpu::InputStepMode::Instance,
@ -224,6 +224,7 @@ impl SpritePipeline {
terrain_layout: &TerrainLayout, terrain_layout: &TerrainLayout,
aa_mode: AaMode, aa_mode: AaMode,
) -> Self { ) -> Self {
common::span!(_guard, "SpritePipeline::new");
let render_pipeline_layout = let render_pipeline_layout =
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("Sprite pipeline layout"), label: Some("Sprite pipeline layout"),

View File

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

View File

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