#include "multisample.h"
#include "points.h"
#include "polygon.h"
+#include "shared.h"
#include "scissor.h"
#include "stencil.h"
#include "texenv.h"
* deleted while saved in the attribute stack).
*/
struct gl_texture_object *SavedTexRef[MAX_TEXTURE_UNITS][NUM_TEXTURE_TARGETS];
+
+ /* We need to keep a reference to the shared state. That's where the
+ * default texture objects are kept. We don't want that state to be
+ * freed while the attribute stack contains pointers to any default
+ * texture objects.
+ */
+ struct gl_shared_state *SharedRef;
};
}
}
+ _mesa_reference_shared_state(ctx, &texstate->SharedRef, ctx->Shared);
+
_mesa_unlock_context_textures(ctx);
save_attrib_data(&head, GL_TEXTURE_BIT, texstate);
_mesa_ActiveTextureARB(GL_TEXTURE0_ARB + texstate->Texture.CurrentUnit);
+ _mesa_reference_shared_state(ctx, &texstate->SharedRef, NULL);
+
_mesa_unlock_context_textures(ctx);
}
_mesa_reference_texobj(&texstate->SavedTexRef[u][tgt], NULL);
}
}
+ _mesa_reference_shared_state(ctx, &texstate->SharedRef, NULL);
}
else {
/* any other chunks of state that requires special handling? */