1use alloc::{
72 format,
73 string::{String, ToString},
74 vec::Vec,
75};
76use core::fmt::{Error as FmtError, Write};
77
78use crate::{arena::Handle, back::TaskDispatchLimits, ir, proc::index, valid::ModuleInfo};
79
80mod keywords;
81mod mesh_shader;
82mod ray;
83pub mod sampler;
84mod writer;
85
86pub use writer::Writer;
87
88pub type Slot = u8;
89pub type InlineSamplerIndex = u8;
90
91#[derive(Clone, Debug, PartialEq, Eq, Hash)]
92#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
93#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
94pub enum BindSamplerTarget {
95 Resource(Slot),
96 Inline(InlineSamplerIndex),
97}
98
99#[derive(Clone, Debug, PartialEq, Eq, Hash)]
105#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
106#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
107pub struct BindExternalTextureTarget {
108 pub planes: [Slot; 3],
109 pub params: Slot,
110}
111
112#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
113#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
114#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
115#[cfg_attr(any(feature = "serialize", feature = "deserialize"), serde(default))]
116pub struct BindTarget {
117 pub buffer: Option<Slot>,
118 pub texture: Option<Slot>,
119 pub sampler: Option<BindSamplerTarget>,
120 pub external_texture: Option<BindExternalTextureTarget>,
121 pub mutable: bool,
122}
123
124#[cfg(feature = "deserialize")]
125#[derive(serde::Deserialize)]
126struct BindingMapSerialization {
127 resource_binding: crate::ResourceBinding,
128 bind_target: BindTarget,
129}
130
131#[cfg(feature = "deserialize")]
132fn deserialize_binding_map<'de, D>(deserializer: D) -> Result<BindingMap, D::Error>
133where
134 D: serde::Deserializer<'de>,
135{
136 use serde::Deserialize;
137
138 let vec = Vec::<BindingMapSerialization>::deserialize(deserializer)?;
139 let mut map = BindingMap::default();
140 for item in vec {
141 map.insert(item.resource_binding, item.bind_target);
142 }
143 Ok(map)
144}
145
146pub type BindingMap = alloc::collections::BTreeMap<crate::ResourceBinding, BindTarget>;
148
149#[derive(Clone, Debug, Default, Hash, Eq, PartialEq)]
150#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
151#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
152#[cfg_attr(any(feature = "serialize", feature = "deserialize"), serde(default))]
153pub struct EntryPointResources {
154 #[cfg_attr(
155 feature = "deserialize",
156 serde(deserialize_with = "deserialize_binding_map")
157 )]
158 pub resources: BindingMap,
159
160 pub immediates_buffer: Option<Slot>,
161
162 pub sizes_buffer: Option<Slot>,
166}
167
168pub type EntryPointResourceMap = alloc::collections::BTreeMap<String, EntryPointResources>;
169
170enum ResolvedBinding {
171 BuiltIn(crate::BuiltIn),
172 Attribute(u32),
173 Color {
174 location: u32,
175 blend_src: Option<u32>,
176 },
177 User {
178 prefix: &'static str,
179 index: u32,
180 interpolation: Option<ResolvedInterpolation>,
181 },
182 Resource(BindTarget),
183 Payload,
184}
185
186#[derive(Copy, Clone)]
187enum ResolvedInterpolation {
188 CenterPerspective,
189 CenterNoPerspective,
190 CentroidPerspective,
191 CentroidNoPerspective,
192 SamplePerspective,
193 SampleNoPerspective,
194 Flat,
195 PerVertex,
196}
197
198#[derive(Debug, thiserror::Error)]
201pub enum Error {
202 #[error(transparent)]
203 Format(#[from] FmtError),
204 #[error("bind target {0:?} is empty")]
205 UnimplementedBindTarget(BindTarget),
206 #[error("composing of {0:?} is not implemented yet")]
207 UnsupportedCompose(Handle<crate::Type>),
208 #[error("operation {0:?} is not implemented yet")]
209 UnsupportedBinaryOp(crate::BinaryOperator),
210 #[error("standard function '{0}' is not implemented yet")]
211 UnsupportedCall(String),
212 #[error("feature '{0}' is not implemented yet")]
213 FeatureNotImplemented(String),
214 #[error("internal naga error: module should not have validated: {0}")]
215 GenericValidation(String),
216 #[error("BuiltIn {0:?} is not supported")]
217 UnsupportedBuiltIn(crate::BuiltIn),
218 #[error("capability {0:?} is not supported")]
219 CapabilityNotSupported(crate::valid::Capabilities),
220 #[error("attribute '{0}' is not supported for target MSL version")]
221 UnsupportedAttribute(String),
222 #[error("function '{0}' is not supported for target MSL version")]
223 UnsupportedFunction(String),
224 #[error("can not use writable storage buffers in fragment stage prior to MSL 1.2")]
225 UnsupportedWritableStorageBuffer,
226 #[error("can not use writable storage textures in {0:?} stage prior to MSL 1.2")]
227 UnsupportedWritableStorageTexture(ir::ShaderStage),
228 #[error("can not use read-write storage textures prior to MSL 1.2")]
229 UnsupportedRWStorageTexture,
230 #[error("array of '{0}' is not supported for target MSL version")]
231 UnsupportedArrayOf(String),
232 #[error("array of type '{0:?}' is not supported")]
233 UnsupportedArrayOfType(Handle<crate::Type>),
234 #[error("ray tracing is not supported prior to MSL 2.4")]
235 UnsupportedRayTracing,
236 #[error("cooperative matrix is not supported prior to MSL 2.3")]
237 UnsupportedCooperativeMatrix,
238 #[error("overrides should not be present at this stage")]
239 Override,
240 #[error("bitcasting to {0:?} is not supported")]
241 UnsupportedBitCast(crate::TypeInner),
242 #[error(transparent)]
243 ResolveArraySizeError(#[from] crate::proc::ResolveArraySizeError),
244 #[error("entry point with stage {0:?} and name '{1}' not found")]
245 EntryPointNotFound(ir::ShaderStage, String),
246 #[error("Cannot use mesh shader syntax prior to MSL 3.0")]
247 UnsupportedMeshShader,
248 #[error("Per vertex fragment inputs are not supported prior to MSL 4.0")]
249 PerVertexNotSupported,
250}
251
252#[derive(Clone, Debug, PartialEq, thiserror::Error)]
253#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
254#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
255pub enum EntryPointError {
256 #[error("global '{0}' doesn't have a binding")]
257 MissingBinding(String),
258 #[error("mapping of {0:?} is missing")]
259 MissingBindTarget(crate::ResourceBinding),
260 #[error("mapping for immediates is missing")]
261 MissingImmediateData,
262 #[error("mapping for sizes buffer is missing")]
263 MissingSizesBuffer,
264}
265
266#[derive(Clone, Copy, Debug)]
275enum LocationMode {
276 VertexInput,
278
279 VertexOutput,
281
282 FragmentInput,
284
285 FragmentOutput,
287
288 MeshOutput,
290
291 Uniform,
293}
294
295#[derive(Clone, Debug, Hash, PartialEq, Eq)]
296#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
297#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
298#[cfg_attr(feature = "deserialize", serde(default))]
299pub struct Options {
300 pub lang_version: (u8, u8),
302 pub per_entry_point_map: EntryPointResourceMap,
304 pub inline_samplers: Vec<sampler::InlineSampler>,
306 pub spirv_cross_compatibility: bool,
308 pub fake_missing_bindings: bool,
310 pub bounds_check_policies: index::BoundsCheckPolicies,
312 pub zero_initialize_workgroup_memory: bool,
314 pub force_loop_bounding: bool,
317 pub task_dispatch_limits: Option<TaskDispatchLimits>,
320 pub mesh_shader_primitive_indices_clamp: bool,
322 pub emit_int_div_checks: bool,
327 pub ray_query_initialization_tracking: bool,
329}
330
331impl Default for Options {
332 fn default() -> Self {
333 Options {
334 lang_version: (1, 0),
335 per_entry_point_map: EntryPointResourceMap::default(),
336 inline_samplers: Vec::new(),
337 spirv_cross_compatibility: false,
338 fake_missing_bindings: true,
339 bounds_check_policies: index::BoundsCheckPolicies::default(),
340 zero_initialize_workgroup_memory: true,
341 force_loop_bounding: true,
342 task_dispatch_limits: None,
343 mesh_shader_primitive_indices_clamp: true,
344 ray_query_initialization_tracking: true,
345 emit_int_div_checks: true,
346 }
347 }
348}
349
350#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
352#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
353#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
354pub enum VertexBufferStepMode {
355 Constant,
356 #[default]
357 ByVertex,
358 ByInstance,
359}
360
361#[derive(Debug, Clone, PartialEq, Eq, Hash)]
364#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
365#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
366pub struct AttributeMapping {
367 pub shader_location: u32,
369 pub offset: u32,
371 pub format: nt::VertexFormat,
377}
378
379#[derive(Debug, Default, Clone, PartialEq, Eq, Hash)]
382#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
383#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
384pub struct VertexBufferMapping {
385 pub id: u32,
387 pub stride: u32,
389 pub step_mode: VertexBufferStepMode,
391 pub attributes: Vec<AttributeMapping>,
393}
394
395#[derive(Debug, Default, Clone)]
397#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
398#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
399#[cfg_attr(feature = "deserialize", serde(default))]
400pub struct PipelineOptions {
401 pub entry_point: Option<(ir::ShaderStage, String)>,
409
410 pub allow_and_force_point_size: bool,
417
418 pub vertex_pulling_transform: bool,
426
427 pub vertex_buffer_mappings: Vec<VertexBufferMapping>,
430
431 #[cfg_attr(
435 feature = "deserialize",
436 serde(deserialize_with = "deserialize_binding_array_length_map")
437 )]
438 pub binding_array_length_map: crate::FastHashMap<crate::ResourceBinding, u32>,
439}
440
441#[cfg(feature = "deserialize")]
442#[derive(serde::Deserialize)]
443struct BindingArrayLengthMapSerialization {
444 resource_binding: crate::ResourceBinding,
445 count: u32,
446}
447
448#[cfg(feature = "deserialize")]
449fn deserialize_binding_array_length_map<'de, D>(
450 deserializer: D,
451) -> Result<crate::FastHashMap<crate::ResourceBinding, u32>, D::Error>
452where
453 D: serde::Deserializer<'de>,
454{
455 use serde::Deserialize;
456
457 let vec = Vec::<BindingArrayLengthMapSerialization>::deserialize(deserializer)?;
458 let mut map = crate::FastHashMap::default();
459 for item in vec {
460 map.insert(item.resource_binding, item.count);
461 }
462 Ok(map)
463}
464
465impl Options {
466 fn resolve_local_binding(
467 &self,
468 binding: &crate::Binding,
469 mode: LocationMode,
470 ) -> Result<ResolvedBinding, Error> {
471 match *binding {
472 crate::Binding::BuiltIn(mut built_in) => {
473 match built_in {
474 crate::BuiltIn::Position { ref mut invariant } => {
475 if *invariant && self.lang_version < (2, 1) {
476 return Err(Error::UnsupportedAttribute("invariant".to_string()));
477 }
478
479 if !matches!(mode, LocationMode::VertexOutput) {
482 *invariant = false;
483 }
484 }
485 crate::BuiltIn::BaseInstance if self.lang_version < (1, 2) => {
486 return Err(Error::UnsupportedAttribute("base_instance".to_string()));
487 }
488 crate::BuiltIn::InstanceIndex if self.lang_version < (1, 2) => {
489 return Err(Error::UnsupportedAttribute("instance_id".to_string()));
490 }
491 crate::BuiltIn::PrimitiveIndex if self.lang_version < (2, 3) => {
494 return Err(Error::UnsupportedAttribute("primitive_id".to_string()));
495 }
496 crate::BuiltIn::ViewIndex if self.lang_version < (2, 2) => {
500 return Err(Error::UnsupportedAttribute("amplification_id".to_string()));
501 }
502 crate::BuiltIn::Barycentric { .. } if self.lang_version < (2, 3) => {
505 return Err(Error::UnsupportedAttribute("barycentric_coord".to_string()));
506 }
507 _ => {}
508 }
509
510 Ok(ResolvedBinding::BuiltIn(built_in))
511 }
512 crate::Binding::Location {
513 location,
514 interpolation,
515 sampling,
516 blend_src,
517 per_primitive,
518 } => match mode {
519 LocationMode::VertexInput => Ok(ResolvedBinding::Attribute(location)),
520 LocationMode::FragmentOutput => {
521 if blend_src.is_some() && self.lang_version < (1, 2) {
522 return Err(Error::UnsupportedAttribute("blend_src".to_string()));
523 }
524 Ok(ResolvedBinding::Color {
525 location,
526 blend_src,
527 })
528 }
529 LocationMode::VertexOutput
530 | LocationMode::FragmentInput
531 | LocationMode::MeshOutput => {
532 Ok(ResolvedBinding::User {
533 prefix: if self.spirv_cross_compatibility {
534 "locn"
535 } else {
536 "loc"
537 },
538 index: location,
539 interpolation: {
540 let interpolation = interpolation.unwrap();
544 let sampling = sampling.unwrap_or(crate::Sampling::Center);
545 Some(ResolvedInterpolation::from_binding(
546 interpolation,
547 sampling,
548 per_primitive,
549 ))
550 },
551 })
552 }
553 LocationMode::Uniform => Err(Error::GenericValidation(format!(
554 "Unexpected Binding::Location({location}) for the Uniform mode"
555 ))),
556 },
557 }
558 }
559
560 fn get_entry_point_resources(&self, ep: &crate::EntryPoint) -> Option<&EntryPointResources> {
561 self.per_entry_point_map.get(&ep.name)
562 }
563
564 fn get_resource_binding_target(
565 &self,
566 ep: &crate::EntryPoint,
567 res_binding: &crate::ResourceBinding,
568 ) -> Option<&BindTarget> {
569 self.get_entry_point_resources(ep)
570 .and_then(|res| res.resources.get(res_binding))
571 }
572
573 fn resolve_resource_binding(
574 &self,
575 ep: &crate::EntryPoint,
576 res_binding: &crate::ResourceBinding,
577 ) -> Result<ResolvedBinding, EntryPointError> {
578 let target = self.get_resource_binding_target(ep, res_binding);
579 match target {
580 Some(target) => Ok(ResolvedBinding::Resource(target.clone())),
581 None if self.fake_missing_bindings => Ok(ResolvedBinding::User {
582 prefix: "fake",
583 index: 0,
584 interpolation: None,
585 }),
586 None => Err(EntryPointError::MissingBindTarget(*res_binding)),
587 }
588 }
589
590 fn resolve_immediates(
591 &self,
592 ep: &crate::EntryPoint,
593 ) -> Result<ResolvedBinding, EntryPointError> {
594 let slot = self
595 .get_entry_point_resources(ep)
596 .and_then(|res| res.immediates_buffer);
597 match slot {
598 Some(slot) => Ok(ResolvedBinding::Resource(BindTarget {
599 buffer: Some(slot),
600 ..Default::default()
601 })),
602 None if self.fake_missing_bindings => Ok(ResolvedBinding::User {
603 prefix: "fake",
604 index: 0,
605 interpolation: None,
606 }),
607 None => Err(EntryPointError::MissingImmediateData),
608 }
609 }
610
611 fn resolve_sizes_buffer(
612 &self,
613 ep: &crate::EntryPoint,
614 ) -> Result<ResolvedBinding, EntryPointError> {
615 let slot = self
616 .get_entry_point_resources(ep)
617 .and_then(|res| res.sizes_buffer);
618 match slot {
619 Some(slot) => Ok(ResolvedBinding::Resource(BindTarget {
620 buffer: Some(slot),
621 ..Default::default()
622 })),
623 None if self.fake_missing_bindings => Ok(ResolvedBinding::User {
624 prefix: "fake",
625 index: 0,
626 interpolation: None,
627 }),
628 None => Err(EntryPointError::MissingSizesBuffer),
629 }
630 }
631}
632
633impl ResolvedBinding {
634 fn as_inline_sampler<'a>(&self, options: &'a Options) -> Option<&'a sampler::InlineSampler> {
635 match *self {
636 Self::Resource(BindTarget {
637 sampler: Some(BindSamplerTarget::Inline(index)),
638 ..
639 }) => Some(&options.inline_samplers[index as usize]),
640 _ => None,
641 }
642 }
643
644 fn try_fmt<W: Write>(&self, out: &mut W) -> Result<(), Error> {
645 write!(out, " [[")?;
646 match *self {
647 Self::BuiltIn(built_in) => {
648 use crate::BuiltIn as Bi;
649 let name = match built_in {
650 Bi::Position { invariant: false } => "position",
651 Bi::Position { invariant: true } => "position, invariant",
652 Bi::ViewIndex => "amplification_id",
653 Bi::BaseInstance => "base_instance",
655 Bi::BaseVertex => "base_vertex",
656 Bi::ClipDistances => "clip_distance",
657 Bi::InstanceIndex => "instance_id",
658 Bi::PointSize => "point_size",
659 Bi::VertexIndex => "vertex_id",
660 Bi::FragDepth => "depth(any)",
662 Bi::PointCoord => "point_coord",
663 Bi::FrontFacing => "front_facing",
664 Bi::PrimitiveIndex => "primitive_id",
665 Bi::Barycentric { perspective: true } => "barycentric_coord",
666 Bi::Barycentric { perspective: false } => {
667 "barycentric_coord, center_no_perspective"
668 }
669 Bi::SampleIndex => "sample_id",
670 Bi::SampleMask => "sample_mask",
671 Bi::GlobalInvocationId => "thread_position_in_grid",
673 Bi::LocalInvocationId => "thread_position_in_threadgroup",
674 Bi::LocalInvocationIndex => "thread_index_in_threadgroup",
675 Bi::WorkGroupId => "threadgroup_position_in_grid",
676 Bi::WorkGroupSize => "dispatch_threads_per_threadgroup",
677 Bi::NumWorkGroups => "threadgroups_per_grid",
678 Bi::NumSubgroups => "simdgroups_per_threadgroup",
680 Bi::SubgroupId => "simdgroup_index_in_threadgroup",
681 Bi::SubgroupSize => "threads_per_simdgroup",
682 Bi::SubgroupInvocationId => "thread_index_in_simdgroup",
683 Bi::CullDistance | Bi::DrawIndex => {
684 return Err(Error::UnsupportedBuiltIn(built_in))
685 }
686 Bi::CullPrimitive => "primitive_culled",
687 Bi::PointIndex | Bi::LineIndices | Bi::TriangleIndices => unimplemented!(),
689 Bi::MeshTaskSize
692 | Bi::VertexCount
693 | Bi::PrimitiveCount
694 | Bi::Vertices
695 | Bi::Primitives
696 | Bi::RayInvocationId
697 | Bi::NumRayInvocations
698 | Bi::InstanceCustomData
699 | Bi::GeometryIndex
700 | Bi::WorldRayOrigin
701 | Bi::WorldRayDirection
702 | Bi::ObjectRayOrigin
703 | Bi::ObjectRayDirection
704 | Bi::RayTmin
705 | Bi::RayTCurrentMax
706 | Bi::ObjectToWorld
707 | Bi::WorldToObject
708 | Bi::HitKind => unreachable!(),
709 };
710 write!(out, "{name}")?;
711 }
712 Self::Attribute(index) => write!(out, "attribute({index})")?,
713 Self::Color {
714 location,
715 blend_src,
716 } => {
717 if let Some(blend_src) = blend_src {
718 write!(out, "color({location}) index({blend_src})")?
719 } else {
720 write!(out, "color({location})")?
721 }
722 }
723 Self::User {
724 prefix,
725 index,
726 interpolation,
727 } => {
728 write!(out, "user({prefix}{index})")?;
729 if let Some(interpolation) = interpolation {
730 write!(out, ", ")?;
731 interpolation.try_fmt(out)?;
732 }
733 }
734 Self::Resource(ref target) => {
735 if let Some(id) = target.buffer {
736 write!(out, "buffer({id})")?;
737 } else if let Some(id) = target.texture {
738 write!(out, "texture({id})")?;
739 } else if let Some(BindSamplerTarget::Resource(id)) = target.sampler {
740 write!(out, "sampler({id})")?;
741 } else {
742 return Err(Error::UnimplementedBindTarget(target.clone()));
743 }
744 }
745 Self::Payload => write!(out, "payload")?,
746 }
747 write!(out, "]]")?;
748 Ok(())
749 }
750}
751
752impl ResolvedInterpolation {
753 const fn from_binding(
754 interpolation: crate::Interpolation,
755 sampling: crate::Sampling,
756 per_primitive: bool,
757 ) -> Self {
758 use crate::Interpolation as I;
759 use crate::Sampling as S;
760
761 if per_primitive {
762 return Self::Flat;
763 }
764
765 match (interpolation, sampling) {
766 (I::Perspective, S::Center) => Self::CenterPerspective,
767 (I::Perspective, S::Centroid) => Self::CentroidPerspective,
768 (I::Perspective, S::Sample) => Self::SamplePerspective,
769 (I::Linear, S::Center) => Self::CenterNoPerspective,
770 (I::Linear, S::Centroid) => Self::CentroidNoPerspective,
771 (I::Linear, S::Sample) => Self::SampleNoPerspective,
772 (I::Flat, _) => Self::Flat,
773 (I::PerVertex, S::Center) => Self::PerVertex,
774 _ => unreachable!(),
775 }
776 }
777
778 fn try_fmt<W: Write>(self, out: &mut W) -> Result<(), Error> {
779 let identifier = match self {
780 Self::CenterPerspective => "center_perspective",
781 Self::CenterNoPerspective => "center_no_perspective",
782 Self::CentroidPerspective => "centroid_perspective",
783 Self::CentroidNoPerspective => "centroid_no_perspective",
784 Self::SamplePerspective => "sample_perspective",
785 Self::SampleNoPerspective => "sample_no_perspective",
786 Self::Flat => "flat",
787 Self::PerVertex => unreachable!(),
788 };
789 out.write_str(identifier)?;
790 Ok(())
791 }
792}
793
794struct EntryPointArgument {
795 ty_name: String,
796 name: String,
797 binding: String,
798 init: Option<Handle<crate::Expression>>,
799}
800
801type BackendResult = Result<(), Error>;
803
804const NAMESPACE: &str = "metal";
805
806const WRAPPED_ARRAY_FIELD: &str = "inner";
810
811#[derive(Debug)]
814pub struct TranslationInfo {
815 pub entry_point_names: Vec<Result<String, EntryPointError>>,
820}
821
822pub fn write_string(
823 module: &crate::Module,
824 info: &ModuleInfo,
825 options: &Options,
826 pipeline_options: &PipelineOptions,
827) -> Result<(String, TranslationInfo), Error> {
828 let mut w = Writer::new(String::new());
829 let info = w.write(module, info, options, pipeline_options)?;
830 Ok((w.finish(), info))
831}
832
833pub fn supported_capabilities() -> crate::valid::Capabilities {
834 use crate::valid::Capabilities as Caps;
835 Caps::IMMEDIATES
836 | Caps::PRIMITIVE_INDEX
838 | Caps::TEXTURE_AND_SAMPLER_BINDING_ARRAY
839 | Caps::STORAGE_TEXTURE_BINDING_ARRAY
841 | Caps::STORAGE_BUFFER_BINDING_ARRAY
842 | Caps::CLIP_DISTANCES
843 | Caps::STORAGE_TEXTURE_16BIT_NORM_FORMATS
845 | Caps::MULTIVIEW
846 | Caps::MULTISAMPLED_SHADING
848 | Caps::RAY_QUERY
849 | Caps::DUAL_SOURCE_BLENDING
850 | Caps::CUBE_ARRAY_TEXTURES
851 | Caps::SHADER_INT64
852 | Caps::SUBGROUP
853 | Caps::SUBGROUP_BARRIER
854 | Caps::SHADER_INT64_ATOMIC_MIN_MAX
856 | Caps::SHADER_FLOAT32_ATOMIC
858 | Caps::TEXTURE_ATOMIC
859 | Caps::TEXTURE_INT64_ATOMIC
860 | Caps::SHADER_FLOAT16
862 | Caps::SHADER_INT16
863 | Caps::TEXTURE_EXTERNAL
864 | Caps::SHADER_FLOAT16_IN_FLOAT32
865 | Caps::SHADER_BARYCENTRICS
866 | Caps::MESH_SHADER
867 | Caps::MESH_SHADER_POINT_TOPOLOGY
868 | Caps::TEXTURE_AND_SAMPLER_BINDING_ARRAY_NON_UNIFORM_INDEXING
869 | Caps::STORAGE_TEXTURE_BINDING_ARRAY_NON_UNIFORM_INDEXING
871 | Caps::STORAGE_BUFFER_BINDING_ARRAY_NON_UNIFORM_INDEXING
872 | Caps::COOPERATIVE_MATRIX
873 | Caps::PER_VERTEX
874 | Caps::MEMORY_DECORATION_COHERENT
878}
879
880#[test]
881fn test_error_size() {
882 assert_eq!(size_of::<Error>(), 40);
883}