- if (!mipmap->Sampler) {
- struct gl_sampler_object *samp_obj;
-
- _mesa_GenSamplers(1, &mipmap->Sampler);
-
- samp_obj = _mesa_lookup_samplerobj(ctx, mipmap->Sampler);
- assert(samp_obj != NULL && samp_obj->Name == mipmap->Sampler);
-
- _mesa_BindSampler(ctx->Texture.CurrentUnit, mipmap->Sampler);
+ if (mipmap->samp_obj == NULL) {
+ mipmap->samp_obj = ctx->Driver.NewSamplerObject(ctx, 0xDEADBEEF);
+ if (mipmap->samp_obj == NULL) {
+ /* This is a bit lazy. Flag out of memory, and then don't bother to
+ * clean up. Once out of memory is flagged, the only realistic next
+ * move is to destroy the context. That will trigger all the right
+ * clean up.
+ */
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenerateMipmap");
+ return;
+ }