- Add OpenGL ES 3 support to GL renderer

This commit is contained in:
Magnus Norddahl 2017-04-07 04:09:04 +02:00
parent a9591f57a6
commit 994740b3ae
5 changed files with 18 additions and 7 deletions

View file

@ -85,8 +85,11 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
unsigned int lightbuffersize = GLRenderer->mLights->GetBlockSize();
if (lightbuffertype == GL_UNIFORM_BUFFER)
{
// This differentiation is for some Intel drivers which fail on #extension, so use of #version 140 is necessary
if (gl.glslversion < 1.4f)
if (gl.es)
{
vp_comb.Format("#version 300 es\n#define NUM_UBO_LIGHTS %d\n", lightbuffersize);
}
else if (gl.glslversion < 1.4f) // This differentiation is for some Intel drivers which fail on #extension, so use of #version 140 is necessary
{
vp_comb.Format("#version 130\n#extension GL_ARB_uniform_buffer_object : require\n#define NUM_UBO_LIGHTS %d\n", lightbuffersize);
}
@ -411,8 +414,15 @@ FShaderManager::FShaderManager()
{
if (!gl.legacyMode)
{
for (int passType = 0; passType < MAX_PASS_TYPES; passType++)
mPassShaders.Push(new FShaderCollection((EPassType)passType));
if (gl.es) // OpenGL ES does not support multiple fragment shader outputs. As a result, no GBUFFER passes are possible.
{
mPassShaders.Push(new FShaderCollection(NORMAL_PASS));
}
else
{
for (int passType = 0; passType < MAX_PASS_TYPES; passType++)
mPassShaders.Push(new FShaderCollection((EPassType)passType));
}
}
}

View file

@ -176,6 +176,7 @@ void gl_LoadExtensions()
gl.legacyMode = false;
gl.lightmethod = LM_DEFERRED;
gl.buffermethod = BM_DEFERRED;
gl.flags |= RFL_NO_CLIP_PLANES;
}
else
{

View file

@ -5,7 +5,7 @@ vec4 ProcessTexel()
{
vec2 texCoord = vTexCoord.st;
vec4 basicColor = getTexel(texCoord);
ivec2 texSize = textureSize(tex, 0);
vec2 texSize = vec2(textureSize(tex, 0));
texCoord.x = float( int(texCoord.x * texSize.x) ) / texSize.x;
texCoord.y = float( int(texCoord.y * texSize.y) ) / texSize.y;

View file

@ -5,7 +5,7 @@ vec4 ProcessTexel()
{
vec2 texCoord = vTexCoord.st;
vec4 basicColor = getTexel(texCoord);
ivec2 texSize = textureSize(tex, 0);
vec2 texSize = vec2(textureSize(tex, 0));
texCoord.x = float( int(texCoord.x * texSize.x) ) / texSize.x;
texCoord.y = float( int(texCoord.y * texSize.y) ) / texSize.y;

View file

@ -90,7 +90,7 @@ vec4 getTexel(vec2 st)
}
break;
}
if (uObjectColor2.a == 0) texel *= uObjectColor;
if (uObjectColor2.a == 0.0) texel *= uObjectColor;
else texel *= mix(uObjectColor, uObjectColor2, glowdist.z);
return desaturate(texel);