Skip to content

Commit b237d42

Browse files
authored
fix: use weak ref slab (#135)
* chore: bumped rust-gpu * consolidate drawing into new draw module, use weak refs for renderlets internally * fixes after weak ref work * revert back to spirv-builder v0.9.1 and regen shaders * track rust-gpu main
1 parent 222060d commit b237d42

40 files changed

+934
-785
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ resolver = "2"
1717
assert_approx_eq = "1.1.0"
1818
async-channel = "1.8"
1919
bytemuck = { version = "1.13.0", features = ["derive"] }
20-
crabslab = { version = "0.5.1", default-features = false }
20+
crabslab = { version = "0.6.0", default-features = false }
2121
ctor = "0.2.2"
2222
dagga = "0.2.1"
2323
env_logger = "0.10.0"

crates/example-culling/src/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,7 @@ impl TestAppHandler for CullingExample {
202202
) -> Self {
203203
let mut seed = 46;
204204
let mut resources = BagOfResources::default();
205-
let stage = ctx
206-
.new_stage()
207-
.with_lighting(true)
208-
.with_compute_culling(false);
205+
let stage = ctx.new_stage().with_lighting(true);
209206
let sunlight_a = stage.new_value(DirectionalLight {
210207
direction: Vec3::new(-0.8, -1.0, 0.5).normalize(),
211208
color: Vec4::ONE,

crates/renderling-ui/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use renderling::{
3434
atlas::AtlasTexture,
3535
camera::Camera,
3636
math::{Quat, UVec2, Vec2, Vec3Swizzles, Vec4},
37-
slab::{Hybrid, UpdatesSlab},
37+
slab::Hybrid,
3838
stage::{NestedTransform, Renderlet, Stage},
3939
transform::Transform,
4040
Context,
@@ -146,6 +146,9 @@ pub struct Ui {
146146
// We keep a list of transforms that we use to "manually" order renderlets.
147147
//
148148
// This is required because interface elements have transparency.
149+
//
150+
// The `usize` key here is the update source notifier index, which is needed
151+
// to re-order after any transform performs an update.
149152
transforms: Arc<RwLock<FxHashMap<usize, UiTransform>>>,
150153
default_stroke_options: Arc<RwLock<StrokeOptions>>,
151154
default_fill_options: Arc<RwLock<FillOptions>>,
@@ -240,7 +243,7 @@ impl Ui {
240243
self.transforms
241244
.write()
242245
.unwrap()
243-
.insert(transform.transform.id(), transform.clone());
246+
.insert(transform.transform.get_notifier_index(), transform.clone());
244247
transform
245248
}
246249

crates/renderling/Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ readme = "../../README.md"
1515
crate-type = ["rlib", "cdylib"]
1616

1717
[features]
18-
default = ["gltf", "sdf", "shaders", "tutorial", "winit"]
18+
default = ["gltf", "shaders", "tutorial", "winit"]
1919
shaders = [
2020
"array_test",
2121
"bloom",
@@ -37,7 +37,6 @@ shaders = [
3737
"tonemapping_vertex"
3838
]
3939
gltf = ["dep:gltf", "dep:serde_json"]
40-
sdf = []
4140
tutorial = [
4241
"tutorial_passthru_fragment",
4342
"tutorial_implicit_isosceles_vertex",
@@ -88,9 +87,12 @@ tutorial_slabbed_renderlet = []
8887

8988
wasm = ["wgpu/fragile-send-sync-non-atomic-wasm"]
9089

90+
[patch.crates-io]
91+
spirv-std = { git = "https://github.com/Rust-GPU/rust-gpu" }
92+
9193
# dependencies for CPU and GPU code
9294
[dependencies]
93-
spirv-std = "0.9"
95+
spirv-std = { version = "0.9" }
9496

9597
# dependencies for GPU code
9698
[target.'cfg(target_arch = "spirv")'.dependencies]

0 commit comments

Comments
 (0)