From 44c98089cf923fda924902bceec4edb01f36ce2c Mon Sep 17 00:00:00 2001 From: mntmn Date: Tue, 25 Aug 2020 20:49:51 +0200 Subject: shaders: Fix transparency on GC7000L (#10036) Workaround for the missing GL_ALPHA_TEST implementation in Mesa (etnaviv driver). --- src/client/shader.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/client') diff --git a/src/client/shader.cpp b/src/client/shader.cpp index ee6079f7a..0aba7b118 100644 --- a/src/client/shader.cpp +++ b/src/client/shader.cpp @@ -38,6 +38,16 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "gamedef.h" #include "client/tile.h" +#if ENABLE_GLES +#ifdef _IRR_COMPILE_WITH_OGLES1_ +#include +#else +#include +#endif +#else +#include +#endif + /* A cache from shader name to shader path */ @@ -607,6 +617,14 @@ ShaderInfo generate_shader(const std::string &name, u8 material_type, u8 drawtyp // Create shaders header std::string shaders_header = "#version 120\n"; +#ifdef __unix__ + // For renderers that should use discard instead of GL_ALPHA_TEST + const char* gl_renderer = (const char*)glGetString(GL_RENDERER); + if (strstr(gl_renderer, "GC7000")) { + shaders_header += "#define USE_DISCARD\n"; + } +#endif + static const char* drawTypes[] = { "NDT_NORMAL", "NDT_AIRLIKE", -- cgit v1.2.3