pub struct CommandRef<'a> { /* private fields */ }Expand description
Recording interface for general Vulkan commands.
This structure provides a strongly-typed set of methods which allow acceleration structures to be built and updated.
§Examples
Basic usage:
my_graph.begin_cmd()
.record_cmd(move |cmd| {
// Use provided command buffer functions or native calls
assert_ne!(cmd.handle, vk::CommandBuffer::null());
});Implementations§
Source§impl<'a> CommandRef<'a>
impl<'a> CommandRef<'a>
Sourcepub fn build_accel_struct(
&self,
infos: &[BuildAccelerationStructureInfo],
) -> &Self
pub fn build_accel_struct( &self, infos: &[BuildAccelerationStructureInfo], ) -> &Self
Build acceleration structures.
There is no ordering or synchronization implied between any of the individual acceleration structure builds.
Requires a scratch buffer which was created with the following requirements:
- Flags must include
vk::BufferUsageFlags::SHADER_DEVICE_ADDRESS - Size must be equal to or greater than the
build_sizevalue returned byAccelerationStructure::size_of, aligned tomin_accel_struct_scratch_offset_alignmentofPhysicalDevice::accel_struct_properties.
§Examples
Basic usage:
my_graph.begin_cmd()
.resource_access(index_buf, AccessType::IndexBuffer)
.resource_access(vertex_buf, AccessType::VertexBuffer)
.resource_access(scratch_buf, AccessType::AccelerationStructureBufferWrite)
.resource_access(blas_node, AccessType::AccelerationStructureBuildWrite)
.record_cmd(move |cmd| {
let scratch_addr = cmd.resource(scratch_buf).device_address();
let geom = AccelerationStructureGeometry {
max_primitive_count: 64,
flags: vk::GeometryFlagsKHR::OPAQUE,
geometry: AccelerationStructureGeometryData::Triangles {
index_addr: DeviceOrHostAddress::DeviceAddress(
cmd.resource(index_buf).device_address()
),
index_type: vk::IndexType::UINT32,
max_vertex: 42,
transform_addr: None,
vertex_addr: DeviceOrHostAddress::DeviceAddress(
cmd.resource(vertex_buf).device_address(),
),
vertex_format: vk::Format::R32G32B32_SFLOAT,
vertex_stride: 12,
},
};
let build_range = vk::AccelerationStructureBuildRangeInfoKHR {
first_vertex: 0,
primitive_count: 1,
primitive_offset: 0,
transform_offset: 0,
};
let info = AccelerationStructureGeometryInfo::blas([(geom, build_range)]);
cmd.build_accel_struct(&[
BuildAccelerationStructureInfo::new(blas_node, scratch_addr, info)
]);
});See also:
Sourcepub fn build_accel_struct_indirect(
&self,
infos: &[BuildAccelerationStructureIndirectInfo],
) -> &Self
pub fn build_accel_struct_indirect( &self, infos: &[BuildAccelerationStructureIndirectInfo], ) -> &Self
Builds acceleration structures with some parameters provided on the device.
There is no ordering or synchronization implied between any of the individual acceleration structure builds.
Each BuildAccelerationStructureIndirectInfo::range_base is a buffer device address which
points to an array of vk::AccelerationStructureBuildRangeInfoKHR structures defining
dynamic offsets to the addresses where geometry data is stored.
Sourcepub fn update_accel_struct(
&self,
infos: &[UpdateAccelerationStructureInfo],
) -> &Self
pub fn update_accel_struct( &self, infos: &[UpdateAccelerationStructureInfo], ) -> &Self
Update acceleration structures.
There is no ordering or synchronization implied between any of the individual acceleration structure updates.
Requires a scratch buffer which was created with the following requirements:
- Flags must include
vk::BufferUsageFlags::SHADER_DEVICE_ADDRESS - Size must be equal to or greater than the
update_sizevalue returned byAccelerationStructure::size_of, aligned tomin_accel_struct_scratch_offset_alignmentofPhysicalDevice::accel_struct_properties.
Sourcepub fn update_accel_struct_indirect(
&self,
infos: &[UpdateAccelerationStructureIndirectInfo],
) -> &Self
pub fn update_accel_struct_indirect( &self, infos: &[UpdateAccelerationStructureIndirectInfo], ) -> &Self
Updates acceleration structures with some parameters provided on the device.
There is no ordering or synchronization implied between any of the individual acceleration structure updates.
Each UpdateAccelerationStructureIndirectInfo::range_base is a buffer device address
which points to an array of vk::AccelerationStructureBuildRangeInfoKHR structures
defining dynamic offsets to the addresses where geometry data is stored.
Methods from Deref<Target = CommandBuffer>§
Sourcepub fn has_executed(&self) -> Result<bool, DriverError>
pub fn has_executed(&self) -> Result<bool, DriverError>
Returns true after the GPU has executed the previous submission to this command buffer.
See Self::wait_until_executed to block while checking.
Trait Implementations§
Source§impl<'a> Clone for CommandRef<'a>
impl<'a> Clone for CommandRef<'a>
Source§fn clone(&self) -> CommandRef<'a>
fn clone(&self) -> CommandRef<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more