Enum bevy::render::render_resource::TextureFormat

#[repr(C)]
pub enum TextureFormat {
Show 75 variants R8Unorm, R8Snorm, R8Uint, R8Sint, R16Uint, R16Sint, R16Unorm, R16Snorm, R16Float, Rg8Unorm, Rg8Snorm, Rg8Uint, Rg8Sint, R32Uint, R32Sint, R32Float, Rg16Uint, Rg16Sint, Rg16Unorm, Rg16Snorm, Rg16Float, Rgba8Unorm, Rgba8UnormSrgb, Rgba8Snorm, Rgba8Uint, Rgba8Sint, Bgra8Unorm, Bgra8UnormSrgb, Rgb9e5Ufloat, Rgb10a2Uint, Rgb10a2Unorm, Rg11b10Float, Rg32Uint, Rg32Sint, Rg32Float, Rgba16Uint, Rgba16Sint, Rgba16Unorm, Rgba16Snorm, Rgba16Float, Rgba32Uint, Rgba32Sint, Rgba32Float, Stencil8, Depth16Unorm, Depth24Plus, Depth24PlusStencil8, Depth32Float, Depth32FloatStencil8, NV12, Bc1RgbaUnorm, Bc1RgbaUnormSrgb, Bc2RgbaUnorm, Bc2RgbaUnormSrgb, Bc3RgbaUnorm, Bc3RgbaUnormSrgb, Bc4RUnorm, Bc4RSnorm, Bc5RgUnorm, Bc5RgSnorm, Bc6hRgbUfloat, Bc6hRgbFloat, Bc7RgbaUnorm, Bc7RgbaUnormSrgb, Etc2Rgb8Unorm, Etc2Rgb8UnormSrgb, Etc2Rgb8A1Unorm, Etc2Rgb8A1UnormSrgb, Etc2Rgba8Unorm, Etc2Rgba8UnormSrgb, EacR11Unorm, EacR11Snorm, EacRg11Unorm, EacRg11Snorm, Astc { block: AstcBlock, channel: AstcChannel, },
}
Expand description

Underlying texture data format.

If there is a conversion in the format (such as srgb -> linear), the conversion listed here is for loading from texture in a shader. When writing to the texture, the opposite conversion takes place.

Corresponds to WebGPU GPUTextureFormat.

Variants§

§

R8Unorm

Red channel only. 8 bit integer per channel. [0, 255] converted to/from float [0, 1] in shader.

§

R8Snorm

Red channel only. 8 bit integer per channel. [-127, 127] converted to/from float [-1, 1] in shader.

§

R8Uint

Red channel only. 8 bit integer per channel. Unsigned in shader.

§

R8Sint

Red channel only. 8 bit integer per channel. Signed in shader.

§

R16Uint

Red channel only. 16 bit integer per channel. Unsigned in shader.

§

R16Sint

Red channel only. 16 bit integer per channel. Signed in shader.

§

R16Unorm

Red channel only. 16 bit integer per channel. [0, 65535] converted to/from float [0, 1] in shader.

Features::TEXTURE_FORMAT_16BIT_NORM must be enabled to use this texture format.

§

R16Snorm

Red channel only. 16 bit integer per channel. [0, 65535] converted to/from float [-1, 1] in shader.

Features::TEXTURE_FORMAT_16BIT_NORM must be enabled to use this texture format.

§

R16Float

Red channel only. 16 bit float per channel. Float in shader.

§

Rg8Unorm

Red and green channels. 8 bit integer per channel. [0, 255] converted to/from float [0, 1] in shader.

§

Rg8Snorm

Red and green channels. 8 bit integer per channel. [-127, 127] converted to/from float [-1, 1] in shader.

§

Rg8Uint

Red and green channels. 8 bit integer per channel. Unsigned in shader.

§

Rg8Sint

Red and green channels. 8 bit integer per channel. Signed in shader.

§

R32Uint

Red channel only. 32 bit integer per channel. Unsigned in shader.

§

R32Sint

Red channel only. 32 bit integer per channel. Signed in shader.

§

R32Float

Red channel only. 32 bit float per channel. Float in shader.

§

Rg16Uint

Red and green channels. 16 bit integer per channel. Unsigned in shader.

§

Rg16Sint

Red and green channels. 16 bit integer per channel. Signed in shader.

§

Rg16Unorm

Red and green channels. 16 bit integer per channel. [0, 65535] converted to/from float [0, 1] in shader.

Features::TEXTURE_FORMAT_16BIT_NORM must be enabled to use this texture format.

§

Rg16Snorm

Red and green channels. 16 bit integer per channel. [0, 65535] converted to/from float [-1, 1] in shader.

Features::TEXTURE_FORMAT_16BIT_NORM must be enabled to use this texture format.

§

Rg16Float

Red and green channels. 16 bit float per channel. Float in shader.

§

Rgba8Unorm

Red, green, blue, and alpha channels. 8 bit integer per channel. [0, 255] converted to/from float [0, 1] in shader.

§

Rgba8UnormSrgb

Red, green, blue, and alpha channels. 8 bit integer per channel. Srgb-color [0, 255] converted to/from linear-color float [0, 1] in shader.

§

Rgba8Snorm

Red, green, blue, and alpha channels. 8 bit integer per channel. [-127, 127] converted to/from float [-1, 1] in shader.

§

Rgba8Uint

Red, green, blue, and alpha channels. 8 bit integer per channel. Unsigned in shader.

§

Rgba8Sint

Red, green, blue, and alpha channels. 8 bit integer per channel. Signed in shader.

§

Bgra8Unorm

Blue, green, red, and alpha channels. 8 bit integer per channel. [0, 255] converted to/from float [0, 1] in shader.

§

Bgra8UnormSrgb

Blue, green, red, and alpha channels. 8 bit integer per channel. Srgb-color [0, 255] converted to/from linear-color float [0, 1] in shader.

§

Rgb9e5Ufloat

Packed unsigned float with 9 bits mantisa for each RGB component, then a common 5 bits exponent

§

Rgb10a2Uint

Red, green, blue, and alpha channels. 10 bit integer for RGB channels, 2 bit integer for alpha channel. Unsigned in shader.

§

Rgb10a2Unorm

Red, green, blue, and alpha channels. 10 bit integer for RGB channels, 2 bit integer for alpha channel. [0, 1023] ([0, 3] for alpha) converted to/from float [0, 1] in shader.

§

Rg11b10Float

Red, green, and blue channels. 11 bit float with no sign bit for RG channels. 10 bit float with no sign bit for blue channel. Float in shader.

§

Rg32Uint

Red and green channels. 32 bit integer per channel. Unsigned in shader.

§

Rg32Sint

Red and green channels. 32 bit integer per channel. Signed in shader.

§

Rg32Float

Red and green channels. 32 bit float per channel. Float in shader.

§

Rgba16Uint

Red, green, blue, and alpha channels. 16 bit integer per channel. Unsigned in shader.

§

Rgba16Sint

Red, green, blue, and alpha channels. 16 bit integer per channel. Signed in shader.

§

Rgba16Unorm

Red, green, blue, and alpha channels. 16 bit integer per channel. [0, 65535] converted to/from float [0, 1] in shader.

Features::TEXTURE_FORMAT_16BIT_NORM must be enabled to use this texture format.

§

Rgba16Snorm

Red, green, blue, and alpha. 16 bit integer per channel. [0, 65535] converted to/from float [-1, 1] in shader.

Features::TEXTURE_FORMAT_16BIT_NORM must be enabled to use this texture format.

§

Rgba16Float

Red, green, blue, and alpha channels. 16 bit float per channel. Float in shader.

§

Rgba32Uint

Red, green, blue, and alpha channels. 32 bit integer per channel. Unsigned in shader.

§

Rgba32Sint

Red, green, blue, and alpha channels. 32 bit integer per channel. Signed in shader.

§

Rgba32Float

Red, green, blue, and alpha channels. 32 bit float per channel. Float in shader.

§

Stencil8

Stencil format with 8 bit integer stencil.

§

Depth16Unorm

Special depth format with 16 bit integer depth.

§

Depth24Plus

Special depth format with at least 24 bit integer depth.

§

Depth24PlusStencil8

Special depth/stencil format with at least 24 bit integer depth and 8 bits integer stencil.

§

Depth32Float

Special depth format with 32 bit floating point depth.

§

Depth32FloatStencil8

Special depth/stencil format with 32 bit floating point depth and 8 bits integer stencil.

Features::DEPTH32FLOAT_STENCIL8 must be enabled to use this texture format.

§

NV12

YUV 4:2:0 chroma subsampled format.

Contains two planes:

  • 0: Single 8 bit channel luminance.
  • 1: Dual 8 bit channel chrominance at half width and half height.

Valid view formats for luminance are TextureFormat::R8Unorm.

Valid view formats for chrominance are TextureFormat::Rg8Unorm.

Width and height must be even.

Features::TEXTURE_FORMAT_NV12 must be enabled to use this texture format.

§

Bc1RgbaUnorm

4x4 block compressed texture. 8 bytes per block (4 bit/px). 4 color + alpha pallet. 5 bit R + 6 bit G + 5 bit B + 1 bit alpha. [0, 63] ([0, 1] for alpha) converted to/from float [0, 1] in shader.

Also known as DXT1.

Features::TEXTURE_COMPRESSION_BC must be enabled to use this texture format.

§

Bc1RgbaUnormSrgb

4x4 block compressed texture. 8 bytes per block (4 bit/px). 4 color + alpha pallet. 5 bit R + 6 bit G + 5 bit B + 1 bit alpha. Srgb-color [0, 63] ([0, 1] for alpha) converted to/from linear-color float [0, 1] in shader.

Also known as DXT1.

Features::TEXTURE_COMPRESSION_BC must be enabled to use this texture format.

§

Bc2RgbaUnorm

4x4 block compressed texture. 16 bytes per block (8 bit/px). 4 color pallet. 5 bit R + 6 bit G + 5 bit B + 4 bit alpha. [0, 63] ([0, 15] for alpha) converted to/from float [0, 1] in shader.

Also known as DXT3.

Features::TEXTURE_COMPRESSION_BC must be enabled to use this texture format.

§

Bc2RgbaUnormSrgb

4x4 block compressed texture. 16 bytes per block (8 bit/px). 4 color pallet. 5 bit R + 6 bit G + 5 bit B + 4 bit alpha. Srgb-color [0, 63] ([0, 255] for alpha) converted to/from linear-color float [0, 1] in shader.

Also known as DXT3.

Features::TEXTURE_COMPRESSION_BC must be enabled to use this texture format.

§

Bc3RgbaUnorm

4x4 block compressed texture. 16 bytes per block (8 bit/px). 4 color pallet + 8 alpha pallet. 5 bit R + 6 bit G + 5 bit B + 8 bit alpha. [0, 63] ([0, 255] for alpha) converted to/from float [0, 1] in shader.

Also known as DXT5.

Features::TEXTURE_COMPRESSION_BC must be enabled to use this texture format.

§

Bc3RgbaUnormSrgb

4x4 block compressed texture. 16 bytes per block (8 bit/px). 4 color pallet + 8 alpha pallet. 5 bit R + 6 bit G + 5 bit B + 8 bit alpha. Srgb-color [0, 63] ([0, 255] for alpha) converted to/from linear-color float [0, 1] in shader.

Also known as DXT5.

Features::TEXTURE_COMPRESSION_BC must be enabled to use this texture format.

§

Bc4RUnorm

4x4 block compressed texture. 8 bytes per block (4 bit/px). 8 color pallet. 8 bit R. [0, 255] converted to/from float [0, 1] in shader.

Also known as RGTC1.

Features::TEXTURE_COMPRESSION_BC must be enabled to use this texture format.

§

Bc4RSnorm

4x4 block compressed texture. 8 bytes per block (4 bit/px). 8 color pallet. 8 bit R. [-127, 127] converted to/from float [-1, 1] in shader.

Also known as RGTC1.

Features::TEXTURE_COMPRESSION_BC must be enabled to use this texture format.

§

Bc5RgUnorm

4x4 block compressed texture. 16 bytes per block (8 bit/px). 8 color red pallet + 8 color green pallet. 8 bit RG. [0, 255] converted to/from float [0, 1] in shader.

Also known as RGTC2.

Features::TEXTURE_COMPRESSION_BC must be enabled to use this texture format.

§

Bc5RgSnorm

4x4 block compressed texture. 16 bytes per block (8 bit/px). 8 color red pallet + 8 color green pallet. 8 bit RG. [-127, 127] converted to/from float [-1, 1] in shader.

Also known as RGTC2.

Features::TEXTURE_COMPRESSION_BC must be enabled to use this texture format.

§

Bc6hRgbUfloat

4x4 block compressed texture. 16 bytes per block (8 bit/px). Variable sized pallet. 16 bit unsigned float RGB. Float in shader.

Also known as BPTC (float).

Features::TEXTURE_COMPRESSION_BC must be enabled to use this texture format.

§

Bc6hRgbFloat

4x4 block compressed texture. 16 bytes per block (8 bit/px). Variable sized pallet. 16 bit signed float RGB. Float in shader.

Also known as BPTC (float).

Features::TEXTURE_COMPRESSION_BC must be enabled to use this texture format.

§

Bc7RgbaUnorm

4x4 block compressed texture. 16 bytes per block (8 bit/px). Variable sized pallet. 8 bit integer RGBA. [0, 255] converted to/from float [0, 1] in shader.

Also known as BPTC (unorm).

Features::TEXTURE_COMPRESSION_BC must be enabled to use this texture format.

§

Bc7RgbaUnormSrgb

4x4 block compressed texture. 16 bytes per block (8 bit/px). Variable sized pallet. 8 bit integer RGBA. Srgb-color [0, 255] converted to/from linear-color float [0, 1] in shader.

Also known as BPTC (unorm).

Features::TEXTURE_COMPRESSION_BC must be enabled to use this texture format.

§

Etc2Rgb8Unorm

4x4 block compressed texture. 8 bytes per block (4 bit/px). Complex pallet. 8 bit integer RGB. [0, 255] converted to/from float [0, 1] in shader.

Features::TEXTURE_COMPRESSION_ETC2 must be enabled to use this texture format.

§

Etc2Rgb8UnormSrgb

4x4 block compressed texture. 8 bytes per block (4 bit/px). Complex pallet. 8 bit integer RGB. Srgb-color [0, 255] converted to/from linear-color float [0, 1] in shader.

Features::TEXTURE_COMPRESSION_ETC2 must be enabled to use this texture format.

§

Etc2Rgb8A1Unorm

4x4 block compressed texture. 8 bytes per block (4 bit/px). Complex pallet. 8 bit integer RGB + 1 bit alpha. [0, 255] ([0, 1] for alpha) converted to/from float [0, 1] in shader.

Features::TEXTURE_COMPRESSION_ETC2 must be enabled to use this texture format.

§

Etc2Rgb8A1UnormSrgb

4x4 block compressed texture. 8 bytes per block (4 bit/px). Complex pallet. 8 bit integer RGB + 1 bit alpha. Srgb-color [0, 255] ([0, 1] for alpha) converted to/from linear-color float [0, 1] in shader.

Features::TEXTURE_COMPRESSION_ETC2 must be enabled to use this texture format.

§

Etc2Rgba8Unorm

4x4 block compressed texture. 16 bytes per block (8 bit/px). Complex pallet. 8 bit integer RGB + 8 bit alpha. [0, 255] converted to/from float [0, 1] in shader.

Features::TEXTURE_COMPRESSION_ETC2 must be enabled to use this texture format.

§

Etc2Rgba8UnormSrgb

4x4 block compressed texture. 16 bytes per block (8 bit/px). Complex pallet. 8 bit integer RGB + 8 bit alpha. Srgb-color [0, 255] converted to/from linear-color float [0, 1] in shader.

Features::TEXTURE_COMPRESSION_ETC2 must be enabled to use this texture format.

§

EacR11Unorm

4x4 block compressed texture. 8 bytes per block (4 bit/px). Complex pallet. 11 bit integer R. [0, 255] converted to/from float [0, 1] in shader.

Features::TEXTURE_COMPRESSION_ETC2 must be enabled to use this texture format.

§

EacR11Snorm

4x4 block compressed texture. 8 bytes per block (4 bit/px). Complex pallet. 11 bit integer R. [-127, 127] converted to/from float [-1, 1] in shader.

Features::TEXTURE_COMPRESSION_ETC2 must be enabled to use this texture format.

§

EacRg11Unorm

4x4 block compressed texture. 16 bytes per block (8 bit/px). Complex pallet. 11 bit integer R + 11 bit integer G. [0, 255] converted to/from float [0, 1] in shader.

Features::TEXTURE_COMPRESSION_ETC2 must be enabled to use this texture format.

§

EacRg11Snorm

4x4 block compressed texture. 16 bytes per block (8 bit/px). Complex pallet. 11 bit integer R + 11 bit integer G. [-127, 127] converted to/from float [-1, 1] in shader.

Features::TEXTURE_COMPRESSION_ETC2 must be enabled to use this texture format.

§

Astc

block compressed texture. 16 bytes per block.

Features TEXTURE_COMPRESSION_ASTC or TEXTURE_COMPRESSION_ASTC_HDR must be enabled to use this texture format.

Fields

§block: AstcBlock

compressed block dimensions

§channel: AstcChannel

ASTC RGBA channel

Implementations§

§

impl TextureFormat

pub fn aspect_specific_format( &self, aspect: TextureAspect ) -> Option<TextureFormat>

Returns the aspect-specific format of the original format

see https://gpuweb.github.io/gpuweb/#abstract-opdef-resolving-gputextureaspect

pub fn is_depth_stencil_component(&self, combined_format: TextureFormat) -> bool

Returns true if self is a depth or stencil component of the given combined depth-stencil format

pub fn is_depth_stencil_format(&self) -> bool

Returns true if the format is a depth and/or stencil format

see https://gpuweb.github.io/gpuweb/#depth-formats

pub fn is_combined_depth_stencil_format(&self) -> bool

Returns true if the format is a combined depth-stencil format

see https://gpuweb.github.io/gpuweb/#combined-depth-stencil-format

pub fn is_multi_planar_format(&self) -> bool

Returns true if the format is a multi-planar format

pub fn planes(&self) -> Option<u32>

Returns the number of planes a multi-planar format has.

pub fn has_color_aspect(&self) -> bool

Returns true if the format has a color aspect

pub fn has_depth_aspect(&self) -> bool

Returns true if the format has a depth aspect

pub fn has_stencil_aspect(&self) -> bool

Returns true if the format has a stencil aspect

pub fn size_multiple_requirement(&self) -> (u32, u32)

Returns the size multiple requirement for a texture using this format.

pub fn block_dimensions(&self) -> (u32, u32)

Returns the dimension of a block of texels.

Uncompressed formats have a block dimension of (1, 1).

Examples found in repository?
examples/app/headless_renderer.rs (line 360)
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
    fn run(
        &self,
        _graph: &mut RenderGraphContext,
        render_context: &mut RenderContext,
        world: &World,
    ) -> Result<(), NodeRunError> {
        let image_copiers = world.get_resource::<ImageCopiers>().unwrap();
        let gpu_images = world
            .get_resource::<RenderAssets<bevy::render::texture::GpuImage>>()
            .unwrap();

        for image_copier in image_copiers.iter() {
            if !image_copier.enabled() {
                continue;
            }

            let src_image = gpu_images.get(&image_copier.src_image).unwrap();

            let mut encoder = render_context
                .render_device()
                .create_command_encoder(&CommandEncoderDescriptor::default());

            let block_dimensions = src_image.texture_format.block_dimensions();
            let block_size = src_image.texture_format.block_copy_size(None).unwrap();

            // Calculating correct size of image row because
            // copy_texture_to_buffer can copy image only by rows aligned wgpu::COPY_BYTES_PER_ROW_ALIGNMENT
            // That's why image in buffer can be little bit wider
            // This should be taken into account at copy from buffer stage
            let padded_bytes_per_row = RenderDevice::align_copy_bytes_per_row(
                (src_image.size.x as usize / block_dimensions.0 as usize) * block_size as usize,
            );

            let texture_extent = Extent3d {
                width: src_image.size.x,
                height: src_image.size.y,
                depth_or_array_layers: 1,
            };

            encoder.copy_texture_to_buffer(
                src_image.texture.as_image_copy(),
                ImageCopyBuffer {
                    buffer: &image_copier.buffer,
                    layout: ImageDataLayout {
                        offset: 0,
                        bytes_per_row: Some(
                            std::num::NonZeroU32::new(padded_bytes_per_row as u32)
                                .unwrap()
                                .into(),
                        ),
                        rows_per_image: None,
                    },
                },
                texture_extent,
            );

            let render_queue = world.get_resource::<RenderQueue>().unwrap();
            render_queue.submit(std::iter::once(encoder.finish()));
        }

        Ok(())
    }

pub fn is_compressed(&self) -> bool

Returns true for compressed formats.

pub fn required_features(&self) -> Features

Returns the required features (if any) in order to use the texture.

pub fn guaranteed_format_features( &self, device_features: Features ) -> TextureFormatFeatures

Returns the format features guaranteed by the WebGPU spec.

Additional features are available if Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES is enabled.

pub fn sample_type( &self, aspect: Option<TextureAspect>, device_features: Option<Features> ) -> Option<TextureSampleType>

Returns the sample type compatible with this format and aspect.

Returns None only if this is a combined depth-stencil format or a multi-planar format and TextureAspect::All or no aspect was provided.

pub fn block_size(&self, aspect: Option<TextureAspect>) -> Option<u32>

👎Deprecated since 0.19.0: Use block_copy_size instead.

The number of bytes one texel block occupies during an image copy, if applicable.

Known as the texel block copy footprint.

Note that for uncompressed formats this is the same as the size of a single texel, since uncompressed formats have a block size of 1x1.

Returns None if any of the following are true:

  • the format is a combined depth-stencil and no aspect was provided
  • the format is a multi-planar format and no aspect was provided
  • the format is Depth24Plus
  • the format is Depth24PlusStencil8 and aspect is depth.

pub fn block_copy_size(&self, aspect: Option<TextureAspect>) -> Option<u32>

The number of bytes one texel block occupies during an image copy, if applicable.

Known as the texel block copy footprint.

Note that for uncompressed formats this is the same as the size of a single texel, since uncompressed formats have a block size of 1x1.

Returns None if any of the following are true:

  • the format is a combined depth-stencil and no aspect was provided
  • the format is a multi-planar format and no aspect was provided
  • the format is Depth24Plus
  • the format is Depth24PlusStencil8 and aspect is depth.
Examples found in repository?
examples/app/headless_renderer.rs (line 361)
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
    fn run(
        &self,
        _graph: &mut RenderGraphContext,
        render_context: &mut RenderContext,
        world: &World,
    ) -> Result<(), NodeRunError> {
        let image_copiers = world.get_resource::<ImageCopiers>().unwrap();
        let gpu_images = world
            .get_resource::<RenderAssets<bevy::render::texture::GpuImage>>()
            .unwrap();

        for image_copier in image_copiers.iter() {
            if !image_copier.enabled() {
                continue;
            }

            let src_image = gpu_images.get(&image_copier.src_image).unwrap();

            let mut encoder = render_context
                .render_device()
                .create_command_encoder(&CommandEncoderDescriptor::default());

            let block_dimensions = src_image.texture_format.block_dimensions();
            let block_size = src_image.texture_format.block_copy_size(None).unwrap();

            // Calculating correct size of image row because
            // copy_texture_to_buffer can copy image only by rows aligned wgpu::COPY_BYTES_PER_ROW_ALIGNMENT
            // That's why image in buffer can be little bit wider
            // This should be taken into account at copy from buffer stage
            let padded_bytes_per_row = RenderDevice::align_copy_bytes_per_row(
                (src_image.size.x as usize / block_dimensions.0 as usize) * block_size as usize,
            );

            let texture_extent = Extent3d {
                width: src_image.size.x,
                height: src_image.size.y,
                depth_or_array_layers: 1,
            };

            encoder.copy_texture_to_buffer(
                src_image.texture.as_image_copy(),
                ImageCopyBuffer {
                    buffer: &image_copier.buffer,
                    layout: ImageDataLayout {
                        offset: 0,
                        bytes_per_row: Some(
                            std::num::NonZeroU32::new(padded_bytes_per_row as u32)
                                .unwrap()
                                .into(),
                        ),
                        rows_per_image: None,
                    },
                },
                texture_extent,
            );

            let render_queue = world.get_resource::<RenderQueue>().unwrap();
            render_queue.submit(std::iter::once(encoder.finish()));
        }

        Ok(())
    }

pub fn components(&self) -> u8

Returns the number of components this format has.

pub fn components_with_aspect(&self, aspect: TextureAspect) -> u8

Returns the number of components this format has taking into account the aspect.

The aspect is only relevant for combined depth-stencil formats and multi-planar formats.

pub fn remove_srgb_suffix(&self) -> TextureFormat

Strips the Srgb suffix from the given texture format.

pub fn add_srgb_suffix(&self) -> TextureFormat

Adds an Srgb suffix to the given texture format, if the format supports it.

pub fn is_srgb(&self) -> bool

Returns true for srgb formats.

Trait Implementations§

§

impl BevyDefault for TextureFormat

§

impl Clone for TextureFormat

§

fn clone(&self) -> TextureFormat

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for TextureFormat

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for TextureFormat

Available on crate feature serde only.
§

fn deserialize<D>( deserializer: D ) -> Result<TextureFormat, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl From<TextureFormat> for ColorTargetState

§

fn from(format: TextureFormat) -> ColorTargetState

Converts to this type from the input type.
§

impl From<TextureFormat> for FormatAspects

§

fn from(format: TextureFormat) -> FormatAspects

Converts to this type from the input type.
§

impl Hash for TextureFormat

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl PartialEq for TextureFormat

§

fn eq(&self, other: &TextureFormat) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Serialize for TextureFormat

Available on crate feature serde only.
§

fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl TextureFormatPixelInfo for TextureFormat

§

fn pixel_size(&self) -> usize

Returns the size of a pixel in bytes of the format.
§

impl Copy for TextureFormat

§

impl Eq for TextureFormat

§

impl StructuralPartialEq for TextureFormat

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T, U> AsBindGroupShaderType<U> for T
where U: ShaderType, &'a T: for<'a> Into<U>,

§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U

Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DynEq for T
where T: Any + Eq,

§

fn as_any(&self) -> &(dyn Any + 'static)

Casts the type to dyn Any.
§

fn dyn_eq(&self, other: &(dyn DynEq + 'static)) -> bool

This method tests for self and other values to be equal. Read more
§

impl<T> DynHash for T
where T: DynEq + Hash,

§

fn as_dyn_eq(&self) -> &(dyn DynEq + 'static)

Casts the type to dyn Any.
§

fn dyn_hash(&self, state: &mut dyn Hasher)

Feeds this value into the given Hasher.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer ) -> Result<(), ErrorImpl>

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> TypeData for T
where T: 'static + Send + Sync + Clone,

§

fn clone_type_data(&self) -> Box<dyn TypeData>

§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> ConditionalSend for T
where T: Send,

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

§

impl<T> Settings for T
where T: 'static + Send + Sync,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,