# Update to 0.15!
This is a pretty minor update for this tutorial, but there are a few things to consider.
- A
view_formats
field was added toTextureDescriptor
andSurfaceDescriptor
. This allows you to specify differentTextureFormat
s that can be used when creatingTextureView
s. At time of writing this pretty much only allows you to switch between using SRGB and linear formats. For example:
TextureDescriptor {
// other fields...
format: wgpu::TextureFormat::Rgba8UnormSrgb,
view_formats: &[wgpu::TextureFormat::Rgba8Unorm],
}
The format used to create the Texture
will always be supported, so you don't have to specify it.
- The method of acquiring texture formats supported by the
Surface
has changed. Previously there was aget_supported_formats()
that would return aVec<TextureFormat>
. NowSurface
has aget_capabilities()
method. This will return aSurfaceCapabilities
object that will have the supported formats as well as some other fields that you can checkout here (opens new window). I'm using it in the tutorial like this:
let surface_caps = surface.get_capabilities(&adapter);
// Shader code in this tutorial assumes an Srgb surface texture. Using a different
// one will result all the colors comming out darker. If you want to support non
// Srgb surfaces, you'll need to account for that when drawing to the frame.
let surface_format = surface_caps.formats.iter()
.copied()
.filter(|f| f.is_srgb())
.next()
.unwrap_or(surface_caps.formats[0]);
let config = wgpu::SurfaceConfiguration {
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
format: surface_format,
width: size.width,
height: size.height,
present_mode: surface_caps.present_modes[0],
alpha_mode: surface_caps.alpha_modes[0],
view_formats: vec![],
};
As always let me know if I missed anything. You can check out the full changelog for 0.15 here (opens new window)