summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2000-12-10 19:23:19 +0000
committerBrian Paul <[email protected]>2000-12-10 19:23:19 +0000
commit90f042ae8dbc00ecedab5cc68dbc6abae4228af5 (patch)
tree3c075fe61d2b793e71ae0d5d2efeeb7b5425c8c2 /src
parent8aa019d2efcf0295beae51989fe4b419ca50ca17 (diff)
generate GL_INVALID_OPERATION error for bad image format/type combinations
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/colortab.c6
-rw-r--r--src/mesa/main/convolve.c41
-rw-r--r--src/mesa/main/histogram.c55
3 files changed, 44 insertions, 58 deletions
diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c
index 0de0b0261ae..48072c8d7af 100644
--- a/src/mesa/main/colortab.c
+++ b/src/mesa/main/colortab.c
@@ -1,4 +1,4 @@
-/* $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
@@ -304,7 +304,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
if (!_mesa_is_legal_format_and_type(format, type) ||
format == GL_INTENSITY) {
- gl_error(ctx, GL_INVALID_ENUM, "glColorTable(format or type)");
+ gl_error(ctx, GL_INVALID_OPERATION, "glColorTable(format or type)");
return;
}
@@ -521,7 +521,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
if (!_mesa_is_legal_format_and_type(format, type) ||
format == GL_INTENSITY) {
- gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(format or type)");
+ gl_error(ctx, GL_INVALID_OPERATION, "glColorSubTable(format or type)");
return;
}
diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c
index 5bb4e82a843..c496e6c8f55 100644
--- a/src/mesa/main/convolve.c
+++ b/src/mesa/main/convolve.c
@@ -1,4 +1,4 @@
-/* $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
@@ -130,8 +130,12 @@ _mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, G
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_DEPTH_COMPONENT ||
format == GL_INTENSITY ||
@@ -204,8 +208,11 @@ _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, G
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_DEPTH_COMPONENT ||
format == GL_INTENSITY ||
@@ -569,8 +576,12 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *im
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_DEPTH_COMPONENT ||
format == GL_INTENSITY ||
@@ -753,8 +764,12 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row,
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_DEPTH_COMPONENT ||
format == GL_INTENSITY ||
@@ -818,8 +833,12 @@ _mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLs
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_DEPTH_COMPONENT ||
format == GL_INTENSITY ||
diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c
index 115c087022d..06798e37751 100644
--- a/src/mesa/main/histogram.c
+++ b/src/mesa/main/histogram.c
@@ -1,4 +1,4 @@
-/* $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
@@ -37,7 +37,9 @@
#endif
-
+/*
+ * XXX need to handle packed datatypes!
+ */
static void
pack_histogram( GLcontext *ctx,
GLuint n, CONST GLuint rgba[][4],
@@ -194,6 +196,9 @@ pack_histogram( GLcontext *ctx,
+/*
+ * XXX need to handle packed datatypes!
+ */
static void
pack_minmax( GLcontext *ctx, CONST GLfloat minmax[2][4],
GLenum format, GLenum type, GLvoid *destination,
@@ -415,27 +420,8 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo
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;
}
@@ -478,27 +464,8 @@ _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, G
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;
}