summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_gs.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_gs.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_gs.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_gs.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index b762dd6cb5..cd63e2bf9e 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -792,13 +792,13 @@ draw_create_geometry_shader(struct draw_context *draw,
if (gs->info.output_semantic_name[i] == TGSI_SEMANTIC_VIEWPORT_INDEX)
gs->viewport_index_output = i;
if (gs->info.output_semantic_name[i] == TGSI_SEMANTIC_CLIPDIST) {
- if (gs->info.output_semantic_index[i] == 0)
- gs->clipdistance_output[0] = i;
- else
- gs->clipdistance_output[1] = i;
+ debug_assert(gs->info.output_semantic_index[i] <
+ PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
+ gs->clipdistance_output[gs->info.output_semantic_index[i]] = i;
}
if (gs->info.output_semantic_name[i] == TGSI_SEMANTIC_CULLDIST) {
- debug_assert(gs->info.output_semantic_index[i] < Elements(gs->culldistance_output));
+ debug_assert(gs->info.output_semantic_index[i] <
+ PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
gs->culldistance_output[gs->info.output_semantic_index[i]] = i;
}
}