1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 08:35:20 +02:00

shaders: Fix transparency on GC7000L (#10036)

Workaround for the missing GL_ALPHA_TEST implementation in Mesa (etnaviv driver).
This commit is contained in:
mntmn
2020-08-25 20:49:51 +02:00
committed by GitHub
parent f27cf47779
commit 44c98089cf
3 changed files with 34 additions and 0 deletions

View File

@@ -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 <GLES/gl.h>
#else
#include <GLES2/gl2.h>
#endif
#else
#include <GL/gl.h>
#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",