Skip to content

Commit

Permalink
Fix scene update failing if text in Text component is empty (#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
noituri authored Oct 25, 2024
1 parent c18531b commit fbc5971
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions compositor_render/src/transformations/text_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,24 @@ impl TextRendererNode {
return;
}

if self.resolution.width == 0 || self.resolution.height == 0 {
// We can't use zero-sized textures
let target_state = target.ensure_size(
renderer_ctx.wgpu_ctx,
Resolution {
width: 1,
height: 1,
},
);

target_state
.rgba_texture()
.upload(renderer_ctx.wgpu_ctx, &[0; 4]);

self.was_rendered = true;
return;
}

let text_renderer = renderer_ctx.text_renderer_ctx;
let font_system = &mut text_renderer.font_system.lock().unwrap();
let swash_cache = &mut text_renderer.swash_cache.lock().unwrap();
Expand Down

0 comments on commit fbc5971

Please sign in to comment.