-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
UV offsetting in mobile makes that texture hangs and blocky after few minutes #43505
Comments
This is very likely to be a precision issue, especially if it only occurs on mobile. Try enabling high-precision floats in the Project Settings as per #33646. |
Nope, it's still the same, turning on high-precision floats does not solve this issue |
This is a common on android and many devices do not offer high precision in fragment shaders, many have only 10 bit precision. You haven't said whether this is GLES2 or 3, but the issue probably still stands .. I've seen it more on GLES2 devices. As a general rule, I would recommend not touching texture coordinates in fragment shaders for low end mobile. There are two reasons:
This typically manifests as blocky point filtering looks and performance dropping off a cliff. It isn't something Godot can do anything about, it is a hardware limitation. TIME could also be problematic because as time increase, the precision available can decrease in the variable .. although I believe there may be a wraparound at some point. Although we should put in some mechanisms to query low, medium and high precisions at runtime and so allow the user to switch shaders. We have also discussed that we maybe should put warnings up during export when users export such shaders to android etc. See e.g. #32813 for more info. |
It happens in both GLES2 and 3 but using these does not seems to give me such issues.
|
Ah that is interesting, it may have been due to accessing texture outside the 0 - 1 range in your case. Was it a non power of 2 size texture by any chance? The GPU is Adreno 512: However it does have extension GL_OES_texture_npot which suggests it should be able to do npot... |
Nope, the texture is 64x64 tiled across 368x640 res window size using TextureRect node at FullRect setting |
In that case I'm not sure what exactly is triggering it. 🤔 Just to clarify when you say 'starts to hang', what do you mean. Do you mean the app freezes periodically? You could probably pin it down further by tweaking the shader, but it may be a wild goose chase. Unless it is a generic problem in our shader compiler to GLSL (say something to do with that intermediate vec3 It may be that using mod in the UVs before looking up the texture is recognised in the driver, or it may be that it performs better without receiving values outside 0 to 1 range, or it may be it hits a pathological situation. Or precision of one of the intermediates? I'm just wildly guessing at this stage though. 😁 |
What i mean by "hang" is that only the texture with shader(not the whole game) starts to slow down and and becomes blocky per pixel(i guess) and the size of those block keeps increasing as the time goes. |
This does sound exactly as I've seen before when GPUs enter a slow path. No idea why this might be happening with the first variation of the shader and not the second though. |
Closing, as decreasing You'll have to make sure your shader's animation performs a full loop within |
I'm not sure we have established that it is TIME that is causing the blockiness / slowdown here. As I said above, touching UVs on some low end GPUs will cause this by causing the GPU to enter a slower, less precise "limp mode", irrespective of whether TIME is used in calculations. They are related issues, but not the same. "Dependent texture read" I think is one of the names for this: |
The fact that this occurs over time (and not initially) makes me think this is due to |
Ah yes you are likely to be correct, OP later says that the "hang" is only for the texture concerned (maybe they mean this texture updates less frequently). When you get this limp slowdown it generally affects everything I think. But you can still potentially get the GPU kicked into lower precision mode which can then in turn make the TIME issue more pronounced. It would be nice to see this confirmed by the OP, but the issue is old so this is unlikely .. so agree is probably worth closing and watching for any newer related issues. 👍 |
Godot version:
Godot 3.2.4 although it did happen in the previous versions too.
OS/device including version:
Android 9, Asus max pro m2
Issue description:
When I offset tileable texture it starts to hang in mobile and even the texture becomes blocky. It only happens on mobile and only to that texture, I mean the game works fine.
Steps to reproduce:
Minimal reproduction project:
The text was updated successfully, but these errors were encountered: