Don't over-allocate element buffer

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Fix mismanagement of 'initialized' bitmap memory

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Add vec_alloc helper

This helps us allocate a vector with enough space for a certain number of
objects already in it. We can do this with vec_expand but you have to pass a
cast NULL as the first argument, and forgetting the cast causes weird things to
happen.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Add vec_dup macro

Duplicating an existing vector is our most common use case.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Make uniform settings per-material

When setting a uniform, we now take a material ID. The uniform is only set when
drawing objects with that material ID. States no longer have a material ID, but
we have an active material as well as an active state at any one time. Draw
operations have a set of materials that they will draw, which can be modified
with draw_op_[de]activate_material. Setting a uniform on a draw operation
activates that material automatically. Draw procedures no longer have a
material associated with them at all.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Add vec_add and vec_del macros

The purpose of these is obvious, as is their necessity: several memcpy vs.
memmove errors are removed in the process of this change.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Make build requirements explicit

Checking for dependencies and just silently stripping out features if they
aren't there can actually be somewhat annoying, because you end up not noticing
missing dependencies until you compile and end up with a weird barely-working
library. Let's just make all the dependencies yes-or-no.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Make vec behavior configurable

Our autoconf process now takes --with-vec-base=# and --with-stingy-vecs. Stingy
vecs makes the vec_contract macro actually shrink vecs when it can (it is now a
noop by default). The vec-base parameter lets you set the initial/minimum space
reservation for vecs (it is set as 2^N where N is the number given).

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Move definition of SIZE_T_MAX to util.h

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Introduce material_t type

This isn't so different from the integer material IDs we were using. It is now
of type size_t with SIZE_T_MAX serving as our "null value" instead of -1. It
exports a bit cleaner.

The biggest part of the change is we now require the IDs to be allocated and
freed through us, and check their status. Future work will include sweeping
away traces of a material from all of the states and draw_ops when a material
ID is deallocated.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Update TODO

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Insert missing copyright notices

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Make destroying a material eliminate all traces of it

Eliminating a material makes it disappear from all states and operations now.
We use a deferred processing method for this, so the information gets swept
at the last possible moment.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>