[client] major restructure of platform specific code

This commit is contained in:
Geoffrey McRae committed 2021-01-16 20:41:13 +11:00
1 parent 062c4e32cb
commit 27a38294ea
23 files changed
+2120 -2078

No files matched your search

+1 -46
View File
@@ -18,53 +18,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <unistd.h>
#include <GL/glx.h>
int sysinfo_gfx_max_multisample(void)
{
Display * dpy = XOpenDisplay(NULL);
if (!dpy)
return -1;
XVisualInfo queryTemplate;
queryTemplate.screen = 0;
int visualCount;
int maxSamples = -1;
XVisualInfo * visuals = XGetVisualInfo(dpy, VisualScreenMask, &queryTemplate, &visualCount);
for (int i = 0; i < visualCount; i++)
{
XVisualInfo * visual = &visuals[i];
int res, supportsGL;
// Some GLX visuals do not use GL, and these must be ignored in our search.
if ((res = glXGetConfig(dpy, visual, GLX_USE_GL, &supportsGL)) != 0 || !supportsGL)
continue;
int sampleBuffers, samples;
if ((res = glXGetConfig(dpy, visual, GLX_SAMPLE_BUFFERS, &sampleBuffers)) != 0)
continue;
// Will be 1 if this visual supports multisampling
if (sampleBuffers != 1)
continue;
if ((res = glXGetConfig(dpy, visual, GLX_SAMPLES, &samples)) != 0)
continue;
// Track the largest number of samples supported
if (samples > maxSamples)
maxSamples = samples;
}
XCloseDisplay(dpy);
return maxSamples;
}
long sysinfo_getPageSize(void)
{
return sysconf(_SC_PAGESIZE);
}
}