mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Add format features table to wgpu-info and improve output
This commit is contained in:
parent
1da5bbd7b4
commit
ff233fbf31
@ -6,6 +6,124 @@ mod inner {
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
// Lets keep these on one line
|
||||
#[rustfmt::skip]
|
||||
const TEXTURE_FORMAT_LIST: [wgpu::TextureFormat; 113] = [
|
||||
wgpu::TextureFormat::R8Unorm,
|
||||
wgpu::TextureFormat::R8Snorm,
|
||||
wgpu::TextureFormat::R8Uint,
|
||||
wgpu::TextureFormat::R8Sint,
|
||||
wgpu::TextureFormat::R16Uint,
|
||||
wgpu::TextureFormat::R16Sint,
|
||||
wgpu::TextureFormat::R16Unorm,
|
||||
wgpu::TextureFormat::R16Snorm,
|
||||
wgpu::TextureFormat::R16Float,
|
||||
wgpu::TextureFormat::Rg8Unorm,
|
||||
wgpu::TextureFormat::Rg8Snorm,
|
||||
wgpu::TextureFormat::Rg8Uint,
|
||||
wgpu::TextureFormat::Rg8Sint,
|
||||
wgpu::TextureFormat::R32Uint,
|
||||
wgpu::TextureFormat::R32Sint,
|
||||
wgpu::TextureFormat::R32Float,
|
||||
wgpu::TextureFormat::Rg16Uint,
|
||||
wgpu::TextureFormat::Rg16Sint,
|
||||
wgpu::TextureFormat::Rg16Unorm,
|
||||
wgpu::TextureFormat::Rg16Snorm,
|
||||
wgpu::TextureFormat::Rg16Float,
|
||||
wgpu::TextureFormat::Rgba8Unorm,
|
||||
wgpu::TextureFormat::Rgba8UnormSrgb,
|
||||
wgpu::TextureFormat::Rgba8Snorm,
|
||||
wgpu::TextureFormat::Rgba8Uint,
|
||||
wgpu::TextureFormat::Rgba8Sint,
|
||||
wgpu::TextureFormat::Bgra8Unorm,
|
||||
wgpu::TextureFormat::Bgra8UnormSrgb,
|
||||
wgpu::TextureFormat::Rgb10a2Unorm,
|
||||
wgpu::TextureFormat::Rg11b10Float,
|
||||
wgpu::TextureFormat::Rg32Uint,
|
||||
wgpu::TextureFormat::Rg32Sint,
|
||||
wgpu::TextureFormat::Rg32Float,
|
||||
wgpu::TextureFormat::Rgba16Uint,
|
||||
wgpu::TextureFormat::Rgba16Sint,
|
||||
wgpu::TextureFormat::Rgba16Unorm,
|
||||
wgpu::TextureFormat::Rgba16Snorm,
|
||||
wgpu::TextureFormat::Rgba16Float,
|
||||
wgpu::TextureFormat::Rgba32Uint,
|
||||
wgpu::TextureFormat::Rgba32Sint,
|
||||
wgpu::TextureFormat::Rgba32Float,
|
||||
wgpu::TextureFormat::Depth32Float,
|
||||
wgpu::TextureFormat::Depth32FloatStencil8,
|
||||
wgpu::TextureFormat::Depth24Plus,
|
||||
wgpu::TextureFormat::Depth24PlusStencil8,
|
||||
wgpu::TextureFormat::Depth24UnormStencil8,
|
||||
wgpu::TextureFormat::Rgb9e5Ufloat,
|
||||
wgpu::TextureFormat::Bc1RgbaUnorm,
|
||||
wgpu::TextureFormat::Bc1RgbaUnormSrgb,
|
||||
wgpu::TextureFormat::Bc2RgbaUnorm,
|
||||
wgpu::TextureFormat::Bc2RgbaUnormSrgb,
|
||||
wgpu::TextureFormat::Bc3RgbaUnorm,
|
||||
wgpu::TextureFormat::Bc3RgbaUnormSrgb,
|
||||
wgpu::TextureFormat::Bc4RUnorm,
|
||||
wgpu::TextureFormat::Bc4RSnorm,
|
||||
wgpu::TextureFormat::Bc5RgUnorm,
|
||||
wgpu::TextureFormat::Bc5RgSnorm,
|
||||
wgpu::TextureFormat::Bc6hRgbUfloat,
|
||||
wgpu::TextureFormat::Bc6hRgbSfloat,
|
||||
wgpu::TextureFormat::Bc7RgbaUnorm,
|
||||
wgpu::TextureFormat::Bc7RgbaUnormSrgb,
|
||||
wgpu::TextureFormat::Etc2Rgb8Unorm,
|
||||
wgpu::TextureFormat::Etc2Rgb8UnormSrgb,
|
||||
wgpu::TextureFormat::Etc2Rgb8A1Unorm,
|
||||
wgpu::TextureFormat::Etc2Rgb8A1UnormSrgb,
|
||||
wgpu::TextureFormat::Etc2Rgba8Unorm,
|
||||
wgpu::TextureFormat::Etc2Rgba8UnormSrgb,
|
||||
wgpu::TextureFormat::EacR11Unorm,
|
||||
wgpu::TextureFormat::EacR11Snorm,
|
||||
wgpu::TextureFormat::EacRg11Unorm,
|
||||
wgpu::TextureFormat::EacRg11Snorm,
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B4x4, channel: wgpu::AstcChannel::Unorm },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B4x4, channel: wgpu::AstcChannel::UnormSrgb },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B4x4, channel: wgpu::AstcChannel::Hdr },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B5x4, channel: wgpu::AstcChannel::Unorm },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B5x4, channel: wgpu::AstcChannel::UnormSrgb },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B5x4, channel: wgpu::AstcChannel::Hdr },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B5x5, channel: wgpu::AstcChannel::Unorm },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B5x5, channel: wgpu::AstcChannel::UnormSrgb },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B5x5, channel: wgpu::AstcChannel::Hdr },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B6x5, channel: wgpu::AstcChannel::Unorm },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B6x5, channel: wgpu::AstcChannel::UnormSrgb },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B6x5, channel: wgpu::AstcChannel::Hdr },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B6x6, channel: wgpu::AstcChannel::Unorm },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B6x6, channel: wgpu::AstcChannel::UnormSrgb },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B6x6, channel: wgpu::AstcChannel::Hdr },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x5, channel: wgpu::AstcChannel::Unorm },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x5, channel: wgpu::AstcChannel::UnormSrgb },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x5, channel: wgpu::AstcChannel::Hdr },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x6, channel: wgpu::AstcChannel::Unorm },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x6, channel: wgpu::AstcChannel::UnormSrgb },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x6, channel: wgpu::AstcChannel::Hdr },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x8, channel: wgpu::AstcChannel::Unorm },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x8, channel: wgpu::AstcChannel::UnormSrgb },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x8, channel: wgpu::AstcChannel::Hdr },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x5, channel: wgpu::AstcChannel::Unorm },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x5, channel: wgpu::AstcChannel::UnormSrgb },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x5, channel: wgpu::AstcChannel::Hdr },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x6, channel: wgpu::AstcChannel::Unorm },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x6, channel: wgpu::AstcChannel::UnormSrgb },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x6, channel: wgpu::AstcChannel::Hdr },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x8, channel: wgpu::AstcChannel::Unorm },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x8, channel: wgpu::AstcChannel::UnormSrgb },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x8, channel: wgpu::AstcChannel::Hdr },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x10, channel: wgpu::AstcChannel::Unorm },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x10, channel: wgpu::AstcChannel::UnormSrgb },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x10, channel: wgpu::AstcChannel::Hdr },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B12x10, channel: wgpu::AstcChannel::Unorm },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B12x10, channel: wgpu::AstcChannel::UnormSrgb },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B12x10, channel: wgpu::AstcChannel::Hdr },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B12x12, channel: wgpu::AstcChannel::Unorm },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B12x12, channel: wgpu::AstcChannel::UnormSrgb },
|
||||
wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B12x12, channel: wgpu::AstcChannel::Hdr },
|
||||
];
|
||||
|
||||
// Lets keep these on one line
|
||||
#[rustfmt::skip]
|
||||
fn print_info_from_adapter(adapter: &wgpu::Adapter, idx: usize) {
|
||||
@ -26,7 +144,7 @@ mod inner {
|
||||
let bit = wgpu::Features::from_bits(1 << i as u64);
|
||||
if let Some(bit) = bit {
|
||||
if wgpu::Features::all().contains(bit) {
|
||||
println!("\t\t{:<63} {}", format!("{:?}:", bit), features.contains(bit));
|
||||
println!("\t\t{:>63} {}", format!("{:?}:", bit), features.contains(bit));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -102,10 +220,55 @@ mod inner {
|
||||
let bit = wgpu::DownlevelFlags::from_bits(1 << i as u64);
|
||||
if let Some(bit) = bit {
|
||||
if wgpu::DownlevelFlags::all().contains(bit) {
|
||||
println!("\t\t{:<36} {}", format!("{:?}:", bit), flags.contains(bit));
|
||||
println!("\t\t{:>36} {}", format!("{:?}:", bit), flags.contains(bit));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
println!("\tTexture Format Features: ┌──────────┬──────────┬──────────Allowed┬Usages───────────┬───────────────────┐ ┌────────────┬─────────────┬──────────────Feature┬Flags───────────────┬─────────────────┐");
|
||||
for format in TEXTURE_FORMAT_LIST {
|
||||
let features = adapter.get_texture_format_features(format);
|
||||
let format_name = match format {
|
||||
wgpu::TextureFormat::Astc { block, channel } => {
|
||||
format!("Astc{block:?}{channel:?}:")
|
||||
}
|
||||
_ => {
|
||||
format!("{format:?}:")
|
||||
}
|
||||
};
|
||||
print!("\t\t{:>21}", format_name);
|
||||
for i in 0..(size_of::<wgpu::TextureUsages>() * 8) {
|
||||
let bit = wgpu::TextureUsages::from_bits(1 << i as u32);
|
||||
if let Some(bit) = bit {
|
||||
print!(" │ ");
|
||||
if features.allowed_usages.contains(bit) {
|
||||
print!("{bit:?}");
|
||||
}
|
||||
else {
|
||||
let length = format!("{bit:?}").len();
|
||||
print!("{}", " ".repeat(length))
|
||||
}
|
||||
}
|
||||
}
|
||||
print!(" │ │ ");
|
||||
for i in 0..(size_of::<wgpu::TextureFormatFeatureFlags>() * 8) {
|
||||
let bit = wgpu::TextureFormatFeatureFlags::from_bits(1 << i as u32);
|
||||
if let Some(bit) = bit {
|
||||
if i != 0 {
|
||||
print!(" │ ")
|
||||
}
|
||||
if features.flags.contains(bit) {
|
||||
print!("{bit:?}");
|
||||
}
|
||||
else {
|
||||
let length = format!("{bit:?}").len();
|
||||
print!("{}", " ".repeat(length))
|
||||
}
|
||||
}
|
||||
}
|
||||
println!(" │");
|
||||
}
|
||||
println!("\t └──────────┴──────────┴─────────────────┴─────────────────┴───────────────────┘ └────────────┴─────────────┴─────────────────────┴────────────────────┴─────────────────┘");
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user