diff options
author | mntmn <lukas@mnt.mn> | 2020-08-25 20:49:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-25 20:49:51 +0200 |
commit | 44c98089cf923fda924902bceec4edb01f36ce2c (patch) | |
tree | b940582becd30e2de4b9b1fe4e08debe4dde87e0 /client | |
parent | f27cf4777933f06f85fa2f013d56ca0a2cf1d588 (diff) | |
download | minetest-44c98089cf923fda924902bceec4edb01f36ce2c.tar.gz minetest-44c98089cf923fda924902bceec4edb01f36ce2c.tar.bz2 minetest-44c98089cf923fda924902bceec4edb01f36ce2c.zip |
shaders: Fix transparency on GC7000L (#10036)
Workaround for the missing GL_ALPHA_TEST implementation in Mesa (etnaviv driver).
Diffstat (limited to 'client')
-rw-r--r-- | client/shaders/nodes_shader/opengl_fragment.glsl | 8 | ||||
-rw-r--r-- | client/shaders/object_shader/opengl_fragment.glsl | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/client/shaders/nodes_shader/opengl_fragment.glsl b/client/shaders/nodes_shader/opengl_fragment.glsl index 19e6c2d86..7213612bd 100644 --- a/client/shaders/nodes_shader/opengl_fragment.glsl +++ b/client/shaders/nodes_shader/opengl_fragment.glsl @@ -190,6 +190,14 @@ void main(void) #endif vec4 base = texture2D(baseTexture, uv).rgba; +#ifdef USE_DISCARD + // If alpha is zero, we can just discard the pixel. This fixes transparency + // on GPUs like GC7000L, where GL_ALPHA_TEST is not implemented in mesa. + if (base.a == 0.0) { + discard; + } +#endif + #ifdef ENABLE_BUMPMAPPING if (use_normalmap) { vec3 L = normalize(lightVec); diff --git a/client/shaders/object_shader/opengl_fragment.glsl b/client/shaders/object_shader/opengl_fragment.glsl index 0534dc049..2d33ca439 100644 --- a/client/shaders/object_shader/opengl_fragment.glsl +++ b/client/shaders/object_shader/opengl_fragment.glsl @@ -129,6 +129,14 @@ void main(void) vec4 base = texture2D(baseTexture, uv).rgba; +#ifdef USE_DISCARD + // If alpha is zero, we can just discard the pixel. This fixes transparency + // on GPUs like GC7000L, where GL_ALPHA_TEST is not implemented in mesa. + if (base.a == 0.0) { + discard; + } +#endif + #ifdef ENABLE_BUMPMAPPING if (use_normalmap) { vec3 L = normalize(lightVec); |