Document canvas resource and paint helpers

This commit is contained in:
yoriswind committed 2026-10-31 06:08:28 -07:00
1 parent 1162ea23aa
commit dc6ca120b4
3 files changed
+3

No files matched your search

@@ -162,6 +162,7 @@ impl CallbackTrait for CanvasCallback {
Vec::new()
}
/// Draw this view's visible tiles inside the clipped canvas.
fn paint(&self, info: egui::PaintCallbackInfo, pass: &mut wgpu::RenderPass<'static>, resources: &CallbackResources) {
let Some(res) = resources.get::<Resources>() else { return };
if !res.health.is_ok() {
@@ -231,6 +231,7 @@ fn pipeline(
}
impl Resources {
/// Create the shared canvas pipelines, layouts and display resources.
pub(super) fn new(device: &wgpu::Device, queue: &wgpu::Queue, target: wgpu::TextureFormat, high: bool) -> Self {
let module =
device.create_shader_module(wgpu::ShaderModuleDescriptor { label: Some("pc_canvas"), source: wgpu::ShaderSource::Wgsl(CANVAS_WGSL.into()) });
@@ -8,6 +8,7 @@ use serde_json::json;
type Harness = egui_kittest::Harness<'static, PhotocraftApp>;
/// Build the application harness for GPU and CPU canvas comparisons.
fn harness() -> Option<Harness> {
let built = std::panic::catch_unwind(|| {
egui_kittest::Harness::builder().with_size(egui::vec2(1000.0, 700.0)).with_pixels_per_point(1.0).with_max_steps(64).wgpu().build_eframe(|cc| {