Update docs for Align
This commit is contained in:
parent
139dc2aa3b
commit
65e1a7689d
1 changed files with 7 additions and 8 deletions
|
@ -3,14 +3,13 @@ use std::marker::PhantomData;
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
use vk;
|
use vk;
|
||||||
|
|
||||||
/// `Align` handles dynamic alignment. x86 aligns on 4 byte boundries but GPUs
|
/// `Align` handles dynamic alignment. The is useful for dynamic uniform buffers where
|
||||||
/// sometimes have different requirements. For example if the user wants to create
|
/// the alignment might be different. For example a 4x4 f32 matrix has a size of 64 bytes
|
||||||
/// a Uniform buffer of a Vec3<f32>, `get_buffer_memory_requirements` might return
|
/// but the min alignment for a dynamic uniform buffer might be 256 bytes. A slice of `&[Mat4x4<f32>]`
|
||||||
/// an alignment of 16 bytes. A Vec3<f32> has a size of 12 bytes. The memory layout
|
/// has a memory layout of `[[64 bytes], [64 bytes], [64 bytes]]`, but it might need to have a memory
|
||||||
/// for a `Vec<Vec3<f32>>` will be contigous, because 4 is a multiple of 12. But Vulkan
|
/// layout of `[[256 bytes], [256 bytes], [256 bytes]].
|
||||||
/// expects a 4 byte padding in between each Vec3<f32>, if the alignment is 16 bytes.
|
/// `Align::copy_from_slice` will copy a slice of `&[T]` directly into the host memory without
|
||||||
/// `Vec3<f32>, 4bytes, Vec3<f32>, 4bytes, Vec3<f32>...`. Align is able to take a slice
|
/// an additional allocation and with the correct alignment.
|
||||||
/// that is allocated on 4 bytes boundries, and insert the correct amount of paddings.
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Align<T> {
|
pub struct Align<T> {
|
||||||
ptr: *mut vk::c_void,
|
ptr: *mut vk::c_void,
|
||||||
|
|
Loading…
Add table
Reference in a new issue