Fix wrong intermediate target texture format

This commit is contained in:
Imbris 2021-04-21 23:31:44 -04:00 committed by Avi Weinstock
parent 8669788682
commit 584c152dd3
9 changed files with 12 additions and 26 deletions

View File

@ -145,7 +145,6 @@ impl CloudsPipeline {
vs_module: &wgpu::ShaderModule, vs_module: &wgpu::ShaderModule,
fs_module: &wgpu::ShaderModule, fs_module: &wgpu::ShaderModule,
global_layout: &GlobalsLayouts, global_layout: &GlobalsLayouts,
sc_desc: &wgpu::SwapChainDescriptor,
layout: &CloudsLayout, layout: &CloudsLayout,
aa_mode: AaMode, aa_mode: AaMode,
) -> Self { ) -> Self {
@ -196,7 +195,7 @@ impl CloudsPipeline {
module: fs_module, module: fs_module,
entry_point: "main", entry_point: "main",
targets: &[wgpu::ColorTargetState { targets: &[wgpu::ColorTargetState {
format: sc_desc.format, format: wgpu::TextureFormat::Rgba16Float,
blend: None, blend: None,
write_mask: wgpu::ColorWrite::ALL, write_mask: wgpu::ColorWrite::ALL,
}], }],

View File

@ -173,7 +173,6 @@ impl FigurePipeline {
device: &wgpu::Device, device: &wgpu::Device,
vs_module: &wgpu::ShaderModule, vs_module: &wgpu::ShaderModule,
fs_module: &wgpu::ShaderModule, fs_module: &wgpu::ShaderModule,
sc_desc: &wgpu::SwapChainDescriptor,
global_layout: &GlobalsLayouts, global_layout: &GlobalsLayouts,
layout: &FigureLayout, layout: &FigureLayout,
aa_mode: AaMode, aa_mode: AaMode,
@ -241,7 +240,7 @@ impl FigurePipeline {
module: fs_module, module: fs_module,
entry_point: "main", entry_point: "main",
targets: &[wgpu::ColorTargetState { targets: &[wgpu::ColorTargetState {
format: sc_desc.format, format: wgpu::TextureFormat::Rgba16Float,
blend: None, blend: None,
write_mask: wgpu::ColorWrite::ALL, write_mask: wgpu::ColorWrite::ALL,
}], }],

View File

@ -115,7 +115,6 @@ impl FluidPipeline {
device: &wgpu::Device, device: &wgpu::Device,
vs_module: &wgpu::ShaderModule, vs_module: &wgpu::ShaderModule,
fs_module: &wgpu::ShaderModule, fs_module: &wgpu::ShaderModule,
sc_desc: &wgpu::SwapChainDescriptor,
global_layout: &GlobalsLayouts, global_layout: &GlobalsLayouts,
layout: &FluidLayout, layout: &FluidLayout,
terrain_layout: &TerrainLayout, terrain_layout: &TerrainLayout,
@ -184,7 +183,7 @@ impl FluidPipeline {
module: fs_module, module: fs_module,
entry_point: "main", entry_point: "main",
targets: &[wgpu::ColorTargetState { targets: &[wgpu::ColorTargetState {
format: sc_desc.format, format: wgpu::TextureFormat::Rgba16Float,
blend: Some(wgpu::BlendState { blend: Some(wgpu::BlendState {
color: wgpu::BlendComponent { color: wgpu::BlendComponent {
src_factor: wgpu::BlendFactor::SrcAlpha, src_factor: wgpu::BlendFactor::SrcAlpha,

View File

@ -152,7 +152,6 @@ impl LodTerrainPipeline {
device: &wgpu::Device, device: &wgpu::Device,
vs_module: &wgpu::ShaderModule, vs_module: &wgpu::ShaderModule,
fs_module: &wgpu::ShaderModule, fs_module: &wgpu::ShaderModule,
sc_desc: &wgpu::SwapChainDescriptor,
global_layout: &GlobalsLayouts, global_layout: &GlobalsLayouts,
aa_mode: AaMode, aa_mode: AaMode,
) -> Self { ) -> Self {
@ -213,7 +212,7 @@ impl LodTerrainPipeline {
module: fs_module, module: fs_module,
entry_point: "main", entry_point: "main",
targets: &[wgpu::ColorTargetState { targets: &[wgpu::ColorTargetState {
format: sc_desc.format, format: wgpu::TextureFormat::Rgba16Float,
blend: None, blend: None,
write_mask: wgpu::ColorWrite::ALL, write_mask: wgpu::ColorWrite::ALL,
}], }],

View File

@ -175,7 +175,6 @@ impl ParticlePipeline {
device: &wgpu::Device, device: &wgpu::Device,
vs_module: &wgpu::ShaderModule, vs_module: &wgpu::ShaderModule,
fs_module: &wgpu::ShaderModule, fs_module: &wgpu::ShaderModule,
sc_desc: &wgpu::SwapChainDescriptor,
global_layout: &GlobalsLayouts, global_layout: &GlobalsLayouts,
aa_mode: AaMode, aa_mode: AaMode,
) -> Self { ) -> Self {
@ -237,7 +236,8 @@ impl ParticlePipeline {
module: fs_module, module: fs_module,
entry_point: "main", entry_point: "main",
targets: &[wgpu::ColorTargetState { targets: &[wgpu::ColorTargetState {
format: sc_desc.format, // TODO: use a constant and/or pass in this format on pipeline construction
format: wgpu::TextureFormat::Rgba16Float,
blend: Some(wgpu::BlendState { blend: Some(wgpu::BlendState {
color: wgpu::BlendComponent { color: wgpu::BlendComponent {
src_factor: wgpu::BlendFactor::SrcAlpha, src_factor: wgpu::BlendFactor::SrcAlpha,

View File

@ -27,6 +27,7 @@ impl VertexTrait for Vertex {
const STRIDE: wgpu::BufferAddress = mem::size_of::<Self>() as wgpu::BufferAddress; const STRIDE: wgpu::BufferAddress = mem::size_of::<Self>() as wgpu::BufferAddress;
} }
// TODO: does skybox still do anything with new cloud shaders?
pub struct SkyboxPipeline { pub struct SkyboxPipeline {
pub pipeline: wgpu::RenderPipeline, pub pipeline: wgpu::RenderPipeline,
} }
@ -36,7 +37,6 @@ impl SkyboxPipeline {
device: &wgpu::Device, device: &wgpu::Device,
vs_module: &wgpu::ShaderModule, vs_module: &wgpu::ShaderModule,
fs_module: &wgpu::ShaderModule, fs_module: &wgpu::ShaderModule,
sc_desc: &wgpu::SwapChainDescriptor,
layouts: &GlobalsLayouts, layouts: &GlobalsLayouts,
aa_mode: AaMode, aa_mode: AaMode,
) -> Self { ) -> Self {
@ -98,7 +98,7 @@ impl SkyboxPipeline {
module: fs_module, module: fs_module,
entry_point: "main", entry_point: "main",
targets: &[wgpu::ColorTargetState { targets: &[wgpu::ColorTargetState {
format: sc_desc.format, format: wgpu::TextureFormat::Rgba16Float,
blend: None, blend: None,
write_mask: wgpu::ColorWrite::ALL, write_mask: wgpu::ColorWrite::ALL,
}], }],

View File

@ -406,7 +406,6 @@ impl SpritePipeline {
device: &wgpu::Device, device: &wgpu::Device,
vs_module: &wgpu::ShaderModule, vs_module: &wgpu::ShaderModule,
fs_module: &wgpu::ShaderModule, fs_module: &wgpu::ShaderModule,
sc_desc: &wgpu::SwapChainDescriptor,
global_layout: &GlobalsLayouts, global_layout: &GlobalsLayouts,
layout: &SpriteLayout, layout: &SpriteLayout,
terrain_layout: &TerrainLayout, terrain_layout: &TerrainLayout,
@ -477,7 +476,7 @@ impl SpritePipeline {
module: fs_module, module: fs_module,
entry_point: "main", entry_point: "main",
targets: &[wgpu::ColorTargetState { targets: &[wgpu::ColorTargetState {
format: sc_desc.format, format: wgpu::TextureFormat::Rgba16Float,
// TODO: can we remove sprite transparency? // TODO: can we remove sprite transparency?
blend: Some(wgpu::BlendState { blend: Some(wgpu::BlendState {
color: wgpu::BlendComponent { color: wgpu::BlendComponent {

View File

@ -210,7 +210,6 @@ impl TerrainPipeline {
device: &wgpu::Device, device: &wgpu::Device,
vs_module: &wgpu::ShaderModule, vs_module: &wgpu::ShaderModule,
fs_module: &wgpu::ShaderModule, fs_module: &wgpu::ShaderModule,
sc_desc: &wgpu::SwapChainDescriptor,
global_layout: &GlobalsLayouts, global_layout: &GlobalsLayouts,
layout: &TerrainLayout, layout: &TerrainLayout,
aa_mode: AaMode, aa_mode: AaMode,
@ -278,7 +277,7 @@ impl TerrainPipeline {
module: fs_module, module: fs_module,
entry_point: "main", entry_point: "main",
targets: &[wgpu::ColorTargetState { targets: &[wgpu::ColorTargetState {
format: sc_desc.format, format: wgpu::TextureFormat::Rgba16Float,
blend: None, blend: None,
write_mask: wgpu::ColorWrite::ALL, write_mask: wgpu::ColorWrite::ALL,
}], }],

View File

@ -549,13 +549,13 @@ impl Renderer {
mip_level_count: levels, mip_level_count: levels,
sample_count, sample_count,
dimension: wgpu::TextureDimension::D2, dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Bgra8UnormSrgb, format: wgpu::TextureFormat::Rgba16Float,
usage: wgpu::TextureUsage::SAMPLED | wgpu::TextureUsage::RENDER_ATTACHMENT, usage: wgpu::TextureUsage::SAMPLED | wgpu::TextureUsage::RENDER_ATTACHMENT,
}); });
tex.create_view(&wgpu::TextureViewDescriptor { tex.create_view(&wgpu::TextureViewDescriptor {
label: None, label: None,
format: Some(wgpu::TextureFormat::Bgra8UnormSrgb), format: Some(wgpu::TextureFormat::Rgba16Float),
dimension: Some(wgpu::TextureViewDimension::D2), dimension: Some(wgpu::TextureViewDimension::D2),
// TODO: why is this not Color? // TODO: why is this not Color?
aspect: wgpu::TextureAspect::All, aspect: wgpu::TextureAspect::All,
@ -2062,7 +2062,6 @@ fn create_pipelines(
device, device,
&create_shader("skybox-vert", ShaderKind::Vertex)?, &create_shader("skybox-vert", ShaderKind::Vertex)?,
&create_shader("skybox-frag", ShaderKind::Fragment)?, &create_shader("skybox-frag", ShaderKind::Fragment)?,
sc_desc,
&layouts.global, &layouts.global,
mode.aa, mode.aa,
); );
@ -2072,7 +2071,6 @@ fn create_pipelines(
device, device,
&figure_vert_mod, &figure_vert_mod,
&create_shader("figure-frag", ShaderKind::Fragment)?, &create_shader("figure-frag", ShaderKind::Fragment)?,
sc_desc,
&layouts.global, &layouts.global,
&layouts.figure, &layouts.figure,
mode.aa, mode.aa,
@ -2084,7 +2082,6 @@ fn create_pipelines(
device, device,
&terrain_vert, &terrain_vert,
&create_shader("terrain-frag", ShaderKind::Fragment)?, &create_shader("terrain-frag", ShaderKind::Fragment)?,
sc_desc,
&layouts.global, &layouts.global,
&layouts.terrain, &layouts.terrain,
mode.aa, mode.aa,
@ -2100,7 +2097,6 @@ fn create_pipelines(
device, device,
&create_shader("fluid-vert", ShaderKind::Vertex)?, &create_shader("fluid-vert", ShaderKind::Vertex)?,
&create_shader(&selected_fluid_shader, ShaderKind::Fragment)?, &create_shader(&selected_fluid_shader, ShaderKind::Fragment)?,
sc_desc,
&layouts.global, &layouts.global,
&layouts.fluid, &layouts.fluid,
&layouts.terrain, &layouts.terrain,
@ -2112,7 +2108,6 @@ fn create_pipelines(
device, device,
&create_shader("sprite-vert", ShaderKind::Vertex)?, &create_shader("sprite-vert", ShaderKind::Vertex)?,
&create_shader("sprite-frag", ShaderKind::Fragment)?, &create_shader("sprite-frag", ShaderKind::Fragment)?,
sc_desc,
&layouts.global, &layouts.global,
&layouts.sprite, &layouts.sprite,
&layouts.terrain, &layouts.terrain,
@ -2124,7 +2119,6 @@ fn create_pipelines(
device, device,
&create_shader("particle-vert", ShaderKind::Vertex)?, &create_shader("particle-vert", ShaderKind::Vertex)?,
&create_shader("particle-frag", ShaderKind::Fragment)?, &create_shader("particle-frag", ShaderKind::Fragment)?,
sc_desc,
&layouts.global, &layouts.global,
mode.aa, mode.aa,
); );
@ -2144,7 +2138,6 @@ fn create_pipelines(
device, device,
&create_shader("lod-terrain-vert", ShaderKind::Vertex)?, &create_shader("lod-terrain-vert", ShaderKind::Vertex)?,
&create_shader("lod-terrain-frag", ShaderKind::Fragment)?, &create_shader("lod-terrain-frag", ShaderKind::Fragment)?,
sc_desc,
&layouts.global, &layouts.global,
mode.aa, mode.aa,
); );
@ -2156,7 +2149,6 @@ fn create_pipelines(
&create_shader("clouds-frag", ShaderKind::Fragment)?, &create_shader("clouds-frag", ShaderKind::Fragment)?,
// TODO: pass in format of intermediate color buffer // TODO: pass in format of intermediate color buffer
&layouts.global, &layouts.global,
sc_desc,
&layouts.clouds, &layouts.clouds,
mode.aa, mode.aa,
); );