mangoapp: Use glXQueryCurrentRendererIntegerMESA if available

This is the best way to get vendor IDs instead of hardcoding based on the GL_RENDERER vendor string.
pull/1085/head
Joshua Ashton 10 months ago committed by flightlessmango
parent 528ba6c9c0
commit ef444a740d

@ -295,13 +295,20 @@ int main(int, char**)
window_size = ImVec2(params.width, params.height);
deviceName = (char*)glGetString(GL_RENDERER);
sw_stats.deviceName = deviceName;
if (deviceName.find("Radeon") != std::string::npos
|| deviceName.find("AMD") != std::string::npos){
vendorID = 0x1002;
} else if (deviceName.find("Intel") != std::string::npos) {
vendorID = 0x8086;
#define GLX_RENDERER_VENDOR_ID_MESA 0x8183
auto pfn_glXQueryCurrentRendererIntegerMESA = (Bool (*)(int, unsigned int*)) (glfwGetProcAddress("glXQueryCurrentRendererIntegerMESA"));
if (pfn_glXQueryCurrentRendererIntegerMESA) {
pfn_glXQueryCurrentRendererIntegerMESA(GLX_RENDERER_VENDOR_ID_MESA, &vendorID);
} else {
vendorID = 0x10de;
if (deviceName.find("Radeon") != std::string::npos
|| deviceName.find("AMD") != std::string::npos){
vendorID = 0x1002;
} else if (deviceName.find("Intel") != std::string::npos) {
vendorID = 0x8086;
} else {
vendorID = 0x10de;
}
}
init_gpu_stats(vendorID, 0, params);
init_system_info();

Loading…
Cancel
Save