summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/GL/glx/singlesize.c
diff options
context:
space:
mode:
Diffstat (limited to 'xc/programs/Xserver/GL/glx/singlesize.c')
-rw-r--r--xc/programs/Xserver/GL/glx/singlesize.c296
1 files changed, 256 insertions, 40 deletions
diff --git a/xc/programs/Xserver/GL/glx/singlesize.c b/xc/programs/Xserver/GL/glx/singlesize.c
index 1cff4c3a7..b7ca83245 100644
--- a/xc/programs/Xserver/GL/glx/singlesize.c
+++ b/xc/programs/Xserver/GL/glx/singlesize.c
@@ -1,23 +1,37 @@
-/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.c,v 1.2 1999/06/14 07:31:35 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.c,v 1.3 2001/03/21 16:29:37 dawes Exp $ */
/*
-** The contents of this file are subject to the GLX Public License Version 1.0
-** (the "License"). You may not use this file except in compliance with the
-** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
-** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
-** or at http://www.sgi.com/software/opensource/glx/license.html.
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
**
-** Software distributed under the License is distributed on an "AS IS"
-** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
-** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
-** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
-** language governing rights and limitations under the License.
-**
-** The Original Software is GLX version 1.2 source code, released February,
-** 1999. The developer of the Original Software is Silicon Graphics, Inc.
-** Those portions of the Subject Software created by Silicon Graphics, Inc.
-** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
-**
-** $SGI$
*/
#include <GL/gl.h>
@@ -34,8 +48,8 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h)
{
GLint elements, esize;
GLint rowsize, padding;
-
- if (w < 0 || h < 0) {
+
+ if (w < 0 || h < 0) {
return -1;
}
switch (format) {
@@ -55,9 +69,11 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h)
elements = 2;
break;
case GL_RGB:
+ case GL_BGR:
elements = 3;
break;
case GL_RGBA:
+ case GL_BGRA:
case GL_ABGR_EXT:
elements = 4;
break;
@@ -71,7 +87,7 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h)
*/
switch (type) {
case GL_BITMAP:
- if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
+ if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
rowsize = ((w * elements)+7)/8;
padding = rowsize % 4;
if (padding) {
@@ -85,15 +101,36 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h)
case GL_UNSIGNED_BYTE:
esize = 1;
break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
case GL_SHORT:
case GL_UNSIGNED_SHORT:
esize = 2;
break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
case GL_INT:
case GL_UNSIGNED_INT:
case GL_FLOAT:
esize = 4;
break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
default:
return -1;
}
@@ -151,11 +188,10 @@ GLint __glGetTexParameterfv_size(GLenum pname)
{
switch (pname) {
case GL_TEXTURE_WRAP_S:
- return 1;
case GL_TEXTURE_WRAP_T:
+ case GL_TEXTURE_WRAP_R:
return 1;
case GL_TEXTURE_MIN_FILTER:
- return 1;
case GL_TEXTURE_MAG_FILTER:
return 1;
case GL_TEXTURE_BORDER_COLOR:
@@ -163,7 +199,12 @@ GLint __glGetTexParameterfv_size(GLenum pname)
case GL_TEXTURE_PRIORITY:
return 1;
case GL_TEXTURE_RESIDENT:
- return 1;
+ return 1;
+ case GL_TEXTURE_MIN_LOD:
+ case GL_TEXTURE_MAX_LOD:
+ case GL_TEXTURE_BASE_LEVEL:
+ case GL_TEXTURE_MAX_LEVEL:
+ return 1;
default:
return -1;
@@ -184,7 +225,7 @@ GLint __glGetLightfv_size(GLenum pname)
return 4;
case GL_SPECULAR:
return 4;
- case GL_POSITION:
+ case GL_POSITION:
return 4;
case GL_SPOT_DIRECTION:
return 3;
@@ -236,7 +277,7 @@ static GLint EvalComputeK(GLenum target)
}
return 0;
}
-
+
GLint __glGetMap_size(GLenum target, GLenum query)
{
GLint k, order=0, majorMinor[2];
@@ -342,7 +383,7 @@ GLint __glGetPixelMap_size(GLenum map)
{
GLint size;
GLenum query;
-
+
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
query = GL_PIXEL_MAP_I_TO_I_SIZE;
@@ -454,9 +495,13 @@ GLint __glGet_size(GLenum sq)
case GL_POINT_SIZE:
return 1;
case GL_POINT_SIZE_RANGE:
+ /* case GL_SMOOTH_POINT_SIZE_RANGE: */ /* alias */
return 2;
case GL_POINT_SIZE_GRANULARITY:
+ /* case GL_SMOOTH_POINT_SIZE_GRANULARITY: */ /* alias */
return 1;
+ case GL_ALIASED_POINT_SIZE_RANGE:
+ return 2;
case GL_POINT_SMOOTH:
return 1;
case GL_LINE_SMOOTH:
@@ -464,9 +509,13 @@ GLint __glGet_size(GLenum sq)
case GL_LINE_WIDTH:
return 1;
case GL_LINE_WIDTH_RANGE:
+ /* case GL_SMOOTH_LINE_WIDTH_RANGE: */ /* alias */
return 2;
case GL_LINE_WIDTH_GRANULARITY:
+ /* case GL_SMOOTH_LINE_WIDTH_GRANULARITY: */ /* alias */
return 1;
+ case GL_ALIASED_LINE_WIDTH_RANGE:
+ return 2;
case GL_LINE_STIPPLE_PATTERN:
return 1;
case GL_LINE_STIPPLE_REPEAT:
@@ -495,6 +544,8 @@ GLint __glGet_size(GLenum sq)
return 1;
case GL_LIGHT_MODEL_AMBIENT:
return 4;
+ case GL_LIGHT_MODEL_COLOR_CONTROL:
+ return 1;
case GL_COLOR_MATERIAL:
return 1;
case GL_COLOR_MATERIAL_FACE:
@@ -637,10 +688,14 @@ GLint __glGet_size(GLenum sq)
return 1;
case GL_PACK_ROW_LENGTH:
return 1;
+ case GL_PACK_IMAGE_HEIGHT:
+ return 1;
case GL_PACK_SKIP_ROWS:
return 1;
case GL_PACK_SKIP_PIXELS:
return 1;
+ case GL_PACK_SKIP_IMAGES:
+ return 1;
case GL_PACK_ALIGNMENT:
return 1;
case GL_UNPACK_SWAP_BYTES:
@@ -649,10 +704,14 @@ GLint __glGet_size(GLenum sq)
return 1;
case GL_UNPACK_ROW_LENGTH:
return 1;
+ case GL_UNPACK_IMAGE_HEIGHT:
+ return 1;
case GL_UNPACK_SKIP_ROWS:
return 1;
case GL_UNPACK_SKIP_PIXELS:
return 1;
+ case GL_UNPACK_SKIP_IMAGES:
+ return 1;
case GL_UNPACK_ALIGNMENT:
return 1;
case GL_MAP_COLOR:
@@ -678,11 +737,11 @@ GLint __glGet_size(GLenum sq)
case GL_ZOOM_X:
case GL_ZOOM_Y:
return 1;
- case GL_PIXEL_MAP_I_TO_I_SIZE: case GL_PIXEL_MAP_S_TO_S_SIZE:
- case GL_PIXEL_MAP_I_TO_R_SIZE: case GL_PIXEL_MAP_I_TO_G_SIZE:
- case GL_PIXEL_MAP_I_TO_B_SIZE: case GL_PIXEL_MAP_I_TO_A_SIZE:
- case GL_PIXEL_MAP_R_TO_R_SIZE: case GL_PIXEL_MAP_G_TO_G_SIZE:
- case GL_PIXEL_MAP_B_TO_B_SIZE: case GL_PIXEL_MAP_A_TO_A_SIZE:
+ case GL_PIXEL_MAP_I_TO_I_SIZE: case GL_PIXEL_MAP_S_TO_S_SIZE:
+ case GL_PIXEL_MAP_I_TO_R_SIZE: case GL_PIXEL_MAP_I_TO_G_SIZE:
+ case GL_PIXEL_MAP_I_TO_B_SIZE: case GL_PIXEL_MAP_I_TO_A_SIZE:
+ case GL_PIXEL_MAP_R_TO_R_SIZE: case GL_PIXEL_MAP_G_TO_G_SIZE:
+ case GL_PIXEL_MAP_B_TO_B_SIZE: case GL_PIXEL_MAP_A_TO_A_SIZE:
return 1;
case GL_MAX_EVAL_ORDER:
return 1;
@@ -731,17 +790,18 @@ GLint __glGet_size(GLenum sq)
return 2;
case GL_TEXTURE_1D:
case GL_TEXTURE_2D:
+ case GL_TEXTURE_3D:
return 1;
case GL_NAME_STACK_DEPTH:
return 1;
case GL_MAX_VIEWPORT_DIMS:
- return 2;
+ return 2;
case GL_DOUBLEBUFFER:
- return 1;
+ return 1;
case GL_AUX_BUFFERS:
- return 1;
+ return 1;
case GL_STEREO:
- return 1;
+ return 1;
case GL_CLIP_PLANE0: case GL_CLIP_PLANE1:
case GL_CLIP_PLANE2: case GL_CLIP_PLANE3:
case GL_CLIP_PLANE4: case GL_CLIP_PLANE5:
@@ -774,14 +834,56 @@ GLint __glGet_size(GLenum sq)
return 1;
case GL_TEXTURE_BINDING_1D:
case GL_TEXTURE_BINDING_2D:
+ case GL_TEXTURE_BINDING_3D:
return 1;
- case GL_BLEND_COLOR_EXT:
+ case GL_BLEND_COLOR:
return 4;
- case GL_BLEND_EQUATION_EXT:
+ case GL_BLEND_EQUATION:
+ return 1;
+ case GL_COLOR_MATRIX:
+ return 16;
+ case GL_COLOR_MATRIX_STACK_DEPTH:
+ return 1;
+ case GL_COLOR_TABLE:
+ case GL_POST_CONVOLUTION_COLOR_TABLE:
+ case GL_POST_COLOR_MATRIX_COLOR_TABLE:
+ case GL_CONVOLUTION_1D:
+ case GL_CONVOLUTION_2D:
+ case GL_SEPARABLE_2D:
+ case GL_HISTOGRAM:
+ case GL_MINMAX:
return 1;
case GL_POLYGON_OFFSET_FACTOR:
case GL_POLYGON_OFFSET_UNITS:
return 1;
+ case GL_POST_CONVOLUTION_RED_SCALE:
+ case GL_POST_CONVOLUTION_GREEN_SCALE:
+ case GL_POST_CONVOLUTION_BLUE_SCALE:
+ case GL_POST_CONVOLUTION_ALPHA_SCALE:
+ case GL_POST_CONVOLUTION_RED_BIAS:
+ case GL_POST_CONVOLUTION_GREEN_BIAS:
+ case GL_POST_CONVOLUTION_BLUE_BIAS:
+ case GL_POST_CONVOLUTION_ALPHA_BIAS:
+ return 1;
+ case GL_POST_COLOR_MATRIX_RED_SCALE:
+ case GL_POST_COLOR_MATRIX_GREEN_SCALE:
+ case GL_POST_COLOR_MATRIX_BLUE_SCALE:
+ case GL_POST_COLOR_MATRIX_ALPHA_SCALE:
+ case GL_POST_COLOR_MATRIX_RED_BIAS:
+ case GL_POST_COLOR_MATRIX_GREEN_BIAS:
+ case GL_POST_COLOR_MATRIX_BLUE_BIAS:
+ case GL_POST_COLOR_MATRIX_ALPHA_BIAS:
+ return 1;
+ case GL_RESCALE_NORMAL:
+ return 1;
+ case GL_ACTIVE_TEXTURE_ARB:
+ case GL_CLIENT_ACTIVE_TEXTURE_ARB:
+ case GL_MAX_TEXTURE_UNITS_ARB:
+ return 1;
+ case GL_MAX_COLOR_MATRIX_STACK_DEPTH:
+ case GL_MAX_CONVOLUTION_WIDTH:
+ case GL_MAX_CONVOLUTION_HEIGHT:
+ return 1;
default:
return -1;
}
@@ -812,6 +914,7 @@ GLint __glGetTexLevelParameterfv_size(GLenum pname)
switch (pname) {
case GL_TEXTURE_WIDTH:
case GL_TEXTURE_HEIGHT:
+ case GL_TEXTURE_DEPTH:
case GL_TEXTURE_COMPONENTS:
case GL_TEXTURE_BORDER:
case GL_TEXTURE_RED_SIZE:
@@ -832,17 +935,19 @@ GLint __glGetTexLevelParameteriv_size(GLenum pname)
}
GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format,
- GLenum type, GLint width, GLint height)
+ GLenum type, GLint width, GLint height, GLint depth)
{
GLint elements, esize;
GLint padding, rowsize;
switch (format) {
case GL_RGBA:
+ case GL_BGRA:
case GL_ABGR_EXT:
elements = 4;
break;
case GL_RGB:
+ case GL_BGR:
elements = 3;
break;
case GL_RED:
@@ -863,15 +968,36 @@ GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format,
case GL_UNSIGNED_BYTE:
esize = 1;
break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
case GL_SHORT:
case GL_UNSIGNED_SHORT:
esize = 2;
break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
case GL_INT:
case GL_UNSIGNED_INT:
case GL_FLOAT:
esize = 4;
break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
default:
return -1;
}
@@ -885,5 +1011,95 @@ GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format,
if (padding) {
rowsize += 4 - padding;
}
- return (rowsize * height);
+ return (rowsize * height * depth);
}
+
+GLint __glGetConvolutionParameteriv_size(GLenum pname)
+{
+ switch (pname) {
+ case GL_CONVOLUTION_BORDER_COLOR:
+ case GL_CONVOLUTION_FILTER_SCALE:
+ case GL_CONVOLUTION_FILTER_BIAS:
+ return 4;
+ case GL_CONVOLUTION_BORDER_MODE:
+ case GL_CONVOLUTION_FORMAT:
+ case GL_CONVOLUTION_WIDTH:
+ case GL_CONVOLUTION_HEIGHT:
+ case GL_MAX_CONVOLUTION_WIDTH:
+ case GL_MAX_CONVOLUTION_HEIGHT:
+ return 1;
+ default:
+ return -1;
+ }
+}
+
+GLint __glGetConvolutionParameterfv_size(GLenum pname)
+{
+ return __glGetConvolutionParameteriv_size(pname);
+}
+
+
+GLint __glGetHistogramParameterfv_size(GLenum pname)
+{
+ switch (pname) {
+ case GL_HISTOGRAM_WIDTH:
+ case GL_HISTOGRAM_FORMAT:
+ case GL_HISTOGRAM_RED_SIZE:
+ case GL_HISTOGRAM_GREEN_SIZE:
+ case GL_HISTOGRAM_BLUE_SIZE:
+ case GL_HISTOGRAM_ALPHA_SIZE:
+ case GL_HISTOGRAM_LUMINANCE_SIZE:
+ case GL_HISTOGRAM_SINK:
+ return 1;
+ default:
+ return -1;
+ }
+}
+
+GLint __glGetHistogramParameteriv_size(GLenum pname)
+{
+ return __glGetHistogramParameterfv_size(pname);
+}
+
+GLint __glGetMinmaxParameterfv_size(GLenum pname)
+{
+ switch (pname) {
+ case GL_MINMAX_FORMAT:
+ case GL_MINMAX_SINK:
+ return 1;
+ default:
+ return -1;
+ }
+}
+
+GLint __glGetMinmaxParameteriv_size(GLenum pname)
+{
+ return __glGetMinmaxParameterfv_size(pname);
+}
+
+GLint __glGetColorTableParameterfv_size(GLenum pname)
+{
+ switch(pname) {
+
+ case GL_COLOR_TABLE_SCALE: /* return RGBA */
+ case GL_COLOR_TABLE_BIAS:
+ return 4;
+ case GL_COLOR_TABLE_FORMAT:
+ case GL_COLOR_TABLE_WIDTH:
+ case GL_COLOR_TABLE_RED_SIZE:
+ case GL_COLOR_TABLE_GREEN_SIZE:
+ case GL_COLOR_TABLE_BLUE_SIZE:
+ case GL_COLOR_TABLE_ALPHA_SIZE:
+ case GL_COLOR_TABLE_LUMINANCE_SIZE:
+ case GL_COLOR_TABLE_INTENSITY_SIZE:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+GLint __glGetColorTableParameteriv_size(GLenum pname)
+{
+ return __glGetColorTableParameterfv_size(pname);
+}
+