1#[cfg(feature = "serde-support")]
2use serde::{Deserialize, Serialize};
3
4use crate::{RafxBuffer, RafxBufferDef, RafxSampler, RafxTexture};
5use rafx_base::DecimalF32;
6use std::hash::{Hash, Hasher};
7
8#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
9pub enum RafxApiType {
10 Vk = 0,
11 Dx12 = 1,
12 Metal = 2,
13 Gles2 = 3,
14 Gles3 = 4,
15 Empty = 5,
16}
17
18pub const RAFX_VALID_API_TYPES: [RafxApiType; 5] = [
20 RafxApiType::Vk,
21 RafxApiType::Dx12,
22 RafxApiType::Metal,
23 RafxApiType::Gles2,
24 RafxApiType::Gles3,
25];
26
27#[derive(Copy, Clone, Debug, PartialEq)]
30pub enum RafxValidationMode {
31 Disabled,
34
35 EnabledIfAvailable,
38
39 Enabled,
42}
43
44impl Default for RafxValidationMode {
45 fn default() -> Self {
46 #[cfg(debug_assertions)]
47 let validation_mode = RafxValidationMode::EnabledIfAvailable;
48 #[cfg(not(debug_assertions))]
49 let validation_mode = RafxValidationMode::Disabled;
50
51 validation_mode
52 }
53}
54
55pub struct RafxDeviceInfo {
58 pub supports_multithreaded_usage: bool,
59 pub debug_names_enabled: bool,
60 pub min_uniform_buffer_offset_alignment: u32,
61 pub min_storage_buffer_offset_alignment: u32,
62 pub upload_texture_alignment: u32,
63 pub upload_texture_row_alignment: u32,
64
65 pub supports_clamp_to_border_color: bool,
67
68 pub max_vertex_attribute_count: u32,
69 }
79
80#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
82pub enum RafxQueueType {
83 Graphics,
85
86 Compute,
88
89 Transfer,
92}
93
94#[derive(Copy, Clone, Debug)]
97pub enum RafxColorType {
98 Linear,
99 Srgb,
100}
101
102bitflags::bitflags! {
116 pub struct RafxResourceState: u32 {
123 const UNDEFINED = 0;
124 const VERTEX_AND_CONSTANT_BUFFER = 0x1;
125 const INDEX_BUFFER = 0x2;
126 const RENDER_TARGET = 0x4;
128 const UNORDERED_ACCESS = 0x8;
130 const DEPTH_WRITE = 0x10;
132 const DEPTH_READ = 0x20;
133 const NON_PIXEL_SHADER_RESOURCE = 0x40;
134 const PIXEL_SHADER_RESOURCE = 0x80;
135 const SHADER_RESOURCE = 0x40 | 0x80;
137 const STREAM_OUT = 0x100;
138 const INDIRECT_ARGUMENT = 0x200;
139 const COPY_DST = 0x400;
141 const COPY_SRC = 0x800;
143 const GENERIC_READ = (((((0x1 | 0x2) | 0x40) | 0x80) | 0x200) | 0x800);
144 const PRESENT = 0x1000;
146 const COMMON = 0x2000;
148 }
149}
150
151#[derive(Default, Copy, Clone, Debug, PartialEq, Eq, Hash)]
153pub struct RafxExtents2D {
154 pub width: u32,
155 pub height: u32,
156}
157
158#[derive(Default, Copy, Clone, Debug, PartialEq, Eq, Hash)]
160pub struct RafxExtents3D {
161 pub width: u32,
162 pub height: u32,
163 pub depth: u32,
164}
165
166impl RafxExtents3D {
167 pub fn to_2d(self) -> RafxExtents2D {
168 RafxExtents2D {
169 width: self.width,
170 height: self.height,
171 }
172 }
173}
174
175#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
177#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
178pub enum RafxSampleCount {
179 SampleCount1,
180 SampleCount2,
181 SampleCount4,
182 SampleCount8,
183 SampleCount16,
184}
185
186impl Default for RafxSampleCount {
187 fn default() -> Self {
188 RafxSampleCount::SampleCount1
189 }
190}
191
192impl RafxSampleCount {
193 pub fn from_u32(samples: u32) -> Self {
194 match samples {
195 1 => RafxSampleCount::SampleCount1,
196 2 => RafxSampleCount::SampleCount2,
197 4 => RafxSampleCount::SampleCount4,
198 8 => RafxSampleCount::SampleCount8,
199 16 => RafxSampleCount::SampleCount16,
200 _ => unimplemented!(),
201 }
202 }
203
204 pub fn as_u32(self) -> u32 {
205 match self {
206 RafxSampleCount::SampleCount1 => 1,
207 RafxSampleCount::SampleCount2 => 2,
208 RafxSampleCount::SampleCount4 => 4,
209 RafxSampleCount::SampleCount8 => 8,
210 RafxSampleCount::SampleCount16 => 16,
211 }
212 }
213}
214
215bitflags::bitflags! {
216 #[derive(Default)]
218 #[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
219 pub struct RafxResourceType: u32 {
220 const UNDEFINED = 0;
221 const SAMPLER = 1<<0;
222 const TEXTURE = 1<<1;
224 const TEXTURE_READ_WRITE = 1<<2;
226 const BUFFER = 1<<3;
228 const BUFFER_READ_WRITE = 1<<5;
230 const UNIFORM_BUFFER = 1<<7;
232 const ROOT_CONSTANT = 1<<8;
235 const VERTEX_BUFFER = 1<<9;
238 const INDEX_BUFFER = 1<<10;
240 const INDIRECT_BUFFER = 1<<11;
242 const TEXTURE_CUBE = 1<<12 | RafxResourceType::TEXTURE.bits();
245 const RENDER_TARGET_MIP_SLICES = 1<<13;
247 const RENDER_TARGET_ARRAY_SLICES = 1<<14;
248 const RENDER_TARGET_DEPTH_SLICES = 1<<15;
249 const INPUT_ATTACHMENT = 1<<16;
251 const TEXEL_BUFFER = 1<<17;
252 const TEXEL_BUFFER_READ_WRITE = 1<<18;
253 const COMBINED_IMAGE_SAMPLER = 1<<19;
254 const ARGUMENT_BUFFER = 1<<20;
256 const INDIRECT_COMMAND_BUFFER = 1<<21;
257 const RENDER_PIPELINE_STATE = 1<<22;
258 const RENDER_TARGET_COLOR = 1<<23;
261 const RENDER_TARGET_DEPTH_STENCIL = 1<<24;
263 }
264}
265
266impl RafxResourceType {
267 pub fn is_uniform_buffer(self) -> bool {
268 self.intersects(RafxResourceType::UNIFORM_BUFFER)
269 }
270
271 pub fn is_storage_buffer(self) -> bool {
272 self.intersects(RafxResourceType::BUFFER | RafxResourceType::BUFFER_READ_WRITE)
273 }
274
275 pub fn is_render_target(self) -> bool {
276 self.intersects(
277 RafxResourceType::RENDER_TARGET_COLOR | RafxResourceType::RENDER_TARGET_DEPTH_STENCIL,
278 )
279 }
280
281 pub fn is_texture(self) -> bool {
282 self.intersects(RafxResourceType::TEXTURE | RafxResourceType::TEXTURE_READ_WRITE)
283 }
284}
285
286bitflags::bitflags! {
287 #[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
289 pub struct RafxColorFlags: u8 {
290 const RED = 1;
291 const GREEN = 2;
292 const BLUE = 4;
293 const ALPHA = 8;
294 const ALL = 0x0F;
295 }
296}
297
298impl Default for RafxColorFlags {
299 fn default() -> Self {
300 RafxColorFlags::ALL
301 }
302}
303
304#[derive(Clone, Copy, PartialEq, Debug)]
306pub enum RafxMemoryUsage {
307 Unknown,
308
309 GpuOnly,
311
312 CpuOnly,
314
315 CpuToGpu,
317
318 GpuToCpu,
320}
321
322#[derive(Clone, Copy, PartialEq, Debug)]
324pub enum RafxPresentSuccessResult {
325 Success,
327
328 SuccessSuboptimal,
333
334 DeviceReset,
340}
341
342#[derive(Clone, Copy, PartialEq, Debug)]
344pub enum RafxFenceStatus {
345 Complete,
347 Incomplete,
349 Unsubmitted,
352}
353
354bitflags::bitflags! {
355 #[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
357 pub struct RafxBlendStateTargets : u8 {
358 const BLEND_STATE_TARGET_0 = 0x01;
359 const BLEND_STATE_TARGET_1 = 0x02;
360 const BLEND_STATE_TARGET_2 = 0x04;
361 const BLEND_STATE_TARGET_3 = 0x08;
362 const BLEND_STATE_TARGET_4 = 0x10;
363 const BLEND_STATE_TARGET_5 = 0x20;
364 const BLEND_STATE_TARGET_6 = 0x40;
365 const BLEND_STATE_TARGET_7 = 0x80;
366 const BLEND_STATE_TARGET_ALL = 0xFF;
367 }
368}
369
370bitflags::bitflags! {
371 #[derive(Default)]
374 #[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
375 pub struct RafxShaderStageFlags : u32 {
376 const NONE = 0;
377 const VERTEX = 1;
378 const TESSELLATION_CONTROL = 2;
379 const TESSELLATION_EVALUATION = 4;
380 const GEOMETRY = 8;
381 const FRAGMENT = 16;
382 const COMPUTE = 32;
383 const ALL_GRAPHICS = 0x1F;
384 const ALL = 0x7FFF_FFFF;
385 }
386}
387
388pub const ALL_SHADER_STAGE_FLAGS: [RafxShaderStageFlags; 6] = [
390 RafxShaderStageFlags::VERTEX,
391 RafxShaderStageFlags::TESSELLATION_CONTROL, RafxShaderStageFlags::TESSELLATION_EVALUATION, RafxShaderStageFlags::GEOMETRY,
394 RafxShaderStageFlags::FRAGMENT,
395 RafxShaderStageFlags::COMPUTE,
396];
397
398#[derive(Clone, Copy, PartialEq, Debug)]
400pub enum RafxPipelineType {
401 Graphics = 0,
402 Compute = 1,
403}
404
405#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
407pub enum RafxVertexAttributeRate {
408 Vertex,
409 Instance,
410}
411
412impl Default for RafxVertexAttributeRate {
413 fn default() -> Self {
414 RafxVertexAttributeRate::Vertex
415 }
416}
417
418#[derive(Copy, Clone, Debug, Hash, PartialEq)]
421pub enum RafxLoadOp {
422 DontCare,
423 Load,
424 Clear,
425}
426
427impl Default for RafxLoadOp {
428 fn default() -> Self {
429 RafxLoadOp::DontCare
430 }
431}
432
433#[derive(Copy, Clone, Debug, Hash, PartialEq)]
436pub enum RafxStoreOp {
437 DontCare,
439
440 Store,
442}
443
444impl Default for RafxStoreOp {
445 fn default() -> Self {
446 RafxStoreOp::Store
447 }
448}
449
450#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
452#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
453pub enum RafxPrimitiveTopology {
454 PointList,
455 LineList,
456 LineStrip,
457 TriangleList,
458 TriangleStrip,
459 PatchList,
460}
461
462#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
464#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
465pub enum RafxIndexType {
466 Uint32,
467 Uint16,
468}
469
470impl Default for RafxIndexType {
471 fn default() -> Self {
472 RafxIndexType::Uint32
473 }
474}
475
476impl RafxIndexType {
477 pub fn size_in_bytes(self) -> usize {
478 match self {
479 RafxIndexType::Uint32 => 4,
480 RafxIndexType::Uint16 => 2,
481 }
482 }
483}
484
485#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
487#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
488pub enum RafxBlendFactor {
489 Zero,
490 One,
491 SrcColor,
492 OneMinusSrcColor,
493 DstColor,
494 OneMinusDstColor,
495 SrcAlpha,
496 OneMinusSrcAlpha,
497 DstAlpha,
498 OneMinusDstAlpha,
499 SrcAlphaSaturate,
500 ConstantColor,
501 OneMinusConstantColor,
502}
503
504impl Default for RafxBlendFactor {
505 fn default() -> Self {
506 RafxBlendFactor::Zero
507 }
508}
509
510#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
512#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
513pub enum RafxBlendOp {
514 Add,
515 Subtract,
516 ReverseSubtract,
517 Min,
518 Max,
519}
520
521impl Default for RafxBlendOp {
522 fn default() -> Self {
523 RafxBlendOp::Add
524 }
525}
526
527#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
529#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
530pub enum RafxCompareOp {
531 Never,
532 Less,
533 Equal,
534 LessOrEqual,
535 Greater,
536 NotEqual,
537 GreaterOrEqual,
538 Always,
539}
540
541impl Default for RafxCompareOp {
542 fn default() -> Self {
543 RafxCompareOp::Never
544 }
545}
546
547#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
549#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
550pub enum RafxStencilOp {
551 Keep,
552 Zero,
553 Replace,
554 IncrementAndClamp,
555 DecrementAndClamp,
556 Invert,
557 IncrementAndWrap,
558 DecrementAndWrap,
559}
560
561impl Default for RafxStencilOp {
562 fn default() -> Self {
563 RafxStencilOp::Keep
564 }
565}
566
567#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
570#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
571pub enum RafxCullMode {
572 None,
573 Back,
574 Front,
575}
576
577impl Default for RafxCullMode {
578 fn default() -> Self {
579 RafxCullMode::None
580 }
581}
582
583#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
586#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
587pub enum RafxFrontFace {
588 CounterClockwise,
589 Clockwise,
590}
591
592impl Default for RafxFrontFace {
593 fn default() -> Self {
594 RafxFrontFace::CounterClockwise
595 }
596}
597
598#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
600#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
601pub enum RafxFillMode {
602 Solid,
603 Wireframe,
604}
605
606impl Default for RafxFillMode {
607 fn default() -> Self {
608 RafxFillMode::Solid
609 }
610}
611
612#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
614#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
615pub enum RafxFilterType {
616 Nearest,
619
620 Linear,
623}
624
625impl Default for RafxFilterType {
626 fn default() -> Self {
627 RafxFilterType::Nearest
628 }
629}
630
631#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
634#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
635pub enum RafxAddressMode {
636 Mirror,
637 Repeat,
638 ClampToEdge,
639 ClampToBorder,
640}
641
642impl Default for RafxAddressMode {
643 fn default() -> Self {
644 RafxAddressMode::Mirror
645 }
646}
647
648#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
650#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
651pub enum RafxMipMapMode {
652 Nearest,
653 Linear,
654}
655
656impl Default for RafxMipMapMode {
657 fn default() -> Self {
658 RafxMipMapMode::Nearest
659 }
660}
661
662#[derive(Copy, Clone, Debug, Default)]
664pub struct RafxColorClearValue(pub [f32; 4]);
665
666impl Hash for RafxColorClearValue {
667 fn hash<H: Hasher>(
668 &self,
669 mut state: &mut H,
670 ) {
671 for &value in &self.0 {
672 DecimalF32(value).hash(&mut state);
673 }
674 }
675}
676
677#[derive(Clone, Copy, Debug)]
680pub struct RafxDepthStencilClearValue {
681 pub depth: f32,
682 pub stencil: u32,
683}
684
685impl Default for RafxDepthStencilClearValue {
686 fn default() -> Self {
687 RafxDepthStencilClearValue {
688 depth: 0.0,
689 stencil: 0,
690 }
691 }
692}
693
694impl Hash for RafxDepthStencilClearValue {
695 fn hash<H: Hasher>(
696 &self,
697 mut state: &mut H,
698 ) {
699 DecimalF32(self.depth).hash(&mut state);
700 self.stencil.hash(&mut state);
701 }
702}
703
704#[derive(Debug, Copy, Clone)]
706pub enum RafxBarrierQueueTransition {
707 None,
709
710 ReleaseTo(RafxQueueType),
713
714 AcquireFrom(RafxQueueType),
717}
718
719impl Default for RafxBarrierQueueTransition {
720 fn default() -> Self {
721 RafxBarrierQueueTransition::None
722 }
723}
724
725pub struct RafxBufferBarrier<'a> {
728 pub buffer: &'a RafxBuffer,
729 pub src_state: RafxResourceState,
730 pub dst_state: RafxResourceState,
731 pub queue_transition: RafxBarrierQueueTransition,
732 pub offset_size: Option<RafxOffsetSize>,
733}
734
735pub struct RafxTextureBarrier<'a> {
738 pub texture: &'a RafxTexture,
739 pub src_state: RafxResourceState,
740 pub dst_state: RafxResourceState,
741 pub queue_transition: RafxBarrierQueueTransition,
742 pub array_slice: Option<u16>,
744 pub mip_slice: Option<u8>,
746}
747
748impl<'a> RafxTextureBarrier<'a> {
749 pub fn state_transition(
751 texture: &'a RafxTexture,
752 src_state: RafxResourceState,
753 dst_state: RafxResourceState,
754 ) -> RafxTextureBarrier {
755 RafxTextureBarrier {
756 texture,
757 src_state,
758 dst_state,
759 queue_transition: RafxBarrierQueueTransition::None,
760 array_slice: None,
761 mip_slice: None,
762 }
763 }
764}
765
766#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
772#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
773pub enum RafxSwapchainColorSpace {
774 Srgb,
775 SrgbExtended,
776
777 DisplayP3Extended,
780}
781
782impl RafxSwapchainColorSpace {
783 pub fn is_extended(self) -> bool {
784 match self {
785 RafxSwapchainColorSpace::Srgb => false,
786 RafxSwapchainColorSpace::SrgbExtended => true,
787 RafxSwapchainColorSpace::DisplayP3Extended => true,
788 }
789 }
790
791 pub fn is_srgb(self) -> bool {
792 match self {
793 RafxSwapchainColorSpace::Srgb => true,
794 RafxSwapchainColorSpace::SrgbExtended => true,
795 RafxSwapchainColorSpace::DisplayP3Extended => false,
796 }
797 }
798}
799
800impl Default for RafxSwapchainColorSpace {
801 fn default() -> Self {
802 RafxSwapchainColorSpace::Srgb
803 }
804}
805
806#[derive(Clone)]
808pub struct RafxSwapchainImage {
809 pub texture: RafxTexture,
810 pub swapchain_image_index: u32,
811}
812
813#[derive(Debug)]
815pub struct RafxColorRenderTargetBinding<'a> {
816 pub texture: &'a RafxTexture,
817 pub load_op: RafxLoadOp,
818 pub store_op: RafxStoreOp,
819 pub mip_slice: Option<u8>,
820 pub array_slice: Option<u16>,
821 pub clear_value: RafxColorClearValue,
822 pub resolve_target: Option<&'a RafxTexture>,
823 pub resolve_store_op: RafxStoreOp,
824 pub resolve_mip_slice: Option<u8>,
825 pub resolve_array_slice: Option<u16>,
826}
827
828#[derive(Debug)]
830pub struct RafxDepthStencilRenderTargetBinding<'a> {
831 pub texture: &'a RafxTexture,
832 pub depth_load_op: RafxLoadOp,
833 pub stencil_load_op: RafxLoadOp,
834 pub depth_store_op: RafxStoreOp,
835 pub stencil_store_op: RafxStoreOp,
836 pub mip_slice: Option<u8>,
837 pub array_slice: Option<u16>,
838 pub clear_value: RafxDepthStencilClearValue,
839}
840
841pub struct RafxVertexBufferBinding<'a> {
843 pub buffer: &'a RafxBuffer,
844 pub byte_offset: u64,
845}
846
847pub struct RafxIndexBufferBinding<'a> {
849 pub buffer: &'a RafxBuffer,
850 pub byte_offset: u64,
851 pub index_type: RafxIndexType,
852}
853
854#[derive(Default, Clone)]
856pub struct RafxCmdCopyBufferToBufferParams {
857 pub src_byte_offset: u64,
858 pub dst_byte_offset: u64,
859 pub size: u64,
860}
861
862impl RafxCmdCopyBufferToBufferParams {
863 pub fn full_copy(
864 src_def: &RafxBufferDef,
865 dst_def: &RafxBufferDef,
866 ) -> Self {
867 assert_eq!(src_def.size, dst_def.size);
868 RafxCmdCopyBufferToBufferParams {
869 src_byte_offset: 0,
870 dst_byte_offset: 0,
871 size: src_def.size,
872 }
873 }
874}
875
876#[derive(Default, Clone)]
878pub struct RafxCmdCopyBufferToTextureParams {
879 pub buffer_offset: u64,
880 pub array_layer: u16,
881 pub mip_level: u8,
882}
883
884#[derive(Default, Clone)]
885pub struct RafxCmdCopyTextureToTextureParams {
886 pub src_offset: RafxExtents3D,
887 pub dst_offset: RafxExtents3D,
888 pub extents: RafxExtents3D,
889 pub src_mip_level: u8,
890 pub dst_mip_level: u8,
891 pub array_slices: Option<[u16; 2]>,
893}
894
895#[derive(Clone)]
897pub struct RafxCmdBlitParams {
898 pub src_state: RafxResourceState,
899 pub dst_state: RafxResourceState,
900 pub src_extents: [RafxExtents3D; 2],
901 pub dst_extents: [RafxExtents3D; 2],
902 pub src_mip_level: u8,
903 pub dst_mip_level: u8,
904 pub array_slices: Option<[u16; 2]>,
905}
906
907#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
911pub struct RafxDescriptorIndex(pub(crate) u32);
912
913#[derive(Clone, PartialEq, Eq, Hash, Debug)]
915pub enum RafxDescriptorKey<'a> {
916 Undefined,
917 Name(&'a str),
918 Binding(u32),
919 DescriptorIndex(RafxDescriptorIndex),
920}
921
922impl<'a> Default for RafxDescriptorKey<'a> {
923 fn default() -> Self {
924 RafxDescriptorKey::Undefined
925 }
926}
927
928#[derive(Default, Clone, Copy, Debug)]
930pub struct RafxOffsetSize {
931 pub byte_offset: u64,
932 pub size: u64,
933}
934
935#[derive(Default, Debug)]
937pub struct RafxDescriptorElements<'a> {
938 pub textures: Option<&'a [&'a RafxTexture]>,
939 pub samplers: Option<&'a [&'a RafxSampler]>,
940 pub buffers: Option<&'a [&'a RafxBuffer]>,
941 pub buffer_offset_sizes: Option<&'a [RafxOffsetSize]>,
942}
943
944#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
946pub enum RafxTextureBindType {
947 Srv,
949 SrvStencil,
951 UavMipChain,
953 UavMipSlice(u32),
955}
956
957#[derive(Debug)]
959pub struct RafxDescriptorUpdate<'a> {
960 pub array_index: u32,
961 pub descriptor_key: RafxDescriptorKey<'a>,
962 pub elements: RafxDescriptorElements<'a>,
963 pub dst_element_offset: u32,
964 pub texture_bind_type: Option<RafxTextureBindType>,
966}
967
968impl<'a> Default for RafxDescriptorUpdate<'a> {
969 fn default() -> Self {
970 RafxDescriptorUpdate {
971 array_index: 0,
972 descriptor_key: RafxDescriptorKey::Undefined,
973 elements: RafxDescriptorElements::default(),
974 dst_element_offset: 0,
975 texture_bind_type: None,
976 }
977 }
978}
979
980pub struct RafxDrawIndirectCommand {
982 pub vertex_count: u32,
983 pub instance_count: u32,
984 pub first_vertex: u32,
985 pub first_instance: u32,
986}
987
988pub struct RafxDrawIndexedIndirectCommand {
990 pub index_count: u32,
991 pub instance_count: u32,
992 pub first_index: u32,
993 pub vertex_offset: i32, pub first_instance: u32,
995}
996
997pub struct RafxDispatchIndirectCommand {
999 pub group_count_x: u32,
1000 pub group_count_y: u32,
1001 pub group_count_z: u32,
1002}