From 85d65418c145b2b809498122d0d2bb75e4a96573 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Thu, 26 Oct 2023 19:58:05 +0200 Subject: sokol_gfx.h gl win32: important regression fix in GL context setup --- CHANGELOG.md | 8 ++++++++ README.md | 2 +- sokol_app.h | 9 +++------ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b0c3fa5..d920f373 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ ## Updates +#### 26-Oct-2023 + +- sokol_app.h gl: fix a regression introduced in https://github.com/floooh/sokol/pull/916 + which could select the wrong framebuffer pixel format and break rendering + on some GL drivers (in my case: an older Intel GPU). + + If you are using the GL backend on Windows, please make sure to upgrade! + #### 23-Oct-2023 - sokol_app.h gl: some further startup optimizations in the WGL code path diff --git a/README.md b/README.md index b9db2ba8..50947d61 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Simple [STB-style](https://github.com/nothings/stb/blob/master/docs/stb_howto.txt) cross-platform libraries for C and C++, written in C. -[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**21-Oct-2023** WebGPU!) +[**See what's new**](https://github.com/floooh/sokol/blob/master/CHANGELOG.md) (**26-Oct-2023** IMPORTANT REGRESSION FIX FOR GL ON WINDOWS!) [![Build](/../../actions/workflows/main.yml/badge.svg)](/../../actions/workflows/main.yml) [![Bindings](/../../actions/workflows/gen_bindings.yml/badge.svg)](/../../actions/workflows/gen_bindings.yml) [![build](https://github.com/floooh/sokol-zig/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-zig/actions/workflows/main.yml) [![build](https://github.com/floooh/sokol-nim/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-nim/actions/workflows/main.yml) [![Odin](https://github.com/floooh/sokol-odin/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-odin/actions/workflows/main.yml)[![Rust](https://github.com/floooh/sokol-rust/actions/workflows/main.yml/badge.svg)](https://github.com/floooh/sokol-rust/actions/workflows/main.yml) diff --git a/sokol_app.h b/sokol_app.h index 3b6602b0..3b811607 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -6799,8 +6799,6 @@ _SOKOL_PRIVATE int _sapp_wgl_find_pixel_format(void) { desired.samples = (_sapp.sample_count > 1) ? _sapp.sample_count : 0; int pixel_format = 0; - _sapp_gl_fbconfig u; - _sapp_gl_init_fbconfig(&u); _sapp_gl_fbselect fbselect; _sapp_gl_init_fbselect(&fbselect); @@ -6816,16 +6814,15 @@ _SOKOL_PRIVATE int _sapp_wgl_find_pixel_format(void) { continue; } + _sapp_gl_fbconfig u; + _sapp_clear(&u, sizeof(u)); u.red_bits = query_results[result_red_bits_index]; u.green_bits = query_results[result_green_bits_index]; u.blue_bits = query_results[result_blue_bits_index]; u.alpha_bits = query_results[result_alpha_bits_index]; u.depth_bits = query_results[result_depth_bits_index]; u.stencil_bits = query_results[result_stencil_bits_index]; - if (query_results[result_double_buffer_index]) { - u.doublebuffer = true; - } - + u.doublebuffer = 0 != query_results[result_double_buffer_index]; u.samples = query_results[result_samples_index]; // NOTE: If arb_multisample is not supported - just takes the default 0 // Test if this pixel format is better than the previous one -- cgit v1.2.3