wgl: Add PFD flags based on stw_winsys callback response
Reviewed-by: Charmaine Lee <charmainel@vmware.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7535>
This commit is contained in:
parent
c28eb3c6aa
commit
acf8af458f
|
@ -38,6 +38,7 @@
|
||||||
#include "stw_device.h"
|
#include "stw_device.h"
|
||||||
#include "stw_pixelformat.h"
|
#include "stw_pixelformat.h"
|
||||||
#include "stw_tls.h"
|
#include "stw_tls.h"
|
||||||
|
#include "stw_winsys.h"
|
||||||
|
|
||||||
|
|
||||||
struct stw_pf_color_info
|
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
|
const unsigned
|
||||||
stw_pf_multisample[] = {
|
stw_pf_multisample[] = {
|
||||||
0,
|
0,
|
||||||
|
@ -128,6 +136,7 @@ stw_pixelformat_add(struct stw_device *stw_dev,
|
||||||
const struct stw_pf_depth_info *depth,
|
const struct stw_pf_depth_info *depth,
|
||||||
unsigned accum,
|
unsigned accum,
|
||||||
boolean doublebuffer,
|
boolean doublebuffer,
|
||||||
|
boolean gdi,
|
||||||
unsigned samples)
|
unsigned samples)
|
||||||
{
|
{
|
||||||
struct stw_pixelformat_info *pfi;
|
struct stw_pixelformat_info *pfi;
|
||||||
|
@ -163,6 +172,9 @@ stw_pixelformat_add(struct stw_device *stw_dev,
|
||||||
if (doublebuffer)
|
if (doublebuffer)
|
||||||
pfi->pfd.dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_EXCHANGE;
|
pfi->pfd.dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_EXCHANGE;
|
||||||
|
|
||||||
|
if (gdi)
|
||||||
|
pfi->pfd.dwFlags |= PFD_SUPPORT_GDI;
|
||||||
|
|
||||||
pfi->pfd.iPixelType = PFD_TYPE_RGBA;
|
pfi->pfd.iPixelType = PFD_TYPE_RGBA;
|
||||||
|
|
||||||
pfi->pfd.cColorBits =
|
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)
|
unsigned num_color_formats, boolean extended)
|
||||||
{
|
{
|
||||||
struct pipe_screen *screen = stw_dev->screen;
|
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 bind_flags = PIPE_BIND_RENDER_TARGET;
|
||||||
unsigned num_added = 0;
|
unsigned num_added = 0;
|
||||||
int force_samples = 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
|
/* 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.
|
* to force all pixel formats to have a particular number of samples.
|
||||||
*/
|
*/
|
||||||
|
@ -273,16 +289,21 @@ add_color_format_variants(const struct stw_pf_color_info *color_formats,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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++) {
|
for (acc = 0; acc < 2; acc++) {
|
||||||
stw_pixelformat_add(stw_dev, extended, &color_formats[cfmt],
|
stw_pixelformat_add(stw_dev, extended, &color_formats[cfmt],
|
||||||
depth,
|
depth, acc * 16, doublebuffer,
|
||||||
acc * 16, doublebuffer, samples);
|
(flag == stw_pfd_gdi_support), samples);
|
||||||
num_added++;
|
num_added++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return num_added;
|
return num_added;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue