diff --git a/src/gallium/frontends/wgl/stw_pixelformat.c b/src/gallium/frontends/wgl/stw_pixelformat.c index dc922afd140..a494aa2b1d7 100644 --- a/src/gallium/frontends/wgl/stw_pixelformat.c +++ b/src/gallium/frontends/wgl/stw_pixelformat.c @@ -38,6 +38,7 @@ #include "stw_device.h" #include "stw_pixelformat.h" #include "stw_tls.h" +#include "stw_winsys.h" struct stw_pf_color_info @@ -112,6 +113,13 @@ stw_pf_doublebuffer[] = { }; +static const stw_pfd_flag +stw_pf_flag[] = { + stw_pfd_double_buffer, + stw_pfd_gdi_support, +}; + + const unsigned stw_pf_multisample[] = { 0, @@ -128,6 +136,7 @@ stw_pixelformat_add(struct stw_device *stw_dev, const struct stw_pf_depth_info *depth, unsigned accum, boolean doublebuffer, + boolean gdi, unsigned samples) { struct stw_pixelformat_info *pfi; @@ -163,6 +172,9 @@ stw_pixelformat_add(struct stw_device *stw_dev, 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 = @@ -229,11 +241,15 @@ add_color_format_variants(const struct stw_pf_color_info *color_formats, 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. */ @@ -273,11 +289,16 @@ add_color_format_variants(const struct stw_pf_color_info *color_formats, 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++; + } } } }