From 15c5728f01be7a657f661c9ac503db4c5855864a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 31 Jul 2022 17:48:55 +0200 Subject: [PATCH] - fixes and improvements for survey code. Check for Windows on ARM and do proper checks for GLES. 32 bit checks are still retained to catch non-official builds that disable the compile check. --- src/common/rendering/gl_load/gl_interface.cpp | 14 +++++++++++--- src/common/rendering/gles/gles_framebuffer.h | 1 + src/common/rendering/gles/gles_system.cpp | 5 +++++ src/d_anonstats.cpp | 19 +++++++++++-------- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/common/rendering/gl_load/gl_interface.cpp b/src/common/rendering/gl_load/gl_interface.cpp index 344a3d4fa..ea011819b 100644 --- a/src/common/rendering/gl_load/gl_interface.cpp +++ b/src/common/rendering/gl_load/gl_interface.cpp @@ -44,7 +44,8 @@ static TArray m_Extensions; RenderContext gl; -static double realglversion; // this is public so the statistics code can access it. +static double realglversion; +static bool bindless; //========================================================================== // @@ -156,7 +157,7 @@ void gl_LoadExtensions() #ifdef _WIN32 if (strstr(gl.vendorstring, "ATI Tech")) { - gl.flags |= RFL_NO_CLIP_PLANES; // gl_ClipDistance is horribly broken on ATI GL3 drivers for Windows. (TBD: Relegate to vintage build? Maybe after the next survey.) + gl.flags |= RFL_NO_CLIP_PLANES; // gl_ClipDistance is horribly broken on ATI GL3 drivers for Windows. } #endif gl.glslversion = 3.31f; // Force GLSL down to 3.3. @@ -201,6 +202,8 @@ void gl_LoadExtensions() glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl.max_texturesize); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + bindless = CheckExtension("GL_ARB_bindless_texture"); } //========================================================================== @@ -247,9 +250,14 @@ void gl_PrintStartupLog() } } +void setGlVersion(double glv) +{ + realglversion = glv; +} + std::pair gl_getInfo() { // gl_ARB_bindless_texture is the closest we can get to determine Vulkan support from OpenGL. // This isn't foolproof because Intel doesn't support it but for NVidia and AMD support of this extension means Vulkan support. - return std::make_pair(realglversion, CheckExtension("GL_ARB_bindless_texture")); + return std::make_pair(realglversion, bindless); } diff --git a/src/common/rendering/gles/gles_framebuffer.h b/src/common/rendering/gles/gles_framebuffer.h index d7c7587f8..3cf32f179 100644 --- a/src/common/rendering/gles/gles_framebuffer.h +++ b/src/common/rendering/gles/gles_framebuffer.h @@ -22,6 +22,7 @@ public: explicit OpenGLFrameBuffer() {} OpenGLFrameBuffer(void *hMonitor, bool fullscreen) ; ~OpenGLFrameBuffer(); + int Backend() override { return 0; } void InitializeState() override; void Update() override; diff --git a/src/common/rendering/gles/gles_system.cpp b/src/common/rendering/gles/gles_system.cpp index 51f8ee6a2..edaa86afa 100644 --- a/src/common/rendering/gles/gles_system.cpp +++ b/src/common/rendering/gles/gles_system.cpp @@ -9,6 +9,7 @@ CVAR(Bool, gles_use_mapped_buffer, false, 0); CVAR(Bool, gles_force_glsl_v100, false, 0); CVAR(Int, gles_max_lights_per_surface, 32, 0); EXTERN_CVAR(Bool, gl_customshader); +void setGlVersion(double glv); #if USE_GLES2 @@ -191,5 +192,9 @@ namespace OpenGLESRenderer #endif gles.numlightvectors = (gles.maxlights * LIGHT_VEC4_NUM); + + const char* glversion = (const char*)glGetString(GL_VERSION); + setGlVersion( strtod(glversion, NULL)); + } } diff --git a/src/d_anonstats.cpp b/src/d_anonstats.cpp index 4df68406c..6d3da51ec 100644 --- a/src/d_anonstats.cpp +++ b/src/d_anonstats.cpp @@ -176,20 +176,24 @@ bool I_HTTPRequest(const char* request) static int GetOSVersion() { #ifdef _WIN32 +#ifndef _M_ARM64 if (sizeof(void*) == 4) // 32 bit { BOOL res; if (IsWow64Process(GetCurrentProcess(), &res) && res) { - return 2; + return 1; } - return 1; + return 0; } else { - if (sys_ostype == 2) return 3; - else return 4; + if (sys_ostype == 2) return 2; + else return 3; } +#else + return 4; +#endif #elif defined __APPLE__ @@ -198,9 +202,8 @@ static int GetOSVersion() #else return 5; #endif -#else -// fall-through linux stuff here +#else // fall-through linux stuff here #ifdef __arm__ return 9; #else @@ -264,12 +267,12 @@ static int GetCoreInfo() static int GetRenderInfo() { + if (screen->Backend() == 0) return 1; if (screen->Backend() == 1) return 4; auto info = gl_getInfo(); if (!info.second) { - if ((screen->hwcaps & (RFL_SHADER_STORAGE_BUFFER | RFL_BUFFER_STORAGE)) == (RFL_SHADER_STORAGE_BUFFER | RFL_BUFFER_STORAGE)) return 2; - return 1; + return 2; } return 3; }