-/* $Id: teximage.c,v 1.71 2001/02/06 21:42:48 brianp Exp $ */
+/* $Id: teximage.c,v 1.72 2001/02/06 23:35:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
/*
+ * Reset the fields of a gl_texture_image struct to zero.
* This is called when a proxy texture test fails, we set all the
* image members (except DriverData) to zero.
+ * It's also used in glTexImage[123]D as a safeguard to be sure all
+ * required fields get initialized properly by the Driver.TexImage[123]D
+ * functions.
*/
static void
-clear_proxy_teximage(struct gl_texture_image *img)
+clear_teximage_fields(struct gl_texture_image *img)
{
ASSERT(img);
img->Format = 0;
img->Data = NULL;
img->IsCompressed = 0;
img->CompressedSize = 0;
+ img->FetchTexel = NULL;
}
FREE(texImage->Data);
texImage->Data = NULL;
}
+ clear_teximage_fields(texImage); /* not really needed, but helpful */
if (ctx->NewState & _NEW_PIXEL)
gl_update_state(ctx);
}
}
+ /* one of these has to be non-zero! */
+ ASSERT(texImage->RedBits || texImage->IndexBits || texImage->AlphaBits ||
+ texImage->LuminanceBits || texImage->IntensityBits);
+ ASSERT(texImage->FetchTexel);
+
/* state update */
texObj->Complete = GL_FALSE;
ctx->NewState |= _NEW_TEXTURE;
if (error) {
/* if error, clear all proxy texture image parameters */
if (level >= 0 && level < ctx->Const.MaxTextureLevels) {
- clear_proxy_teximage(ctx->Texture.Proxy1D->Image[level]);
+ clear_teximage_fields(ctx->Texture.Proxy1D->Image[level]);
}
}
}
FREE(texImage->Data);
texImage->Data = NULL;
}
+ clear_teximage_fields(texImage); /* not really needed, but helpful */
if (ctx->NewState & _NEW_PIXEL)
gl_update_state(ctx);
}
}
+ /* one of these has to be non-zero! */
+ ASSERT(texImage->RedBits || texImage->IndexBits || texImage->AlphaBits ||
+ texImage->LuminanceBits || texImage->IntensityBits);
+ ASSERT(texImage->FetchTexel);
+
/* state update */
texObj->Complete = GL_FALSE;
ctx->NewState |= _NEW_TEXTURE;
if (error) {
/* if error, clear all proxy texture image parameters */
if (level >= 0 && level < ctx->Const.MaxTextureLevels) {
- clear_proxy_teximage(ctx->Texture.Proxy2D->Image[level]);
+ clear_teximage_fields(ctx->Texture.Proxy2D->Image[level]);
}
}
}
FREE(texImage->Data);
texImage->Data = NULL;
}
+ clear_teximage_fields(texImage); /* not really needed, but helpful */
if (ctx->NewState & _NEW_PIXEL)
gl_update_state(ctx);
}
}
+ /* one of these has to be non-zero! */
+ ASSERT(texImage->RedBits || texImage->IndexBits || texImage->AlphaBits ||
+ texImage->LuminanceBits || texImage->IntensityBits);
+ ASSERT(texImage->FetchTexel);
+
/* state update */
texObj->Complete = GL_FALSE;
ctx->NewState |= _NEW_TEXTURE;
}
if (error) {
/* if error, clear all proxy texture image parameters */
- if (level>=0 && level<ctx->Const.MaxTextureLevels) {
- clear_proxy_teximage(ctx->Texture.Proxy3D->Image[level]);
+ if (level >= 0 && level < ctx->Const.MaxTextureLevels) {
+ clear_teximage_fields(ctx->Texture.Proxy3D->Image[level]);
}
}
}
}
if (error) {
/* if error, clear all proxy texture image parameters */
- if (level>=0 && level<ctx->Const.MaxTextureLevels) {
- clear_proxy_teximage(ctx->Texture.Proxy1D->Image[level]);
+ if (level >= 0 && level < ctx->Const.MaxTextureLevels) {
+ clear_teximage_fields(ctx->Texture.Proxy1D->Image[level]);
}
}
}
}
if (error) {
/* if error, clear all proxy texture image parameters */
- if (level>=0 && level<ctx->Const.MaxTextureLevels) {
- clear_proxy_teximage(ctx->Texture.Proxy2D->Image[level]);
+ if (level >= 0 && level < ctx->Const.MaxTextureLevels) {
+ clear_teximage_fields(ctx->Texture.Proxy2D->Image[level]);
}
}
}
}
if (error) {
/* if error, clear all proxy texture image parameters */
- if (level>=0 && level<ctx->Const.MaxTextureLevels) {
- clear_proxy_teximage(ctx->Texture.Proxy3D->Image[level]);
+ if (level >= 0 && level < ctx->Const.MaxTextureLevels) {
+ clear_teximage_fields(ctx->Texture.Proxy3D->Image[level]);
}
}
}