}
texObj = _mesa_select_tex_object(ctx, texUnit, target);
- _mesa_lock_texture(ctx, texObj);
img = _mesa_select_tex_image(ctx, texObj, target, level);
if (!img || !img->TexFormat) {
*params = 1;
else
*params = 0;
- goto out;
+ return;
}
texFormat = img->TexFormat;
if (ctx->Extensions.ARB_depth_texture)
*params = _mesa_get_format_bits(texFormat, pname);
else
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
+ goto invalid_pname;
break;
case GL_TEXTURE_STENCIL_SIZE_EXT:
if (ctx->Extensions.EXT_packed_depth_stencil ||
*params = _mesa_get_format_bits(texFormat, pname);
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
+ goto invalid_pname;
}
break;
case GL_TEXTURE_SHARED_SIZE:
*params = 0;
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
+ goto invalid_pname;
}
break;
_mesa_get_format_datatype(texFormat) : GL_NONE;
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
+ goto invalid_pname;
}
break;
case GL_TEXTURE_GREEN_TYPE_ARB:
_mesa_get_format_datatype(texFormat) : GL_NONE;
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
+ goto invalid_pname;
}
break;
case GL_TEXTURE_BLUE_TYPE_ARB:
_mesa_get_format_datatype(texFormat) : GL_NONE;
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
+ goto invalid_pname;
}
break;
case GL_TEXTURE_ALPHA_TYPE_ARB:
_mesa_get_format_datatype(texFormat) : GL_NONE;
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
+ goto invalid_pname;
}
break;
case GL_TEXTURE_LUMINANCE_TYPE_ARB:
_mesa_get_format_datatype(texFormat) : GL_NONE;
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
+ goto invalid_pname;
}
break;
case GL_TEXTURE_INTENSITY_TYPE_ARB:
_mesa_get_format_datatype(texFormat) : GL_NONE;
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
+ goto invalid_pname;
}
break;
case GL_TEXTURE_DEPTH_TYPE_ARB:
_mesa_get_format_datatype(texFormat) : GL_NONE;
}
else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
+ goto invalid_pname;
}
break;
default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
+ goto invalid_pname;
}
- out:
- _mesa_unlock_texture(ctx, texObj);
+ /* no error if we get here */
+ return;
+
+invalid_pname:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname=%s)",
+ _mesa_lookup_enum_by_nr(pname));
}