From c432fbe534d1b1d3874b612b97d8ed3fe97c8945 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Wed, 7 Feb 2024 10:55:32 -0800 Subject: [PATCH] wgl: Add no-gdi-single-buffered and gdi-double-buffered PFDs Reviewed-by: Sil Vilerino Reviewed-by: Jose Fonseca Part-of: --- src/gallium/frontends/wgl/stw_pixelformat.c | 49 +++++++++------------ 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/src/gallium/frontends/wgl/stw_pixelformat.c b/src/gallium/frontends/wgl/stw_pixelformat.c index 461e11a5b1e..adf72c19502 100644 --- a/src/gallium/frontends/wgl/stw_pixelformat.c +++ b/src/gallium/frontends/wgl/stw_pixelformat.c @@ -107,18 +107,12 @@ stw_pf_depth_stencil[] = { { PIPE_FORMAT_S8_UINT_Z24_UNORM, {24, 8} } }; - -static const bool -stw_pf_doublebuffer[] = { - false, - true, -}; - - static const stw_pfd_flag stw_pf_flag[] = { + 0, stw_pfd_double_buffer, stw_pfd_gdi_support, + stw_pfd_double_buffer | stw_pfd_gdi_support, }; @@ -247,7 +241,7 @@ add_color_format_variants(const struct stw_pf_color_info *color_formats, unsigned num_color_formats, bool extended) { struct pipe_screen *screen = stw_dev->screen; - unsigned cfmt, ms, db, ds, acc, f; + unsigned cfmt, ms, ds, acc, f; unsigned bind_flags = PIPE_BIND_RENDER_TARGET; unsigned num_added = 0; int force_samples = 0; @@ -292,29 +286,26 @@ add_color_format_variants(const struct stw_pf_color_info *color_formats, continue; } - for (db = 0; db < ARRAY_SIZE(stw_pf_doublebuffer); db++) { - unsigned doublebuffer = stw_pf_doublebuffer[db]; + for (ds = 0; ds < ARRAY_SIZE(stw_pf_depth_stencil); ds++) { + const struct stw_pf_depth_info *depth = &stw_pf_depth_stencil[ds]; - for (ds = 0; ds < ARRAY_SIZE(stw_pf_depth_stencil); ds++) { - const struct stw_pf_depth_info *depth = &stw_pf_depth_stencil[ds]; + if (!screen->is_format_supported(screen, depth->format, + PIPE_TEXTURE_2D, samples, + samples, + PIPE_BIND_DEPTH_STENCIL)) { + continue; + } - if (!screen->is_format_supported(screen, depth->format, - PIPE_TEXTURE_2D, samples, - samples, - PIPE_BIND_DEPTH_STENCIL)) { + for (f = 0; f < ARRAY_SIZE(stw_pf_flag); f++) { + stw_pfd_flag flag = stw_pf_flag[f]; + if ((supported_flags & flag) != flag) 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++) { - stw_pixelformat_add(stw_dev, extended, &color_formats[cfmt], - depth, acc * 16, doublebuffer, - (flag == stw_pfd_gdi_support), samples); - num_added++; - } + for (acc = 0; acc < 2; acc++) { + stw_pixelformat_add(stw_dev, extended, &color_formats[cfmt], + depth, acc * 16, + (flag & stw_pfd_double_buffer) != 0, + (flag == stw_pfd_gdi_support) != 0, samples); + num_added++; } } }