Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSdx-ogl: Drop AMD's SSO workarounds #2696

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 37 additions & 19 deletions plugins/GSdx/Renderers/OpenGL/GLLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ namespace GLLoader {
bool s_first_load = true;

bool amd_legacy_buggy_driver = false;
bool amd_buggy_driver = false;
bool vendor_id_amd = false;
bool vendor_id_nvidia = false;
bool vendor_id_intel = false;
Expand Down Expand Up @@ -325,35 +326,52 @@ namespace GLLoader {
return true;
}

bool check_gl_version(int major, int minor) {
// AMD's GL_version is made of: <OpenGL version number> <requested context> <DriverVersion>
// Technically speaking we'd just be interested in the atioglxx/fglrx_dri userspace lib,
// whose revision number is comfortably exposed in the first element of the string above.
// Unfortunately (at least for the 2 problems we have), its reported version doesn't readily
// change across the buggy and fixed "branch". Therefore look for the kernel driver build.
//
// Coincidentally the same position is also where Intel and Nvidia put their only version id
bool check_driver_version(const unsigned char *s, std::string v) {
std::stringstream iss(v);
std::vector<int> fixed_version((std::istream_iterator<int>(iss)), std::istream_iterator<int>());

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

const char *version_string = strrchr(reinterpret_cast<const char *>(s), ' ');
char *offset;
for (const auto fixed_version_part : fixed_version)
{
const long used_version = strtol(version_string, &offset, 10);
if (used_version < fixed_version_part) {
return 0;
}
if (used_version > fixed_version_part)
return 1;
version_string = offset + 1;
}
return 1;
}

bool check_gl_version(int major, int minor) {

const GLubyte* s = glGetString(GL_VERSION);
if (s == NULL) {
fprintf(stderr, "Error: GLLoader failed to get GL version\n");
return false;
}
GLuint v = 1;
while (s[v] != '\0' && s[v-1] != ' ') v++;

const char* vendor = (const char*)glGetString(GL_VENDOR);
if (s_first_load)
fprintf(stdout, "OpenGL information. GPU: %s. Vendor: %s. Driver: %s\n", glGetString(GL_RENDERER), vendor, &s[v]);
fprintf(stdout, "OpenGL information. GPU: %s. Vendor: %s. Driver: %s\n", glGetString(GL_RENDERER), vendor, &s[0]);

// Name changed but driver is still bad!
if (strstr(vendor, "Advanced Micro Devices") || strstr(vendor, "ATI Technologies Inc.") || strstr(vendor, "ATI"))
// 32-bit driver should always actually just report the former
if (strstr(vendor, "ATI Technologies Inc.") || strstr(vendor, "Advanced Micro Devices") || strstr(vendor, "ATI")) {
vendor_id_amd = true;
/*if (vendor_id_amd && (
strstr((const char*)&s[v], " 10.") || // Blacklist all 2010 AMD drivers.
strstr((const char*)&s[v], " 11.") || // Blacklist all 2011 AMD drivers.
strstr((const char*)&s[v], " 12.") || // Blacklist all 2012 AMD drivers.
strstr((const char*)&s[v], " 13.") || // Blacklist all 2013 AMD drivers.
strstr((const char*)&s[v], " 14.") || // Blacklist all 2014 AMD drivers.
strstr((const char*)&s[v], " 15.") || // Blacklist all 2015 AMD drivers.
strstr((const char*)&s[v], " 16.") || // Blacklist all 2016 AMD drivers.
strstr((const char*)&s[v], " 17.") // Blacklist all 2017 AMD drivers for now.
))
/*if (!check_driver_version(s,"15 300")) // Crimson ~15.11 beta
amd_legacy_buggy_driver = true;
*/
*/

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

if (!check_driver_version(s,"25 20 14007 1000")) // Adrenalin 18.10.2
amd_buggy_driver = true;
}

This comment was marked as spam.

This comment was marked as spam.


if (strstr(vendor, "NVIDIA Corporation"))
vendor_id_nvidia = true;

Expand All @@ -365,7 +383,7 @@ namespace GLLoader {
mesa_driver = !vendor_id_nvidia && !vendor_id_amd;
#endif

buggy_sso_dual_src = vendor_id_intel || vendor_id_amd /*|| amd_legacy_buggy_driver*/;
buggy_sso_dual_src = vendor_id_intel || amd_buggy_driver /*|| amd_legacy_buggy_driver*/;

if (theApp.GetConfigI("override_geometry_shader") != -1) {
found_geometry_shader = theApp.GetConfigB("override_geometry_shader");
Expand Down
1 change: 1 addition & 0 deletions plugins/GSdx/Renderers/OpenGL/GLLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ namespace GLLoader {
extern bool vendor_id_nvidia;
extern bool vendor_id_intel;
extern bool amd_legacy_buggy_driver;
extern bool amd_buggy_driver;
extern bool mesa_driver;
extern bool buggy_sso_dual_src;
extern bool in_replayer;
Expand Down