You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GPU Driver: "NVIDIA Unified Driver for all Supported NVIDIA GPUs"
#version450//fragment shaderlayout(push_constant) uniform PushConstants {
mat3 m;
} pc;
outlayout(location =0) outvec4 target;
void main() {
target = pc.m *vec3(0.0, 1.0, 1.0);
//results in a black screen when identity matrix is used, because the identity matrix is instead read as [[1, 0, 0], [1, 0, 0], [1, 0, 0]]
}
Issue
Rust packs the matrix too tightly, as an [[f32; 3]; 3], with no gaps between elements, whereas the gpu expects an [[f32; 4]; 3], where the last element of each [f32; 4] is dummy data.
This means that the gpu will read m[1] as [m[1][1], m[1][2], m[2][0]] and m[2] as [m[2][2], m[3][0], m[3][1]] (out of bounds array accesses, potential UB as well as being incorrect?), m[0] will be read normally.
The text was updated successfully, but these errors were encountered:
Issue
Rust packs the matrix too tightly, as an [[f32; 3]; 3], with no gaps between elements, whereas the gpu expects an [[f32; 4]; 3], where the last element of each [f32; 4] is dummy data.
This means that the gpu will read m[1] as [m[1][1], m[1][2], m[2][0]] and m[2] as [m[2][2], m[3][0], m[3][1]] (out of bounds array accesses, potential UB as well as being incorrect?), m[0] will be read normally.
The text was updated successfully, but these errors were encountered: