- 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.
This commit is contained in:
Christoph Oelckers 2022-07-31 17:48:55 +02:00
parent 46d9564507
commit 15c5728f01
4 changed files with 28 additions and 11 deletions

View file

@ -44,7 +44,8 @@
static TArray<FString> m_Extensions; static TArray<FString> m_Extensions;
RenderContext gl; 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 #ifdef _WIN32
if (strstr(gl.vendorstring, "ATI Tech")) 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 #endif
gl.glslversion = 3.31f; // Force GLSL down to 3.3. 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); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl.max_texturesize);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 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<double, bool> gl_getInfo() std::pair<double, bool> gl_getInfo()
{ {
// gl_ARB_bindless_texture is the closest we can get to determine Vulkan support from OpenGL. // 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. // 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);
} }

View file

@ -22,6 +22,7 @@ public:
explicit OpenGLFrameBuffer() {} explicit OpenGLFrameBuffer() {}
OpenGLFrameBuffer(void *hMonitor, bool fullscreen) ; OpenGLFrameBuffer(void *hMonitor, bool fullscreen) ;
~OpenGLFrameBuffer(); ~OpenGLFrameBuffer();
int Backend() override { return 0; }
void InitializeState() override; void InitializeState() override;
void Update() override; void Update() override;

View file

@ -9,6 +9,7 @@ CVAR(Bool, gles_use_mapped_buffer, false, 0);
CVAR(Bool, gles_force_glsl_v100, false, 0); CVAR(Bool, gles_force_glsl_v100, false, 0);
CVAR(Int, gles_max_lights_per_surface, 32, 0); CVAR(Int, gles_max_lights_per_surface, 32, 0);
EXTERN_CVAR(Bool, gl_customshader); EXTERN_CVAR(Bool, gl_customshader);
void setGlVersion(double glv);
#if USE_GLES2 #if USE_GLES2
@ -191,5 +192,9 @@ namespace OpenGLESRenderer
#endif #endif
gles.numlightvectors = (gles.maxlights * LIGHT_VEC4_NUM); gles.numlightvectors = (gles.maxlights * LIGHT_VEC4_NUM);
const char* glversion = (const char*)glGetString(GL_VERSION);
setGlVersion( strtod(glversion, NULL));
} }
} }

View file

@ -176,20 +176,24 @@ bool I_HTTPRequest(const char* request)
static int GetOSVersion() static int GetOSVersion()
{ {
#ifdef _WIN32 #ifdef _WIN32
#ifndef _M_ARM64
if (sizeof(void*) == 4) // 32 bit if (sizeof(void*) == 4) // 32 bit
{ {
BOOL res; BOOL res;
if (IsWow64Process(GetCurrentProcess(), &res) && res) if (IsWow64Process(GetCurrentProcess(), &res) && res)
{ {
return 2; return 1;
} }
return 1; return 0;
} }
else else
{ {
if (sys_ostype == 2) return 3; if (sys_ostype == 2) return 2;
else return 4; else return 3;
} }
#else
return 4;
#endif
#elif defined __APPLE__ #elif defined __APPLE__
@ -198,9 +202,8 @@ static int GetOSVersion()
#else #else
return 5; return 5;
#endif #endif
#else
// fall-through linux stuff here #else // fall-through linux stuff here
#ifdef __arm__ #ifdef __arm__
return 9; return 9;
#else #else
@ -264,12 +267,12 @@ static int GetCoreInfo()
static int GetRenderInfo() static int GetRenderInfo()
{ {
if (screen->Backend() == 0) return 1;
if (screen->Backend() == 1) return 4; if (screen->Backend() == 1) return 4;
auto info = gl_getInfo(); auto info = gl_getInfo();
if (!info.second) if (!info.second)
{ {
if ((screen->hwcaps & (RFL_SHADER_STORAGE_BUFFER | RFL_BUFFER_STORAGE)) == (RFL_SHADER_STORAGE_BUFFER | RFL_BUFFER_STORAGE)) return 2; return 2;
return 1;
} }
return 3; return 3;
} }