summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/glide/fxddtex.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c
index 3253a1bcde5..21f2bd98b0e 100644
--- a/src/mesa/drivers/glide/fxddtex.c
+++ b/src/mesa/drivers/glide/fxddtex.c
@@ -1166,9 +1166,8 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
struct gl_texture_image *texImage)
{
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
- GrTextureFormat_t gldformat;
tfxTexInfo *ti;
- tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
+ tfxMipMapLevel *mml;
GLint texelBytes;
if (!fxIsTexSupported(target, internalFormat, texImage)) {
@@ -1176,16 +1175,23 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
return;
}
- if (!texObj->DriverData)
+ if (!texObj->DriverData) {
texObj->DriverData = fxAllocTexObjData(fxMesa);
+ if (!texObj->DriverData) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
+ return;
+ }
+ }
ti = fxTMGetTexInfo(texObj);
- if (!mml) {
+ if (!texImage->DriverData) {
texImage->DriverData = MALLOC(sizeof(tfxMipMapLevel));
- mml = FX_MIPMAP_DATA(texImage);
+ if (!texImage->DriverData) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
+ return;
+ }
}
-
- fxTexGetFormat(internalFormat, &gldformat, NULL);
+ mml = FX_MIPMAP_DATA(texImage);
fxTexGetInfo(width, height, NULL, NULL, NULL, NULL,
NULL, NULL, &mml->wScale, &mml->hScale);
@@ -1199,7 +1205,6 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
internalFormat, format, type);
assert(texImage->TexFormat);
-
texelBytes = texImage->TexFormat->TexelBytes;
assert(texelBytes == 1 || texelBytes == 2);