use super::generated_value_types::*;
use super::{Origin, Region};
#[derive(Clone, Debug, Default, PartialEq)]
pub struct BufferRange {
pub buffer_address: u64,
pub length: u64,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct CopySparseBufferMappingOperation {
pub source_range: std::ops::Range<usize>,
pub destination_offset: usize,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct CopySparseTextureMappingOperation {
pub source_region: Region,
pub source_level: usize,
pub source_slice: usize,
pub destination_origin: Origin,
pub destination_level: usize,
pub destination_slice: usize,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct TimestampHeapEntry {
pub timestamp: u64,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct UpdateSparseBufferMappingOperation {
pub mode: SparseTextureMappingMode,
pub buffer_range: std::ops::Range<usize>,
pub heap_offset: usize,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct UpdateSparseTextureMappingOperation {
pub mode: SparseTextureMappingMode,
pub texture_region: Region,
pub texture_level: usize,
pub texture_slice: usize,
pub heap_offset: usize,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AccelerationStructureInstanceDescriptor {
pub transformation_matrix: PackedFloat4x3,
pub options: AccelerationStructureInstanceOptions,
pub mask: u32,
pub intersection_function_table_offset: u32,
pub acceleration_structure_index: u32,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AccelerationStructureMotionInstanceDescriptor {
pub options: AccelerationStructureInstanceOptions,
pub mask: u32,
pub intersection_function_table_offset: u32,
pub acceleration_structure_index: u32,
pub user_id: u32,
pub motion_transforms_start_index: u32,
pub motion_transforms_count: u32,
pub motion_start_border_mode: MotionBorderMode,
pub motion_end_border_mode: MotionBorderMode,
pub motion_start_time: f32,
pub motion_end_time: f32,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AccelerationStructureSizes {
pub acceleration_structure_size: usize,
pub build_scratch_buffer_size: usize,
pub refit_scratch_buffer_size: usize,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AccelerationStructureUserIDInstanceDescriptor {
pub transformation_matrix: PackedFloat4x3,
pub options: AccelerationStructureInstanceOptions,
pub mask: u32,
pub intersection_function_table_offset: u32,
pub acceleration_structure_index: u32,
pub user_id: u32,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AxisAlignedBoundingBox {
pub min: PackedFloat3,
pub max: PackedFloat3,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ComponentTransform {
pub scale: PackedFloat3,
pub shear: PackedFloat3,
pub pivot: PackedFloat3,
pub rotation: PackedFloatQuaternion,
pub translation: PackedFloat3,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct CounterResultStageUtilization {
pub total_cycles: u64,
pub vertex_cycles: u64,
pub tessellation_cycles: u64,
pub post_tessellation_vertex_cycles: u64,
pub fragment_cycles: u64,
pub render_target_cycles: u64,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct CounterResultStatistic {
pub tessellation_input_patches: u64,
pub vertex_invocations: u64,
pub post_tessellation_vertex_invocations: u64,
pub clipper_invocations: u64,
pub clipper_primitives_out: u64,
pub fragment_invocations: u64,
pub fragments_passed: u64,
pub compute_kernel_invocations: u64,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct CounterResultTimestamp {
pub timestamp: u64,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct DispatchThreadgroupsIndirectArguments {
pub threadgroups_per_grid: [u32; 3],
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct DispatchThreadsIndirectArguments {
pub threads_per_grid: [u32; 3],
pub threads_per_threadgroup: [u32; 3],
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct DrawIndexedPrimitivesIndirectArguments {
pub index_count: u32,
pub instance_count: u32,
pub index_start: u32,
pub base_vertex: i32,
pub base_instance: u32,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct DrawPatchIndirectArguments {
pub patch_count: u32,
pub instance_count: u32,
pub patch_start: u32,
pub base_instance: u32,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct DrawPrimitivesIndirectArguments {
pub vertex_count: u32,
pub instance_count: u32,
pub vertex_start: u32,
pub base_instance: u32,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct IndirectAccelerationStructureInstanceDescriptor {
pub transformation_matrix: PackedFloat4x3,
pub options: AccelerationStructureInstanceOptions,
pub mask: u32,
pub intersection_function_table_offset: u32,
pub user_id: u32,
pub acceleration_structure_id: ResourceID,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct IndirectAccelerationStructureMotionInstanceDescriptor {
pub options: AccelerationStructureInstanceOptions,
pub mask: u32,
pub intersection_function_table_offset: u32,
pub user_id: u32,
pub acceleration_structure_id: ResourceID,
pub motion_transforms_start_index: u32,
pub motion_transforms_count: u32,
pub motion_start_border_mode: MotionBorderMode,
pub motion_end_border_mode: MotionBorderMode,
pub motion_start_time: f32,
pub motion_end_time: f32,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct IndirectCommandBufferExecutionRange {
pub location: u32,
pub length: u32,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct IntersectionFunctionBufferArguments {
pub intersection_function_buffer: u64,
pub intersection_function_buffer_size: u64,
pub intersection_function_stride: u64,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct MapIndirectArguments {
pub region_origin_x: u32,
pub region_origin_y: u32,
pub region_origin_z: u32,
pub region_size_width: u32,
pub region_size_height: u32,
pub region_size_depth: u32,
pub mip_map_level: u32,
pub slice_id: u32,
}
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct PackedFloat3(pub [f32; 3]);
impl PackedFloat3 {
#[must_use]
pub const fn new(values: [f32; 3]) -> Self {
Self(values)
}
#[must_use]
pub const fn from_components(x: f32, y: f32, z: f32) -> Self {
Self([x, y, z])
}
#[must_use]
pub const fn into_array(self) -> [f32; 3] {
self.0
}
}
impl std::ops::Index<usize> for PackedFloat3 {
type Output = f32;
fn index(&self, index: usize) -> &Self::Output {
&self.0[index]
}
}
impl std::ops::IndexMut<usize> for PackedFloat3 {
fn index_mut(&mut self, index: usize) -> &mut Self::Output {
&mut self.0[index]
}
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PackedFloat4x3 {
pub columns: [PackedFloat3; 4],
}
impl PackedFloat4x3 {
#[must_use]
pub const fn new(columns: [PackedFloat3; 4]) -> Self {
Self { columns }
}
}
impl std::ops::Index<usize> for PackedFloat4x3 {
type Output = PackedFloat3;
fn index(&self, index: usize) -> &Self::Output {
&self.columns[index]
}
}
impl std::ops::IndexMut<usize> for PackedFloat4x3 {
fn index_mut(&mut self, index: usize) -> &mut Self::Output {
&mut self.columns[index]
}
}
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct PackedFloatQuaternion(pub [f32; 4]);
impl PackedFloatQuaternion {
#[must_use]
pub const fn new(values: [f32; 4]) -> Self {
Self(values)
}
#[must_use]
pub const fn from_components(x: f32, y: f32, z: f32, w: f32) -> Self {
Self([x, y, z, w])
}
#[must_use]
pub const fn into_array(self) -> [f32; 4] {
self.0
}
}
impl std::ops::Index<usize> for PackedFloatQuaternion {
type Output = f32;
fn index(&self, index: usize) -> &Self::Output {
&self.0[index]
}
}
impl std::ops::IndexMut<usize> for PackedFloatQuaternion {
fn index_mut(&mut self, index: usize) -> &mut Self::Output {
&mut self.0[index]
}
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct QuadTessellationFactorsHalf {
pub edge_tessellation_factor: [u16; 4],
pub inside_tessellation_factor: [u16; 2],
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ResourceID {
pub _impl: u64,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct SamplePosition {
pub x: f32,
pub y: f32,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ScissorRect {
pub x: usize,
pub y: usize,
pub width: usize,
pub height: usize,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct SizeAndAlign {
pub size: usize,
pub align: usize,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct StageInRegionIndirectArguments {
pub stage_in_origin: [u32; 3],
pub stage_in_size: [u32; 3],
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct TextureSwizzleChannels {
pub red: TextureSwizzle,
pub green: TextureSwizzle,
pub blue: TextureSwizzle,
pub alpha: TextureSwizzle,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct TriangleTessellationFactorsHalf {
pub edge_tessellation_factor: [u16; 3],
pub inside_tessellation_factor: u16,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct VertexAmplificationViewMapping {
pub viewport_array_index_offset: u32,
pub render_target_array_index_offset: u32,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct OperatingSystemVersion {
pub major_version: isize,
pub minor_version: isize,
pub patch_version: isize,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Range {
pub location: usize,
pub length: usize,
}
impl Range {
#[must_use]
pub const fn new(location: usize, length: usize) -> Option<Self> {
if location.checked_add(length).is_some() {
Some(Self { location, length })
} else {
None
}
}
#[must_use]
pub const fn contains(&self, location: usize) -> bool {
location >= self.location && location < self.location.saturating_add(self.length)
}
#[must_use]
pub const fn end(&self) -> Option<usize> {
self.location.checked_add(self.length)
}
}