mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-05 10:14:04 +00:00
[client] major restructure of platform specific code
This commit is contained in:
@@ -17,8 +17,5 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// returns the maximum number of multisamples supported by the system
|
||||
int sysinfo_gfx_max_multisample();
|
||||
|
||||
// returns the page size
|
||||
long sysinfo_getPageSize();
|
||||
long sysinfo_getPageSize();
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user