[Mesa-dev] [PATCH 1/4] mesa: restructure error checking in _mesa_FramebufferTexture1D/2DEXT()
Ian Romanick
idr at freedesktop.org
Fri Aug 19 10:47:47 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
For the series:
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
On 08/18/2011 03:05 PM, Brian Paul wrote:
> In anticipation of adding more texture targets.
> ---
> src/mesa/main/fbobject.c | 56 +++++++++++++++++++++++++++++++++++++---------
> 1 files changed, 45 insertions(+), 11 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 7646f9b..e25ec8c 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -1984,10 +1984,23 @@ _mesa_FramebufferTexture1DEXT(GLenum target, GLenum attachment,
> {
> GET_CURRENT_CONTEXT(ctx);
>
> - if ((texture != 0) && (textarget != GL_TEXTURE_1D)) {
> - _mesa_error(ctx, GL_INVALID_OPERATION,
> - "glFramebufferTexture1DEXT(textarget)");
> - return;
> + if (texture != 0) {
> + GLboolean error;
> +
> + switch (textarget) {
> + case GL_TEXTURE_1D:
> + error = GL_FALSE;
> + break;
> + default:
> + error = GL_TRUE;
> + }
> +
> + if (error) {
> + _mesa_error(ctx, GL_INVALID_OPERATION,
> + "glFramebufferTexture1DEXT(textarget=%s)",
> + _mesa_lookup_enum_by_nr(textarget));
> + return;
> + }
> }
>
> framebuffer_texture(ctx, "1D", target, attachment, textarget, texture,
> @@ -2001,13 +2014,34 @@ _mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment,
> {
> GET_CURRENT_CONTEXT(ctx);
>
> - if ((texture != 0) &&
> - (textarget != GL_TEXTURE_2D) &&
> - (textarget != GL_TEXTURE_RECTANGLE_ARB) &&
> - (!is_cube_face(textarget))) {
> - _mesa_error(ctx, GL_INVALID_OPERATION,
> - "glFramebufferTexture2DEXT(textarget=0x%x)", textarget);
> - return;
> + if (texture != 0) {
> + GLboolean error;
> +
> + switch (textarget) {
> + case GL_TEXTURE_2D:
> + error = GL_FALSE;
> + break;
> + case GL_TEXTURE_RECTANGLE:
> + error = !ctx->Extensions.NV_texture_rectangle;
> + break;
> + case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
> + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
> + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
> + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
> + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
> + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
> + error = !ctx->Extensions.ARB_texture_cube_map;
> + break;
> + default:
> + error = GL_FALSE;
> + }
> +
> + if (error) {
> + _mesa_error(ctx, GL_INVALID_OPERATION,
> + "glFramebufferTexture2DEXT(textarget=%s)",
> + _mesa_lookup_enum_by_nr(textarget));
> + return;
> + }
> }
>
> framebuffer_texture(ctx, "2D", target, attachment, textarget, texture,
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAk5OocMACgkQX1gOwKyEAw94tgCdEGuJKAZaEeD37gxYKsASdqTE
DKEAniEgsvOFsMzmn1kLbXPKWI0TDHoj
=ecUN
-----END PGP SIGNATURE-----
More information about the mesa-dev
mailing list