ptitSeb / gl4es

GL4ES is a OpenGL 2.1/1.5 to GL ES 2.0/1.1 translation library, with support for Pandora, ODroid, OrangePI, CHIP, Raspberry PI, Android, Emscripten and AmigaOS4.
http://ptitseb.github.io/gl4es/
MIT License
694 stars 159 forks source link

Minetest visual artifacts with use_shaders = true #81

Open jdonald opened 5 years ago

jdonald commented 5 years ago

Spinning this off from #66 :

In Minetest, all the terrain appears very red by default. If I disable shaders things look normal again, but it would be nice to have shaders.

@jdonald: Minetest: with Shaders enabled, it shows no shader errors in the output even with LIBGL_LOGSHADERERROR=1. The terrain just appears very red and the player's weapon in hand comes with a black billboard.

To toggle shaders on/off, ~edit \~/.minetest/minetest.conf~ use the Shaders checkbox in the GUI

This has been observed on a Raspberry PI 3B+ (LIBGL_FB=1, configure for minimum 128 MB GPU memory) but may affect other platforms the same.

ptitSeb commented 5 years ago

I've just tested on my Pandora, and while I noticed an issue with the transparency issues (weapon in hand, but also some flowers), I have witnessed any red-ish issue with landscape. It all feels normal.

minetest01 I activated all shaders in the GUI.

minetest02 (it's almost night-time in the screenshot) I'll look at the transparent issue, but the red-issue will be more difficult to track.

ptitSeb commented 5 years ago

I tried with latest gl4es (1.1.2) and didn't reproduced any bugs on my side (it was a quick test). Also, just to note, implementation of VBO in gl4es halped speedup a bit minetest.

Can I close the issue?

jdonald commented 5 years ago

Just pulled out a Pi 3B+ (4B doesn't support legacy GLES), used Raspbian Buster, built and ran v1.1.2 (0f5345f). The red terrain issue is gone, but the blacked out weapon in hand / flowers problem (the one you could reproduce even on Pandora in December) is still there:

image

If I disable shaders it renders fine. I'd be surprised if you managed to fix the black boxes on Pandora without fixing on the Pi at the same time. Is it possible your recent test had shaders disabled?

Note I'm toggling Shaders via the GUI, because for whatever reason it doesn't stick when I edit minetest.conf anymore.

ptitSeb commented 5 years ago

Ah damn, right. I haven't looked at the right thing when testing!

I still need to investigate this one.

AbduSharif commented 2 years ago

Is this still an issue now?

jdonald commented 2 years ago

Yes, seems to behave roughly the same as before.

Minetest 0.4.17.1 (the one that conveniently comes with sudo apt install minetest on Raspberry Pi OS Buster): image Notice the transparent portions of leaves becoming opaque black, and the in-hand item becoming opaque white.

Stdout has such errors:

glGetError 0x500
2022-07-04 21:53:00: ERROR[Main]: Irrlicht: Vertex shader compilation failed at position 585:
Invalid token
2022-07-04 21:53:00: ERROR[Main]: Irrlicht: Pixel shader compilation failed at position 580:
Invalid value (implicit param?)
2022-07-04 21:53:00: ERROR[Main]: Irrlicht: Vertex shader compilation failed at position 605:
Invalid token
2022-07-04 21:53:00: ERROR[Main]: Irrlicht: Pixel shader compilation failed at position 586:
Invalid value (implicit param?)

Compared to the scene properly rendered in GL fake KMS mode without gl4es (shaders still enabled): image

Alternatively, when shaders are disabled, legacy mode + gl4es also renders the scene reasonably.

Minetest 5.6.0-dev-213d3562b (built from source): it's more playable, but shaders are still not working. Here is some desert scene: image Shader effects are not working. Easiest ones to see are waving leaves/plants and dynamic shadows. They are clearly working in fake KMS without gl4es, but no such effects are visible when running legacy + gl4es. Probably due to shader generation failing with a few more details in stdout:

2022-07-04 21:28:52: ERROR[Main]: Irrlicht: GLSL (> 2.x) shader program failed to link
2022-07-04 21:28:52: ERROR[Main]: Irrlicht: ERROR:SEMANTIC-4 (vertex shader, line 252) Operator not supported for operand types
2022-07-04 21:28:52: ERROR[Main]: generate_shader(): failed to generate "nodes_shader", addHighLevelShaderMaterial failed.

Apparently the "Color format not supported: R32F" errors appear regardless of whether shaders are enabled.

Repro notes:

AbduSharif commented 2 years ago

Thank you very much for the detailed response.