Skip to content

Layer rendering breaks if one is not drawn at any point #2700

@edwloef

Description

@edwloef

Is your issue REALLY a bug?

  • My issue is indeed a bug!
  • I am not crazy! I will not fill out this form just to ask a question or request a feature. Pinky promise.

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

If you have a layer that is not drawn either because it is fully outside of the application window, or because its snapped bounds have an area of zero, this breaks subsequent layer draws. This is because at

iced/wgpu/src/lib.rs

Lines 271 to 275 in f2c9b6b

let Some(physical_bounds) =
physical_bounds.intersection(&(layer.bounds * scale))
else {
continue;
};
and

iced/wgpu/src/lib.rs

Lines 277 to 279 in f2c9b6b

let Some(scissor_rect) = physical_bounds.snap() else {
continue;
};
rendering for those layers is skipped without updating the quad_layer, mesh_layer and text_layer indices.

Here is a video of this occuring in a real iced app:

2024-12-18.12-19-02.mp4

and the relevant lines in the source code of this app: https://github.com/generic-daw/generic-daw/blob/b5593615b46625cfde0f194d16582f15cc672d7a/src/generic_front/widget/track.rs#L56-L59

What is the expected behavior?

Layer rendering doesn't break when a layer is not visible.

Version

crates.io release

Operating System

Linux

Do you have any log output?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions