diff options
author | mano-wii <germano.costa@ig.com.br> | 2019-05-29 00:33:50 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2019-05-29 06:28:13 +0300 |
commit | e0879517025f0e9520d5a01f71950635f7aba7a5 (patch) | |
tree | 7f8ae0076d6c4ba271ab74916fc39f43ea558ae1 /source | |
parent | 2f06a0b14b74c2aa089e8732d716b4dd6acbdd99 (diff) |
Possible fix for T63685: macOS edit mode selection not working on second display
The idea is to force `glReadPixel` to run in the offscreen context.
And don't rely on any rendering context.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 7a95120b273..47d0e97d34b 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2863,7 +2863,19 @@ void DRW_framebuffer_select_id_read(const rcti *rect, uint *r_buf) rcti rect_clamp = *rect; if (BLI_rcti_isect(&r, &rect_clamp, &rect_clamp)) { - GPU_texture_read_rect(g_select_buffer.texture_u32, GPU_DATA_UNSIGNED_INT, &rect_clamp, r_buf); + DRW_opengl_context_enable(); + GPU_framebuffer_bind(g_select_buffer.framebuffer_select_id); + glReadBuffer(GL_COLOR_ATTACHMENT0); + glReadPixels(rect_clamp.xmin, + rect_clamp.ymin, + BLI_rcti_size_x(&rect_clamp), + BLI_rcti_size_y(&rect_clamp), + GL_RED_INTEGER, + GL_UNSIGNED_INT, + r_buf); + + GPU_framebuffer_restore(); + DRW_opengl_context_disable(); if (!BLI_rcti_compare(rect, &rect_clamp)) { GPU_select_buffer_stride_realign(rect, &rect_clamp, r_buf); |