Skip to content

Commit

Permalink
- fixes and improvements for survey code.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
coelckers committed Jul 31, 2022
1 parent 46d9564 commit 15c5728
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
14 changes: 11 additions & 3 deletions src/common/rendering/gl_load/gl_interface.cpp
Expand Up @@ -44,7 +44,8 @@

static TArray<FString> m_Extensions;
RenderContext gl;
static double realglversion; // this is public so the statistics code can access it.
static double realglversion;
static bool bindless;

//==========================================================================
//
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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");
}

//==========================================================================
Expand Down Expand Up @@ -247,9 +250,14 @@ void gl_PrintStartupLog()
}
}

void setGlVersion(double glv)
{
realglversion = glv;
}

std::pair<double, bool> 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);
}
1 change: 1 addition & 0 deletions src/common/rendering/gles/gles_framebuffer.h
Expand Up @@ -22,6 +22,7 @@ class OpenGLFrameBuffer : public SystemGLFrameBuffer
explicit OpenGLFrameBuffer() {}
OpenGLFrameBuffer(void *hMonitor, bool fullscreen) ;
~OpenGLFrameBuffer();
int Backend() override { return 0; }

void InitializeState() override;
void Update() override;
Expand Down
5 changes: 5 additions & 0 deletions src/common/rendering/gles/gles_system.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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));

}
}
19 changes: 11 additions & 8 deletions src/d_anonstats.cpp
Expand Up @@ -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__

Expand All @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 15c5728

Please sign in to comment.