<div dir="ltr">On 22 March 2013 13:11, Paul Berry <span dir="ltr"><<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>On 22 March 2013 12:32, Eric Anholt <span dir="ltr"><<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>></span> wrote:<br>
</div></div><div class="gmail_extra"><div class="gmail_quote"><div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Paul Berry <<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a>> writes:<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c<br>
> index c8ca018..7e941dd 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_vs.c<br>
> +++ b/src/mesa/drivers/dri/i965/brw_vs.c<br>
> @@ -66,6 +66,12 @@ brw_compute_vue_map(struct brw_context *brw, struct brw_vs_compile *c,<br>
> vue_map->slots_valid = slots_valid;<br>
> int i;<br>
><br>
> + /* Make sure that the values we store in vue_map->vert_result_to_slot and<br>
> + * vue_map->slot_to_vert_result won't overflow the signed chars that are<br>
> + * used to store them.<br>
> + */<br>
> + STATIC_ASSERT(BRW_VARYING_SLOT_MAX <= 128);<br>
<br>
</div>If the max varying slot was 128, that would be overflowed, right?<br></blockquote><div><br></div></div></div><div>Actually, BRW_VARYING_SLOT_MAX is a misnomer--it's actually the max varying slot + 1. Want me to rename it BRW_NUM_VARYING_SLOT_MAX_PLUS_1 or something?<br>
</div></div></div></div></blockquote><div><br></div><div>Scratch that, I was wrong. The value BRW_VARYING_SLOT_MAX *is* actually used, as a placeholder to mark unused slots (see comments above brw_vue_map::slot_to_varying). If there are no objections, I think I'll take both Eric's original suggestion (changing 128 to 127) and the suggestion to rename BRW_VARYING_SLOT_MAX to BRW_VARYING_SLOT_COUNT. I'll also add additional commentary above the STATIC_ASSERT to explain why comparing to 127 is correct.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>
</div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
With s/128/127/, the series is:<br>
<br>
Reviewed-by: Eric Anholt <<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>><br>
</blockquote></div></div><br></div></div>
</blockquote></div><br></div></div>