mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Code refactor in GLInfo::init()
This commit is contained in:
parent
5c5c218e41
commit
10ec517fe9
|
@ -14,9 +14,9 @@
|
|||
using namespace opengl;
|
||||
|
||||
void GLInfo::init() {
|
||||
const char * strVersion = reinterpret_cast<const char *>(glGetString(GL_VERSION));
|
||||
isGLESX = strstr(strVersion, "OpenGL ES") != nullptr;
|
||||
isGLES2 = strstr(strVersion, "OpenGL ES 2") != nullptr;
|
||||
const char * strDriverVersion = reinterpret_cast<const char *>(glGetString(GL_VERSION));
|
||||
isGLESX = strstr(strDriverVersion, "OpenGL ES") != nullptr;
|
||||
isGLES2 = strstr(strDriverVersion, "OpenGL ES 2") != nullptr;
|
||||
if (isGLES2) {
|
||||
majorVersion = 2;
|
||||
minorVersion = 0;
|
||||
|
@ -29,23 +29,22 @@ void GLInfo::init() {
|
|||
|
||||
|
||||
LOG(LOG_VERBOSE, "OpenGL vendor: %s", glGetString(GL_VENDOR));
|
||||
const GLubyte * strRenderer = glGetString(GL_RENDERER);
|
||||
const GLubyte * strDriverVersion = glGetString(GL_VERSION);
|
||||
const char * strRenderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
|
||||
|
||||
if (std::regex_match(std::string((const char*)strRenderer), std::regex("Adreno.*530")))
|
||||
if (std::regex_match(std::string(strRenderer), std::regex("Adreno.*530")))
|
||||
renderer = Renderer::Adreno530;
|
||||
else if (std::regex_match(std::string((const char*)strRenderer), std::regex("Adreno.*540")) ||
|
||||
std::regex_match(std::string((const char*)strRenderer), std::regex("Adreno.*6\\d\\d")))
|
||||
else if (std::regex_match(std::string(strRenderer), std::regex("Adreno.*540")) ||
|
||||
std::regex_match(std::string(strRenderer), std::regex("Adreno.*6\\d\\d")))
|
||||
renderer = Renderer::Adreno_no_bugs;
|
||||
else if (strstr((const char*)strRenderer, "Adreno") != nullptr)
|
||||
else if (strstr(strRenderer, "Adreno") != nullptr)
|
||||
renderer = Renderer::Adreno;
|
||||
else if (strstr((const char*)strRenderer, "VideoCore IV") != nullptr)
|
||||
else if (strstr(strRenderer, "VideoCore IV") != nullptr)
|
||||
renderer = Renderer::VideoCore;
|
||||
else if (strstr((const char*)strRenderer, "Intel") != nullptr)
|
||||
else if (strstr(strRenderer, "Intel") != nullptr)
|
||||
renderer = Renderer::Intel;
|
||||
else if (strstr((const char*)strRenderer, "PowerVR") != nullptr)
|
||||
else if (strstr(strRenderer, "PowerVR") != nullptr)
|
||||
renderer = Renderer::PowerVR;
|
||||
else if (strstr((const char*)strRenderer, "NVIDIA Tegra") != nullptr)
|
||||
else if (strstr(strRenderer, "NVIDIA Tegra") != nullptr)
|
||||
renderer = Renderer::Tegra;
|
||||
LOG(LOG_VERBOSE, "OpenGL renderer: %s", strRenderer);
|
||||
|
||||
|
@ -65,7 +64,7 @@ void GLInfo::init() {
|
|||
bool hasBuggyFragmentShaderInterlock = false;
|
||||
|
||||
if (renderer == Renderer::Tegra) {
|
||||
std::string strDriverVersionString((const char*)strDriverVersion);
|
||||
std::string strDriverVersionString(strDriverVersion);
|
||||
std::string nvidiaText = "NVIDIA";
|
||||
std::size_t versionPosition = strDriverVersionString.find(nvidiaText);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user