st/mesa: fix texture memory allocation bug
authorBrian Paul <brianp@vmware.com>
Wed, 16 Sep 2009 18:57:26 +0000 (12:57 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 16 Sep 2009 18:57:26 +0000 (12:57 -0600)
commitcfa1a0a609daefffc6f8c4087ed0bc34c2665ef4
tree734b4475d44f96831709e8c93155bc35eab1b770
parent2921a2555d0a76fa649b23c31e3264bbc78b2ff5
st/mesa: fix texture memory allocation bug

The following example caused an incorrect GL_OUT_OF_MEMORY error to be
raised in glTexSubImage2D:

   glTexImage2D(level=0, width=32, height=32, pixels=NULL);
   glTexImage2D(level=0, width=64, height=64, pixels=NULL);
   glTexSubImage2D(level=0, pixels!=NULL);

The second glTexImage2D() call needs to cause the first image to be
deallocated then reallocated at the new size.  This was not happening
because we were testing for pixels==NULL too early.
src/mesa/state_tracker/st_cb_texture.c