in ReplicaSDK/ptex/EGL.cpp [213:271]
void EGLCtx::PrintInformation() {
PFNEGLQUERYDEVICESEXTPROC eglQueryDevicesEXT =
reinterpret_cast<PFNEGLQUERYDEVICESEXTPROC>(eglGetProcAddress("eglQueryDevicesEXT"));
EGLDeviceEXT devices[32];
EGLint num_devices;
if (!eglQueryDevicesEXT(32, devices, &num_devices)) {
std::cout << "Failed to query devices." << std::endl;
return;
}
if (num_devices == 0) {
std::cout << "Found no devices." << std::endl;
return;
}
std::cout << "Found " << num_devices << " device(s)." << std::endl;
PFNEGLQUERYDEVICEATTRIBEXTPROC eglQueryDeviceAttribEXT =
reinterpret_cast<PFNEGLQUERYDEVICEATTRIBEXTPROC>(
eglGetProcAddress("eglQueryDeviceAttribEXT"));
PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT =
reinterpret_cast<PFNEGLQUERYDEVICESTRINGEXTPROC>(
eglGetProcAddress("eglQueryDeviceStringEXT"));
for (int i = 0; i < num_devices; ++i) {
std::cout << "Device " << i << ":" << std::endl;
EGLDeviceEXT device = devices[i];
const char* devExts = eglQueryDeviceStringEXT(device, EGL_EXTENSIONS);
if (devExts) {
std::cout << " Device Extensions: ";
if (std::strlen(devExts))
std::cout << devExts << std::endl;
else
std::cout << "none" << std::endl;
} else {
std::cout << " Failed to retrieve device extensions." << std::endl;
}
for (int j = 0; j < devicePropertiesSize; ++j) {
const auto property = deviceProperties[j];
if (!devExts || strstr(devExts, property.extension) == nullptr)
continue;
switch (property.type) {
case device_property_t::String: {
const char* value = eglQueryDeviceStringEXT(device, property.name);
std::cout << " " << property.displayName << ": " << value << std::endl;
break;
}
case device_property_t::Attribute: {
EGLAttrib attrib;
if (eglQueryDeviceAttribEXT(device, property.name, &attrib) == EGL_FALSE)
break;
std::cout << " " << property.displayName << ": " << attrib << std::endl;
break;
}
}
}
std::cout << std::endl;
}
}