products/Sources/formale Sprachen/C/Firefox/third_party/rust/cexpr/tests/input/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 816 B image not shown  

Quelle  command.rs

  Sprache: Rust
 

use alloc::vec::Vec;
use core::{mem, ops::Range};

use windows::{
    core::Interface as _,
    Win32::{
        Foundation,
        Graphics::{Direct3D12, Dxgi},
    },
};

use super::conv;
use crate::{
    auxil::{
        self,
        dxgi::{name::ObjectExt as _, result::HResult as _},
    },
    dx12::borrow_interface_temporarily,
    AccelerationStructureEntries, CommandEncoder as _,
};

fn make_box(origin: &wgt::Origin3d, size: &crate::CopyExtent) -> Direct3D12::D3D12_BOX {
    Direct3D12::D3D12_BOX {
        left: origin.x,
        top: origin.y,
        right: origin.x + size.width,
        bottom: origin.y + size.height,
        front: origin.z,
        back: origin.z + size.depth,
    }
}

impl crate::BufferTextureCopy {
    fn to_subresource_footprint(
        &self,
        format: wgt::TextureFormat,
    ) -> Direct3D12::D3D12_PLACED_SUBRESOURCE_FOOTPRINT {
        let (block_width, _) = format.block_dimensions();
        Direct3D12::D3D12_PLACED_SUBRESOURCE_FOOTPRINT {
            Offset: self.buffer_layout.offset,
            Footprint: Direct3D12::D3D12_SUBRESOURCE_FOOTPRINT {
                Format: auxil::dxgi::conv::map_texture_format_for_copy(
                    format,
                    self.texture_base.aspect,
                )
                .unwrap(),
                Width: self.size.width,
                Height: self.size.height,
                Depth: self.size.depth,
                RowPitch: {
                    let actual = self.buffer_layout.bytes_per_row.unwrap_or_else(|| {
                        // this may happen for single-line updates
                        let block_size = format
                            .block_copy_size(Some(self.texture_base.aspect.map()))
                            .unwrap();
                        (self.size.width / block_width) * block_size
                    });
                    wgt::math::align_to(actual, Direct3D12::D3D12_TEXTURE_DATA_PITCH_ALIGNMENT)
                },
            },
        }
    }
}

impl super::Temp {
    fn prepare_marker(&mut self, marker: &str) -> (&[u16], u32) {
        self.marker.clear();
        self.marker.extend(marker.encode_utf16());
        self.marker.push(0);
        (&self.marker, self.marker.len() as u32 * 2)
    }
}

impl Drop for super::CommandEncoder {
    fn drop(&mut self) {
        use crate::CommandEncoder;
        unsafe { self.discard_encoding() }

        let mut rtv_pool = self.rtv_pool.lock();
        for handle in self.temp_rtv_handles.drain(..) {
            rtv_pool.free_handle(handle);
        }
        drop(rtv_pool);

        self.counters.command_encoders.sub(1);
    }
}

impl super::CommandEncoder {
    unsafe fn begin_pass(&mut self, kind: super::PassKind, label: crate::Label) {
        let list = self.list.as_ref().unwrap();
        self.pass.kind = kind;
        if let Some(label) = label {
            let (wide_label, size) = self.temp.prepare_marker(label);
            unsafe { list.BeginEvent(0, Some(wide_label.as_ptr().cast()), size) };
            self.pass.has_label = true;
        }
        self.pass.dirty_root_elements = 0;
        self.pass.dirty_vertex_buffers = 0;
        unsafe {
            list.SetDescriptorHeaps(&[
                Some(self.shared.heap_views.raw.clone()),
                Some(self.shared.sampler_heap.heap().clone()),
            ])
        };
    }

    unsafe fn end_pass(&mut self) {
        let list = self.list.as_ref().unwrap();
        unsafe { list.SetDescriptorHeaps(&[]) };
        if self.pass.has_label {
            unsafe { list.EndEvent() };
        }
        self.pass.clear();
    }

    unsafe fn prepare_vertex_buffers(&mut self) {
        while self.pass.dirty_vertex_buffers != 0 {
            let list = self.list.as_ref().unwrap();
            let index = self.pass.dirty_vertex_buffers.trailing_zeros();
            self.pass.dirty_vertex_buffers ^= 1 << index;
            unsafe {
                list.IASetVertexBuffers(
                    index,
                    Some(&self.pass.vertex_buffers[index as usize..][..1]),
                );
            }
        }
    }

    unsafe fn prepare_draw(&mut self, first_vertex: i32, first_instance: u32) {
        unsafe {
            self.prepare_vertex_buffers();
        }
        if let Some(root_index) = self
            .pass
            .layout
            .special_constants
            .as_ref()
            .map(|sc| sc.root_index)
        {
            let special_constants = super::SpecialConstants::from_indirect_draw_call_params(
                first_vertex,
                first_instance,
            );
            let needs_update = match self.pass.root_elements[root_index as usize] {
                super::RootElement::SpecialConstants(old_special_constants) => {
                    old_special_constants != special_constants
                }
                _ => true,
            };
            if needs_update {
                self.pass.dirty_root_elements |= 1 << root_index;
                self.pass.root_elements[root_index as usize] =
                    super::RootElement::SpecialConstants(special_constants);
            }
        }
        self.update_root_elements();
    }

    fn prepare_dispatch(&mut self, workgroup_count: [u32; 3]) {
        if let Some(root_index) = self
            .pass
            .layout
            .special_constants
            .as_ref()
            .map(|sc| sc.root_index)
        {
            let special_constants =
                super::SpecialConstants::from_compute_dispatch_params(workgroup_count);
            let needs_update = match self.pass.root_elements[root_index as usize] {
                super::RootElement::SpecialConstants(old_special_constants) => {
                    old_special_constants != special_constants
                }
                _ => true,
            };
            if needs_update {
                self.pass.dirty_root_elements |= 1 << root_index;
                self.pass.root_elements[root_index as usize] =
                    super::RootElement::SpecialConstants(special_constants);
            }
        }
        self.update_root_elements();
    }

    // Note: we have to call this lazily before draw calls. Otherwise, D3D complains
    // about the root parameters being incompatible with root signature.
    fn update_root_elements(&mut self) {
        use super::PassKind as Pk;

        while self.pass.dirty_root_elements != 0 {
            let list = self.list.as_ref().unwrap();
            let index = self.pass.dirty_root_elements.trailing_zeros();
            self.pass.dirty_root_elements ^= 1 << index;

            match self.pass.root_elements[index as usize] {
                super::RootElement::Empty => unreachable!(
                    "Empty root element at index {index} should not have been marked as dirty"
                ),
                super::RootElement::Immediates => {
                    let info = self.pass.layout.immediates_info.as_ref().unwrap();

                    for offset in 0..info.size {
                        let val = self.pass.immediates[offset as usize];
                        match self.pass.kind {
                            Pk::Render => unsafe {
                                list.SetGraphicsRoot32BitConstant(index, val, offset)
                            },
                            Pk::Compute => unsafe {
                                list.SetComputeRoot32BitConstant(index, val, offset)
                            },
                            Pk::Transfer => (),
                        }
                    }
                }
                super::RootElement::SpecialConstants(super::SpecialConstants {
                    first_vertex_or_x,
                    first_instance_or_y,
                    unused_or_z,
                }) => match self.pass.kind {
                    Pk::Render => {
                        unsafe {
                            list.SetGraphicsRoot32BitConstant(index, first_vertex_or_x as u32, 0)
                        };
                        unsafe { list.SetGraphicsRoot32BitConstant(index, first_instance_or_y, 1) };
                    }
                    Pk::Compute => {
                        unsafe {
                            list.SetComputeRoot32BitConstant(index, first_vertex_or_x as u32, 0)
                        };
                        unsafe { list.SetComputeRoot32BitConstant(index, first_instance_or_y, 1) };
                        unsafe { list.SetComputeRoot32BitConstant(index, unused_or_z, 2) };
                    }
                    Pk::Transfer => (),
                },
                super::RootElement::DescriptorTable(descriptor) => match self.pass.kind {
                    Pk::Render => unsafe { list.SetGraphicsRootDescriptorTable(index, descriptor) },
                    Pk::Compute => unsafe { list.SetComputeRootDescriptorTable(index, descriptor) },
                    Pk::Transfer => (),
                },
                super::RootElement::DynamicUniformBuffer { address } => {
                    let address = address.ptr;
                    match self.pass.kind {
                        Pk::Render => unsafe {
                            list.SetGraphicsRootConstantBufferView(index, address)
                        },
                        Pk::Compute => unsafe {
                            list.SetComputeRootConstantBufferView(index, address)
                        },
                        Pk::Transfer => (),
                    }
                }
                super::RootElement::DynamicStorageBufferOffsets { start, end } => {
                    let values = &self.pass.dynamic_storage_buffer_offsets[start..end];

                    for (offset, &value) in values.iter().enumerate() {
                        match self.pass.kind {
                            Pk::Render => unsafe {
                                list.SetGraphicsRoot32BitConstant(index, value, offset as u32)
                            },
                            Pk::Compute => unsafe {
                                list.SetComputeRoot32BitConstant(index, value, offset as u32)
                            },
                            Pk::Transfer => (),
                        }
                    }
                }
                super::RootElement::SamplerHeapDescriptorTable => match self.pass.kind {
                    Pk::Render => unsafe {
                        list.SetGraphicsRootDescriptorTable(
                            index,
                            self.shared.sampler_heap.gpu_descriptor_table(),
                        )
                    },
                    Pk::Compute => unsafe {
                        list.SetComputeRootDescriptorTable(
                            index,
                            self.shared.sampler_heap.gpu_descriptor_table(),
                        )
                    },
                    Pk::Transfer => (),
                },
            }
        }
    }

    fn reset_signature(&mut self, layout: &super::PipelineLayoutShared) {
        if let Some(root_index) = layout.special_constants.as_ref().map(|sc| sc.root_index) {
            self.pass.root_elements[root_index as usize] =
                super::RootElement::SpecialConstants(super::SpecialConstants::default());
        }
        if let Some(root_index) = layout.sampler_heap_root_index {
            self.pass.root_elements[root_index as usize] =
                super::RootElement::SamplerHeapDescriptorTable;
        }
        self.pass.layout = layout.clone();
        self.pass.dirty_root_elements = (1 << layout.total_root_elements) - 1;
    }

    fn write_pass_end_timestamp_if_requested(&mut self) {
        if let Some((query_set_raw, index)) = self.end_of_pass_timer_query.take() {
            use crate::CommandEncoder as _;
            unsafe {
                self.write_timestamp(
                    &crate::dx12::QuerySet {
                        raw: query_set_raw,
                        raw_ty: Direct3D12::D3D12_QUERY_TYPE_TIMESTAMP,
                    },
                    index,
                );
            }
        }
    }

    unsafe fn buf_tex_intermediate<T>(
        &mut self,
        region: crate::BufferTextureCopy,
        tex_fmt: wgt::TextureFormat,
        copy_op: impl FnOnce(&mut Self, &super::Buffer, wgt::BufferSize, crate::BufferTextureCopy) -> T,
    ) -> (T, super::Buffer) {
        let size = {
            let copy_info = region.buffer_layout.get_buffer_texture_copy_info(
                tex_fmt,
                region.texture_base.aspect.map(),
                ®ion.size.into(),
            );
            copy_info.unwrap().bytes_in_copy
        };

        let size = wgt::BufferSize::new(size).unwrap();

        let buffer = {
            let (resource, allocation) =
                super::suballocation::DeviceAllocationContext::from(&*self)
                    .create_buffer(&crate::BufferDescriptor {
                        label: None,
                        size: size.get(),
                        usage: wgt::BufferUses::COPY_SRC | wgt::BufferUses::COPY_DST,
                        memory_flags: crate::MemoryFlags::empty(),
                    })
                    .expect(concat!(
                        "internal error: ",
                        "failed to allocate intermediate buffer ",
                        "for offset alignment"
                    ));
            super::Buffer {
                resource,
                size: size.get(),
                allocation,
            }
        };

        let mut region = region;
        region.buffer_layout.offset = 0;

        unsafe {
            self.transition_buffers(
                [crate::BufferBarrier {
                    buffer: &buffer,
                    usage: crate::StateTransition {
                        from: wgt::BufferUses::empty(),
                        to: wgt::BufferUses::COPY_DST,
                    },
                }]
                .into_iter(),
            )
        };

        let t = copy_op(self, &buffer, size, region);

        unsafe {
            self.transition_buffers(
                [crate::BufferBarrier {
                    buffer: &buffer,
                    usage: crate::StateTransition {
                        from: wgt::BufferUses::COPY_DST,
                        to: wgt::BufferUses::COPY_SRC,
                    },
                }]
                .into_iter(),
            )
        };

        (t, buffer)
    }
}

impl crate::CommandEncoder for super::CommandEncoder {
    type A = super::Api;

    unsafe fn begin_encoding(&mut self, label: crate::Label) -> Result<(), crate::DeviceError> {
        let list = loop {
            if let Some(list) = self.free_lists.pop() {
                // TODO: Is an error expected here and should we print it?
                let reset_result = unsafe { list.Reset(&self.allocator, None) };
                if reset_result.is_ok() {
                    break Some(list);
                }
            } else {
                break None;
            }
        };

        let list = if let Some(list) = list {
            list
        } else {
            unsafe {
                self.device.CreateCommandList(
                    0,
                    Direct3D12::D3D12_COMMAND_LIST_TYPE_DIRECT,
                    &self.allocator,
                    None,
                )
            }
            .into_device_result("Create command list")?
        };

        if let Some(label) = label {
            list.set_name(label)?;
        }

        self.list = Some(list);
        self.temp.clear();
        self.pass.clear();
        Ok(())
    }
    unsafe fn discard_encoding(&mut self) {
        if let Some(list) = self.list.take() {
            if unsafe { list.Close() }.is_ok() {
                self.free_lists.push(list);
            }
        }
    }
    unsafe fn end_encoding(&mut self) -> Result<super::CommandBuffer, crate::DeviceError> {
        let raw = self.list.take().unwrap();
        unsafe { raw.Close() }.into_device_result("GraphicsCommandList::close")?;
        Ok(super::CommandBuffer { raw })
    }
    unsafe fn reset_all<I: Iterator<Item = super::CommandBuffer>>(&mut self, command_buffers: I) {
        self.intermediate_copy_bufs.clear();
        for cmd_buf in command_buffers {
            self.free_lists.push(cmd_buf.raw);
        }
        if let Err(e) = unsafe { self.allocator.Reset() } {
            log::error!("ID3D12CommandAllocator::Reset() failed with {e}");
        }
    }

    unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)
    where
        T: Iterator<Item = crate::BufferBarrier<'a, super::Buffer>>,
    {
        self.temp.barriers.clear();

        for barrier in barriers {
            let s0 = conv::map_buffer_usage_to_state(barrier.usage.from);
            let s1 = conv::map_buffer_usage_to_state(barrier.usage.to);
            if s0 != s1 {
                let raw = Direct3D12::D3D12_RESOURCE_BARRIER {
                    Type: Direct3D12::D3D12_RESOURCE_BARRIER_TYPE_TRANSITION,
                    Flags: Direct3D12::D3D12_RESOURCE_BARRIER_FLAG_NONE,
                    Anonymous: Direct3D12::D3D12_RESOURCE_BARRIER_0 {
                        Transition: mem::ManuallyDrop::new(
                            Direct3D12::D3D12_RESOURCE_TRANSITION_BARRIER {
                                pResource: unsafe {
                                    borrow_interface_temporarily(&barrier.buffer.resource)
                                },
                                Subresource: Direct3D12::D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,
                                StateBefore: s0,
                                StateAfter: s1,
                            },
                        ),
                    },
                };
                self.temp.barriers.push(raw);
            } else if barrier.usage.from == wgt::BufferUses::STORAGE_READ_WRITE
                || barrier.usage.from == wgt::BufferUses::ACCELERATION_STRUCTURE_QUERY
            {
                let raw = Direct3D12::D3D12_RESOURCE_BARRIER {
                    Type: Direct3D12::D3D12_RESOURCE_BARRIER_TYPE_UAV,
                    Flags: Direct3D12::D3D12_RESOURCE_BARRIER_FLAG_NONE,
                    Anonymous: Direct3D12::D3D12_RESOURCE_BARRIER_0 {
                        UAV: mem::ManuallyDrop::new(Direct3D12::D3D12_RESOURCE_UAV_BARRIER {
                            pResource: unsafe {
                                borrow_interface_temporarily(&barrier.buffer.resource)
                            },
                        }),
                    },
                };
                self.temp.barriers.push(raw);
            }
        }

        if !self.temp.barriers.is_empty() {
            unsafe {
                self.list
                    .as_ref()
                    .unwrap()
                    .ResourceBarrier(&self.temp.barriers)
            };
        }
    }

    unsafe fn transition_textures<'a, T>(&mut self, barriers: T)
    where
        T: Iterator<Item = crate::TextureBarrier<'a, super::Texture>>,
    {
        self.temp.barriers.clear();

        for barrier in barriers {
            let s0 = conv::map_texture_usage_to_state(barrier.usage.from);
            let s1 = conv::map_texture_usage_to_state(barrier.usage.to);
            if s0 != s1 {
                let mut raw = Direct3D12::D3D12_RESOURCE_BARRIER {
                    Type: Direct3D12::D3D12_RESOURCE_BARRIER_TYPE_TRANSITION,
                    Flags: Direct3D12::D3D12_RESOURCE_BARRIER_FLAG_NONE,
                    Anonymous: Direct3D12::D3D12_RESOURCE_BARRIER_0 {
                        Transition: mem::ManuallyDrop::new(
                            Direct3D12::D3D12_RESOURCE_TRANSITION_BARRIER {
                                pResource: unsafe {
                                    borrow_interface_temporarily(&barrier.texture.resource)
                                },
                                Subresource: Direct3D12::D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,
                                StateBefore: s0,
                                StateAfter: s1,
                            },
                        ),
                    },
                };

                let tex_mip_level_count = barrier.texture.mip_level_count;
                let tex_array_layer_count = barrier.texture.array_layer_count();

                if barrier.range.is_full_resource(
                    barrier.texture.format,
                    tex_mip_level_count,
                    tex_array_layer_count,
                ) {
                    // Only one barrier if it affects the whole image.
                    self.temp.barriers.push(raw);
                } else {
                    // Selected texture aspect is relevant if the texture format has both depth _and_ stencil aspects.
                    let planes = if barrier.texture.format.is_combined_depth_stencil_format() {
                        match barrier.range.aspect {
                            wgt::TextureAspect::All => 0..2,
                            wgt::TextureAspect::DepthOnly => 0..1,
                            wgt::TextureAspect::StencilOnly => 1..2,
                            _ => unreachable!(),
                        }
                    } else if let Some(planes) = barrier.texture.format.planes() {
                        match barrier.range.aspect {
                            wgt::TextureAspect::All => 0..planes,
                            wgt::TextureAspect::Plane0 => 0..1,
                            wgt::TextureAspect::Plane1 => 1..2,
                            wgt::TextureAspect::Plane2 => 2..3,
                            _ => unreachable!(),
                        }
                    } else {
                        match barrier.texture.format {
                            wgt::TextureFormat::Stencil8 => 1..2,
                            wgt::TextureFormat::Depth24Plus => 0..2// TODO: investigate why tests fail if we set this to 0..1
                            _ => 0..1,
                        }
                    };

                    for mip_level in barrier.range.mip_range(tex_mip_level_count) {
                        for array_layer in barrier.range.layer_range(tex_array_layer_count) {
                            for plane in planes.clone() {
                                unsafe { &mut *raw.Anonymous.Transition }.Subresource = barrier
                                    .texture
                                    .calc_subresource(mip_level, array_layer, plane);
                                self.temp.barriers.push(raw.clone());
                            }
                        }
                    }
                }
            } else if barrier.usage.from == wgt::TextureUses::STORAGE_READ_WRITE {
                let raw = Direct3D12::D3D12_RESOURCE_BARRIER {
                    Type: Direct3D12::D3D12_RESOURCE_BARRIER_TYPE_UAV,
                    Flags: Direct3D12::D3D12_RESOURCE_BARRIER_FLAG_NONE,
                    Anonymous: Direct3D12::D3D12_RESOURCE_BARRIER_0 {
                        UAV: mem::ManuallyDrop::new(Direct3D12::D3D12_RESOURCE_UAV_BARRIER {
                            pResource: unsafe {
                                borrow_interface_temporarily(&barrier.texture.resource)
                            },
                        }),
                    },
                };
                self.temp.barriers.push(raw);
            }
        }

        if !self.temp.barriers.is_empty() {
            unsafe {
                self.list
                    .as_ref()
                    .unwrap()
                    .ResourceBarrier(&self.temp.barriers)
            };
        }
    }

    unsafe fn clear_buffer(&mut self, buffer: &super::Buffer, range: crate::MemoryRange) {
        let list = self.list.as_ref().unwrap();
        let mut offset = range.start;
        while offset < range.end {
            let size = super::ZERO_BUFFER_SIZE.min(range.end - offset);
            unsafe {
                list.CopyBufferRegion(&buffer.resource, offset, &self.shared.zero_buffer0, size)
            };
            offset += size;
        }
    }

    unsafe fn copy_buffer_to_buffer<T>(
        &mut self,
        src: &super::Buffer,
        dst: &super::Buffer,
        regions: T,
    ) where
        T: Iterator<Item = crate::BufferCopy>,
    {
        let list = self.list.as_ref().unwrap();
        for r in regions {
            unsafe {
                list.CopyBufferRegion(
                    &dst.resource,
                    r.dst_offset,
                    &src.resource,
                    r.src_offset,
                    r.size.get(),
                )
            };
        }
    }

    unsafe fn copy_texture_to_texture<T>(
        &mut self,
        src: &super::Texture,
        _src_usage: wgt::TextureUses,
        dst: &super::Texture,
        regions: T,
    ) where
        T: Iterator<Item = crate::TextureCopy>,
    {
        let list = self.list.as_ref().unwrap();

        for r in regions {
            let src_location = Direct3D12::D3D12_TEXTURE_COPY_LOCATION {
                pResource: unsafe { borrow_interface_temporarily(&src.resource) },
                Type: Direct3D12::D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX,
                Anonymous: Direct3D12::D3D12_TEXTURE_COPY_LOCATION_0 {
                    SubresourceIndex: src.calc_subresource_for_copy(&r.src_base),
                },
            };
            let dst_location = Direct3D12::D3D12_TEXTURE_COPY_LOCATION {
                pResource: unsafe { borrow_interface_temporarily(&dst.resource) },
                Type: Direct3D12::D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX,
                Anonymous: Direct3D12::D3D12_TEXTURE_COPY_LOCATION_0 {
                    SubresourceIndex: dst.calc_subresource_for_copy(&r.dst_base),
                },
            };

            let src_box = make_box(&r.src_base.origin, &r.size);

            unsafe {
                list.CopyTextureRegion(
                    &dst_location,
                    r.dst_base.origin.x,
                    r.dst_base.origin.y,
                    r.dst_base.origin.z,
                    &src_location,
                    Some(&src_box),
                )
            };
        }
    }

    unsafe fn copy_buffer_to_texture<T>(
        &mut self,
        src: &super::Buffer,
        dst: &super::Texture,
        regions: T,
    ) where
        T: Iterator<Item = crate::BufferTextureCopy>,
    {
        let offset_alignment = self.shared.private_caps.texture_data_placement_alignment();

        for naive_copy_region in regions {
            let is_offset_aligned = naive_copy_region.buffer_layout.offset % offset_alignment == 0;
            let (final_copy_region, src) = if is_offset_aligned {
                (naive_copy_region, src)
            } else {
                let (intermediate_to_dst_region, intermediate_buf) = unsafe {
                    let src_offset = naive_copy_region.buffer_layout.offset;
                    self.buf_tex_intermediate(
                        naive_copy_region,
                        dst.format,
                        |this, buf, size, intermediate_to_dst_region| {
                            let layout = crate::BufferCopy {
                                src_offset,
                                dst_offset: 0,
                                size,
                            };
                            this.copy_buffer_to_buffer(src, buf, [layout].into_iter());
                            intermediate_to_dst_region
                        },
                    )
                };
                self.intermediate_copy_bufs.push(intermediate_buf);
                let intermediate_buf = self.intermediate_copy_bufs.last().unwrap();
                (intermediate_to_dst_region, intermediate_buf)
            };

            let list = self.list.as_ref().unwrap();

            let src_location = Direct3D12::D3D12_TEXTURE_COPY_LOCATION {
                pResource: unsafe { borrow_interface_temporarily(&src.resource) },
                Type: Direct3D12::D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT,
                Anonymous: Direct3D12::D3D12_TEXTURE_COPY_LOCATION_0 {
                    PlacedFootprint: final_copy_region.to_subresource_footprint(dst.format),
                },
            };
            let dst_location = Direct3D12::D3D12_TEXTURE_COPY_LOCATION {
                pResource: unsafe { borrow_interface_temporarily(&dst.resource) },
                Type: Direct3D12::D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX,
                Anonymous: Direct3D12::D3D12_TEXTURE_COPY_LOCATION_0 {
                    SubresourceIndex: dst
                        .calc_subresource_for_copy(&final_copy_region.texture_base),
                },
            };

            let src_box = make_box(&wgt::Origin3d::ZERO, &final_copy_region.size);
            unsafe {
                list.CopyTextureRegion(
                    &dst_location,
                    final_copy_region.texture_base.origin.x,
                    final_copy_region.texture_base.origin.y,
                    final_copy_region.texture_base.origin.z,
                    &src_location,
                    Some(&src_box),
                )
            };
        }
    }

    unsafe fn copy_texture_to_buffer<T>(
        &mut self,
        src: &super::Texture,
        _src_usage: wgt::TextureUses,
        dst: &super::Buffer,
        regions: T,
    ) where
        T: Iterator<Item = crate::BufferTextureCopy>,
    {
        let copy_aligned = |this: &mut Self,
                            src: &super::Texture,
                            dst: &super::Buffer,
                            r: crate::BufferTextureCopy| {
            let list = this.list.as_ref().unwrap();

            let src_location = Direct3D12::D3D12_TEXTURE_COPY_LOCATION {
                pResource: unsafe { borrow_interface_temporarily(&src.resource) },
                Type: Direct3D12::D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX,
                Anonymous: Direct3D12::D3D12_TEXTURE_COPY_LOCATION_0 {
                    SubresourceIndex: src.calc_subresource_for_copy(&r.texture_base),
                },
            };
            let dst_location = Direct3D12::D3D12_TEXTURE_COPY_LOCATION {
                pResource: unsafe { borrow_interface_temporarily(&dst.resource) },
                Type: Direct3D12::D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT,
                Anonymous: Direct3D12::D3D12_TEXTURE_COPY_LOCATION_0 {
                    PlacedFootprint: r.to_subresource_footprint(src.format),
                },
            };

            let src_box = make_box(&r.texture_base.origin, &r.size);
            unsafe {
                list.CopyTextureRegion(&dst_location, 000, &src_location, Some(&src_box))
            };
        };

        let offset_alignment = self.shared.private_caps.texture_data_placement_alignment();

        for r in regions {
            let is_offset_aligned = r.buffer_layout.offset % offset_alignment == 0;
            if is_offset_aligned {
                copy_aligned(self, src, dst, r)
            } else {
                let orig_offset = r.buffer_layout.offset;
                let (intermediate_to_dst_region, src) = unsafe {
                    self.buf_tex_intermediate(
                        r,
                        src.format,
                        |this, buf, size, intermediate_region| {
                            copy_aligned(this, src, buf, intermediate_region);
                            crate::BufferCopy {
                                src_offset: 0,
                                dst_offset: orig_offset,
                                size,
                            }
                        },
                    )
                };

                unsafe {
                    self.copy_buffer_to_buffer(&src, dst, [intermediate_to_dst_region].into_iter());
                }

                self.intermediate_copy_bufs.push(src);
            };
        }
    }

    unsafe fn begin_query(&mut self, set: &super::QuerySet, index: u32) {
        unsafe {
            self.list
                .as_ref()
                .unwrap()
                .BeginQuery(&set.raw, set.raw_ty, index)
        };
    }
    unsafe fn end_query(&mut self, set: &super::QuerySet, index: u32) {
        unsafe {
            self.list
                .as_ref()
                .unwrap()
                .EndQuery(&set.raw, set.raw_ty, index)
        };
    }
    unsafe fn write_timestamp(&mut self, set: &super::QuerySet, index: u32) {
        unsafe {
            self.list.as_ref().unwrap().EndQuery(
                &set.raw,
                Direct3D12::D3D12_QUERY_TYPE_TIMESTAMP,
                index,
            )
        };
    }
    unsafe fn read_acceleration_structure_compact_size(
        &mut self,
        acceleration_structure: &super::AccelerationStructure,
        buf: &super::Buffer,
    ) {
        let list = self
            .list
            .as_ref()
            .unwrap()
            .cast::<Direct3D12::ID3D12GraphicsCommandList4>()
            .unwrap();
        unsafe {
            list.EmitRaytracingAccelerationStructurePostbuildInfo(
                &Direct3D12::D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC {
                    DestBuffer: buf.resource.GetGPUVirtualAddress(),
                    InfoType: Direct3D12::D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_COMPACTED_SIZE,
                },
                &[
                    acceleration_structure.resource.GetGPUVirtualAddress()
                ],
            )
        }
    }
    unsafe fn reset_queries(&mut self, _set: &>super::QuerySet, _range: Range<u32>) {
        // nothing to do here
    }
    unsafe fn copy_query_results(
        &mut self,
        set: &super::QuerySet,
        range: Range<u32>,
        buffer: &super::Buffer,
        offset: wgt::BufferAddress,
        _stride: wgt::BufferSize,
    ) {
        unsafe {
            self.list.as_ref().unwrap().ResolveQueryData(
                &set.raw,
                set.raw_ty,
                range.start,
                range.end - range.start,
                &buffer.resource,
                offset,
            )
        };
    }

    // render

    unsafe fn begin_render_pass(
        &mut self,
        desc: &crate::RenderPassDescriptor<super::QuerySet, super::TextureView>,
    ) -> Result<(), crate::DeviceError> {
        unsafe { self.begin_pass(super::PassKind::Render, desc.label) };

        // Start timestamp if any (before all other commands but after debug marker)
        if let Some(timestamp_writes) = desc.timestamp_writes.as_ref() {
            if let Some(index) = timestamp_writes.beginning_of_pass_write_index {
                unsafe {
                    self.write_timestamp(timestamp_writes.query_set, index);
                }
            }
            self.end_of_pass_timer_query = timestamp_writes
                .end_of_pass_write_index
                .map(|index| (timestamp_writes.query_set.raw.clone(), index));
        }

        let mut color_views =
            [Direct3D12::D3D12_CPU_DESCRIPTOR_HANDLE { ptr: 0 }; crate::MAX_COLOR_ATTACHMENTS];
        let mut rtv_pool = self.rtv_pool.lock();
        for (rtv, cat) in color_views.iter_mut().zip(desc.color_attachments.iter()) {
            if let Some(cat) = cat.as_ref() {
                if cat.target.view.dimension == wgt::TextureViewDimension::D3 {
                    let desc = Direct3D12::D3D12_RENDER_TARGET_VIEW_DESC {
                        Format: cat.target.view.raw_format,
                        ViewDimension: Direct3D12::D3D12_RTV_DIMENSION_TEXTURE3D,
                        Anonymous: Direct3D12::D3D12_RENDER_TARGET_VIEW_DESC_0 {
                            Texture3D: Direct3D12::D3D12_TEX3D_RTV {
                                MipSlice: cat.target.view.mip_slice,
                                FirstWSlice: cat.depth_slice.unwrap(),
                                WSize: 1,
                            },
                        },
                    };
                    let handle = rtv_pool.alloc_handle()?;
                    unsafe {
                        self.device.CreateRenderTargetView(
                            &cat.target.view.texture,
                            Some(&desc),
                            handle.raw,
                        )
                    };
                    *rtv = handle.raw;
                    self.temp_rtv_handles.push(handle);
                } else {
                    *rtv = cat.target.view.handle_rtv.unwrap().raw;
                }
            } else {
                *rtv = self.null_rtv_handle.raw;
            }
        }
        drop(rtv_pool);

        let ds_view = desc.depth_stencil_attachment.as_ref().map(|ds| {
            if ds.target.usage == wgt::TextureUses::DEPTH_STENCIL_WRITE {
                ds.target.view.handle_dsv_rw.as_ref().unwrap().raw
            } else {
                ds.target.view.handle_dsv_ro.as_ref().unwrap().raw
            }
        });

        let list = self.list.as_ref().unwrap();
        unsafe {
            list.OMSetRenderTargets(
                desc.color_attachments.len() as u32,
                Some(color_views.as_ptr()),
                false,
                ds_view.as_ref().map(core::ptr::from_ref),
            )
        };

        self.pass.resolves.clear();
        for (rtv, cat) in color_views.iter().zip(desc.color_attachments.iter()) {
            if let Some(cat) = cat.as_ref() {
                if cat.ops.contains(crate::AttachmentOps::LOAD_CLEAR) {
                    let value = [
                        cat.clear_value.r as f32,
                        cat.clear_value.g as f32,
                        cat.clear_value.b as f32,
                        cat.clear_value.a as f32,
                    ];
                    unsafe { list.ClearRenderTargetView(*rtv, &value, None) };
                }
                if let Some(ref target) = cat.resolve_target {
                    self.pass.resolves.push(super::PassResolve {
                        src: (
                            cat.target.view.texture.clone(),
                            cat.target.view.subresource_index,
                        ),
                        dst: (target.view.texture.clone(), target.view.subresource_index),
                        format: target.view.raw_format,
                    });
                }
            }
        }

        if let Some(ref ds) = desc.depth_stencil_attachment {
            let mut flags = Direct3D12::D3D12_CLEAR_FLAGS::default();
            let aspects = ds.target.view.aspects;
            if ds.depth_ops.contains(crate::AttachmentOps::LOAD_CLEAR)
                && aspects.contains(crate::FormatAspects::DEPTH)
            {
                flags |= Direct3D12::D3D12_CLEAR_FLAG_DEPTH;
            }
            if ds.stencil_ops.contains(crate::AttachmentOps::LOAD_CLEAR)
                && aspects.contains(crate::FormatAspects::STENCIL)
            {
                flags |= Direct3D12::D3D12_CLEAR_FLAG_STENCIL;
            }

            if let Some(ds_view) = ds_view {
                if flags != Direct3D12::D3D12_CLEAR_FLAGS::default() {
                    unsafe {
                        list.ClearDepthStencilView(
                            ds_view,
                            flags,
                            ds.clear_value.0,
                            ds.clear_value.1 as u8,
                            None,
                        )
                    }
                }
            }
        }

        if let Some(multiview_mask) = desc.multiview_mask {
            unsafe {
                list.cast::<Direct3D12::ID3D12GraphicsCommandList2>()
                    .unwrap()
                    .SetViewInstanceMask(multiview_mask.get());
            }
        }

        let raw_vp = Direct3D12::D3D12_VIEWPORT {
            TopLeftX: 0.0,
            TopLeftY: 0.0,
            Width: desc.extent.width as f32,
            Height: desc.extent.height as f32,
            MinDepth: 0.0,
            MaxDepth: 1.0,
        };
        let raw_rect = Foundation::RECT {
            left: 0,
            top: 0,
            right: desc.extent.width asuse alloc::ec:;
bottom:descextent  i32java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
 originx +sizewidth
        unsafe { list.RSSetViewports(core::java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 24
        let(lock_width,_  formatblock_dimensions)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57

        Ok(())
    }

    unsafe fn end_render_pass(&mut                Format: auxil:dxgi:conv:map_texture_format_for_copy
        if)
            .as_ref).nwrap(;
            self.temp.barriers.clear();

            // All the targets are expected to be in `COLOR_TARGET` state,
           // but D3D12 has special source/destination states for the resolves.
            for                          this may happen for single-line updates
                let barrier = Direct3D12::D3D12_RESOURCE_BARRIER {
                    Type (self..width  block_width)*block_size
java.lang.StringIndexOutOfBoundsException: Range [37, 20) out of bounds for length 72
                     :D3D12_RESOURCE_BARRIER_0{
                        // Note: this assumes `D3D12_RESOURCE_STATE_RENDER_TARGET`.
                        // If it's not the case, we can include the `TextureUses` in `PassResolve`..clear(;
                        Transition:mem::ManuallyDrop::ew
                            Direct3D12:D3D12_RESOURCE_TRANSITION_BARRIER
     pResource  {borrow_interface_temporarily&src.0)},
                                Subresource: resolve.fndrop(&ut self java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
Direct3D12::D3D12_RESOURCE_STATE_RENDER_TARGET,
                                StateAfter: Direct3D12::D3D12_RESOURCE_STATE_RESOLVE_SOURCE,
                            
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
                    
                        list =selflistas_ref().unwrap();
                self        self.pass.kind  kind;
         barrier = Direct3D12::3D12_RESOURCE_BARRIER{
                    : Direct3D12::3D12_RESOURCE_BARRIER_TYPE_TRANSITION,
                    Flags: Direct3D12::D3D12_RESOURCE_BARRIER_FLAG_NONE,
                    Anonymous:Direct3D12::D3D12_RESOURCE_BARRIER_0 {
            self.ass.has_label = true;
selfpass.dirty_root_elements = 0;
java.lang.StringIndexOutOfBoundsException: Range [34, 24) out of bounds for length 59
                s.heap_views()java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
                                  (&esolve. ,
                                 list=self.as_ref.();
                       ,
p.(;
                            },
                        ,
                    },
                };
                self.barriers.pushbarrier)java.lang.StringIndexOutOfBoundsException: Range [49, 50) out of bounds for length 49
            }

            if !self.temp.barriers.is_empty() {
profilings(::";
                unsafe list.ResourceBarrier&selftempbarriers);
            }

forresolveinself.pass.resolves.iter(){
                profiling if  (oot_index) 
                unsafeas_refjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
                    .
                        &                first_instance
                        resolve.dst.1,
                       java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 39
                        resolve.src.1,
                        .format
                    )
                };
}

            
 java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
 = unsafe &mut*barrierAnonymous.Transition }java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
                mem:        {
java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 13
!.barriersis_empty){
profiling:(ID3D12GraphicsCommandList::esourceBarrier");
                unsafe { list.ResourceBarrier(&self.temp.barriers) };
            }
        }

(;

unsafeend_pass}


    (
        &mut self,
        layout: &super:PipelineLayout,
        index u32,
        group: &super::BindGroup,
[wgt::ynamicOffset],
    ) {
        let infojava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
root_index bjava.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 59

/
if.tablescontains(super:TableTypes::RV_CBV_UAV){
            self.pass.root_elements[                    "Empty root element at index} shouldnot  beenmarked asdirty"
                super::                    let info = self.pass.layout.immediates_info.as_ref().unwrap();
            root_index += 1java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
:  ,

let java.lang.StringIndexOutOfBoundsException: Range [34, 35) out of bounds for length 34
        iflet(ynamic_storage_buffer_offsets =info.dynamic_storage_buffer_offsets() {
let root_index= dynamic_storage_buffer_offsets.root_index;
            let range = &dynamic_storage_buffer_offsets.range;

            if range.end >                            .SetGraphicsRoot32BitConstantindex first_vertex_or_xasu32,0)
                .pass
                    .dynamic_storage_buffer_offsets
                    .resize(range.end, 0);
            }

            offsets_index += range.start;

            self.pass.                        unsafe  java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 99
                :: 
                    start:PkTransfer>(,
                     .,
               java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18

            ifselfpass.ayoutsignature = layout.shared.signature {
                self.pass.dirty_root_elements |= 1 << root_index;
            }e {
                // D3D12 requires full reset on signature change
                // but we don't reset it here since it will be reset below
            }              :Render>unsafe {
        }

        // Bind root descriptors for dynamic uniform buffers
        // or set root constants for offsets of dynamic storage buffers
        for (&dynamic_buffer, }java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
             {
                super::DynamicBuffer::Uniform(gpu_base) => {
                    self.:   
                        super::}java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
    :D {
                                ptr: gpu_base.ptr + offset asjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
}java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
};
                    root_index +=  indexjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
                })
                    :=unsafejava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
                                                java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 76
                    offsets_index +=            java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
                java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
}
        }

        self.layout.signature == layout.shared.signature {
            self.pass.dirty_root_elements |= (1 << root_index) - (1 << java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 9
        } else {
                        // D3D12 requires full reset on signature change
            self.reset_signature(e 1 <.java.lang.StringIndexOutOfBoundsException: Range [75, 72) out of bounds for length 78
        };
                 :java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 43
    (
        &mut self,
        layout: &super:},
        offset_bytesjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
data:&u32]
    ) {
set_words  asusize /4java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53

        let info      - T super::uffer) {

              java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 78

        self..)

        if java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
           passjava.lang.StringIndexOutOfBoundsException: Range [44, 41) out of bounds for length 66
        } else {
/java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
.&;

    }

    unsafe fn  insert_debug_marker&mut self, :&java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 59
let(ide_label )=selftemp.(label;
        unsafe {
            self.list
                .as_ref()
                ()
                }
        ;
    }
    java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
        let (                [crateBufferBarrierjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
        unsafe {
            .
               .s_ref)
                .unwrap()
                .BeginEvent)
        }
    }
              cratejava.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 39
                                from wgt:::COPY_DSTjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
    }

    unsafe fnjava.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
        let list = self.ist.lone(.(;


java.lang.StringIndexOutOfBoundsException: Range [34, 12) out of bounds for length 60
            {.(pipeline.ayoutsignature.s_ref) ;
self.(&pipeline.)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
        };

        unsafe{ .SetPipelineState&.raw }
        unsafe { list.java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 17

        for (,(,&)  self
             Somelist)=list java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
            {
            .iter_mut()
            ..iter)
            .enumerate()
        {
            if let Some(stride) =                     None,
                if vb.StrideInBytes}
                                i(Createcommandlist)?
                    .passdirty_vertex_buffers=1< index;
                java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
            }
        }
    }

    unsafe fn        passclear)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
        &mut self,
        binding crate:<',super:,
format :IndexFormat
    ) {
        let ibv             
      BufferLocation .()
           :binding.resolve_size(.()unwrap)java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
             :::(ormat,
        };

unsafe{self.istas_ref.nwrap)IASetIndexBufferSome&) java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
       java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    unsafe fn set_vertex_buffer<'a>(
&ut elfjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
        index: u32,
        :BufferBinding',super:Buffer,
    ) {
        let vb = &mut java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 9
vbBufferLocation =.(;
        vb.SizeInBytes    
        selfpassd | 1 <index;
    }

    unsafe fn              s0=conv:(barrier..)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
       raw_vp=Direct3D12: {
            :rectxjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
            TopLeftY: rect.y,
            Width: rect.w,
            Height: rect.h,
            MinDepth: depth_range.                    Anonymous: Direct3D1:: {
            MaxDepth: depth_range.end,
        };
unsafe{
            selfborrow_interface_temporarily&..esource
                .as_ref()
                .unwrap)
.(:slice:(raw_vp)
        }
    }
    unsafe fn set_scissor_rect( },
        let raw_rect = Foundation:)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
            selftempbarrierspush()java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
            . asi32java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
            right r.x +rect.w  ,
            bottom: (rect.y + rect.h) as i32,
        };
        unsafe {
            self.list
                Flags :,
                unwrap)
.RSSetScissorRects(ore:slice:from_ref&)
        }
    }
    , value: u32 {
                    }
    }
    unsafe                 }
        unsafe {.istas_ref(.unwrap(.((olor) java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
    }

    unsafe fn draw(
        &mut.as_ref)
        first_vertex: u32,
        vertex_count:                     .Reso(&..arriers)
        first_instance: u32,
        instance_count u32,
    where
         .repare_drawfirst_vertex  i32 first_instance)}
        unsafe {
            self.java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
               ,
                java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
                 letmut  : {
                first_instance,
            )
        }
    }
    unsafe Transition :ManuallyDrop:(
        &mut self,
        first_index: u32,
        index_count: u32,
        base_vertex i32java.lang.StringIndexOutOfBoundsException: Range [25, 26) out of bounds for length 25
        first_instance: u32,
        instance_count: u32,
 java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
        unsafe { self.prepare_draw                            ,
        unsafe {
            self.java.lang.StringIndexOutOfBoundsException: Range [0, 21) out of bounds for length 18
                index_count,
                instance_count,
                first_index,
                               java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 28
                first_instance,
            )
        }
    }
    unsafe fn draw_mesh_tasks(
        & java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
        group_count_x: u32,
        group_count_y: u32,
        group_count_z: u32,
    ) {
       java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 77
        let cmd_list6: Direct3D12::                        }
            a)(.);
        unsafe {
            cmd_list6:java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 65
        wgtTjava.lang.StringIndexOutOfBoundsException: Range [48, 46) out of bounds for length 63
    }
    unsafe }
        &mut self,
        :&uper:,
        offset: wgt::BufferAddress,
        draw_count: u32,
    ){
        if self
            .pass
            .layout
            .special_constants
            .(java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
            .(sc .ndirect_cmd_signaturesas_ref)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
            .is_some()
        {
            unsafe { self.prepare_vertex_buffers() };
            .update_root_elements()
        } else {
            unsafe { self.prepare_draw(00) };
        }

        cmd_signature = &elf
                 raw=Direct3D12:D3D12_RESOURCE_BARRIER
            .ayout
            .special_constants
            .as_ref()
            .and_then(|sc| sc.UAV: mem::ManuallyDropD:: {
            .unwrap_or_else(|| &self.shared.cmd_signatures)
            .draw;
        unsafe {
            self.list.as_ref().unwrap().java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 18
                cmd_signature,
                        if !self.tempjava.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 43
                &uffer.esource
                offset,
               
                0,
            )
        }
    }
    unsafe fn draw_indexed_indirect(
        &mut self,
        buffer: &super             size = super:.minrangeend-)
        offsetlistCopyBufferRegion&ufferresource ,&.haredzero_buffer 0 java.lang.StringIndexOutOfBoundsException: Index 98 out of bounds for length 98
        draw_count: u32,
    unsafe  <T(
         self
            .pass
            .layout
            .special_constants
            .as_ref{
            .and_then(|sc| sc.indirect_cmd_signatures.as_ref())
            .is_some()
        {
            unsafe { self.prepare_vertex_buffers()             unsafe{
            selfupdate_root_elements)
        } else {
            unsafe { self.                    srcresource
        }

        let cmd_signature = &self
            .pass
            .layout
            .special_constants
(
            .and_then(|sc| sc.java.lang.StringIndexOutOfBoundsException: Range [0, 53) out of bounds for length 11
            java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 59
            .draw_indexed;
        unsafe {
            self.list.as_ref().unwrapType Djava.lang.StringIndexOutOfBoundsException: Range [76, 75) out of bounds for length 76
                cmd_signature,
                draw_count,
                &buffer.            ;
                offset,
               ,
                0,
            )
        }
    }
    unsafe fn draw_mesh_tasks_indirect(
        &mut self,
             src_box=make_box&..origin .;
        offset: wgt::BufferAddress,
        draw_count: d,
    {
        selfprepare_dispatch(0 3]java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
        ::ID3D12GraphicsCommandList6=
            ..as_ref(.nwrap)cast)unwrap(;
        let Some(java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 17
}
        };
        unsafe {
            cmd_list6.ExecuteIndirect super:,
        }
    }
    unsafe fn draw_indirect_count(
        &mut self,
        buffer: &super::Buffer,
        offset: wgt::BufferAddress,
        count_buffer: &        T: Iterator<Item =:BufferTextureCopy>
        count_offset::wgt:BufferAddress,
        max_count         regions {
    ) {
        unsafe { self.prepare_draw(0             java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 99
        unsafe                java.lang.StringIndexOutOfBoundsException: Range [36, 34) out of bounds for length 40
            self.list.as_ref().=java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 76
                &self.shared.cmd_signatures.draw,
                max_count,
                &buffer.resource,
                offset,
                &                          =: java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
                count_offset,
            )
        }
    }
    unsafe fn java.lang.StringIndexOutOfBoundsException: Range [28, 25) out of bounds for length 54
        &mut self,
        buffer &super:Buffer
        offset:                 let =.java.lang.StringIndexOutOfBoundsException: Range [67, 66) out of bounds for length 83
        java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 14
        wgt:,
        java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
    ) {
        unsafe { elfprepare_draw( 0) };
        unsafe {
().unwrap.(
                &self.shared.                    PlacedFootprint:to_subresource_footprintdst.)
                max_count,
                &buffer.                pResource: unsafe(d.resource) }
                offset,
                &count_buffer.resource,
                                : Direct3D12:D3D12_TEXTURE_COPY_LOCATION_0
            )
        }
    }
    unsafe fn (
        &mut
::Api>:Buffer,
        offset: wgt::BufferAddress,
         &:A  :Api>:
        count_offset: wgt::BufferAddress,
         ,
    ){
        self.prepare_dispatch([03                    
        let cmd_list6: java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 9
            selflistas_ref(.unwrap)cast)unwrap);
& self,
            panic!("Feature `MESH_SHADING` not enabled");
}java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
        java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
            .java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38

java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
                &buffer.resource r B java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
                offset,
                .java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
                count_offset,
            );
        }
    }



    fn'(
        &mut self,
        desc: &crate::ComputePassDescriptor<'a, super::QuerySet>,
    ) {
        unsafe { self .java.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 76

        if let Some(timestamp_writes)java.lang.StringIndexOutOfBoundsException: Range [0, 38) out of bounds for length 20
            if let Some(index) = timestamp_writes.beginning_of_pass_write_index {
                unsafe {
);
                }
            }
           .java.lang.StringIndexOutOfBoundsException: Range [42, 40) out of bounds for length 59
                .nd_of_pass_write_index
               map(|(.query_setraw.lone,index))java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    }
    unsafe fn              rjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
        self.copy_aligned(this buf java.lang.StringIndexOutOfBoundsException: Range [78, 76) out of bounds for length 78
        unsafe { self.end_pass() };
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    unsafe fn java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 18
        let list = self.list.clone().unwrap();

ifself.passl.signature =pipeline.layout.signature {
            // D3D12 requires full reset on signature change
                    
            self.reset_signature(&     fnbegin_query(mutself,set super:,:)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
}java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10

        (&pipelineraw)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
    }

    unsafe fn java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 16
        self.prepare_dispatch(.)
        unsafe { self.list.as_ref().unwrap().Dispatch(x, y, z) }
    }

    unsafe dispatch_workgroups_indirect(
        &mut self,
        buffer: &super::Buffer,
        offset: wgt::            self.list.as_ref((.EndQuery(
    ) {                :D3D12_QUERY_TYPE_TIMESTAMP
        if self
            .pass
                  .ayout
            .special_constants
            .as_ref()
            .and_then(|sc| sc.indirect_cmd_signatures:&:java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
            .is_some()
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
            self.update_root_elements();
        } else {
            self.prepare_dispatch([0erationStructurePostbuildInfo(
        }

        let                     DestBuffer: buf.resource.GetGPUVirtualAddress(),
            .pass
            .layout
            .special_constants
            .as_ref()
            .and_then(|sc| sc.indirect_cmd_signatures.as_ref())
            .unwrap_or_else(||&self.shared.md_signatures)
            .dispatch;
        unsafe {
            self.list)
                cmd_signature
                1,
               &buffer.resource,
                offset,
                None,
                0,
               (
        }
    }

    unsafe fn::java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
        &mut self,
        _descriptor_count:u32,
        descriptors: T,
    )                set.awjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
        super: range. -.,
        T: IntoIterator<
            Item = crate                ,
                'a,
                super:    
                super:A,
            >,
        >,
    {
        // Implement using `BuildRaytracingAccelerationStructure`:
s://microsoft.github.io/DirectX-Specs/d3d/Raytracing.html#buildraytracingaccelerationstructure
        let list = self
            .list
            .as_ref()
            .unwrap()
Ijava.lang.StringIndexOutOfBoundsException: Range [61, 58) out of bounds for length 61
            .unwrap();
        for descriptor in descriptors {
 from requiringbuffers, should this bededuped?
            let mut geometry_desc;
            selfjava.lang.StringIndexOutOfBoundsException: Range [43, 40) out of bounds for length 59
            let inputs0;
            let num_desc;
            match             [Direct3D12::D3D12_CPU_DES:D3D12_CPU_DESCRIPTOR_HANDLE  ptr:0 }; crate::MAX_COLOR_ATTACHMENTS];
                AccelerationStructureEntries::Instances(instances) => {
                    let desc_address = unsafe {
                        instances
                            .buffer
                            .expect("needs buffer to build")
                            .resource
                            .GetGPUVirtualAddress()
                    } + instances.offset as   .java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
                    D java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
                    inputs0 .java.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 70
                        InstanceDescs: desc_address,
                    }
                    lethandle .);
                }
                AccelerationStructureEntries::Triangles&...java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
                    geometry_desc = Vecjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 25
                    for triangle in triangles {
                        let transform_address =
                            triangle.transform.as_ref().map_or(0, |                    rtv=cat.targetview..unwrap).raw;
                                transform.*  java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
                                    + transform.offset java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                            ifdstargetusage = ::TextureUses::{
                        let =
                            .indices
                            .as_ref(
                            .map_or(Dxgi::Common::DXGI_FORMAT_UNKNOWN, |indices| {
                                auxil::dxgi::conv::java.lang.StringIndexOutOfBoundsException: Range [0, 67) out of bounds for length 0
                            )
                        let vertex_format =
auxil::conv:map_vertex_formattrianglevertex_format)java.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 89
                         index_count =
                            triangle.indices.as_ref().map_or(0, |indices| indices.count);
                        let                false,
                            
                                .buffer
                                .expect("needs buffer to build")
                                .resource
.GetGPUVirtualAddress
                                indicesoffsetas
                        ;
                        let vertex_address = unsafe {
                            triangle
                                .vertex_buffer
                                .expect("needs buffer to build")
                                .resource
                                .GetGPUVirtualAddress()
                                + (triangle.first_vertex as u64 * triangle.                    ]
                        };

let=:D3 {
                            Transform3x4: java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 30
                            IndexFormat: index_format,
                            VertexFormat: vertex_format,
                           java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 52
                            
                            : index_address,
             mut=:;
                                StartAddress: vertex_address,
                                                &containsFjava.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 64
                            
                        };

                        geometry_desc.push(Direct3D12::java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 13
                            Typeds
                            Flags: conv::java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 25
                            Anonymous: Direct3D12::java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 17
                                Triangles: triangle_desc,
                            },
                        })
                    }
                    ty .(multiview_maskget()java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                        pGeometryDescs: geometry_desc.as_ptr(),
                    };
                    num_desc = geometry_desc.len() 
                }
                AccelerationStructureEntries::AABBs(aabbs) => {
                    geometry_desc = Vec:: }java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
java.lang.StringIndexOutOfBoundsException: Range [37, 20) out of bounds for length 39
                        let aabb_address =             0java.lang.StringIndexOutOfBoundsException: Range [20, 21) out of bounds for length 20
                                        :desc.extent.height as i32,
                                .expect("        }java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
                                .java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0
                                .GetGPUVirtualAddress(
                                 (.  u64*)
};

                        let            self.temp.barriers.()java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
                            AABBCount: aabb.count as u64,
                            AABBs: Direct3D12::D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE {
                                StartAddress: aabb_address,
b.stride,
                            },
                        };

                        geometry_desc.push(Direct3D12::D3D12_RAYTRACING_GEOMETRY_DESC {
                            Type: Direct3D12Flags:java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 69
                            Flags: conv::map_acceleration_structure_geometry_flags(aabb.flags),
                            Anonymous: Direct3D12::D3D12_RAYTRACING_GEOMETRY_DESC_0
                                AABBs:                                 pResource: unsaf borrow_interface_temporarilyr.src0 ,
                            },
                        })
                    }
                    ty = Direct3D12::D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL;
TS_0 {
                       pGeometryDescs: geometry_desc.as_ptr()java.lang.StringIndexOutOfBoundsException: Range [63, 64) out of bounds for length 63
                    };
                    num_desc = geometry_desc.len() as u32;
                }
ljava.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 66
             acceleration_structure_inputs =
                Direct3D12::D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS {
                    / assumes`java.lang.StringIndexOutOfBoundsException: Range [83, 81) out of bounds for length 83
                    Flags: conv::map_acceleration_structure_build_flags(
                        descriptor.flags,
                        Some(descriptor.mode),
                    )java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
                     java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 39
                    DescsLayout: Direct3D12::D3D12_ELEMENTS_LAYOUT_ARRAY,
                    Anonymous: inputs0,
                ;

                                }
                descriptor
                    .destination_acceleration_structure
                    if!...is_empty){
                    .GetGPUVirtualAddress(                ::scope("ID3D12GraphicsCommandList::esourceBarrier");
            };
            let src_acceleration_structure_address = descriptor
                .source_acceleration_structure
                .as_ref()
                .ap_or(, |source java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
                    source.resource.                    list.ResolveSubresource
                });
            let scratch_address = unsafe {
                                        resolve.,
                    + descriptor.scratch_buffer_offset
            };

            let desc = Direct3D12::D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC {
: dst_acceleration_structure_address,
                Inputs: acceleration_structure_inputs,
                SourceAccelerationStructureData: src_acceleration_structure_address,
               ScratchAccelerationStructureData,
            };
            unsafe { list.java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 13
        }
    }

    unsafejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        &mut self,
b ::java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 55
    ) {
        // TODO: This is not very optimal, we should be using [enhanced barriers](https://microsoft.github.io/DirectX-Specs/d3d/D3D12EnhancedBarriers.html) if possible
                dynamic_offsets [::]java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
            .
            .as_ref()let  .  usize
            .unwrap()
            >
            .unwrap();
        unsafe {
             {
                Type: Direct3D12::D3D12_RESOURCE_BARRIER_TYPE_UAV,
                Flags: Direct3D12::java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 9
                Anonymous: Direct3D12:         let dynamic_storage_buffer_offsets=..as_ref 
                    UAV: mem::ManuallyDrop::new(Direct3D12::D3D12_RESOURCE_UAV_BARRIER {
                        
                    )java.lang.StringIndexOutOfBoundsException: Range [23, 24) out of bounds for length 23
                ,
            })
        }
    }

    unsafe fn copy_acceleration_structure_to_acceleration_structure(
&self
        src: &super::AccelerationStructure,
        dst                ;
        copy wgt::ccelerationStructureCopy,
    ) {
        let=
            .list
            .                
            .unwrap()
            .cast::<Direct3D12:        
            java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
         {

                                        :::java.lang.StringIndexOutOfBoundsException: Range [66, 64) out of bounds for length 66
               resource.GetGPUVirtualAddress(,
                                            java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
            )
        }
    }

    e_dependencies(
        _command_buffers: &[&super::CommandBuffer],
        _dependencies: &[&super::AccelerationStructure],
    ) {
   }
}

Messung V0.5 in Prozent
C=98 H=71 G=85

¤ Dauer der Verarbeitung: 0.36 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.