upgrade wgpu

This commit is contained in:
Carter Anderson 2020-03-30 00:56:15 -07:00
parent 13da707aee
commit c7ee4bc133
11 changed files with 132 additions and 148 deletions

View File

@ -13,7 +13,7 @@ bevy_derive = { path = "bevy_derive" }
bevy_transform = { path = "bevy_transform" } bevy_transform = { path = "bevy_transform" }
# rendering # rendering
wgpu = { git = "https://github.com/gfx-rs/wgpu-rs.git", rev = "a7b0d5ae5bc0934439ef559ed145e93f0117c39a", optional = true } wgpu = { git = "https://github.com/gfx-rs/wgpu-rs.git", rev = "d08f83762426c2c42eda74c7ca9c43d8d950fc0a", optional = true }
winit = { version = "0.22.0", optional = true } winit = { version = "0.22.0", optional = true }
spirv-reflect = "0.2.3" spirv-reflect = "0.2.3"
shaderc = "0.6" shaderc = "0.6"
@ -40,6 +40,7 @@ type-uuid = "0.1"
libloading = "0.5.2" libloading = "0.5.2"
# TODO: replace once_cell with std equivalent if/when this lands: https://github.com/rust-lang/rfcs/pull/2788 # TODO: replace once_cell with std equivalent if/when this lands: https://github.com/rust-lang/rfcs/pull/2788
once_cell = "1.3.1" once_cell = "1.3.1"
futures = "0.3"
[profile.release] [profile.release]
debug = true debug = true

View File

@ -1,5 +1,5 @@
use super::UniformProperty; use super::UniformProperty;
use crate::render::texture::TextureViewDimension; use crate::render::texture::{TextureComponentType, TextureViewDimension, TextureFormat};
#[derive(Hash, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] #[derive(Hash, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
pub struct BindingDescriptor { pub struct BindingDescriptor {
@ -19,13 +19,19 @@ pub enum BindType {
dynamic: bool, dynamic: bool,
readonly: bool, readonly: bool,
}, },
Sampler, Sampler {
comparison: bool,
},
SampledTexture { SampledTexture {
multisampled: bool, multisampled: bool,
dimension: TextureViewDimension, dimension: TextureViewDimension,
component_type: TextureComponentType,
}, },
StorageTexture { StorageTexture {
dimension: TextureViewDimension, dimension: TextureViewDimension,
component_type: TextureComponentType,
format: TextureFormat,
readonly: bool,
}, },
} }

View File

@ -30,7 +30,7 @@ impl AppPlugin for WgpuRendererPlugin {
pub fn wgpu_render_system(resources: &Resources) -> impl FnMut(&mut World, &mut Resources) { pub fn wgpu_render_system(resources: &Resources) -> impl FnMut(&mut World, &mut Resources) {
let window_resize_event = resources.get::<Event<WindowResize>>().unwrap(); let window_resize_event = resources.get::<Event<WindowResize>>().unwrap();
let mut wgpu_renderer = WgpuRenderer::new(window_resize_event.get_handle()); let mut wgpu_renderer = futures::executor::block_on(WgpuRenderer::new(window_resize_event.get_handle()));
move |world, resources| { move |world, resources| {
wgpu_renderer.update(world, resources); wgpu_renderer.update(world, resources);
} }

View File

@ -28,12 +28,12 @@ impl<'a, 'b, 'c, 'd> RenderPass for WgpuRenderPass<'a, 'b, 'c, 'd> {
fn set_vertex_buffer(&mut self, start_slot: u32, resource: RenderResource, offset: u64) { fn set_vertex_buffer(&mut self, start_slot: u32, resource: RenderResource, offset: u64) {
let buffer = self.wgpu_resources.buffers.get(&resource).unwrap(); let buffer = self.wgpu_resources.buffers.get(&resource).unwrap();
self.render_pass self.render_pass
.set_vertex_buffers(start_slot, &[(&buffer, offset)]); .set_vertex_buffer(start_slot, &buffer, offset, 0);
} }
fn set_index_buffer(&mut self, resource: RenderResource, offset: u64) { fn set_index_buffer(&mut self, resource: RenderResource, offset: u64) {
let buffer = self.wgpu_resources.buffers.get(&resource).unwrap(); let buffer = self.wgpu_resources.buffers.get(&resource).unwrap();
self.render_pass.set_index_buffer(&buffer, offset); self.render_pass.set_index_buffer(&buffer, offset, 0);
} }
fn draw_indexed(&mut self, indices: Range<u32>, base_vertex: i32, instances: Range<u32>) { fn draw_indexed(&mut self, indices: Range<u32>, base_vertex: i32, instances: Range<u32>) {

View File

@ -33,13 +33,14 @@ pub struct WgpuRenderer {
} }
impl WgpuRenderer { impl WgpuRenderer {
pub fn new(window_resize_event: EventHandle<WindowResize>) -> Self { pub async fn new(window_resize_event: EventHandle<WindowResize>) -> Self {
let adapter = wgpu::Adapter::request( let adapter = wgpu::Adapter::request(
&wgpu::RequestAdapterOptions { &wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::Default, power_preference: wgpu::PowerPreference::Default,
}, },
wgpu::BackendBit::PRIMARY, wgpu::BackendBit::PRIMARY,
) )
.await
.unwrap(); .unwrap();
let (device, queue) = adapter.request_device(&wgpu::DeviceDescriptor { let (device, queue) = adapter.request_device(&wgpu::DeviceDescriptor {
@ -47,7 +48,7 @@ impl WgpuRenderer {
anisotropic_filtering: false, anisotropic_filtering: false,
}, },
limits: wgpu::Limits::default(), limits: wgpu::Limits::default(),
}); }).await;
WgpuRenderer { WgpuRenderer {
device: Rc::new(RefCell::new(device)), device: Rc::new(RefCell::new(device)),
@ -85,12 +86,12 @@ impl WgpuRenderer {
let bind_group_layout_binding = bind_group let bind_group_layout_binding = bind_group
.bindings .bindings
.iter() .iter()
.map(|binding| wgpu::BindGroupLayoutBinding { .map(|binding| wgpu::BindGroupLayoutEntry {
binding: binding.index, binding: binding.index,
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT, visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
ty: (&binding.bind_type).into(), ty: (&binding.bind_type).into(),
}) })
.collect::<Vec<wgpu::BindGroupLayoutBinding>>(); .collect::<Vec<wgpu::BindGroupLayoutEntry>>();
let wgpu_bind_group_layout = let wgpu_bind_group_layout =
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
bindings: bind_group_layout_binding.as_slice(), bindings: bind_group_layout_binding.as_slice(),
@ -182,11 +183,13 @@ impl WgpuRenderer {
.depth_stencil_state .depth_stencil_state
.as_ref() .as_ref()
.map(|d| d.into()), .map(|d| d.into()),
index_format: pipeline_descriptor.index_format.into(), vertex_state: wgpu::VertexStateDescriptor {
vertex_buffers: &owned_vertex_buffer_descriptors index_format: pipeline_descriptor.index_format.into(),
.iter() vertex_buffers: &owned_vertex_buffer_descriptors
.map(|v| v.into()) .iter()
.collect::<Vec<wgpu::VertexBufferDescriptor>>(), .map(|v| v.into())
.collect::<Vec<wgpu::VertexBufferDescriptor>>(),
},
sample_count: pipeline_descriptor.sample_count, sample_count: pipeline_descriptor.sample_count,
sample_mask: pipeline_descriptor.sample_mask, sample_mask: pipeline_descriptor.sample_mask,
alpha_to_coverage_enabled: pipeline_descriptor.alpha_to_coverage_enabled, alpha_to_coverage_enabled: pipeline_descriptor.alpha_to_coverage_enabled,

View File

@ -77,7 +77,7 @@ impl WgpuResources {
panic!("expected a Texture resource"); panic!("expected a Texture resource");
} }
} }
BindType::Sampler => { BindType::Sampler { .. } => {
if let ResourceInfo::Sampler = resource_info { if let ResourceInfo::Sampler = resource_info {
let sampler = self.samplers.get(&resource).unwrap(); let sampler = self.samplers.get(&resource).unwrap();
wgpu::BindingResource::Sampler(sampler) wgpu::BindingResource::Sampler(sampler)
@ -251,8 +251,8 @@ impl WgpuResources {
wgpu::BufferCopyView { wgpu::BufferCopyView {
buffer: &temp_buf, buffer: &temp_buf,
offset: 0, offset: 0,
row_pitch: 4 * descriptor.size.width, bytes_per_row: 4 * descriptor.size.width,
image_height: descriptor.size.height, rows_per_image: 0, // NOTE: Example sets this to 0, but should it be height?
}, },
wgpu::TextureCopyView { wgpu::TextureCopyView {
texture: &texture, texture: &texture,

View File

@ -15,8 +15,8 @@ use crate::{
}, },
render_resource::BufferUsage, render_resource::BufferUsage,
texture::{ texture::{
AddressMode, Extent3d, FilterMode, SamplerDescriptor, TextureDescriptor, AddressMode, Extent3d, FilterMode, SamplerDescriptor, TextureComponentType,
TextureDimension, TextureFormat, TextureUsage, TextureViewDimension, TextureDescriptor, TextureDimension, TextureFormat, TextureUsage, TextureViewDimension,
}, },
}, },
}; };
@ -158,18 +158,40 @@ impl From<&BindType> for wgpu::BindingType {
BindType::SampledTexture { BindType::SampledTexture {
dimension, dimension,
multisampled, multisampled,
component_type,
} => wgpu::BindingType::SampledTexture { } => wgpu::BindingType::SampledTexture {
dimension: (*dimension).into(), dimension: (*dimension).into(),
multisampled: *multisampled, multisampled: *multisampled,
component_type: (*component_type).into(),
}, },
BindType::Sampler => wgpu::BindingType::Sampler, BindType::Sampler { comparison } => wgpu::BindingType::Sampler {
BindType::StorageTexture { dimension } => wgpu::BindingType::StorageTexture { comparison: *comparison,
},
BindType::StorageTexture {
dimension,
component_type,
format,
readonly,
} => wgpu::BindingType::StorageTexture {
dimension: (*dimension).into(), dimension: (*dimension).into(),
component_type: (*component_type).into(),
format: (*format).into(),
readonly: *readonly,
}, },
} }
} }
} }
impl From<TextureComponentType> for wgpu::TextureComponentType {
fn from(texture_component_type: TextureComponentType) -> Self {
match texture_component_type {
TextureComponentType::Float => wgpu::TextureComponentType::Float,
TextureComponentType::Sint => wgpu::TextureComponentType::Sint,
TextureComponentType::Uint => wgpu::TextureComponentType::Uint,
}
}
}
impl From<Extent3d> for wgpu::Extent3d { impl From<Extent3d> for wgpu::Extent3d {
fn from(val: Extent3d) -> Self { fn from(val: Extent3d) -> Self {
wgpu::Extent3d { wgpu::Extent3d {
@ -224,8 +246,6 @@ impl From<TextureFormat> for wgpu::TextureFormat {
TextureFormat::R8Snorm => wgpu::TextureFormat::R8Snorm, TextureFormat::R8Snorm => wgpu::TextureFormat::R8Snorm,
TextureFormat::R8Uint => wgpu::TextureFormat::R8Uint, TextureFormat::R8Uint => wgpu::TextureFormat::R8Uint,
TextureFormat::R8Sint => wgpu::TextureFormat::R8Sint, TextureFormat::R8Sint => wgpu::TextureFormat::R8Sint,
TextureFormat::R16Unorm => wgpu::TextureFormat::R16Unorm,
TextureFormat::R16Snorm => wgpu::TextureFormat::R16Snorm,
TextureFormat::R16Uint => wgpu::TextureFormat::R16Uint, TextureFormat::R16Uint => wgpu::TextureFormat::R16Uint,
TextureFormat::R16Sint => wgpu::TextureFormat::R16Sint, TextureFormat::R16Sint => wgpu::TextureFormat::R16Sint,
TextureFormat::R16Float => wgpu::TextureFormat::R16Float, TextureFormat::R16Float => wgpu::TextureFormat::R16Float,
@ -236,8 +256,6 @@ impl From<TextureFormat> for wgpu::TextureFormat {
TextureFormat::R32Uint => wgpu::TextureFormat::R32Uint, TextureFormat::R32Uint => wgpu::TextureFormat::R32Uint,
TextureFormat::R32Sint => wgpu::TextureFormat::R32Sint, TextureFormat::R32Sint => wgpu::TextureFormat::R32Sint,
TextureFormat::R32Float => wgpu::TextureFormat::R32Float, TextureFormat::R32Float => wgpu::TextureFormat::R32Float,
TextureFormat::Rg16Unorm => wgpu::TextureFormat::Rg16Unorm,
TextureFormat::Rg16Snorm => wgpu::TextureFormat::Rg16Snorm,
TextureFormat::Rg16Uint => wgpu::TextureFormat::Rg16Uint, TextureFormat::Rg16Uint => wgpu::TextureFormat::Rg16Uint,
TextureFormat::Rg16Sint => wgpu::TextureFormat::Rg16Sint, TextureFormat::Rg16Sint => wgpu::TextureFormat::Rg16Sint,
TextureFormat::Rg16Float => wgpu::TextureFormat::Rg16Float, TextureFormat::Rg16Float => wgpu::TextureFormat::Rg16Float,
@ -253,8 +271,6 @@ impl From<TextureFormat> for wgpu::TextureFormat {
TextureFormat::Rg32Uint => wgpu::TextureFormat::Rg32Uint, TextureFormat::Rg32Uint => wgpu::TextureFormat::Rg32Uint,
TextureFormat::Rg32Sint => wgpu::TextureFormat::Rg32Sint, TextureFormat::Rg32Sint => wgpu::TextureFormat::Rg32Sint,
TextureFormat::Rg32Float => wgpu::TextureFormat::Rg32Float, TextureFormat::Rg32Float => wgpu::TextureFormat::Rg32Float,
TextureFormat::Rgba16Unorm => wgpu::TextureFormat::Rgba16Unorm,
TextureFormat::Rgba16Snorm => wgpu::TextureFormat::Rgba16Snorm,
TextureFormat::Rgba16Uint => wgpu::TextureFormat::Rgba16Uint, TextureFormat::Rgba16Uint => wgpu::TextureFormat::Rgba16Uint,
TextureFormat::Rgba16Sint => wgpu::TextureFormat::Rgba16Sint, TextureFormat::Rgba16Sint => wgpu::TextureFormat::Rgba16Sint,
TextureFormat::Rgba16Float => wgpu::TextureFormat::Rgba16Float, TextureFormat::Rgba16Float => wgpu::TextureFormat::Rgba16Float,
@ -314,6 +330,30 @@ impl From<CompareFunction> for wgpu::CompareFunction {
} }
} }
static COMPARE_FUNCTION_NEVER: &wgpu::CompareFunction = &wgpu::CompareFunction::Never;
static COMPARE_FUNCTION_LESS: &wgpu::CompareFunction = &wgpu::CompareFunction::Less;
static COMPARE_FUNCTION_EQUAL: &wgpu::CompareFunction = &wgpu::CompareFunction::Equal;
static COMPARE_FUNCTION_LESSEQUAL: &wgpu::CompareFunction = &wgpu::CompareFunction::LessEqual;
static COMPARE_FUNCTION_GREATER: &wgpu::CompareFunction = &wgpu::CompareFunction::Greater;
static COMPARE_FUNCTION_NOTEQUAL: &wgpu::CompareFunction = &wgpu::CompareFunction::NotEqual;
static COMPARE_FUNCTION_GREATEREQUAL: &wgpu::CompareFunction = &wgpu::CompareFunction::GreaterEqual;
static COMPARE_FUNCTION_ALWAYS: &wgpu::CompareFunction = &wgpu::CompareFunction::Always;
impl From<CompareFunction> for &'static wgpu::CompareFunction {
fn from(val: CompareFunction) -> Self {
match val {
CompareFunction::Never => COMPARE_FUNCTION_NEVER,
CompareFunction::Less => COMPARE_FUNCTION_LESS,
CompareFunction::Equal => COMPARE_FUNCTION_EQUAL,
CompareFunction::LessEqual => COMPARE_FUNCTION_LESSEQUAL,
CompareFunction::Greater => COMPARE_FUNCTION_GREATER,
CompareFunction::NotEqual => COMPARE_FUNCTION_NOTEQUAL,
CompareFunction::GreaterEqual => COMPARE_FUNCTION_GREATEREQUAL,
CompareFunction::Always => COMPARE_FUNCTION_ALWAYS,
}
}
}
impl From<StencilOperation> for wgpu::StencilOperation { impl From<StencilOperation> for wgpu::StencilOperation {
fn from(val: StencilOperation) -> Self { fn from(val: StencilOperation) -> Self {
match val { match val {
@ -440,7 +480,7 @@ impl From<IndexFormat> for wgpu::IndexFormat {
} }
} }
impl From<SamplerDescriptor> for wgpu::SamplerDescriptor { impl From<SamplerDescriptor> for wgpu::SamplerDescriptor<'_> {
fn from(sampler_descriptor: SamplerDescriptor) -> Self { fn from(sampler_descriptor: SamplerDescriptor) -> Self {
wgpu::SamplerDescriptor { wgpu::SamplerDescriptor {
address_mode_u: sampler_descriptor.address_mode_u.into(), address_mode_u: sampler_descriptor.address_mode_u.into(),
@ -451,7 +491,7 @@ impl From<SamplerDescriptor> for wgpu::SamplerDescriptor {
mipmap_filter: sampler_descriptor.mipmap_filter.into(), mipmap_filter: sampler_descriptor.mipmap_filter.into(),
lod_min_clamp: sampler_descriptor.lod_min_clamp, lod_min_clamp: sampler_descriptor.lod_min_clamp,
lod_max_clamp: sampler_descriptor.lod_max_clamp, lod_max_clamp: sampler_descriptor.lod_max_clamp,
compare_function: sampler_descriptor.compare_function.into(), compare: sampler_descriptor.compare_function.map(|c| c.into()),
} }
} }
} }
@ -483,9 +523,9 @@ impl From<&Window> for wgpu::SwapChainDescriptor {
width: window.width, width: window.width,
height: window.height, height: window.height,
present_mode: if window.vsync { present_mode: if window.vsync {
wgpu::PresentMode::Vsync wgpu::PresentMode::Fifo
} else { } else {
wgpu::PresentMode::NoVsync wgpu::PresentMode::Immediate
}, },
} }
} }

View File

@ -3,7 +3,7 @@ use crate::render::{
BindGroupDescriptor, BindType, BindingDescriptor, InputStepMode, UniformProperty, BindGroupDescriptor, BindType, BindingDescriptor, InputStepMode, UniformProperty,
UniformPropertyType, VertexAttributeDescriptor, VertexBufferDescriptor, VertexFormat, UniformPropertyType, VertexAttributeDescriptor, VertexBufferDescriptor, VertexFormat,
}, },
texture::TextureViewDimension, texture::{TextureComponentType, TextureViewDimension},
}; };
use spirv_reflect::{ use spirv_reflect::{
types::{ types::{
@ -183,10 +183,12 @@ fn reflect_binding(binding: &ReflectDescriptorBinding) -> BindingDescriptor {
&binding.name, &binding.name,
BindType::SampledTexture { BindType::SampledTexture {
dimension: reflect_dimension(type_description), dimension: reflect_dimension(type_description),
component_type: TextureComponentType::Float,
multisampled: false, multisampled: false,
}, },
), ),
ReflectDescriptorType::Sampler => (&binding.name, BindType::Sampler), // TODO: detect comparison "true" case: https://github.com/gpuweb/gpuweb/issues/552
ReflectDescriptorType::Sampler => (&binding.name, BindType::Sampler { comparison: false }),
_ => panic!("unsupported bind type {:?}", binding.descriptor_type), _ => panic!("unsupported bind type {:?}", binding.descriptor_type),
}; };
@ -421,6 +423,7 @@ mod tests {
bind_type: BindType::SampledTexture { bind_type: BindType::SampledTexture {
multisampled: false, multisampled: false,
dimension: TextureViewDimension::D2, dimension: TextureViewDimension::D2,
component_type: TextureComponentType::Float,
}, },
}] }]
), ),

View File

@ -4,7 +4,7 @@ use crate::{
render::{ render::{
color::ColorSource, color::ColorSource,
pipeline::{BindType, VertexBufferDescriptor}, pipeline::{BindType, VertexBufferDescriptor},
texture::{Texture, TextureViewDimension}, texture::Texture,
}, },
}; };
@ -36,75 +36,6 @@ pub enum FieldBindType {
Texture, Texture,
} }
// TODO: Remove this
pub struct UniformInfoIter<'a, T: AsUniforms> {
pub uniforms: &'a T,
pub index: usize,
pub add_sampler: bool,
}
impl<'a, T> UniformInfoIter<'a, T>
where
T: AsUniforms,
{
pub fn new(uniforms: &'a T) -> Self {
UniformInfoIter {
uniforms,
index: 0,
add_sampler: false,
}
}
}
impl<'a, T> Iterator for UniformInfoIter<'a, T>
where
T: AsUniforms,
{
type Item = UniformInfo<'a>;
fn next(&mut self) -> Option<Self::Item> {
let field_infos = T::get_field_infos();
if self.add_sampler {
self.add_sampler = false;
Some(UniformInfo {
name: field_infos[self.index - 1].sampler_name,
bind_type: BindType::Sampler,
})
} else {
if self.index >= field_infos.len() {
None
} else {
let index = self.index;
self.index += 1;
let ref field_info = field_infos[index];
let bind_type = self.uniforms.get_field_bind_type(field_info.name);
if let Some(bind_type) = bind_type {
Some(match bind_type {
FieldBindType::Uniform { .. } => UniformInfo {
bind_type: BindType::Uniform {
dynamic: false,
properties: Vec::new(),
},
name: field_info.uniform_name,
},
FieldBindType::Texture => {
self.add_sampler = true;
UniformInfo {
bind_type: BindType::SampledTexture {
dimension: TextureViewDimension::D2,
multisampled: false,
},
name: field_info.texture_name,
}
}
})
} else {
self.next()
}
}
}
}
}
pub struct FieldInfo { pub struct FieldInfo {
pub name: &'static str, pub name: &'static str,
pub uniform_name: &'static str, pub uniform_name: &'static str,

View File

@ -11,7 +11,7 @@ pub struct SamplerDescriptor {
pub mipmap_filter: FilterMode, pub mipmap_filter: FilterMode,
pub lod_min_clamp: f32, pub lod_min_clamp: f32,
pub lod_max_clamp: f32, pub lod_max_clamp: f32,
pub compare_function: CompareFunction, pub compare_function: Option<CompareFunction>,
} }
impl From<&Texture> for SamplerDescriptor { impl From<&Texture> for SamplerDescriptor {
@ -25,7 +25,7 @@ impl From<&Texture> for SamplerDescriptor {
mipmap_filter: FilterMode::Nearest, mipmap_filter: FilterMode::Nearest,
lod_min_clamp: -100.0, lod_min_clamp: -100.0,
lod_max_clamp: 100.0, lod_max_clamp: 100.0,
compare_function: CompareFunction::Always, compare_function: Some(CompareFunction::Always),
} }
} }
} }

View File

@ -24,7 +24,14 @@ pub struct Extent3d {
pub depth: u32, pub depth: u32,
} }
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)] #[derive(Copy, Hash, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
pub enum TextureComponentType {
Float,
Sint,
Uint,
}
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, Ord, PartialOrd)]
pub enum TextureFormat { pub enum TextureFormat {
// Normal 8 bit formats // Normal 8 bit formats
R8Unorm = 0, R8Unorm = 0,
@ -33,57 +40,50 @@ pub enum TextureFormat {
R8Sint = 3, R8Sint = 3,
// Normal 16 bit formats // Normal 16 bit formats
R16Unorm = 4, R16Uint = 4,
R16Snorm = 5, R16Sint = 5,
R16Uint = 6, R16Float = 6,
R16Sint = 7, Rg8Unorm = 7,
R16Float = 8, Rg8Snorm = 8,
Rg8Uint = 9,
Rg8Unorm = 9, Rg8Sint = 10,
Rg8Snorm = 10,
Rg8Uint = 11,
Rg8Sint = 12,
// Normal 32 bit formats // Normal 32 bit formats
R32Uint = 13, R32Uint = 11,
R32Sint = 14, R32Sint = 12,
R32Float = 15, R32Float = 13,
Rg16Unorm = 16, Rg16Uint = 14,
Rg16Snorm = 17, Rg16Sint = 15,
Rg16Uint = 18, Rg16Float = 16,
Rg16Sint = 19, Rgba8Unorm = 17,
Rg16Float = 20, Rgba8UnormSrgb = 18,
Rgba8Unorm = 21, Rgba8Snorm = 19,
Rgba8UnormSrgb = 22, Rgba8Uint = 20,
Rgba8Snorm = 23, Rgba8Sint = 21,
Rgba8Uint = 24, Bgra8Unorm = 22,
Rgba8Sint = 25, Bgra8UnormSrgb = 23,
Bgra8Unorm = 26,
Bgra8UnormSrgb = 27,
// Packed 32 bit formats // Packed 32 bit formats
Rgb10a2Unorm = 28, Rgb10a2Unorm = 24,
Rg11b10Float = 29, Rg11b10Float = 25,
// Normal 64 bit formats // Normal 64 bit formats
Rg32Uint = 30, Rg32Uint = 26,
Rg32Sint = 31, Rg32Sint = 27,
Rg32Float = 32, Rg32Float = 28,
Rgba16Unorm = 33, Rgba16Uint = 29,
Rgba16Snorm = 34, Rgba16Sint = 30,
Rgba16Uint = 35, Rgba16Float = 31,
Rgba16Sint = 36,
Rgba16Float = 37,
// Normal 128 bit formats // Normal 128 bit formats
Rgba32Uint = 38, Rgba32Uint = 32,
Rgba32Sint = 39, Rgba32Sint = 33,
Rgba32Float = 40, Rgba32Float = 34,
// Depth and stencil formats // Depth and stencil formats
Depth32Float = 41, Depth32Float = 35,
Depth24Plus = 42, Depth24Plus = 36,
Depth24PlusStencil8 = 43, Depth24PlusStencil8 = 37,
} }
bitflags::bitflags! { bitflags::bitflags! {