Godot Version
v4.3.rc2.official [3978628c6]
Question
Hi! I’ve implemented a screen effect simulating “datamosh” using CompositorEffect.
When watching streamers play the game I realized (in horror) that the effect looks very different in some machines. Making the game almost unplayable.
I’ve no way to test it for myself, but I suspect of the following line in the .glsl
code:
float amount = params.amount / 100.0;
Where I’m dividing an int by a float, expecting a float.
In this GLSL documentation int/float
is not listed as a valid operation.
float amount = float(params.amount) / 100.0;
Link to full code.
My question is:
- Is really
int/float
an invalid operation as I’m suspecting?
- Could this behave differently on each PC? And why?
- Why Godot didn’t warn me of the invalid operation?
Thanks!
1 Like
I don’t have an answer but I don’t think it should be an issue as it wouldn’t run at all, If that was not allowed. and You also cast the value in the real code.
Just an FYI, GLSL is only a language it is not a compiler, the compiler makes the decision on how to address float integers mixing. Also Godot is using the Vulkan API for computer shaders, and you are referring to webgl reference.
My guess is the data types you are laying out may not be available on the GPUs of the other machines. That is my hunch. Why not try a 32 bit type.
1 Like
Thanks for the info, that clarify a couple of doubts I had
Will also try your proposed change.
Hello, thanks for asking this question - I’m also using glsl shaders and am worried about them running on different machines.
Did you find what the problem was / a solution?
Hi! was unable to check the suggested solution. Due to a lack of time and access to the hardware with issues.
I’ll be posting here when I do
1 Like