From 07c29d1c1cf7d9f2aaa93550a2a50dea4c40a69a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 13 May 2021 21:41:51 +0200 Subject: [PATCH] Skip initial buffer swap when single-buffered This skips the buffer swap after the initial glClear performed during window creation, if the window is single-buffered. This call confused apitrace into thinking the window was double-buffered. Fixes #1873. (cherry picked from commit 184377b493cd382485914624b30574cfd39216ba) --- README.md | 1 + src/context.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 493568f2..a7e8460e 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,7 @@ information on what to include when reporting a bug. ## Changelog + - Bugfix: Buffers were swapped at creation on single-buffered windows (#1873) - [Win32] Bugfix: `USE_MSVC_RUNTIME_LIBRARY_DLL` had no effect on CMake 3.15 or later (#1783,#1796) - [Win32] Bugfix: Compilation with LLVM for Windows failed (#1807,#1824,#1874) diff --git a/src/context.c b/src/context.c index 867e399f..647a9942 100644 --- a/src/context.c +++ b/src/context.c @@ -570,7 +570,9 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window, PFNGLCLEARPROC glClear = (PFNGLCLEARPROC) window->context.getProcAddress("glClear"); glClear(GL_COLOR_BUFFER_BIT); - window->context.swapBuffers(window); + + if (window->doublebuffer) + window->context.swapBuffers(window); } glfwMakeContextCurrent((GLFWwindow*) previous);