Browse Source

generate GL_INVALID_OPERATION error for bad image format/type combinations

tags/mesa_3_5
Brian Paul 26 years ago
parent
commit
90f042ae8d
3 changed files with 44 additions and 58 deletions
  1. 3
    3
      src/mesa/main/colortab.c
  2. 30
    11
      src/mesa/main/convolve.c
  3. 11
    44
      src/mesa/main/histogram.c

+ 3
- 3
src/mesa/main/colortab.c View File

/* $Id: colortab.c,v 1.31 2000/12/09 20:51:12 brianp Exp $ */
/* $Id: colortab.c,v 1.32 2000/12/10 19:23:19 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library


if (!_mesa_is_legal_format_and_type(format, type) || if (!_mesa_is_legal_format_and_type(format, type) ||
format == GL_INTENSITY) { format == GL_INTENSITY) {
gl_error(ctx, GL_INVALID_ENUM, "glColorTable(format or type)");
gl_error(ctx, GL_INVALID_OPERATION, "glColorTable(format or type)");
return; return;
} }




if (!_mesa_is_legal_format_and_type(format, type) || if (!_mesa_is_legal_format_and_type(format, type) ||
format == GL_INTENSITY) { format == GL_INTENSITY) {
gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(format or type)");
gl_error(ctx, GL_INVALID_OPERATION, "glColorSubTable(format or type)");
return; return;
} }



+ 30
- 11
src/mesa/main/convolve.c View File

/* $Id: convolve.c,v 1.15 2000/11/23 02:50:56 jtaylor Exp $ */
/* $Id: convolve.c,v 1.16 2000/12/10 19:23:19 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
return; return;
} }


if (!_mesa_is_legal_format_and_type(format, type) ||
format == GL_COLOR_INDEX ||
if (!_mesa_is_legal_format_and_type(format, type)) {
gl_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter1D(format or type)");
return;
}

if (format == GL_COLOR_INDEX ||
format == GL_STENCIL_INDEX || format == GL_STENCIL_INDEX ||
format == GL_DEPTH_COMPONENT || format == GL_DEPTH_COMPONENT ||
format == GL_INTENSITY || format == GL_INTENSITY ||
return; return;
} }


if (!_mesa_is_legal_format_and_type(format, type) ||
format == GL_COLOR_INDEX ||
if (!_mesa_is_legal_format_and_type(format, type)) {
gl_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter2D(format or type)");
return;
}
if (format == GL_COLOR_INDEX ||
format == GL_STENCIL_INDEX || format == GL_STENCIL_INDEX ||
format == GL_DEPTH_COMPONENT || format == GL_DEPTH_COMPONENT ||
format == GL_INTENSITY || format == GL_INTENSITY ||
gl_update_state(ctx); gl_update_state(ctx);
} }


if (!_mesa_is_legal_format_and_type(format, type) ||
format == GL_COLOR_INDEX ||
if (!_mesa_is_legal_format_and_type(format, type)) {
gl_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(format or type)");
return;
}

if (format == GL_COLOR_INDEX ||
format == GL_STENCIL_INDEX || format == GL_STENCIL_INDEX ||
format == GL_DEPTH_COMPONENT || format == GL_DEPTH_COMPONENT ||
format == GL_INTENSITY || format == GL_INTENSITY ||
return; return;
} }


if (!_mesa_is_legal_format_and_type(format, type) ||
format == GL_COLOR_INDEX ||
if (!_mesa_is_legal_format_and_type(format, type)) {
gl_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(format or type)");
return;
}

if (format == GL_COLOR_INDEX ||
format == GL_STENCIL_INDEX || format == GL_STENCIL_INDEX ||
format == GL_DEPTH_COMPONENT || format == GL_DEPTH_COMPONENT ||
format == GL_INTENSITY || format == GL_INTENSITY ||
return; return;
} }


if (!_mesa_is_legal_format_and_type(format, type) ||
format == GL_COLOR_INDEX ||
if (!_mesa_is_legal_format_and_type(format, type)) {
gl_error(ctx, GL_INVALID_OPERATION, "glSeparableFilter2D(format or type)");
return;
}

if (format == GL_COLOR_INDEX ||
format == GL_STENCIL_INDEX || format == GL_STENCIL_INDEX ||
format == GL_DEPTH_COMPONENT || format == GL_DEPTH_COMPONENT ||
format == GL_INTENSITY || format == GL_INTENSITY ||

+ 11
- 44
src/mesa/main/histogram.c View File

/* $Id: histogram.c,v 1.2 2000/11/10 18:31:04 brianp Exp $ */
/* $Id: histogram.c,v 1.3 2000/12/10 19:23:19 brianp Exp $ */


/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
#endif #endif





/*
* XXX need to handle packed datatypes!
*/
static void static void
pack_histogram( GLcontext *ctx, pack_histogram( GLcontext *ctx,
GLuint n, CONST GLuint rgba[][4], GLuint n, CONST GLuint rgba[][4],






/*
* XXX need to handle packed datatypes!
*/
static void static void
pack_minmax( GLcontext *ctx, CONST GLfloat minmax[2][4], pack_minmax( GLcontext *ctx, CONST GLfloat minmax[2][4],
GLenum format, GLenum type, GLvoid *destination, GLenum format, GLenum type, GLvoid *destination,
return; return;
} }


if (format != GL_RED &&
format != GL_GREEN &&
format != GL_BLUE &&
format != GL_ALPHA &&
format != GL_RGB &&
format != GL_RGBA &&
format != GL_ABGR_EXT &&
format != GL_LUMINANCE &&
format != GL_LUMINANCE_ALPHA) {
gl_error(ctx, GL_INVALID_ENUM, "glGetMinmax(format)");
return;
}

if (type != GL_UNSIGNED_BYTE &&
type != GL_BYTE &&
type != GL_UNSIGNED_SHORT &&
type != GL_SHORT &&
type != GL_UNSIGNED_INT &&
type != GL_INT &&
type != GL_FLOAT) {
gl_error(ctx, GL_INVALID_ENUM, "glGetMinmax(type)");
if (!_mesa_is_legal_format_and_type(format, type)) {
gl_error(ctx, GL_INVALID_OPERATION, "glGetMinmax(format or type)");
return; return;
} }


return; return;
} }


if (format != GL_RED &&
format != GL_GREEN &&
format != GL_BLUE &&
format != GL_ALPHA &&
format != GL_RGB &&
format != GL_RGBA &&
format != GL_ABGR_EXT &&
format != GL_LUMINANCE &&
format != GL_LUMINANCE_ALPHA) {
gl_error(ctx, GL_INVALID_ENUM, "glGetHistogram(format)");
return;
}

if (type != GL_UNSIGNED_BYTE &&
type != GL_BYTE &&
type != GL_UNSIGNED_SHORT &&
type != GL_SHORT &&
type != GL_UNSIGNED_INT &&
type != GL_INT &&
type != GL_FLOAT) {
gl_error(ctx, GL_INVALID_ENUM, "glGetHistogram(type)");
if (!_mesa_is_legal_format_and_type(format, type)) {
gl_error(ctx, GL_INVALID_OPERATION, "glGetHistogram(format or type)");
return; return;
} }



Loading…
Cancel
Save