#multiple nodes failing to launch the same compute shader

1 messages · Page 1 of 1 (latest)

sly sedge
#

Hello, is there something to pay attention to when launching multiple nodes that have the same script launching the same compute shader?
i have this situation, and only one of the nodes is launching the shader as expected.

edit: what comes after was an unrelated mistake, please ignore
i don't really understand: only the color of the light seem to be taken into account somehow? 🤔 also the actual position of the node seem to be ignored for some reason.

Joined are images of the result, the part of the code where i feed the parameters to the shader in the process() and the print showing that the input parameters should differ.
Also i get an error telling me a a device is already submitted, which i do not understand as i got that error also on my light_module() node which launches its own shader once per process() and there is only one of it so why is it unhappy?.

sacred geyser
#

I'm assuming that rd is of type RenderingDevice

#

Are you using the same RenderingDevice for both nodes?

#

@sly sedge

sly sedge
#

var rd := RenderingServer.create_local_rendering_device() #create a local rendering device.

#

i'm doing that in the declaration of the class at the top

#

so it may be the issue 👀

#

No, they are different rendering devices

sacred geyser
#

At least I don't see the issue in the code you have posted so far

#

oh actually

#

What are these used for?

sly sedge
#

they're used to determinate the center of the set of tiles calculated, they're intended ot be the player coordinates

#

the shader is an image centered on the player; so it's to center

#

but even determining why the direction is the same for both lights, it's not normal

#

and why out of it all, the color of the light works

sacred geyser
#

How is light_angle defined?

#

also would love to get the full script that you took that screenshot out of

sly sedge
#

maybe a hint, if i don't do what i do in the ready() at line 61, the color is the same as the first light

sacred geyser
#

Could you just upload the script as a file? 😅

sly sedge
#

sure

sacred geyser
#

Sending screenshots of code is not the best practice ^^

sly sedge
#

just a ctrl c ctrl v and sending it as a txt?

sacred geyser
#

That will work!

sly sedge
sacred geyser
#

Do you get any warnings/errors about duplicate UIDs anywhere?

sly sedge
#

only the error i sent in the first batch of screenshot

#

i assume it'd be marked in red, i don't see anything UID related int here

#

i'm thinking it may be cause by the compute list

#

no nvm

sly sedge
#

ok i'm closing in on the problem i think. I'm rather sure it's because of that error i sent, but i have not found any trace of it online

#

it seems like the shader just doesn't run for the 2nd light. I had 2 lights because i was grabbing a wrong offset in the shader that mixes everything together

#

but now i fixed it and surprise surprise, when i look at the input lightmaps, one is empty

#

So the problem is clearly how to launch both

#

multiple nodes failing to launch the same compute shader

sly sedge
#

relevant data

#

the renderingdevice is different, the compute list value isn't but it doesn't seem to be the problem right? idk how you'd even make that vary

sacred geyser
#

and the thing is not fast enough for that or something

#

I would imagine that it's not related to the other issue, but you might as well fix that issue as well and hope it somehow magically fixes the other thing :b

sacred geyser
#

ACTUALLY that could be possible

#

I think..?

#

Exported array -> duplicate node -> same array on both nodes..?

#

would have to test that to know if that is possible

#

Doesn't seem to happen

#

(just tested this)

sacred geyser
sly sedge
#

and look

#

one of them is equal to 0, so it means neither the shader nor the output_bytes[0] could modify it, so i guess i have goofed the array declaration somewhere somehow

#

🤔

sly sedge
sacred geyser
#

ah hm

#

You are probably getting all 0's because the compute shader was not ready yet

sacred geyser
sly sedge
#

yeah i'm not forgetting that error, but shouldn't that output_bytes[0] = 64

#

still go through

sacred geyser
#

not sure what setting the first byte to 64 would do to a float ngl

sly sedge
#

it's putting that small decimal part in

sacred geyser
#

since you're setting that byte and then converting to a float

sly sedge
#

hmm

sacred geyser
#

Sometimes float formatting does not show all decimals

#

I mean in different programs and languages and such

#

not sure what the case is in Godot

sly sedge
#

it shows for the other that's set to 2, so i assume it's not small enough to be ignored

sacred geyser
#

I'd just print the output bytes as they are

sly sedge
#

yush

#

i'll do that instead

sacred geyser
#

Well, I say "day", but an issue can persist over weeks or months (or longer but we don't have to talk about that)

sly sedge
#

true

#

and u were right, it's actually set to 64

#

you just saved me a beautiful day (evening)

#

yeah alright well it's probably that other error

#

but i don't understand, the shader takes less than 2ms, it's definitely not slow enough for the frame to not be ready

#

and if i sync() the error message stays btw

#

ok well nvm it goes away when i sync

#

but it does not seem to solve the issue

#

and on top of all the other hints, you can tell the other shader doesn't launch because one node takes 2ms~ the other that's failing takes 0.8ms~

#

well it's not that it doesn't run, it runs but sets everything to 0

sacred geyser
#

Calling for sync and waiting is pausing the code execution until the shader is ready, though

sacred geyser
sly sedge
#

i'm checking, i'll report back

#

ok so i think something goes wrong with the parameters, it does seem to launch, actually, when i rig the output of the shader to just write the inputs they show correctly in the output

#

i think it's just my calcs that went wrong 🤔 i'll dig more into it, you can consider my issue solved unless i'm come back in desperation.
Ugh tho when i had one light i messed with it a bunch to check if it was solid and i had no issues so whhhhhyyyyyyyyyyy is it showing now

#

Ok i found the issue, i kinda feel bad that you spent so much effort now

#

i pass a shadow geometry in the form of an array of triangles to the shader, and if it's empty, the shader just does nothing, i forgot this edge case

#

so that + the wrong offset in the shader that mix lightmaps together it really looked like there was a problem with calling the shaders or something in the likes. My bad sorry