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)) {
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);
texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
internalFormat, format, type);
assert(texImage->TexFormat);
-
texelBytes = texImage->TexFormat->TexelBytes;
assert(texelBytes == 1 || texelBytes == 2);