mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 07:22:07 +00:00
This commit is contained in:
commit
17aceac912
4 changed files with 24 additions and 14 deletions
|
@ -151,6 +151,7 @@ void gl_LoadExtensions()
|
||||||
{
|
{
|
||||||
double v1 = strtod(version, NULL);
|
double v1 = strtod(version, NULL);
|
||||||
double v2 = strtod(glversion, NULL);
|
double v2 = strtod(glversion, NULL);
|
||||||
|
if (v1 >= 3.0 && v1 < 3.3) v1 = 3.3; // promote '3' to 3.3 to avoid falling back to the legacy path.
|
||||||
if (v2 < v1) version = glversion;
|
if (v2 < v1) version = glversion;
|
||||||
else Printf("Emulating OpenGL v %s\n", version);
|
else Printf("Emulating OpenGL v %s\n", version);
|
||||||
}
|
}
|
||||||
|
@ -204,8 +205,9 @@ void gl_LoadExtensions()
|
||||||
gl.flags |= RFL_SAMPLER_OBJECTS;
|
gl.flags |= RFL_SAMPLER_OBJECTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The minimum requirement for the modern render path are GL 3.0 + uniform buffers. Also exclude the Linux Mesa driver at GL 3.0 because it errors out on shader compilation.
|
// The minimum requirement for the modern render path is GL 3.3.
|
||||||
if (gl_version < 3.0f || (gl_version < 3.1f && (!CheckExtension("GL_ARB_uniform_buffer_object") || strstr(gl.vendorstring, "X.Org") != nullptr)))
|
// Although some GL 3.1 or 3.2 solutions may theoretically work they are usually too broken or too slow.
|
||||||
|
if (gl_version < 3.3f)
|
||||||
{
|
{
|
||||||
gl.legacyMode = true;
|
gl.legacyMode = true;
|
||||||
gl.lightmethod = LM_LEGACY;
|
gl.lightmethod = LM_LEGACY;
|
||||||
|
@ -213,16 +215,6 @@ void gl_LoadExtensions()
|
||||||
gl.glslversion = 0;
|
gl.glslversion = 0;
|
||||||
gl.flags |= RFL_NO_CLIP_PLANES;
|
gl.flags |= RFL_NO_CLIP_PLANES;
|
||||||
}
|
}
|
||||||
else if (gl.glslversion < 1.4f && !CheckExtension("GL_ARB_uniform_buffer_object"))
|
|
||||||
{
|
|
||||||
// Some old ATI drivers report OpenGL 3.1 with GLSL version 1.3 and no support for uniform buffers.
|
|
||||||
// We have no choice but to force them down to OpenGL 2.x.
|
|
||||||
gl.legacyMode = true;
|
|
||||||
gl.lightmethod = LM_LEGACY;
|
|
||||||
gl.buffermethod = BM_LEGACY;
|
|
||||||
gl.glslversion = 0;
|
|
||||||
gl.flags |= RFL_NO_CLIP_PLANES;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gl.legacyMode = false;
|
gl.legacyMode = false;
|
||||||
|
|
|
@ -530,7 +530,7 @@ NSOpenGLPixelFormat* CreatePixelFormat(const OpenGLProfile profile)
|
||||||
if (nullptr != glversion)
|
if (nullptr != glversion)
|
||||||
{
|
{
|
||||||
const double version = strtod(glversion, nullptr) + 0.01;
|
const double version = strtod(glversion, nullptr) + 0.01;
|
||||||
if (version < 3.2)
|
if (version < 3.0)
|
||||||
{
|
{
|
||||||
profile = NSOpenGLProfileVersionLegacy;
|
profile = NSOpenGLProfileVersionLegacy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,20 @@
|
||||||
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
||||||
EXTERN_CVAR(Bool, r_drawvoxels);
|
EXTERN_CVAR(Bool, r_drawvoxels);
|
||||||
|
|
||||||
|
namespace { double sprite_distance_cull = 1e16; }
|
||||||
|
|
||||||
|
CUSTOM_CVAR(Float, r_sprite_distance_cull, 5000.0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
{
|
||||||
|
if (r_sprite_distance_cull > 0.0)
|
||||||
|
{
|
||||||
|
sprite_distance_cull = r_sprite_distance_cull * r_sprite_distance_cull;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprite_distance_cull = 1e16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
RenderOpaquePass::RenderOpaquePass(RenderThread *thread) : renderline(thread)
|
RenderOpaquePass::RenderOpaquePass(RenderThread *thread) : renderline(thread)
|
||||||
|
@ -936,6 +950,10 @@ namespace swrenderer
|
||||||
if (!renderportal->CurrentPortalInSkybox && renderportal->CurrentPortal && !!P_PointOnLineSidePrecise(thing->Pos(), renderportal->CurrentPortal->dst))
|
if (!renderportal->CurrentPortalInSkybox && renderportal->CurrentPortal && !!P_PointOnLineSidePrecise(thing->Pos(), renderportal->CurrentPortal->dst))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
double distanceSquared = (thing->Pos() - Thread->Viewport->viewpoint.Pos).LengthSquared();
|
||||||
|
if (distanceSquared > sprite_distance_cull)
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -877,7 +877,7 @@ bool Win32GLVideo::InitHardware (HWND Window, int multisample)
|
||||||
int prof = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
|
int prof = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||||
const char *version = Args->CheckValue("-glversion");
|
const char *version = Args->CheckValue("-glversion");
|
||||||
|
|
||||||
if (version != nullptr && strcmp(version, "3.0") < 0) prof = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
if (version != nullptr && strtod(version, nullptr) < 3.0) prof = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||||
|
|
||||||
for (; prof <= WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; prof++)
|
for (; prof <= WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; prof++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue