Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-08-17 05:53:35 +0300
committerCampbell Barton <campbell@blender.org>2022-08-17 05:58:17 +0300
commit48da8c40405c3901df87b6388128ca2d73a4f656 (patch)
treefbde3fc7b60f14fb0637967cab7e794ac3a992dc /source/blender/windowmanager/WM_api.h
parent54827bb7cd8bd060a9588b5b0e01eec887c6a971 (diff)
Fix T98462: Save Screenshot (glReadPixels) fails under Wayland
Use an off-screen buffer for the screen-shot operator. Reading from the front-buffer immediately after calling swap-buffers failed for GHOST/Wayland in some cases. While EGL can request to preserve the front-buffer while drawing, this isn't always supported. So workaround the problem by avoiding use of the front-buffer entirely.
Diffstat (limited to 'source/blender/windowmanager/WM_api.h')
-rw-r--r--source/blender/windowmanager/WM_api.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 44c5b86857d..0393be93bb5 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -134,7 +134,24 @@ void WM_window_pixel_sample_read(const wmWindowManager *wm,
const int pos[2],
float r_col[3]);
+/**
+ * Read pixels from the front-buffer (fast).
+ *
+ * \note Internally this depends on the front-buffer state,
+ * for a slower but more reliable method of reading pixels, use #WM_window_pixels_read_offscreen.
+ * Fast pixel access may be preferred for file-save thumbnails.
+ *
+ * \warning Drawing (swap-buffers) immediately before calling this function causes
+ * the front-buffer state to be invalid under some EGL configurations.
+ */
uint *WM_window_pixels_read(struct wmWindowManager *wm, struct wmWindow *win, int r_size[2]);
+/**
+ * Draw the window & read pixels from an off-screen buffer (slower than #WM_window_pixels_read).
+ *
+ * \note This is needed because the state of the front-buffer may be damaged
+ * (see in-line code comments for details).
+ */
+uint *WM_window_pixels_read_offscreen(struct bContext *C, struct wmWindow *win, int r_size[2]);
/**
* Support for native pixel size