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 11 months ago committed by flightlessmango
parent 528ba6c9c0
commit ef444a740d

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

Loading…
Cancel
Save