summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_context.c
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2013-06-10 23:36:59 -0400
committerZack Rusin <zackr@vmware.com>2013-06-13 12:13:11 -0400
commit5507c11f85dda4fbcdc9b36494551c933471a070 (patch)
treeded8a6152801200b5b6d79f02a180f838e7af763 /src/gallium/auxiliary/draw/draw_context.c
parentb63eeaf7b7df83a2c52c5ddb701454fd8a49b987 (diff)
downloadexternal_mesa3d-5507c11f85dda4fbcdc9b36494551c933471a070.tar.gz
external_mesa3d-5507c11f85dda4fbcdc9b36494551c933471a070.tar.bz2
external_mesa3d-5507c11f85dda4fbcdc9b36494551c933471a070.zip
gallium/draw: add limits to the clip and cull distances
There are strict limits on those registers. Define the maximums and use them instead of magic numbers. Also allows us to add some extra sanity checks. Suggested by Brian. Signed-off-by: Zack Rusin <zackr@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_context.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 0dbddb4511..22c0e9be99 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -738,6 +738,7 @@ draw_current_shader_clipvertex_output(const struct draw_context *draw)
uint
draw_current_shader_clipdistance_output(const struct draw_context *draw, int index)
{
+ debug_assert(index < PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
if (draw->gs.geometry_shader)
return draw->gs.geometry_shader->clipdistance_output[index];
return draw->vs.clipdistance_output[index];
@@ -756,6 +757,7 @@ draw_current_shader_num_written_clipdistances(const struct draw_context *draw)
uint
draw_current_shader_culldistance_output(const struct draw_context *draw, int index)
{
+ debug_assert(index < PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
if (draw->gs.geometry_shader)
return draw->gs.geometry_shader->culldistance_output[index];
return draw->vs.vertex_shader->culldistance_output[index];