Skip to content

Conversation

@gkoulin
Copy link
Contributor

@gkoulin gkoulin commented Mar 6, 2025

No description provided.

@nmwsharp
Copy link
Owner

nmwsharp commented Apr 2, 2025

Thanks for submitting this! Can you say briefly what problem this solves (ie what is the current/expected behavior)?

We don't really have a consistent policy about what should happen to options on a shutdown. Should they go back to the defaults, or stay as-is? But I don't think corresponds to either, it's more about not breaking caching?

@gkoulin
Copy link
Contributor Author

gkoulin commented Apr 7, 2025

Problem

What currently happens is that variables inside namespace lazy will keep their state after shutdown. This means that next time you initialise, the renderer may not apply some of the options, if they happen to match those cached by lazy variables.

Example

For example, in my case I would create a point cloud with transparency which sets:

options::transparencyMode = TransparencyMode::Pretty;

But the current lazy state (from previous session) is already set to that, therefore the following branch is skipped. Resulting in opaque rendering.

  if (lazy::transparencyMode != options::transparencyMode) {
    lazy::transparencyMode = options::transparencyMode;
    render::engine->setTransparencyMode(options::transparencyMode);
  }

Solution

The submitted change resets lazy variables states, at shutdown, back to the default initialised. This will make sure that in the next session will correctly apply options to the renderer.

Now that I'm thinking about it, it might be better to reset lazy state to match that of default constructed options, since that is what the renderer is initialised with. Otherwise we have two default initialisation states which don't have to match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants