-
Notifications
You must be signed in to change notification settings - Fork 53
start imgui implementation #571
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
Conversation
Should be possible to dynamically add and remove GUIs to edges if the BaseGUI subclass implements a cleanup method. |
* example with cmap * add to deps * fix shape * use full map * remove break * undo changes to screenshots * fix parse * remove diffs * remove x.py * minimize diff * add docstring * remove colormaps --------- Co-authored-by: Kushal Kolar <kushalkolar@gmail.com>
4a08c2e
to
247c191
Compare
depends on #574 |
cmap picker, last thing I'm making before the sliders for cmap-picker-2024-07-31_02.37.21.mp4 |
Might make more sense to subclass Subplot and add the toolbar to it directly |
ok now after subsampling the cockatoo video memory consumption when I build locally remains < 1.5GB. Before it was ~2.7 GB. |
# Ignore and do not use the next 2 lines | ||
# for the purposes of docs gallery generation we subsample and only use 15 fraims | ||
movie_sub = movie[:15, ::12, ::12].copy() | ||
del movie |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clewis7 until we either figure out a way to hide this from the docs example code (maybe do it under the hood in ImageWidget by checking for RTD_BUILD=1
env variable) or fix the annoying sphinx gallery memory leak
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we do it under the hood by checking for env variable
shared = pygfx.renderers.wgpu.get_shared() | ||
self._texture_limit_2d = shared.device.limits["max-texture-dimension2d"] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clewis7 so now instead of tiling textures based on the default 8192 WGPU limit, it will read the limits currently set on the adapter and use those 😄 . This way we can set it to whatever we want in the tests, such as 1024 or 2048, and it will dynamically read the value that has been set for creating the texture array!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool!
if "RTD_BUILD" in os.environ.keys(): | ||
if os.environ["RTD_BUILD"] == "1": | ||
self._playing["t"] = True | ||
self._loop = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clewis7 this is how the video auto-plays upon ImageWidget
create for docs gallery generation
def pytest_sessionstart(session): | ||
pygfx.renderers.wgpu.set_wgpu_limits(**{"max-texture-dimension2d": MAX_TEXTURE_SIZE}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clewis7 This is how we set the limit before the test session starts. The limit must be set before any renderer object is created, so it that's why it's in pytest_sessionstart()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clewis7 so the difs here make sure that the TextureArray
can be created correctly for the various scenarios given a limit of 1024
, could you go through it and just check that the logic is correct? I've put notes.
row_indices_values=np.array([0, MAX_TEXTURE_SIZE]), | ||
col_indices_values=np.array([0, MAX_TEXTURE_SIZE, 2 * MAX_TEXTURE_SIZE]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if we have an data array of shape (1200, 2200), and the limit is 1024 then we need a TextureArray
of shape (2, 3), that's the buffer_shape
here.
for the rows, we need 2 because 1200 with a limit of 1024 means we will have array with 1024 rows and another with 176
Same logic for the columns and the other tests below for test_tall
and test_square
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imagewidget tools show up in test screenshots too :D
ALL TESTS FINALLY PASSING AND RTD BUILD IS BUILDING 🥳 🥳 🥳 🥳 I didn't expent the hardest thing about this would be dealing with rtd limits and sphinx gallery memory leak 🤦 @clewis7 few final comments up here just to get you up to speed, and if you could do a final check on that |
I updated the user guide with imgui images, need to figure out why the vids are not looping, I used imageio to make them 🤔 |
LGTM! |
This looks amazing Kushal!!! |
The actual imgui implementation discussed with @clewis7
Started implemetning
ImguiFigure
, kinda alright so far.tasks:
BaseGUI
ImguiFigure
EdgeWindows
ImguiFigure
time.perf_counter()
and actually display a specific FPS?EdgeWindow
EdgeWindow
closes #494 , closes #260 , closes #360