st/mesa: only set primitive_restart when the restart index is in range