Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

Solari: the binding array's dummy buffer is one traced vertex, 64 bytes

shinyobjectzc6c165ca4c31
diff --git a/vendor/bevy_solari/src/scene/binder/bind_group.rs b/vendor/bevy_solari/src/scene/binder/bind_group.rs
index eae7cff8..0843b892 100644
--- a/vendor/bevy_solari/src/scene/binder/bind_group.rs
+++ b/vendor/bevy_solari/src/scene/binder/bind_group.rs
@@ -35,7 +35,8 @@ impl BindGroupCacheState {
// Binding arrays are dense, so freed slots still need something valid bound into them
let dummy_buffer = render_device.create_buffer(&BufferDescriptor {
label: Some("solari_dummy_binding_array_buffer"),
- size: 48,
+ // raea: one traced vertex, the vertex buffers' least binding (it was 48, the vertex before its colour)
+ size: crate::scene::types::VERTEX_BYTES,
usage: BufferUsages::STORAGE,
mapped_at_creation: false,
});
diff --git a/vendor/bevy_solari/src/scene/blas.rs b/vendor/bevy_solari/src/scene/blas.rs
index ae3a2f02..67af9938 100644
--- a/vendor/bevy_solari/src/scene/blas.rs
+++ b/vendor/bevy_solari/src/scene/blas.rs
@@ -140,7 +140,7 @@ pub fn prepare_raytracing_blas(
vertex_buffer: vertex_slice.buffer,
first_vertex: vertex_slice.range.start,
// raea: position, normal, uv, tangent and the vertex colour (scene/bindings.wesl PackedVertex)
- vertex_stride: 64,
+ vertex_stride: super::types::VERTEX_BYTES,
index_buffer: Some(index_slice.buffer),
first_index: Some(index_slice.range.start),
transform_buffer: None,
diff --git a/vendor/bevy_solari/src/scene/types.rs b/vendor/bevy_solari/src/scene/types.rs
index 212dbdb8..38a8d954 100644
--- a/vendor/bevy_solari/src/scene/types.rs
+++ b/vendor/bevy_solari/src/scene/types.rs
@@ -50,3 +50,8 @@ pub struct SkyPortals(pub Vec<[bevy_math::Vec3; 3]>);
/// raea: how many sky portals the environment uniform holds (bindings.wesl's array)
pub const MAX_SKY_PORTALS: usize = 8;
+
+// raea: a traced vertex's size in bytes: position, normal, uv, tangent and the vertex colour (scene/bindings.wesl
+// PackedVertex). The BLAS's stride and the binding array's dummy buffer both read it: the dummy left at 48 when the
+// colour came in made the GPU refuse the frame after a part's mesh slab was freed (Stay, frame 1699)
+pub(crate) const VERTEX_BYTES: u64 = 64;