Skip to content

Lazy State update regression #1501

@rolandhill

Description

@rolandhill

Hi Robert,

My application has a RenderGraph with multiple passes to render Opaque objects, Transparent, Text Labels etc. Each pass is done using it's own View with a different mask for each view. All the views traverse the same scenegraph with different nodes being traversed according to the mask. I have created a specific Switch that goes at the top of each branch of the graph (each branch is a type of user selectable data) that accepts a RecordTraversal and will decide whether to traverse the scene depending on the value of the traversalMask and user selectable state for visibility and alpha.

This all worked perfectly well until VSG commit c1528ac, lazy state. This changed:

Image

That change has been further refined to now be

Image

In my application, the user now turns Text Label visibility on, but nothing appears in the scene. I can trace program execution and see that the relevant nodes are being traversed, but nothing is rendered.

If I put breakpoints in most methods within StateStack for the label pass, I can see that push() is called (see image below) with pos = 0 and the value equals the same as in stack[0]. Both stack[0] and stack[1] are already filled with old values. During push(), pos is pre-incremented to 1 and the new value overwrites the existing stack[1]. The problem is, stack[1] now equals stack[0], so current->record() is not called during the StateStack->record() function. Therefore, nothing gets rendered.

Image

Looking at the StateStack class, it appears to be designed so that stack[0] is initialised to nullptr, and then updated with the "previous" value so that unnecessary calls to record the same state are not made. In this case, it looks like stack[0] is not being reset to nullptr before my LabelText view starts the record traversal.

If the user adds in a new branch within the scene graph, suddenly the text labels from the first branch will appear, even though the two branches are completely separate. Presumably this is because stack[0] is left with a different old value before the labeltext view is recorded.

I think this is what's happening. It's hard to explain - I hope it makes sense.

Regards,
Roland

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions