Parse IMGTEC's GL_VERSION string format

ImgTec's driver uses a major.minor@changeID versioning system

This is packed into a double so "1.9@4850625" becomes "109.4850625"

The next release brnach is expected to be 1.10, hence the need for 2
digits for the branch minor.

The changeID should be unique for each build, but is shared over all
branches, so only makes sense to compare withing a branch.

It's likely branch 'major' versions will be used for major hardware
revisions, and the drivers for both maintained in parallel. Thus it
may not make sense to compare versions between different major
verisons - if/when this happens we can hook up a DriverDetails::Family
as needed.
This commit is contained in:
Jonathan Hamilton 2017-09-02 11:25:12 -07:00
parent 4bf672bb27
commit 662abcb2fe

View File

@ -326,6 +326,29 @@ static void InitDriverInfo()
version = 100 * major + minor;
}
break;
case DriverDetails::VENDOR_IMGTEC:
{
// Example version string:
// "OpenGL ES 3.2 build 1.9@4850625"
// Ends up as "109.4850625" - "1.9" being the branch, "4850625" being the build's change ID
// The change ID only makes sense to compare within a branch
driver = DriverDetails::DRIVER_IMGTEC;
double gl_version;
int major, minor, change;
constexpr double change_scale = 10000000;
sscanf(g_ogl_config.gl_version, "OpenGL ES %lg build %d.%d@%d", &gl_version, &major, &minor,
&change);
version = 100 * major + minor;
if (change >= change_scale)
{
ERROR_LOG(VIDEO, "Version changeID overflow - change:%d scale:%f", change, change_scale);
}
else
{
version += static_cast<double>(change) / change_scale;
}
}
break;
// We don't care about these
default:
break;