Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-04-16 09:51:41 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-04-16 09:51:41 +0300
commitbfb633087b60f28ece96d93becee0141e964c015 (patch)
tree9f5b94c1d1975363403dfc8a3e1fcf3896d78819 /source/blender/editors/space_view3d/view3d_select.c
parent9777cd2b1e65035085d6fe2f9d0f1923a48afe01 (diff)
Fix object/bone select buffer big-endian sorting
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_select.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index c38bcbcd645..6833dac558d 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -55,6 +55,10 @@
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#ifdef __BIG_ENDIAN__
+# include "BLI_endian_switch.h"
+#endif
+
/* vertex box select */
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
@@ -1980,11 +1984,16 @@ static int do_armature_box_select(
* Compare result of 'GPU_select': 'uint[4]',
* needed for when we need to align with object draw-order.
*/
-static int opengl_select_buffer_cmp(const void *sel_a_p, const void *sel_b_p)
+static int opengl_bone_select_buffer_cmp(const void *sel_a_p, const void *sel_b_p)
{
/* 4th element is select id */
- const uint sel_a = ((uint *)sel_a_p)[3];
- const uint sel_b = ((uint *)sel_b_p)[3];
+ uint sel_a = ((uint *)sel_a_p)[3];
+ uint sel_b = ((uint *)sel_b_p)[3];
+
+#ifdef __BIG_ENDIAN__
+ BLI_endian_switch_uint32(&sel_a);
+ BLI_endian_switch_uint32(&sel_b);
+#endif
if (sel_a < sel_b) {
return -1;
@@ -2048,7 +2057,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
col = vbuffer + 3;
/* The draw order doesn't always match the order we populate the engine, see: T51695. */
- qsort(vbuffer, hits, sizeof(uint[4]), opengl_select_buffer_cmp);
+ qsort(vbuffer, hits, sizeof(uint[4]), opengl_bone_select_buffer_cmp);
/*
* Even though 'DRW_draw_select_loop' uses 'DEG_OBJECT_ITER_BEGIN',