#include "stw_device.h"
#include "stw_pixelformat.h"
#include "stw_tls.h"
+#include "stw_winsys.h"
struct stw_pf_color_info
};
+static const stw_pfd_flag
+stw_pf_flag[] = {
+ stw_pfd_double_buffer,
+ stw_pfd_gdi_support,
+};
+
+
const unsigned
stw_pf_multisample[] = {
0,
const struct stw_pf_depth_info *depth,
unsigned accum,
boolean doublebuffer,
+ boolean gdi,
unsigned samples)
{
struct stw_pixelformat_info *pfi;
if (doublebuffer)
pfi->pfd.dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_EXCHANGE;
+ if (gdi)
+ pfi->pfd.dwFlags |= PFD_SUPPORT_GDI;
+
pfi->pfd.iPixelType = PFD_TYPE_RGBA;
pfi->pfd.cColorBits =
unsigned num_color_formats, boolean extended)
{
struct pipe_screen *screen = stw_dev->screen;
- unsigned cfmt, ms, db, ds, acc;
+ unsigned cfmt, ms, db, ds, acc, f;
unsigned bind_flags = PIPE_BIND_RENDER_TARGET;
unsigned num_added = 0;
int force_samples = 0;
+ unsigned supported_flags = 0;
+ if (stw_dev->stw_winsys && stw_dev->stw_winsys->get_pfd_flags)
+ supported_flags = stw_dev->stw_winsys->get_pfd_flags(screen);
+
/* Since GLUT for Windows doesn't support MSAA we have an env var
* to force all pixel formats to have a particular number of samples.
*/
continue;
}
- for (acc = 0; acc < 2; acc++) {
- stw_pixelformat_add(stw_dev, extended, &color_formats[cfmt],
- depth,
- acc * 16, doublebuffer, samples);
- num_added++;
+ for (f = 0; f < ARRAY_SIZE(stw_pf_flag); f++) {
+ stw_pfd_flag flag = stw_pf_flag[f];
+ if (!(supported_flags & flag) || (flag == stw_pfd_double_buffer && !doublebuffer))
+ continue;
+ for (acc = 0; acc < 2; acc++) {
+ stw_pixelformat_add(stw_dev, extended, &color_formats[cfmt],
+ depth, acc * 16, doublebuffer,
+ (flag == stw_pfd_gdi_support), samples);
+ num_added++;
+ }
}
}
}