diff --git a/src/gl/system/gl_interface.cpp b/src/gl/system/gl_interface.cpp index dcde3f006..85946d598 100644 --- a/src/gl/system/gl_interface.cpp +++ b/src/gl/system/gl_interface.cpp @@ -151,6 +151,7 @@ void gl_LoadExtensions() { double v1 = strtod(version, 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; else Printf("Emulating OpenGL v %s\n", version); } @@ -204,8 +205,9 @@ void gl_LoadExtensions() 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. - if (gl_version < 3.0f || (gl_version < 3.1f && (!CheckExtension("GL_ARB_uniform_buffer_object") || strstr(gl.vendorstring, "X.Org") != nullptr))) + // The minimum requirement for the modern render path is GL 3.3. + // 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.lightmethod = LM_LEGACY; @@ -213,16 +215,6 @@ void gl_LoadExtensions() gl.glslversion = 0; 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 { gl.legacyMode = false; diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index c6a7f3a81..01e46442e 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -530,7 +530,7 @@ NSOpenGLPixelFormat* CreatePixelFormat(const OpenGLProfile profile) if (nullptr != glversion) { const double version = strtod(glversion, nullptr) + 0.01; - if (version < 3.2) + if (version < 3.0) { profile = NSOpenGLProfileVersionLegacy; } diff --git a/src/swrenderer/scene/r_opaque_pass.cpp b/src/swrenderer/scene/r_opaque_pass.cpp index 7d6d6b461..bebb9580f 100644 --- a/src/swrenderer/scene/r_opaque_pass.cpp +++ b/src/swrenderer/scene/r_opaque_pass.cpp @@ -72,6 +72,20 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor); 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 { RenderOpaquePass::RenderOpaquePass(RenderThread *thread) : renderline(thread) @@ -936,6 +950,10 @@ namespace swrenderer if (!renderportal->CurrentPortalInSkybox && renderportal->CurrentPortal && !!P_PointOnLineSidePrecise(thing->Pos(), renderportal->CurrentPortal->dst)) return false; + double distanceSquared = (thing->Pos() - Thread->Viewport->viewpoint.Pos).LengthSquared(); + if (distanceSquared > sprite_distance_cull) + return false; + return true; } diff --git a/src/win32/win32gliface.cpp b/src/win32/win32gliface.cpp index 614adaa2d..8071399db 100644 --- a/src/win32/win32gliface.cpp +++ b/src/win32/win32gliface.cpp @@ -877,7 +877,7 @@ bool Win32GLVideo::InitHardware (HWND Window, int multisample) int prof = WGL_CONTEXT_CORE_PROFILE_BIT_ARB; 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++) {