Preferences: remove OpenGL select method preference.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 16 Jan 2019 14:18:44 +0000 (15:18 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 16 Jan 2019 15:16:42 +0000 (16:16 +0100)
Deprecated GL_SELECT no longer works in OpenGL core profile, so there is no
reason to have this.

release/scripts/startup/bl_ui/space_userpref.py
source/blender/editors/space_view3d/view3d_view.c
source/blender/gpu/GPU_select.h
source/blender/gpu/intern/gpu_select.c
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/intern/rna_userdef.c
source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c

index 5435d0a90fd25855a97c4eed537e15aa5b10430b..427bdd78ea58a912090ec86da559a3bc4b9b588b 100644 (file)
@@ -667,7 +667,6 @@ class USERPREF_PT_system_opengl_selection(PreferencePanel):
 
         flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
 
-        flow.prop(system, "select_method", text="Selection Method")
         flow.prop(system, "use_select_pick_depth")
 
 
index 6945ba271099ae2bf098f2cb0d712e2e04adc932..9abc0d4f5534a06d97c63bcb621bdaba61802191 100644 (file)
@@ -949,8 +949,7 @@ int view3d_opengl_select(
        const bool is_pick_select = (U.gpu_select_pick_deph != 0);
        const bool do_passes = (
                (is_pick_select == false) &&
-               (select_mode == VIEW3D_SELECT_PICK_NEAREST) &&
-               GPU_select_query_check_active());
+               (select_mode == VIEW3D_SELECT_PICK_NEAREST));
        const bool use_nearest = (is_pick_select && select_mode == VIEW3D_SELECT_PICK_NEAREST);
        bool draw_surface = true;
 
index f1342a1f6b886a9656eb378bd1c8516191f291ae..c6e6b0658b984e08d46766433f48c0191270d6c7 100644 (file)
@@ -49,7 +49,6 @@ void GPU_select_begin(unsigned int *buffer, unsigned int bufsize, const struct r
 bool GPU_select_load_id(unsigned int id);
 void GPU_select_finalize(void);
 unsigned int GPU_select_end(void);
-bool GPU_select_query_check_active(void);
 
 /* cache selection region */
 bool GPU_select_is_cached(void);
index 1c0e7ed4c1ca1613b62756dea5112f684fc106be..1eae90ff2a511920f709cfb166336c62cef44dfa 100644 (file)
@@ -26,8 +26,8 @@
 /** \file blender/gpu/intern/gpu_select.c
  *  \ingroup gpu
  *
- * Interface for accessing gpu-related methods for selection. The semantics will be
- * similar to glRenderMode(GL_SELECT) since the goal is to maintain compatibility.
+ * Interface for accessing gpu-related methods for selection. The semantics are
+ * similar to glRenderMode(GL_SELECT) from older OpenGL versions.
  */
 #include <stdlib.h>
 
 
 /* Internal algorithm used */
 enum {
-       /** GL_SELECT, legacy OpenGL selection */
-       ALGO_GL_LEGACY = 1,
        /** glBegin/EndQuery(GL_SAMPLES_PASSED... ), `gpu_select_query.c`
         * Only sets 4th component (ID) correctly. */
-       ALGO_GL_QUERY = 2,
+       ALGO_GL_QUERY = 1,
        /** Read depth buffer for every drawing pass and extract depths, `gpu_select_pick.c`
         * Only sets 4th component (ID) correctly. */
-       ALGO_GL_PICK = 3,
+       ALGO_GL_PICK = 2,
 };
 
 typedef struct GPUSelectState {
        /* To ignore selection id calls when not initialized */
        bool select_is_active;
-       /* flag to cache user preference for occlusion based selection */
-       bool use_gpu_select;
        /* mode of operation */
        char mode;
        /* internal algorithm for selection */
@@ -82,29 +78,16 @@ void GPU_select_begin(uint *buffer, uint bufsize, const rcti *input, char mode,
        }
 
        g_select_state.select_is_active = true;
-       g_select_state.use_gpu_select = GPU_select_query_check_active();
        g_select_state.mode = mode;
 
        if (ELEM(g_select_state.mode, GPU_SELECT_PICK_ALL, GPU_SELECT_PICK_NEAREST)) {
                g_select_state.algorithm = ALGO_GL_PICK;
        }
-       else if (!g_select_state.use_gpu_select) {
-               g_select_state.algorithm = ALGO_GL_LEGACY;
-       }
        else {
                g_select_state.algorithm = ALGO_GL_QUERY;
        }
 
        switch (g_select_state.algorithm) {
-               case ALGO_GL_LEGACY:
-               {
-                       g_select_state.use_cache = false;
-                       glSelectBuffer(bufsize, (GLuint *)buffer);
-                       glRenderMode(GL_SELECT);
-                       glInitNames();
-                       glPushName(-1);
-                       break;
-               }
                case ALGO_GL_QUERY:
                {
                        g_select_state.use_cache = false;
@@ -133,11 +116,6 @@ bool GPU_select_load_id(uint id)
                return true;
 
        switch (g_select_state.algorithm) {
-               case ALGO_GL_LEGACY:
-               {
-                       glLoadName(id);
-                       return true;
-               }
                case ALGO_GL_QUERY:
                {
                        return gpu_select_query_load_id(id);
@@ -159,12 +137,6 @@ uint GPU_select_end(void)
        uint hits = 0;
 
        switch (g_select_state.algorithm) {
-               case ALGO_GL_LEGACY:
-               {
-                       glPopName();
-                       hits = glRenderMode(GL_RENDER);
-                       break;
-               }
                case ALGO_GL_QUERY:
                {
                        hits = gpu_select_query_end();
@@ -182,14 +154,6 @@ uint GPU_select_end(void)
        return hits;
 }
 
-/**
- * has user activated?
- */
-bool GPU_select_query_check_active(void)
-{
-       return ELEM(U.gpu_select_method, USER_SELECT_USE_OCCLUSION_QUERY, USER_SELECT_AUTO);
-}
-
 /* ----------------------------------------------------------------------------
  * Caching
  *
index be172d6d4181edab0352af5e736e774ec1e86e34..f27166775936f4b9934155055b78c6cfd4973daf 100644 (file)
@@ -683,9 +683,8 @@ typedef struct UserDef {
        char  ipo_new;
        /** Handle types for newly added keyframes. */
        char  keyhandles_new;
-       char  gpu_select_method;
        char  gpu_select_pick_deph;
-       char  pad0;
+       char  pad0[2];
        /** #eZoomFrame_Mode. */
        char  view_frame_type;
 
@@ -996,13 +995,6 @@ typedef enum eDupli_ID_Flags {
        USER_DUP_PSYS                   = (1 << 11),
 } eDupli_ID_Flags;
 
-/* selection method for opengl gpu_select_method */
-typedef enum eOpenGL_SelectOptions {
-       USER_SELECT_AUTO = 0,
-       USER_SELECT_USE_OCCLUSION_QUERY = 1,
-       USER_SELECT_USE_SELECT_RENDERMODE = 2,
-} eOpenGL_SelectOptions;
-
 /* max anti alias draw method UserDef.gpu_viewport_antialias */
 typedef enum eOpenGL_AntiAliasMethod {
        USER_AA_NONE  = 0,
index 12de47acd1fefc12021fbd45f73a26d10ff8a103..e0a15422b298376adcce495f635add797168102c 100644 (file)
@@ -4354,13 +4354,6 @@ static void rna_def_userdef_system(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
-       static const EnumPropertyItem gpu_select_method_items[] = {
-           {USER_SELECT_AUTO, "AUTO", 0, "Automatic", ""},
-           {USER_SELECT_USE_SELECT_RENDERMODE, "GL_SELECT", 0, "OpenGL Select", ""},
-           {USER_SELECT_USE_OCCLUSION_QUERY, "GL_QUERY", 0, "OpenGL Occlusion Queries", ""},
-           {0, NULL, 0, NULL, NULL}
-       };
-
        srna = RNA_def_struct(brna, "PreferencesSystem", NULL);
        RNA_def_struct_sdna(srna, "UserDef");
        RNA_def_struct_nested(brna, srna, "Preferences");
@@ -4503,12 +4496,6 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 
        /* Select */
 
-       prop = RNA_def_property(srna, "select_method", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_sdna(prop, NULL, "gpu_select_method");
-       RNA_def_property_enum_items(prop, gpu_select_method_items);
-       RNA_def_property_ui_text(prop, "Selection Method",
-                                "Use OpenGL occlusion queries or selection render mode to accelerate selection");
-
        prop = RNA_def_property(srna, "use_select_pick_depth", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "gpu_select_pick_deph", 1);
        RNA_def_property_ui_text(prop, "OpenGL Depth Picking", "Use the depth buffer for picking 3D View selection");
index 48e5ac5a0725b7729cacf18447a10e80856e9ccb..68c736404e8b468ec692798949ed71546f93de1c 100644 (file)
@@ -520,22 +520,18 @@ static int gizmo_find_intersected_3d_intern(
        /* Almost certainly overkill, but allow for many custom gizmos. */
        GLuint buffer[MAXPICKBUF];
        short hits;
-       const bool do_passes = GPU_select_query_check_active();
 
        BLI_rcti_init_pt_radius(&rect, co, hotspot);
 
        ED_view3d_draw_setup_view(CTX_wm_window(C), CTX_data_depsgraph(C), CTX_data_scene(C), ar, v3d, NULL, NULL, &rect);
 
-       if (do_passes)
-               GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, GPU_SELECT_NEAREST_FIRST_PASS, 0);
-       else
-               GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, GPU_SELECT_ALL, 0);
+       GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, GPU_SELECT_NEAREST_FIRST_PASS, 0);
        /* do the drawing */
        gizmo_draw_select_3D_loop(C, visible_gizmos, gz_stop);
 
        hits = GPU_select_end();
 
-       if (do_passes && (hits > 0)) {
+       if (hits > 0) {
                GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, GPU_SELECT_NEAREST_SECOND_PASS, hits);
                gizmo_draw_select_3D_loop(C, visible_gizmos, gz_stop);
                GPU_select_end();