mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- Add OpenGL ES 3 support to GL renderer
This commit is contained in:
parent
b7482e10e2
commit
85a9984807
5 changed files with 18 additions and 7 deletions
|
@ -85,8 +85,11 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
||||||
unsigned int lightbuffersize = GLRenderer->mLights->GetBlockSize();
|
unsigned int lightbuffersize = GLRenderer->mLights->GetBlockSize();
|
||||||
if (lightbuffertype == GL_UNIFORM_BUFFER)
|
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.es)
|
||||||
if (gl.glslversion < 1.4f)
|
{
|
||||||
|
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);
|
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)
|
if (!gl.legacyMode)
|
||||||
{
|
{
|
||||||
for (int passType = 0; passType < MAX_PASS_TYPES; 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((EPassType)passType));
|
{
|
||||||
|
mPassShaders.Push(new FShaderCollection(NORMAL_PASS));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int passType = 0; passType < MAX_PASS_TYPES; passType++)
|
||||||
|
mPassShaders.Push(new FShaderCollection((EPassType)passType));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,7 @@ void gl_LoadExtensions()
|
||||||
gl.legacyMode = false;
|
gl.legacyMode = false;
|
||||||
gl.lightmethod = LM_DEFERRED;
|
gl.lightmethod = LM_DEFERRED;
|
||||||
gl.buffermethod = BM_DEFERRED;
|
gl.buffermethod = BM_DEFERRED;
|
||||||
|
gl.flags |= RFL_NO_CLIP_PLANES;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@ vec4 ProcessTexel()
|
||||||
{
|
{
|
||||||
vec2 texCoord = vTexCoord.st;
|
vec2 texCoord = vTexCoord.st;
|
||||||
vec4 basicColor = getTexel(texCoord);
|
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.x = float( int(texCoord.x * texSize.x) ) / texSize.x;
|
||||||
texCoord.y = float( int(texCoord.y * texSize.y) ) / texSize.y;
|
texCoord.y = float( int(texCoord.y * texSize.y) ) / texSize.y;
|
||||||
|
|
|
@ -5,7 +5,7 @@ vec4 ProcessTexel()
|
||||||
{
|
{
|
||||||
vec2 texCoord = vTexCoord.st;
|
vec2 texCoord = vTexCoord.st;
|
||||||
vec4 basicColor = getTexel(texCoord);
|
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.x = float( int(texCoord.x * texSize.x) ) / texSize.x;
|
||||||
texCoord.y = float( int(texCoord.y * texSize.y) ) / texSize.y;
|
texCoord.y = float( int(texCoord.y * texSize.y) ) / texSize.y;
|
||||||
|
|
|
@ -90,7 +90,7 @@ vec4 getTexel(vec2 st)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (uObjectColor2.a == 0) texel *= uObjectColor;
|
if (uObjectColor2.a == 0.0) texel *= uObjectColor;
|
||||||
else texel *= mix(uObjectColor, uObjectColor2, glowdist.z);
|
else texel *= mix(uObjectColor, uObjectColor2, glowdist.z);
|
||||||
|
|
||||||
return desaturate(texel);
|
return desaturate(texel);
|
||||||
|
|
Loading…
Reference in a new issue