summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2016-07-28 14:41:17 -0700
committerMatt Turner <[email protected]>2016-08-01 12:09:17 -0700
commitbe35c6ba92ec460f3fc2b172c556d9dc3e253fce (patch)
treeda57622fcfb347d948b27eccd5d74f1206033e0f /src/gallium/auxiliary
parent8e68f35d3208b313a106853a85994792446d0b72 (diff)
draw: Avoid aliasing violations.
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/draw/draw_cliptest_tmp.h6
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_clip.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/draw/draw_cliptest_tmp.h b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h
index 6fbefa56bf1..dd57c5678e0 100644
--- a/src/gallium/auxiliary/draw/draw_cliptest_tmp.h
+++ b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h
@@ -25,6 +25,8 @@
*
**************************************************************************/
+#include "util/u_bitcast.h"
+
static boolean TAG(do_cliptest)( struct pt_post_vs *pvs,
struct draw_vertex_info *info,
const struct draw_prim_info *prim_info )
@@ -45,7 +47,7 @@ static boolean TAG(do_cliptest)( struct pt_post_vs *pvs,
draw_current_shader_viewport_index_output(pvs->draw);
int viewport_index =
draw_current_shader_uses_viewport_index(pvs->draw) ?
- *((unsigned*)out->data[viewport_index_output]): 0;
+ u_bitcast_f2u(out->data[viewport_index_output][0]): 0;
int num_written_clipdistance =
draw_current_shader_num_written_clipdistances(pvs->draw);
@@ -72,7 +74,7 @@ static boolean TAG(do_cliptest)( struct pt_post_vs *pvs,
unsigned verts_per_prim = u_vertices_per_prim(prim_info->prim);
/* only change the viewport_index for the leading vertex */
if (!(j % verts_per_prim)) {
- viewport_index = *((unsigned*)out->data[viewport_index_output]);
+ viewport_index = u_bitcast_f2u(out->data[viewport_index_output][0]);
viewport_index = draw_clamp_viewport_idx(viewport_index);
}
scale = pvs->draw->viewports[viewport_index].scale;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c
index 78845ac0450..cf2b41738bf 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
@@ -32,6 +32,7 @@
*/
+#include "util/u_bitcast.h"
#include "util/u_memory.h"
#include "util/u_math.h"
@@ -90,7 +91,7 @@ draw_viewport_index(struct draw_context *draw,
unsigned viewport_index_output =
draw_current_shader_viewport_index_output(draw);
unsigned viewport_index =
- *((unsigned*)leading_vertex->data[viewport_index_output]);
+ u_bitcast_f2u(leading_vertex->data[viewport_index_output][0]);
return draw_clamp_viewport_idx(viewport_index);
} else {
return 0;