memcpy(&head->Texture.FixedFuncUnit, &ctx->Texture.FixedFuncUnit,
sizeof(ctx->Texture.FixedFuncUnit));
- /* Save references to the currently bound texture objects so they don't
- * accidentally get deleted while referenced in the attribute stack.
- */
- for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
- _mesa_reference_texobj(&head->Texture.SavedTexRef[u][tex],
- ctx->Texture.Unit[u].CurrentTex[tex]);
- }
- }
-
/* copy state/contents of the currently bound texture objects */
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
head->Texture.LodBias[u] = ctx->Texture.Unit[u].LodBias;
sizeof(savedObj->Sampler.Attrib));
memcpy(&texObj->Attrib, &savedObj->Attrib, sizeof(savedObj->Attrib));
}
-
- /* remove saved references to the texture objects */
- for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
- _mesa_reference_texobj(&texstate->SavedTexRef[u][tgt], NULL);
- }
}
if (!ctx->Driver.TexEnv && !ctx->Driver.TexGen) {
ctx->AttribStackDepth--;
attr = &ctx->AttribStack[ctx->AttribStackDepth];
- if (attr->Mask & GL_TEXTURE_BIT) {
- /* clear references to the saved texture objects */
- for (unsigned u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- for (unsigned tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
- _mesa_reference_texobj(&attr->Texture.SavedTexRef[u][tgt], NULL);
- }
- }
+ if (attr->Mask & GL_TEXTURE_BIT)
_mesa_reference_shared_state(ctx, &attr->Texture.SharedRef, NULL);
- }
}
}
/** to save per texture object state (wrap modes, filters, etc): */
struct gl_texture_object SavedObj[MAX_TEXTURE_UNITS][NUM_TEXTURE_TARGETS];
- /**
- * To save references to texture objects (so they don't get accidentally
- * 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