Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent premature draw calls and destroy encoding texture prior to recreation #208

Merged
merged 3 commits into from
Jan 9, 2025

Conversation

flekschas
Copy link
Owner

This PR fixes the WebGL texture bug that appears when one frequently changed the point encoding (point color, size, and opacity)

Description

What was changed in this pull request?

  • Fix: destroy the encoding texture before recreating it
  • Fix: reject set() calls if the instance was destroyed
  • Fix: ensures unnecessary color and encoding texture updates are avoided
  • Fix: color and encoding textures are destroyed upon calling scatterplot.destroy()
  • Fix: prevent a minor memory leak in the newly added advanced exporter

Why is it necessary?

Fixes #165

Example

Before

After ~30 draw calls the WebGL described in #165 appears:

before.mp4

After

With this fix, the error does not appear:

after.mp4

I let it run until 1000 draw calls and everything worked just fine.

Checklist

  • Provided a concise title as a semantic commit message (e.g. "fix: correctly handle undefined properties")
  • CHANGELOG.md updated
  • Tests added or updated
  • Documentation in README.md added or updated
  • Example(s) added or updated
  • Screenshot, gif, or video attached for visual changes

In addition, this commit:
- rejects `set()` if the instance was destroyed
- ensures unnecessary texture updates are avoided
- color and encoding textures are destroyed upon calling `scatterplot.destroy()`
- fixes a small memory leak in the newly added advanced exporter where I forgot to unsubscribe a draw listener.
@flekschas flekschas merged commit c8a933e into main Jan 9, 2025
2 checks passed
@flekschas flekschas deleted the flekschas/prevent-premature-draw-calls branch January 9, 2025 14:49
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.

Displaying colors instead of dots after hiding and showing points multiple times.
1 participant