Skip to content

Commit 8412146

Browse files
committed
RenderTarget::write returns error from callback
1 parent 5d52c48 commit 8412146

File tree

23 files changed

+186
-104
lines changed

23 files changed

+186
-104
lines changed

examples/environment/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ pub async fn run() {
9595
.screen()
9696
.clear(ClearState::color_and_depth(0.5, 0.5, 0.5, 1.0, 1.0))
9797
.render(&camera, skybox.into_iter().chain(&model), &[&light])
98-
.write(|| gui.render());
98+
.write(|| gui.render())
99+
.unwrap();
99100

100101
FrameOutput::default()
101102
});

examples/image/src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,8 @@ pub async fn run() {
117117
Some(ColorTexture::Single(&target)),
118118
None,
119119
)
120-
.write(|| {
121-
gui.render();
122-
});
120+
.write(|| gui.render())
121+
.unwrap();
123122

124123
FrameOutput::default()
125124
});

examples/instanced_shapes/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ pub fn main() {
154154
screen.render(&camera, &non_instanced_meshes, &[&light0, &light1]);
155155
};
156156

157-
screen.write(|| gui.render());
157+
screen.write(|| gui.render()).unwrap();
158158

159159
FrameOutput::default()
160160
});

examples/lighting/src/main.rs

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -267,18 +267,21 @@ pub async fn run() {
267267
screen.clear(ClearState::default());
268268
match material_type {
269269
MaterialType::Normal => {
270-
screen.write(|| {
271-
model.render_with_material(
272-
&NormalMaterial::from_physical_material(&model.material),
273-
&camera,
274-
&lights,
275-
);
276-
plane.render_with_material(
277-
&NormalMaterial::from_physical_material(&plane.material),
278-
&camera,
279-
&lights,
280-
)
281-
});
270+
screen
271+
.write::<RendererError>(|| {
272+
model.render_with_material(
273+
&NormalMaterial::from_physical_material(&model.material),
274+
&camera,
275+
&lights,
276+
);
277+
plane.render_with_material(
278+
&NormalMaterial::from_physical_material(&plane.material),
279+
&camera,
280+
&lights,
281+
);
282+
Ok(())
283+
})
284+
.unwrap();
282285
}
283286
MaterialType::Depth => {
284287
screen.render_with_material(
@@ -289,18 +292,21 @@ pub async fn run() {
289292
);
290293
}
291294
MaterialType::Orm => {
292-
screen.write(|| {
293-
model.render_with_material(
294-
&ORMMaterial::from_physical_material(&model.material),
295-
&camera,
296-
&lights,
297-
);
298-
plane.render_with_material(
299-
&ORMMaterial::from_physical_material(&plane.material),
300-
&camera,
301-
&lights,
302-
)
303-
});
295+
screen
296+
.write::<RendererError>(|| {
297+
model.render_with_material(
298+
&ORMMaterial::from_physical_material(&model.material),
299+
&camera,
300+
&lights,
301+
);
302+
plane.render_with_material(
303+
&ORMMaterial::from_physical_material(&plane.material),
304+
&camera,
305+
&lights,
306+
);
307+
Ok(())
308+
})
309+
.unwrap();
304310
}
305311
MaterialType::Position => {
306312
screen.render_with_material(
@@ -319,18 +325,21 @@ pub async fn run() {
319325
);
320326
}
321327
MaterialType::Color => {
322-
screen.write(|| {
323-
model.render_with_material(
324-
&ColorMaterial::from_physical_material(&model.material),
325-
&camera,
326-
&lights,
327-
);
328-
plane.render_with_material(
329-
&ColorMaterial::from_physical_material(&plane.material),
330-
&camera,
331-
&lights,
332-
)
333-
});
328+
screen
329+
.write::<RendererError>(|| {
330+
model.render_with_material(
331+
&ColorMaterial::from_physical_material(&model.material),
332+
&camera,
333+
&lights,
334+
);
335+
plane.render_with_material(
336+
&ColorMaterial::from_physical_material(&plane.material),
337+
&camera,
338+
&lights,
339+
);
340+
Ok(())
341+
})
342+
.unwrap();
334343
}
335344
MaterialType::Forward => {
336345
screen.render(&camera, model.into_iter().chain(&plane), &lights);
@@ -343,7 +352,7 @@ pub async fn run() {
343352
);
344353
}
345354
}
346-
screen.write(|| gui.render());
355+
screen.write(|| gui.render()).unwrap();
347356

348357
FrameOutput::default()
349358
});

examples/lights/src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,8 @@ pub async fn run() {
130130
lights.iter().map(|l| l.object()).chain(&model),
131131
&lights.iter().map(|l| l.light()).collect::<Vec<_>>(),
132132
)
133-
.write(|| {
134-
gui.render();
135-
});
133+
.write(|| gui.render())
134+
.unwrap();
136135

137136
FrameOutput::default()
138137
});

examples/multisample/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub fn main() {
192192
};
193193

194194
// Render GUI to screen
195-
frame_input.screen().write(|| gui.render());
195+
frame_input.screen().write(|| gui.render()).unwrap();
196196

197197
FrameOutput::default()
198198
});

examples/pbr/src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ pub async fn run() {
145145
),
146146
};
147147
model.render_with_material(&material, &camera, &[&light]);
148-
gui.render();
149-
});
148+
gui.render()
149+
})
150+
.unwrap();
150151

151152
FrameOutput::default()
152153
});

examples/screen/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ pub fn main() {
9494
ClearState::color(0.5, 0.5, 0.5, 1.0),
9595
)
9696
.render_partially(scissor_box_zoomed, &camera, &model, &[])
97-
.write(|| gui.render());
97+
.write(|| gui.render())
98+
.unwrap();
9899

99100
// Secondary view
100101
let secondary_viewport = Viewport {

examples/statues/src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ pub async fn run() {
178178
bounding_box.render(camera, &[]);
179179
}
180180
}
181-
gui.render();
182-
});
181+
gui.render()
182+
})
183+
.unwrap();
183184

184185
FrameOutput::default()
185186
});

examples/terrain/src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,8 @@ pub async fn run() {
287287
Some(ColorTexture::Single(&color_texture)),
288288
Some(DepthTexture::Single(&depth_texture)),
289289
)
290-
.write(|| {
291-
gui.render();
292-
});
290+
.write(|| gui.render())
291+
.unwrap();
293292

294293
FrameOutput::default()
295294
});

0 commit comments

Comments
 (0)