Documentation
¶
Overview ¶
Package indirect provides overflow-safe arithmetic for indirect draw spans.
Index ¶
Constants ¶
const DispatchArgsSize = 12
DispatchArgsSize is the size of DispatchIndirect arguments: x, y, z as u32.
Variables ¶
This section is empty.
Functions ¶
func DelegatedValidationOffset ¶
DelegatedValidationOffset returns the last record offset for a span, or the buffer size when offset arithmetic overflows. Backends with single-record validation can use it to delegate one deterministic failing operation.
Types ¶
type BindGroupCache ¶
type BindGroupCache struct {
// contains filtered or unexported fields
}
BindGroupCache holds the validation bind groups of one arguments buffer, one per binding offset, created on first use. The bind groups live as long as the buffer: commands recorded with them may run until the buffer's last use completes, so they are destroyed with the buffer (Rust wgpu-core Buffer::indirect_validation_bind_groups, disposed when the buffer drops).
func (*BindGroupCache) Destroy ¶
func (c *BindGroupCache) Destroy(device hal.Device)
Destroy destroys every bind group in the cache with device and empties it.
type DispatchSource ¶
type DispatchSource struct {
BindingOffset uint64 // byte offset of the binding, a multiple of the alignment
BindingSize uint64 // byte size of the binding, a multiple of 4
Index uint32 // u32 index of x inside the binding
}
DispatchSource says where the indirect dispatch validation shader reads the arguments of one DispatchIndirect: a storage binding of the arguments buffer at an offset aligned to minStorageBufferOffsetAlignment, and the u32 index of x inside that binding.
Rust wgpu-core (indirect_validation/dispatch.rs Dispatch::params) splits the offset the same way: the aligned part becomes the dynamic offset of the source binding and the remainder an immediate. Without immediates and dynamic offsets in every HAL, core binds the aligned offset statically and selects the remainder from a constant table, so Index is always below alignment/4.
func DispatchSourceFor ¶
func DispatchSourceFor(offset, bufferSize uint64, alignment uint32) DispatchSource
DispatchSourceFor returns the source binding for arguments at offset in a buffer of bufferSize bytes. The caller has checked that offset is a multiple of 4 and that offset+DispatchArgsSize <= bufferSize; alignment is minStorageBufferOffsetAlignment (a power of two, at least 4).