Skip to content

Commit 6b699a5

Browse files
committed
Matrix4x3: document limitations of #[spirv(matrix)]
1 parent 680317c commit 6b699a5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

crates/spirv-std/src/matrix.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ use glam::{Affine3A, Mat3, Mat3A, Mat4, Vec3, Vec3A};
66
/// A Matrix with 4 columns of [`Vec3`], very similar to glam's [`Affine3A`].
77
///
88
/// Primarily used in ray tracing extensions to represent object rotation, scale and translation.
9+
///
10+
/// # Limitations
11+
/// These Limitations apply to all structs marked with `#[spirv(matrix)]`, which `Matrix4x3` is the only one in
12+
/// `spirv-std`:
13+
/// * Cannot be used within buffers, push constants or anything that requires an "explicit layout". Use [`Affine3A`],
14+
/// [`Mat4`] or the combination of [`Mat3`] with [`Vec3`] instead and convert them to `Matrix4x3` in the shader.
15+
/// * There may be other situations where this type may surprisingly fail!
916
#[derive(Clone, Copy, Default, PartialEq)]
1017
#[repr(C)]
1118
#[spirv(matrix)]
@@ -18,7 +25,7 @@ pub struct Matrix4x3 {
1825
}
1926

2027
/// The `from_*` fn signatures should match [`Affine3A`], to make it easier to switch to [`Affine3A`] later.
21-
/// The `to_*` fn signatures are custom
28+
/// The `to_*` fn signatures are custom.
2229
impl Matrix4x3 {
2330
/// Convert from glam's [`Affine3A`]
2431
pub fn from_affine3a(affine: Affine3A) -> Self {

0 commit comments

Comments
 (0)