[Bf-codereview] [PATCH] Fix FDO 34495: Selecting objects in Blender slow due to GL_SELECT

Antony Riakiotakis kalast at gmail.com
Mon Sep 7 08:09:02 CEST 2015


Hi,

We use color coding in edit mode, and it might be good to generalize
this to other modes as well. Occlusion queries are still useful if one
would like to get a list of all objects under the mouse cursor (we
need that when doing alt-select) where color coding would only get the
nearest one, and we also use it to cycle through objects under the
mouse when mouse stays at the same point on screen.
There has been some discussion about removing reliance to OpenGL and
use ray tracing even but for pixel-perfect selection I think OpenGL is
the way to go.

By the way, using the bf-developers list is better for such
discussions, bf-codereview is obsolete now, with last discussion over
a year ago. It was used for our old code review system which has been
moved to phabricator now.

On 7 September 2015 at 08:15, Laura Ekstrand <laura at jlekstrand.net> wrote:
> Hi Antony,
>
> Ah, ok, I see.
>
> GL select is a very ill-defined part of the GL 1.0 spec, which is why driver
> developers are reluctant to optimize it.  I collaborate on the Mesa project,
> and some of the other developers thought it would be a good idea for me to
> try to see if I can help with Blender's GL usage in any way.  It would be
> helpful to us and Blender both if we could get Blender running on OpenGL
> core 3.0.  I'm completely new to the Blender project (I've used Blender a
> little), so I'm not sure how much work there is to do toward this goal.
>
> Have you tried any other strategies besides GL select and occlusion queries?
> In my master's thesis, I used a common technique to make selections whereby
> you color-code each selectable object with a different value and read back
> the color to tell which object was picked.  It's kind of like this:
> http://content.gpwiki.org/OpenGL_Selection_Using_Unique_Color_IDs, only I
> used shaders and painted each object or fragment with a different value to
> get a fine-grained result.
>
> Thanks.
>
> Laura
>
> On Fri, Sep 4, 2015 at 11:40 PM, Antony Riakiotakis <kalast at gmail.com>
> wrote:
>>
>> Hi Laura, the two modes are not equivalent. GL Select is more precise
>> than occlusion queries, that's why we tend to prefer one over the
>> other.
>>
>> On 5 September 2015 at 06:45, Laura Ekstrand <laura at jlekstrand.net> wrote:
>> > Refer to bug: https://bugs.freedesktop.org/show_bug.cgi?id=34495,
>> > Comment 78
>> >
>> > The default selection mode (File > User Preferences > System >
>> > Selection) of
>> > Automatic preferred using glRenderMode(GL_SELECT) unless the user's GPU
>> > was an
>> > ATI. Since glRenderMode(GL_SELECT) is deprecated, driver developers rely
>> > on
>> > software fallbacks for its implementation.  These software fallbacks are
>> > slow.
>> >
>> > Since all drivers (including all open source drivers) now implement
>> > GL_ARB_OCCLUSION_QUERY, this patch sets the selection mode to always
>> > use occlusion query unless:
>> >
>> > 1. GL_ARB_OCCLUSION_QUERY is not present in the driver, or
>> > 2. The user has selected the GL_SELECT selection mode manually using
>> > File >
>> > User Preferences > System > Selection.
>> > ---
>> >  source/blender/gpu/intern/gpu_select.c | 3 +--
>> >  1 file changed, 1 insertion(+), 2 deletions(-)
>> >
>> > diff --git a/source/blender/gpu/intern/gpu_select.c
>> > b/source/blender/gpu/intern/gpu_select.c
>> > index 4978229..0d0dd33 100644
>> > --- a/source/blender/gpu/intern/gpu_select.c
>> > +++ b/source/blender/gpu/intern/gpu_select.c
>> > @@ -243,6 +243,5 @@ bool GPU_select_query_check_support(void)
>> >  bool GPU_select_query_check_active(void)
>> >  {
>> >         return GLEW_ARB_occlusion_query &&
>> > -              ((U.gpu_select_method == USER_SELECT_USE_OCCLUSION_QUERY)
>> > ||
>> > -               ((U.gpu_select_method == USER_SELECT_AUTO) &&
>> > GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)));
>> > +               (U.gpu_select_method !=
>> > USER_SELECT_USE_SELECT_RENDERMODE);
>> >  }
>> > --
>> > 2.4.3
>> >
>> > _______________________________________________
>> > Bf-codereview mailing list
>> > Bf-codereview at blender.org
>> > http://lists.blender.org/mailman/listinfo/bf-codereview
>> _______________________________________________
>> Bf-codereview mailing list
>> Bf-codereview at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-codereview
>
>
>
> _______________________________________________
> Bf-codereview mailing list
> Bf-codereview at blender.org
> http://lists.blender.org/mailman/listinfo/bf-codereview
>


More information about the Bf-codereview mailing list