Fix validation errors with WebGL2 backend (#335)

* Fix validation errors with WebGL2 backend

- view_formats are optional and should be empty unless a specific view format is needed.
- See: https://www.w3.org/TR/webgpu/#dom-gputexturedescriptor-viewformats
This commit is contained in:
Jay Oster 2023-01-28 11:19:45 -08:00 committed by GitHub
parent c3f63a540d
commit eede10ba42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 12 deletions

View file

@ -229,10 +229,7 @@ fn create_texture_view(
dimension: wgpu::TextureDimension::D2,
format: pixels.render_texture_format(),
usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::RENDER_ATTACHMENT,
view_formats: &[
pixels.render_texture_format().add_srgb_suffix(),
pixels.render_texture_format().remove_srgb_suffix(),
],
view_formats: &[],
};
Ok(device

View file

@ -464,10 +464,7 @@ pub(crate) fn create_backing_texture(
dimension: wgpu::TextureDimension::D2,
format: backing_texture_format,
usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
view_formats: &[
backing_texture_format.add_srgb_suffix(),
backing_texture_format.remove_srgb_suffix(),
],
view_formats: &[],
});
let texture_view = texture.create_view(&wgpu::TextureViewDescriptor::default());

View file

@ -512,10 +512,7 @@ impl Pixels {
height: self.surface_size.height,
present_mode: self.present_mode,
alpha_mode: self.alpha_mode,
view_formats: vec![
self.surface_texture_format.add_srgb_suffix(),
self.surface_texture_format.remove_srgb_suffix(),
],
view_formats: vec![],
},
);
}