From 7b7af7d1d5d82ee2162feaeee8f3805fe072fdc8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 27 Jul 2023 21:25:15 +1000 Subject: [PATCH] Fix vertex paint color sample on some GPU's under Wayland Support sampling vertex colors when WM_CAPABILITY_GPU_FRONT_BUFFER_READ isn't supported (see #106264). --- source/blender/editors/sculpt_paint/paint_utils.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/sculpt_paint/paint_utils.cc b/source/blender/editors/sculpt_paint/paint_utils.cc index 3d7201eb10a..d38a485dbe2 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.cc +++ b/source/blender/editors/sculpt_paint/paint_utils.cc @@ -549,15 +549,16 @@ void paint_sample_color( /* No sample found; sample directly from the GPU front buffer. */ { - float rgba_f[4]; - GPU_frontbuffer_read_color( - x + region->winrct.xmin, y + region->winrct.ymin, 1, 1, 4, GPU_DATA_FLOAT, &rgba_f); - + float rgb_fl[3]; + WM_window_pixels_read_sample(C, + CTX_wm_window(C), + blender::int2(x + region->winrct.xmin, y + region->winrct.ymin), + rgb_fl); if (use_palette) { - copy_v3_v3(color->rgb, rgba_f); + copy_v3_v3(color->rgb, rgb_fl); } else { - BKE_brush_color_set(scene, br, rgba_f); + BKE_brush_color_set(scene, br, rgb_fl); } } }