summaryrefslogtreecommitdiff
path: root/src/mesa/main/histogram.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-04-22 00:27:31 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-04-22 00:27:31 +0000
commitf959f6e1dc27c71fc0ccc56e09b29101b3bf3b97 (patch)
tree15b4171c2b3396e3a05f2776cc24d90cb37c8f84 /src/mesa/main/histogram.c
parent05a6f2fd484bab59c6e6a381f58808adc26619f1 (diff)
New glTexImage code.
The gl_texture_format struct now has a StoreTexImageFunc that's called by glTex[Sub]Image[123]D to convert the user's texture data into the specific texture format layout. Now it's much easier to add new texture formats (like the 16/32-bit floating point formats). The texutil.[ch] and texutil_tmp.h files are obsolete.
Diffstat (limited to 'src/mesa/main/histogram.c')
-rw-r--r--src/mesa/main/histogram.c96
1 files changed, 47 insertions, 49 deletions
diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c
index 6c44ae6e9e..9cfb378fb1 100644
--- a/src/mesa/main/histogram.c
+++ b/src/mesa/main/histogram.c
@@ -1,9 +1,8 @@
-
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.1
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -247,6 +246,23 @@ pack_histogram( GLcontext *ctx,
}
}
break;
+ case GL_HALF_FLOAT_ARB:
+ {
+ /* temporarily store as GLuints */
+ GLuint temp[4*HISTOGRAM_TABLE_SIZE];
+ GLhalfARB *dst = (GLhalfARB *) destination;
+ GLuint i;
+ /* get GLuint values */
+ PACK_MACRO(GLuint);
+ /* convert to GLhalf */
+ for (i = 0; i < n * comps; i++) {
+ dst[i] = _mesa_float_to_half((GLfloat) temp[i]);
+ }
+ if (packing->SwapBytes) {
+ _mesa_swap2((GLushort *) dst, n * comps);
+ }
+ }
+ break;
case GL_UNSIGNED_BYTE_3_3_2:
if (format == GL_RGB) {
GLubyte *dst = (GLubyte *) destination;
@@ -678,31 +694,22 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo
return;
}
- if (!_mesa_is_legal_format_and_type(format, type)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax(format or type)");
- return;
+ if (format != GL_RED &&
+ format != GL_GREEN &&
+ format != GL_BLUE &&
+ format != GL_ALPHA &&
+ format != GL_RGB &&
+ format != GL_BGR &&
+ format != GL_RGBA &&
+ format != GL_BGRA &&
+ format != GL_ABGR_EXT &&
+ format != GL_LUMINANCE &&
+ format != GL_LUMINANCE_ALPHA) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(format)");
}
- 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 &&
- type != GL_UNSIGNED_BYTE_3_3_2 &&
- type != GL_UNSIGNED_BYTE_2_3_3_REV &&
- type != GL_UNSIGNED_SHORT_5_6_5 &&
- type != GL_UNSIGNED_SHORT_5_6_5_REV &&
- type != GL_UNSIGNED_SHORT_4_4_4_4 &&
- type != GL_UNSIGNED_SHORT_4_4_4_4_REV &&
- type != GL_UNSIGNED_SHORT_5_5_5_1 &&
- type != GL_UNSIGNED_SHORT_1_5_5_5_REV &&
- type != GL_UNSIGNED_INT_8_8_8_8 &&
- type != GL_UNSIGNED_INT_8_8_8_8_REV &&
- type != GL_UNSIGNED_INT_10_10_10_2 &&
- type != GL_UNSIGNED_INT_2_10_10_10_REV) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmax(type)");
+ if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax(format or type)");
return;
}
@@ -745,31 +752,22 @@ _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, G
return;
}
- if (!_mesa_is_legal_format_and_type(format, type)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram(format or type)");
- return;
+ if (format != GL_RED &&
+ format != GL_GREEN &&
+ format != GL_BLUE &&
+ format != GL_ALPHA &&
+ format != GL_RGB &&
+ format != GL_BGR &&
+ format != GL_RGBA &&
+ format != GL_BGRA &&
+ format != GL_ABGR_EXT &&
+ format != GL_LUMINANCE &&
+ format != GL_LUMINANCE_ALPHA) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(format)");
}
- 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 &&
- type != GL_UNSIGNED_BYTE_3_3_2 &&
- type != GL_UNSIGNED_BYTE_2_3_3_REV &&
- type != GL_UNSIGNED_SHORT_5_6_5 &&
- type != GL_UNSIGNED_SHORT_5_6_5_REV &&
- type != GL_UNSIGNED_SHORT_4_4_4_4 &&
- type != GL_UNSIGNED_SHORT_4_4_4_4_REV &&
- type != GL_UNSIGNED_SHORT_5_5_5_1 &&
- type != GL_UNSIGNED_SHORT_1_5_5_5_REV &&
- type != GL_UNSIGNED_INT_8_8_8_8 &&
- type != GL_UNSIGNED_INT_8_8_8_8_REV &&
- type != GL_UNSIGNED_INT_10_10_10_2 &&
- type != GL_UNSIGNED_INT_2_10_10_10_REV) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(type)");
+ if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram(format or type)");
return;
}