-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Expose local RenderingDevice creation to RenderingServer #42130
Conversation
Thanks! |
Hi fellow devs. Maybe I am missing something but I think this is broken right now (don't know if I should answer here or open an issue). I added this after your
Output:
If I debug, all the 64 elements of the PackedByteArray are filled with zeros. |
I can see 2 potential issues:
|
For the GPU and CPU async, I have the code on my PC and the I will try to wait before fetching results and to use integers. |
Some news : It works ! First, I was having trouble with the godotscript byte decoding API (reading the C++ directly was simpler). Thank you for your time @clayjohn. |
@ChristopheClaustre Great to hear! Indeed, it is still difficult to deal with bytes directly in GDScript, I think there have been some improvements recently, but we will need to do more work to make it easy. Regarding the frame timing. The GPU and CPU run out of sync with one another. This means that the CPU code will continue running without waiting for the GPU code to finish. This is one of the benefits of using compute shaders, but it means you need to be careful about when you retrieve your data from the GPU. In the future, we will be adding documentation to make this clear, and we may add more to the API to do things like force the CPU to stall until data is returned. |
Hello! |
@tito91 it sounds like you need to convert groups of 4 bytes into a float! One way to do that is use the function |
@clayjohn Oh wow, that's a bummer. It works like a charm now. Thanks! |
Marked as draft because I don't think that this is the way that @reduz wants to expose RenderingDevice. Also I am not sure why this works, I feel like it shouldnt.
Anyway, I am opening this PR in case others want to play around with compute shaders from GDscript.
Here is a minimal example of a compute shader.
in a GDScript
_ready()
functionIn a file named "compute.glsl"