mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 16:24:24 +00:00
wgpu format features are again part of TextureFormatInfo
+ some cleanup/fix indentations
This commit is contained in:
parent
757d12aca3
commit
e29d17a13f
@ -522,7 +522,7 @@ impl<B: GfxBackend> Device<B> {
|
||||
debug_assert_eq!(self_id.backend(), B::VARIANT);
|
||||
|
||||
let format_desc = desc.format.describe();
|
||||
let required_features = format_desc.features;
|
||||
let required_features = format_desc.required_features;
|
||||
if !self.features.contains(required_features) {
|
||||
return Err(resource::CreateTextureError::MissingFeature(
|
||||
required_features,
|
||||
@ -553,7 +553,7 @@ impl<B: GfxBackend> Device<B> {
|
||||
{
|
||||
adapter.get_texture_format_features(desc.format)
|
||||
} else {
|
||||
desc.format.features_webgpu()
|
||||
format_desc.guaranteed_format_features
|
||||
};
|
||||
|
||||
let missing_allowed_usages = desc.usage - format_features.allowed_usages;
|
||||
@ -1314,32 +1314,31 @@ impl<B: GfxBackend> Device<B> {
|
||||
(wgt::TextureUsage::SAMPLED, resource::TextureUse::SAMPLED)
|
||||
}
|
||||
wgt::BindingType::StorageTexture { access, .. } => {
|
||||
(
|
||||
wgt::TextureUsage::STORAGE,
|
||||
match access {
|
||||
wgt::StorageTextureAccess::ReadOnly => {
|
||||
resource::TextureUse::STORAGE_LOAD
|
||||
}
|
||||
wgt::StorageTextureAccess::WriteOnly => {
|
||||
resource::TextureUse::STORAGE_STORE
|
||||
}
|
||||
wgt::StorageTextureAccess::ReadWrite => {
|
||||
if !view.format_features.flags.contains(
|
||||
wgt::TextureFormatFeatureFlags::STORAGE_READ_WRITE,
|
||||
let internal_use = match access {
|
||||
wgt::StorageTextureAccess::ReadOnly => {
|
||||
resource::TextureUse::STORAGE_LOAD
|
||||
}
|
||||
wgt::StorageTextureAccess::WriteOnly => {
|
||||
resource::TextureUse::STORAGE_STORE
|
||||
}
|
||||
wgt::StorageTextureAccess::ReadWrite => {
|
||||
if !view.format_features.flags.contains(
|
||||
wgt::TextureFormatFeatureFlags::STORAGE_READ_WRITE,
|
||||
) {
|
||||
return Err(if self.features.contains(
|
||||
wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES,
|
||||
) {
|
||||
if !self.features.contains(
|
||||
wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES,
|
||||
) {
|
||||
return Err(Error::MissingFeatures(wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES));
|
||||
} else {
|
||||
return Err(Error::StorageReadWriteNotSupported(view.format))
|
||||
}
|
||||
}
|
||||
resource::TextureUse::STORAGE_STORE
|
||||
| resource::TextureUse::STORAGE_LOAD
|
||||
Error::StorageReadWriteNotSupported(view.format)
|
||||
} else {
|
||||
Error::MissingFeatures(wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES)
|
||||
});
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
resource::TextureUse::STORAGE_STORE
|
||||
| resource::TextureUse::STORAGE_LOAD
|
||||
}
|
||||
};
|
||||
(wgt::TextureUsage::STORAGE, internal_use)
|
||||
}
|
||||
_ => return Err(Error::WrongBindingType {
|
||||
binding,
|
||||
|
@ -801,7 +801,7 @@ pub struct TextureFormatFeatures {
|
||||
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
||||
pub struct TextureFormatInfo {
|
||||
/// Features required (if any) to use the texture.
|
||||
pub features: Features,
|
||||
pub required_features: Features,
|
||||
/// Type of sampling that is valid for the texture.
|
||||
pub sample_type: TextureSampleType,
|
||||
/// Dimension of a "block" of texels. This is always (1, 1) on uncompressed textures.
|
||||
@ -810,6 +810,8 @@ pub struct TextureFormatInfo {
|
||||
pub block_size: u8,
|
||||
/// Format will have colors be converted from srgb to linear on read and from linear to srgb on write.
|
||||
pub srgb: bool,
|
||||
/// Format features guaranteed by the WebGPU spec. Additional features are available if `Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES` is enabled.
|
||||
pub guaranteed_format_features: TextureFormatFeatures,
|
||||
}
|
||||
|
||||
/// Underlying texture data format.
|
||||
@ -1219,252 +1221,136 @@ impl TextureFormat {
|
||||
let linear = false;
|
||||
let srgb = true;
|
||||
|
||||
// See https://gpuweb.github.io/gpuweb/#texture-format-caps for reference
|
||||
let (features, sample_type, srgb, block_dimensions, block_size) = match self {
|
||||
// Normal 8 bit textures
|
||||
Self::R8Unorm => (native, float, linear, (1, 1), 1),
|
||||
Self::R8Snorm => (native, float, linear, (1, 1), 1),
|
||||
Self::R8Uint => (native, uint, linear, (1, 1), 1),
|
||||
Self::R8Sint => (native, sint, linear, (1, 1), 1),
|
||||
|
||||
// Normal 16 bit textures
|
||||
Self::R16Uint => (native, uint, linear, (1, 1), 2),
|
||||
Self::R16Sint => (native, sint, linear, (1, 1), 2),
|
||||
Self::R16Float => (native, float, linear, (1, 1), 2),
|
||||
Self::Rg8Unorm => (native, float, linear, (1, 1), 2),
|
||||
Self::Rg8Snorm => (native, float, linear, (1, 1), 2),
|
||||
Self::Rg8Uint => (native, uint, linear, (1, 1), 2),
|
||||
Self::Rg8Sint => (native, sint, linear, (1, 1), 2),
|
||||
|
||||
// Normal 32 bit textures
|
||||
Self::R32Uint => (native, uint, linear, (1, 1), 4),
|
||||
Self::R32Sint => (native, sint, linear, (1, 1), 4),
|
||||
Self::R32Float => (native, nearest, linear, (1, 1), 4),
|
||||
Self::Rg16Uint => (native, uint, linear, (1, 1), 4),
|
||||
Self::Rg16Sint => (native, sint, linear, (1, 1), 4),
|
||||
Self::Rg16Float => (native, float, linear, (1, 1), 4),
|
||||
Self::Rgba8Unorm => (native, float, linear, (1, 1), 4),
|
||||
Self::Rgba8UnormSrgb => (native, float, srgb, (1, 1), 4),
|
||||
Self::Rgba8Snorm => (native, float, linear, (1, 1), 4),
|
||||
Self::Rgba8Uint => (native, uint, linear, (1, 1), 4),
|
||||
Self::Rgba8Sint => (native, sint, linear, (1, 1), 4),
|
||||
Self::Bgra8Unorm => (native, float, linear, (1, 1), 4),
|
||||
Self::Bgra8UnormSrgb => (native, float, srgb, (1, 1), 4),
|
||||
|
||||
// Packed 32 bit textures
|
||||
Self::Rgb10a2Unorm => (native, float, linear, (1, 1), 4),
|
||||
Self::Rg11b10Float => (native, float, linear, (1, 1), 4),
|
||||
|
||||
// Packed 32 bit textures
|
||||
Self::Rg32Uint => (native, uint, linear, (1, 1), 8),
|
||||
Self::Rg32Sint => (native, sint, linear, (1, 1), 8),
|
||||
Self::Rg32Float => (native, nearest, linear, (1, 1), 8),
|
||||
Self::Rgba16Uint => (native, uint, linear, (1, 1), 8),
|
||||
Self::Rgba16Sint => (native, sint, linear, (1, 1), 8),
|
||||
Self::Rgba16Float => (native, float, linear, (1, 1), 8),
|
||||
|
||||
// Packed 32 bit textures
|
||||
Self::Rgba32Uint => (native, uint, linear, (1, 1), 16),
|
||||
Self::Rgba32Sint => (native, sint, linear, (1, 1), 16),
|
||||
Self::Rgba32Float => (native, nearest, linear, (1, 1), 16),
|
||||
|
||||
// Depth-stencil textures
|
||||
Self::Depth32Float => (native, depth, linear, (1, 1), 4),
|
||||
Self::Depth24Plus => (native, depth, linear, (1, 1), 4),
|
||||
Self::Depth24PlusStencil8 => (native, depth, linear, (1, 1), 4),
|
||||
|
||||
// BCn compressed textures
|
||||
Self::Bc1RgbaUnorm => (bc, float, linear, (4, 4), 8),
|
||||
Self::Bc1RgbaUnormSrgb => (bc, float, srgb, (4, 4), 8),
|
||||
Self::Bc2RgbaUnorm => (bc, float, linear, (4, 4), 16),
|
||||
Self::Bc2RgbaUnormSrgb => (bc, float, srgb, (4, 4), 16),
|
||||
Self::Bc3RgbaUnorm => (bc, float, linear, (4, 4), 16),
|
||||
Self::Bc3RgbaUnormSrgb => (bc, float, srgb, (4, 4), 16),
|
||||
Self::Bc4RUnorm => (bc, float, linear, (4, 4), 8),
|
||||
Self::Bc4RSnorm => (bc, float, linear, (4, 4), 8),
|
||||
Self::Bc5RgUnorm => (bc, float, linear, (4, 4), 16),
|
||||
Self::Bc5RgSnorm => (bc, float, linear, (4, 4), 16),
|
||||
Self::Bc6hRgbUfloat => (bc, float, linear, (4, 4), 16),
|
||||
Self::Bc6hRgbSfloat => (bc, float, linear, (4, 4), 16),
|
||||
Self::Bc7RgbaUnorm => (bc, float, linear, (4, 4), 16),
|
||||
Self::Bc7RgbaUnormSrgb => (bc, float, srgb, (4, 4), 16),
|
||||
|
||||
// ETC compressed textures
|
||||
Self::Etc2RgbUnorm => (etc2, float, linear, (4, 4), 8),
|
||||
Self::Etc2RgbUnormSrgb => (etc2, float, srgb, (4, 4), 8),
|
||||
Self::Etc2RgbA1Unorm => (etc2, float, linear, (4, 4), 8),
|
||||
Self::Etc2RgbA1UnormSrgb => (etc2, float, srgb, (4, 4), 8),
|
||||
Self::Etc2RgbA8Unorm => (etc2, float, linear, (4, 4), 16),
|
||||
Self::Etc2RgbA8UnormSrgb => (etc2, float, srgb, (4, 4), 16),
|
||||
Self::EacRUnorm => (etc2, float, linear, (4, 4), 8),
|
||||
Self::EacRSnorm => (etc2, float, linear, (4, 4), 8),
|
||||
Self::EtcRgUnorm => (etc2, float, linear, (4, 4), 16),
|
||||
Self::EtcRgSnorm => (etc2, float, linear, (4, 4), 16),
|
||||
|
||||
// ASTC compressed textures
|
||||
Self::Astc4x4RgbaUnorm => (astc_ldr, float, linear, (4, 4), 16),
|
||||
Self::Astc4x4RgbaUnormSrgb => (astc_ldr, float, srgb, (4, 4), 16),
|
||||
Self::Astc5x4RgbaUnorm => (astc_ldr, float, linear, (5, 4), 16),
|
||||
Self::Astc5x4RgbaUnormSrgb => (astc_ldr, float, srgb, (5, 4), 16),
|
||||
Self::Astc5x5RgbaUnorm => (astc_ldr, float, linear, (5, 5), 16),
|
||||
Self::Astc5x5RgbaUnormSrgb => (astc_ldr, float, srgb, (5, 5), 16),
|
||||
Self::Astc6x5RgbaUnorm => (astc_ldr, float, linear, (6, 5), 16),
|
||||
Self::Astc6x5RgbaUnormSrgb => (astc_ldr, float, srgb, (6, 5), 16),
|
||||
Self::Astc6x6RgbaUnorm => (astc_ldr, float, linear, (6, 6), 16),
|
||||
Self::Astc6x6RgbaUnormSrgb => (astc_ldr, float, srgb, (6, 6), 16),
|
||||
Self::Astc8x5RgbaUnorm => (astc_ldr, float, linear, (8, 5), 16),
|
||||
Self::Astc8x5RgbaUnormSrgb => (astc_ldr, float, srgb, (8, 5), 16),
|
||||
Self::Astc8x6RgbaUnorm => (astc_ldr, float, linear, (8, 6), 16),
|
||||
Self::Astc8x6RgbaUnormSrgb => (astc_ldr, float, srgb, (8, 6), 16),
|
||||
Self::Astc10x5RgbaUnorm => (astc_ldr, float, linear, (10, 5), 16),
|
||||
Self::Astc10x5RgbaUnormSrgb => (astc_ldr, float, srgb, (10, 5), 16),
|
||||
Self::Astc10x6RgbaUnorm => (astc_ldr, float, linear, (10, 6), 16),
|
||||
Self::Astc10x6RgbaUnormSrgb => (astc_ldr, float, srgb, (10, 6), 16),
|
||||
Self::Astc8x8RgbaUnorm => (astc_ldr, float, linear, (8, 8), 16),
|
||||
Self::Astc8x8RgbaUnormSrgb => (astc_ldr, float, srgb, (8, 8), 16),
|
||||
Self::Astc10x8RgbaUnorm => (astc_ldr, float, linear, (10, 8), 16),
|
||||
Self::Astc10x8RgbaUnormSrgb => (astc_ldr, float, srgb, (10, 8), 16),
|
||||
Self::Astc10x10RgbaUnorm => (astc_ldr, float, linear, (10, 10), 16),
|
||||
Self::Astc10x10RgbaUnormSrgb => (astc_ldr, float, srgb, (10, 10), 16),
|
||||
Self::Astc12x10RgbaUnorm => (astc_ldr, float, linear, (12, 10), 16),
|
||||
Self::Astc12x10RgbaUnormSrgb => (astc_ldr, float, srgb, (12, 10), 16),
|
||||
Self::Astc12x12RgbaUnorm => (astc_ldr, float, linear, (12, 12), 16),
|
||||
Self::Astc12x12RgbaUnormSrgb => (astc_ldr, float, srgb, (12, 12), 16),
|
||||
};
|
||||
|
||||
TextureFormatInfo {
|
||||
features,
|
||||
sample_type,
|
||||
block_dimensions,
|
||||
block_size,
|
||||
srgb,
|
||||
}
|
||||
}
|
||||
|
||||
/// Lists features supported by WebGPU, not using any native extensions.
|
||||
pub fn features_webgpu(&self) -> TextureFormatFeatures {
|
||||
// Usage flags
|
||||
// Flags
|
||||
let basic = TextureUsage::COPY_SRC | TextureUsage::COPY_DST | TextureUsage::SAMPLED;
|
||||
let attachment = basic | TextureUsage::RENDER_ATTACHMENT;
|
||||
let storage = basic | TextureUsage::STORAGE;
|
||||
let all_flags = TextureUsage::all();
|
||||
|
||||
// See https://gpuweb.github.io/gpuweb/#texture-format-caps for reference
|
||||
let allowed_usages = match self {
|
||||
// Normal 8 bit textures
|
||||
Self::R8Unorm => attachment,
|
||||
Self::R8Snorm => basic,
|
||||
Self::R8Uint => attachment,
|
||||
Self::R8Sint => attachment,
|
||||
let (required_features, sample_type, srgb, block_dimensions, block_size, allowed_usages) =
|
||||
match self {
|
||||
// Normal 8 bit textures
|
||||
Self::R8Unorm => (native, float, linear, (1, 1), 1, attachment),
|
||||
Self::R8Snorm => (native, float, linear, (1, 1), 1, basic),
|
||||
Self::R8Uint => (native, uint, linear, (1, 1), 1, attachment),
|
||||
Self::R8Sint => (native, sint, linear, (1, 1), 1, attachment),
|
||||
|
||||
// Normal 16 bit textures
|
||||
Self::R16Uint => attachment,
|
||||
Self::R16Sint => attachment,
|
||||
Self::R16Float => attachment,
|
||||
Self::Rg8Unorm => attachment,
|
||||
Self::Rg8Snorm => attachment,
|
||||
Self::Rg8Uint => attachment,
|
||||
Self::Rg8Sint => basic,
|
||||
// Normal 16 bit textures
|
||||
Self::R16Uint => (native, uint, linear, (1, 1), 2, attachment),
|
||||
Self::R16Sint => (native, sint, linear, (1, 1), 2, attachment),
|
||||
Self::R16Float => (native, float, linear, (1, 1), 2, attachment),
|
||||
Self::Rg8Unorm => (native, float, linear, (1, 1), 2, attachment),
|
||||
Self::Rg8Snorm => (native, float, linear, (1, 1), 2, attachment),
|
||||
Self::Rg8Uint => (native, uint, linear, (1, 1), 2, attachment),
|
||||
Self::Rg8Sint => (native, sint, linear, (1, 1), 2, basic),
|
||||
|
||||
// Normal 32 bit textures
|
||||
Self::R32Uint => all_flags,
|
||||
Self::R32Sint => all_flags,
|
||||
Self::R32Float => all_flags,
|
||||
Self::Rg16Uint => attachment,
|
||||
Self::Rg16Sint => attachment,
|
||||
Self::Rg16Float => attachment,
|
||||
Self::Rgba8Unorm => all_flags,
|
||||
Self::Rgba8UnormSrgb => attachment,
|
||||
Self::Rgba8Snorm => storage,
|
||||
Self::Rgba8Uint => all_flags,
|
||||
Self::Rgba8Sint => all_flags,
|
||||
Self::Bgra8Unorm => attachment,
|
||||
Self::Bgra8UnormSrgb => attachment,
|
||||
// Normal 32 bit textures
|
||||
Self::R32Uint => (native, uint, linear, (1, 1), 4, all_flags),
|
||||
Self::R32Sint => (native, sint, linear, (1, 1), 4, all_flags),
|
||||
Self::R32Float => (native, nearest, linear, (1, 1), 4, all_flags),
|
||||
Self::Rg16Uint => (native, uint, linear, (1, 1), 4, attachment),
|
||||
Self::Rg16Sint => (native, sint, linear, (1, 1), 4, attachment),
|
||||
Self::Rg16Float => (native, float, linear, (1, 1), 4, attachment),
|
||||
Self::Rgba8Unorm => (native, float, linear, (1, 1), 4, all_flags),
|
||||
Self::Rgba8UnormSrgb => (native, float, srgb, (1, 1), 4, attachment),
|
||||
Self::Rgba8Snorm => (native, float, linear, (1, 1), 4, storage),
|
||||
Self::Rgba8Uint => (native, uint, linear, (1, 1), 4, all_flags),
|
||||
Self::Rgba8Sint => (native, sint, linear, (1, 1), 4, all_flags),
|
||||
Self::Bgra8Unorm => (native, float, linear, (1, 1), 4, attachment),
|
||||
Self::Bgra8UnormSrgb => (native, float, srgb, (1, 1), 4, attachment),
|
||||
|
||||
// Packed 32 bit textures
|
||||
Self::Rgb10a2Unorm => attachment,
|
||||
Self::Rg11b10Float => basic,
|
||||
// Packed 32 bit textures
|
||||
Self::Rgb10a2Unorm => (native, float, linear, (1, 1), 4, attachment),
|
||||
Self::Rg11b10Float => (native, float, linear, (1, 1), 4, basic),
|
||||
|
||||
// Packed 32 bit textures
|
||||
Self::Rg32Uint => all_flags,
|
||||
Self::Rg32Sint => all_flags,
|
||||
Self::Rg32Float => all_flags,
|
||||
Self::Rgba16Uint => all_flags,
|
||||
Self::Rgba16Sint => all_flags,
|
||||
Self::Rgba16Float => all_flags,
|
||||
// Packed 32 bit textures
|
||||
Self::Rg32Uint => (native, uint, linear, (1, 1), 8, all_flags),
|
||||
Self::Rg32Sint => (native, sint, linear, (1, 1), 8, all_flags),
|
||||
Self::Rg32Float => (native, nearest, linear, (1, 1), 8, all_flags),
|
||||
Self::Rgba16Uint => (native, uint, linear, (1, 1), 8, all_flags),
|
||||
Self::Rgba16Sint => (native, sint, linear, (1, 1), 8, all_flags),
|
||||
Self::Rgba16Float => (native, float, linear, (1, 1), 8, all_flags),
|
||||
|
||||
// Packed 32 bit textures
|
||||
Self::Rgba32Uint => all_flags,
|
||||
Self::Rgba32Sint => all_flags,
|
||||
Self::Rgba32Float => all_flags,
|
||||
// Packed 32 bit textures
|
||||
Self::Rgba32Uint => (native, uint, linear, (1, 1), 16, all_flags),
|
||||
Self::Rgba32Sint => (native, sint, linear, (1, 1), 16, all_flags),
|
||||
Self::Rgba32Float => (native, nearest, linear, (1, 1), 16, all_flags),
|
||||
|
||||
// Depth-stencil textures
|
||||
Self::Depth32Float => attachment,
|
||||
Self::Depth24Plus => attachment,
|
||||
Self::Depth24PlusStencil8 => attachment,
|
||||
// Depth-stencil textures
|
||||
Self::Depth32Float => (native, depth, linear, (1, 1), 4, attachment),
|
||||
Self::Depth24Plus => (native, depth, linear, (1, 1), 4, attachment),
|
||||
Self::Depth24PlusStencil8 => (native, depth, linear, (1, 1), 4, attachment),
|
||||
|
||||
// BCn compressed textures
|
||||
Self::Bc1RgbaUnorm => basic,
|
||||
Self::Bc1RgbaUnormSrgb => basic,
|
||||
Self::Bc2RgbaUnorm => basic,
|
||||
Self::Bc2RgbaUnormSrgb => basic,
|
||||
Self::Bc3RgbaUnorm => basic,
|
||||
Self::Bc3RgbaUnormSrgb => basic,
|
||||
Self::Bc4RUnorm => basic,
|
||||
Self::Bc4RSnorm => basic,
|
||||
Self::Bc5RgUnorm => basic,
|
||||
Self::Bc5RgSnorm => basic,
|
||||
Self::Bc6hRgbUfloat => basic,
|
||||
Self::Bc6hRgbSfloat => basic,
|
||||
Self::Bc7RgbaUnorm => basic,
|
||||
Self::Bc7RgbaUnormSrgb => basic,
|
||||
// BCn compressed textures
|
||||
Self::Bc1RgbaUnorm => (bc, float, linear, (4, 4), 8, basic),
|
||||
Self::Bc1RgbaUnormSrgb => (bc, float, srgb, (4, 4), 8, basic),
|
||||
Self::Bc2RgbaUnorm => (bc, float, linear, (4, 4), 16, basic),
|
||||
Self::Bc2RgbaUnormSrgb => (bc, float, srgb, (4, 4), 16, basic),
|
||||
Self::Bc3RgbaUnorm => (bc, float, linear, (4, 4), 16, basic),
|
||||
Self::Bc3RgbaUnormSrgb => (bc, float, srgb, (4, 4), 16, basic),
|
||||
Self::Bc4RUnorm => (bc, float, linear, (4, 4), 8, basic),
|
||||
Self::Bc4RSnorm => (bc, float, linear, (4, 4), 8, basic),
|
||||
Self::Bc5RgUnorm => (bc, float, linear, (4, 4), 16, basic),
|
||||
Self::Bc5RgSnorm => (bc, float, linear, (4, 4), 16, basic),
|
||||
Self::Bc6hRgbUfloat => (bc, float, linear, (4, 4), 16, basic),
|
||||
Self::Bc6hRgbSfloat => (bc, float, linear, (4, 4), 16, basic),
|
||||
Self::Bc7RgbaUnorm => (bc, float, linear, (4, 4), 16, basic),
|
||||
Self::Bc7RgbaUnormSrgb => (bc, float, srgb, (4, 4), 16, basic),
|
||||
|
||||
// ETC compressed textures
|
||||
Self::Etc2RgbUnorm => basic,
|
||||
Self::Etc2RgbUnormSrgb => basic,
|
||||
Self::Etc2RgbA1Unorm => basic,
|
||||
Self::Etc2RgbA1UnormSrgb => basic,
|
||||
Self::Etc2RgbA8Unorm => basic,
|
||||
Self::Etc2RgbA8UnormSrgb => basic,
|
||||
Self::EacRUnorm => basic,
|
||||
Self::EacRSnorm => basic,
|
||||
Self::EtcRgUnorm => basic,
|
||||
Self::EtcRgSnorm => basic,
|
||||
// ETC compressed textures
|
||||
Self::Etc2RgbUnorm => (etc2, float, linear, (4, 4), 8, basic),
|
||||
Self::Etc2RgbUnormSrgb => (etc2, float, srgb, (4, 4), 8, basic),
|
||||
Self::Etc2RgbA1Unorm => (etc2, float, linear, (4, 4), 8, basic),
|
||||
Self::Etc2RgbA1UnormSrgb => (etc2, float, srgb, (4, 4), 8, basic),
|
||||
Self::Etc2RgbA8Unorm => (etc2, float, linear, (4, 4), 16, basic),
|
||||
Self::Etc2RgbA8UnormSrgb => (etc2, float, srgb, (4, 4), 16, basic),
|
||||
Self::EacRUnorm => (etc2, float, linear, (4, 4), 8, basic),
|
||||
Self::EacRSnorm => (etc2, float, linear, (4, 4), 8, basic),
|
||||
Self::EtcRgUnorm => (etc2, float, linear, (4, 4), 16, basic),
|
||||
Self::EtcRgSnorm => (etc2, float, linear, (4, 4), 16, basic),
|
||||
|
||||
// ASTC compressed textures
|
||||
Self::Astc4x4RgbaUnorm => basic,
|
||||
Self::Astc4x4RgbaUnormSrgb => basic,
|
||||
Self::Astc5x4RgbaUnorm => basic,
|
||||
Self::Astc5x4RgbaUnormSrgb => basic,
|
||||
Self::Astc5x5RgbaUnorm => basic,
|
||||
Self::Astc5x5RgbaUnormSrgb => basic,
|
||||
Self::Astc6x5RgbaUnorm => basic,
|
||||
Self::Astc6x5RgbaUnormSrgb => basic,
|
||||
Self::Astc6x6RgbaUnorm => basic,
|
||||
Self::Astc6x6RgbaUnormSrgb => basic,
|
||||
Self::Astc8x5RgbaUnorm => basic,
|
||||
Self::Astc8x5RgbaUnormSrgb => basic,
|
||||
Self::Astc8x6RgbaUnorm => basic,
|
||||
Self::Astc8x6RgbaUnormSrgb => basic,
|
||||
Self::Astc10x5RgbaUnorm => basic,
|
||||
Self::Astc10x5RgbaUnormSrgb => basic,
|
||||
Self::Astc10x6RgbaUnorm => basic,
|
||||
Self::Astc10x6RgbaUnormSrgb => basic,
|
||||
Self::Astc8x8RgbaUnorm => basic,
|
||||
Self::Astc8x8RgbaUnormSrgb => basic,
|
||||
Self::Astc10x8RgbaUnorm => basic,
|
||||
Self::Astc10x8RgbaUnormSrgb => basic,
|
||||
Self::Astc10x10RgbaUnorm => basic,
|
||||
Self::Astc10x10RgbaUnormSrgb => basic,
|
||||
Self::Astc12x10RgbaUnorm => basic,
|
||||
Self::Astc12x10RgbaUnormSrgb => basic,
|
||||
Self::Astc12x12RgbaUnorm => basic,
|
||||
Self::Astc12x12RgbaUnormSrgb => basic,
|
||||
};
|
||||
// ASTC compressed textures
|
||||
Self::Astc4x4RgbaUnorm => (astc_ldr, float, linear, (4, 4), 16, basic),
|
||||
Self::Astc4x4RgbaUnormSrgb => (astc_ldr, float, srgb, (4, 4), 16, basic),
|
||||
Self::Astc5x4RgbaUnorm => (astc_ldr, float, linear, (5, 4), 16, basic),
|
||||
Self::Astc5x4RgbaUnormSrgb => (astc_ldr, float, srgb, (5, 4), 16, basic),
|
||||
Self::Astc5x5RgbaUnorm => (astc_ldr, float, linear, (5, 5), 16, basic),
|
||||
Self::Astc5x5RgbaUnormSrgb => (astc_ldr, float, srgb, (5, 5), 16, basic),
|
||||
Self::Astc6x5RgbaUnorm => (astc_ldr, float, linear, (6, 5), 16, basic),
|
||||
Self::Astc6x5RgbaUnormSrgb => (astc_ldr, float, srgb, (6, 5), 16, basic),
|
||||
Self::Astc6x6RgbaUnorm => (astc_ldr, float, linear, (6, 6), 16, basic),
|
||||
Self::Astc6x6RgbaUnormSrgb => (astc_ldr, float, srgb, (6, 6), 16, basic),
|
||||
Self::Astc8x5RgbaUnorm => (astc_ldr, float, linear, (8, 5), 16, basic),
|
||||
Self::Astc8x5RgbaUnormSrgb => (astc_ldr, float, srgb, (8, 5), 16, basic),
|
||||
Self::Astc8x6RgbaUnorm => (astc_ldr, float, linear, (8, 6), 16, basic),
|
||||
Self::Astc8x6RgbaUnormSrgb => (astc_ldr, float, srgb, (8, 6), 16, basic),
|
||||
Self::Astc10x5RgbaUnorm => (astc_ldr, float, linear, (10, 5), 16, basic),
|
||||
Self::Astc10x5RgbaUnormSrgb => (astc_ldr, float, srgb, (10, 5), 16, basic),
|
||||
Self::Astc10x6RgbaUnorm => (astc_ldr, float, linear, (10, 6), 16, basic),
|
||||
Self::Astc10x6RgbaUnormSrgb => (astc_ldr, float, srgb, (10, 6), 16, basic),
|
||||
Self::Astc8x8RgbaUnorm => (astc_ldr, float, linear, (8, 8), 16, basic),
|
||||
Self::Astc8x8RgbaUnormSrgb => (astc_ldr, float, srgb, (8, 8), 16, basic),
|
||||
Self::Astc10x8RgbaUnorm => (astc_ldr, float, linear, (10, 8), 16, basic),
|
||||
Self::Astc10x8RgbaUnormSrgb => (astc_ldr, float, srgb, (10, 8), 16, basic),
|
||||
Self::Astc10x10RgbaUnorm => (astc_ldr, float, linear, (10, 10), 16, basic),
|
||||
Self::Astc10x10RgbaUnormSrgb => (astc_ldr, float, srgb, (10, 10), 16, basic),
|
||||
Self::Astc12x10RgbaUnorm => (astc_ldr, float, linear, (12, 10), 16, basic),
|
||||
Self::Astc12x10RgbaUnormSrgb => (astc_ldr, float, srgb, (12, 10), 16, basic),
|
||||
Self::Astc12x12RgbaUnorm => (astc_ldr, float, linear, (12, 12), 16, basic),
|
||||
Self::Astc12x12RgbaUnormSrgb => (astc_ldr, float, srgb, (12, 12), 16, basic),
|
||||
};
|
||||
|
||||
TextureFormatFeatures {
|
||||
allowed_usages,
|
||||
flags: TextureFormatFeatureFlags::empty(),
|
||||
TextureFormatInfo {
|
||||
required_features,
|
||||
sample_type,
|
||||
block_dimensions,
|
||||
block_size,
|
||||
srgb,
|
||||
guaranteed_format_features: TextureFormatFeatures {
|
||||
allowed_usages,
|
||||
flags: TextureFormatFeatureFlags::empty(),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user