GPU_select: utility function to finalize selection
[blender-staging.git] / source / blender / gpu / intern / gpu_select.c
index 632b0cfee1b687de4fbb84abb98253432cfaa23b..e2837d96b0f62f9e2cf1e9bf8459327e8e023f6b 100644 (file)
@@ -149,6 +149,29 @@ bool GPU_select_load_id(unsigned int id)
        }
 }
 
+/**
+ * Needed when GL context of #GPU_select_end
+ * can't be used to finalize selection operations
+ * (because of context changes).
+ */
+void GPU_select_finalize(void)
+{
+       if (!g_select_state.select_is_active)
+               return;
+
+       switch (g_select_state.algorithm) {
+               case ALGO_GL_LEGACY:
+               case ALGO_GL_QUERY:
+               {
+                       break;
+               }
+               default:  /* ALGO_GL_PICK */
+               {
+                       gpu_select_pick_finalize();
+               }
+       }
+}
+
 /**
  * Cleanup and flush selection results to buffer.
  * Return number of hits and hits in buffer.