Merge branch 'master' into blender2.8
[blender.git] / source / blender / gpu / intern / gpu_select_pick.c
index 703035483dd14325215fd0187da9a39290f02df7..9aff708d32a8c2ae5981c74f90d21e5e6cd3ba08 100644 (file)
@@ -31,6 +31,8 @@
 #include <stdlib.h>
 #include <float.h>
 
+#include "GPU_immediate.h"
+#include "GPU_draw.h"
 #include "GPU_select.h"
 #include "GPU_extensions.h"
 #include "GPU_glew.h"
@@ -317,8 +319,8 @@ void gpu_select_pick_begin(
 
        /* Restrict OpenGL operations for when we don't have cache */
        if (ps->is_cached == false) {
+               gpuPushAttrib(GPU_DEPTH_BUFFER_BIT | GPU_VIEWPORT_BIT);
 
-               glPushAttrib(GL_DEPTH_BUFFER_BIT | GL_VIEWPORT_BIT);
                /* disable writing to the framebuffer */
                glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
 
@@ -335,10 +337,6 @@ void gpu_select_pick_begin(
                        glDepthFunc(GL_LEQUAL);
                }
 
-               /* set just in case */
-               glPixelTransferf(GL_DEPTH_BIAS, 0.0);
-               glPixelTransferf(GL_DEPTH_SCALE, 1.0);
-
                float viewport[4];
                glGetFloatv(GL_SCISSOR_BOX, viewport);
 
@@ -558,7 +556,7 @@ uint gpu_select_pick_end(void)
                        gpu_select_pick_finalize();
                }
 
-               glPopAttrib();
+               gpuPopAttrib();
                glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
        }