-
-
Notifications
You must be signed in to change notification settings - Fork 50
Add examples for instance extras #728
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
base: main
Are you sure you want to change the base?
Conversation
while renderdoc has a python api, it's complex to build and package with modern python versions. So this might look like a workaround but I feel like that is actually quite convenient to use... making it work on linux sounds plausible. |
examples/extras_debug.py
Outdated
if __name__ == "__main__": | ||
# awful hack: if the script is run by a user, we write the tempfile to then run the launcher and auto catpure | ||
# while the capture itself has an envvar to launch the gui instead. | ||
is_renderdoc = os.environ.get("RENDERDOC_CAPTURE", "0") == "1" |
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.
an alternative idea I have had is to use an arg and check sys.argv[1]
not sure which one makes more sense - if at all
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.
Are you trying to detect if you are running by the pytest test suite?
I think you can use the trick I used:
https://github.com/pygfx/pygfx/blob/main/examples/feature_demo/video_yuv.py#L79
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.
This part is not for the test suite, but I guess this syntax makes a bit more sense.
"0"
evaluating to False
definitely shouldn't be used
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.
oh i guess you are doing something quite similar, where RENDERDOR_CAPTURE
is set by the tool, to help you identify that it is being run by the documentation tool, and not interactively.
^_^
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.
Renderdoc is actually a graphics debugger (not the best name). if you haven't seen or used it - you might enjoy to go really low and step a single pixel of a decompiled shader or inspect all intermediate stages of the render pipeline and resources along the way.
I came up with this dual use script to make it a bit portable and avoid the complicated scripting API. Also didn't want to write as much text.
Let me know what your experience is as I want to improve on the example anyway. For example inserting debug markers, using more labels...
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.
let me try to run it now.
Though a screencast of what you can do could help me understand what a "graphical debugger" can do.
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.
hmm cool. i clicked enough, and edited a few things, but eventually https://renderdoc.org/ "detected" the demo.
I'll have to try to recreate the things you do in a tiny screencast, but seems useful...
@@ -158,7 +175,7 @@ def create_pipeline_layout(device): | |||
) | |||
|
|||
# Create a sampler | |||
sampler = device.create_sampler() | |||
sampler = device.create_sampler(label="Cube Example sampler") | |||
|
|||
# We always have two bind groups, so we can play distributing our |
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.
is this comment still accurate? It seems to be from over 5 years ago when this example was first added
examples/cube.py
Outdated
device.create_bind_group( | ||
layout=bind_group_layout, | ||
entries=entries, | ||
label=f"Cube Example bind group {entries[0]['binding']}", |
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 would like to do something like f"Cube Example {entries[0]['resource'].__name__} bind group"
so it says like buffer, texture, sampler; but it would be a really clunkly inline expression as the buffer has a nested structure. And I don't feel like adding and then popping a label arg above as that might confuse users.
But it seems like they all show up as part of one group in RenderDoc anyway (or it's optimized somewhere):
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.
turns out there is only one item in the list, whole nested structure isn't needed. You can put a label on the bind group but not the individual entries, same for the layout.
This was mentioned in reply #718 (review)
PR adds two examples regarding instance extras:
todos: