Implementation of GL_EXT_texture_env_dot3.

This commit is contained in:
Gareth Hughes 2001-01-06 22:46:13 +00:00
parent c851646050
commit ba8f6172bd
7 changed files with 131 additions and 68 deletions

View File

@ -1,4 +1,4 @@
/* $Id: gl.h,v 1.49 2000/12/09 20:36:18 brianp Exp $ */ /* $Id: gl.h,v 1.50 2001/01/06 22:46:13 gareth Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@ -2228,6 +2228,19 @@ GLAPI void GLAPIENTRY glResizeBuffersMESA( void );
#endif /* GL_MESA_resize_bufffers */ #endif /* GL_MESA_resize_bufffers */
/*
* 220. GL_EXT_texture_env_dot3
*/
#ifndef GL_EXT_texture_env_dot3
#define GL_EXT_texture_env_dot3 1
#define GL_DOT3_RGB_EXT 0x8740
#define GL_DOT3_RGBA_EXT 0x8741
#endif /* GL_EXT_texture_env_dot3 */
#else /* GL_GLEXT_LEGACY */ #else /* GL_GLEXT_LEGACY */
#include <GL/glext.h> #include <GL/glext.h>

View File

@ -13,21 +13,21 @@ extern "C" {
** this file except in compliance with the License. You may obtain a copy ** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
** **
** http://oss.sgi.com/projects/FreeB ** http://oss.sgi.com/projects/FreeB
** **
** Note that, as provided in the License, the Software is distributed on an ** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
** **
** Original Code. The Original Code is: OpenGL Sample Implementation, ** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated ** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved. ** elsewhere herein. All Rights Reserved.
** **
** Additional Notice Provisions: This software was created using the ** Additional Notice Provisions: This software was created using the
** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
** not been independently verified as being compliant with the OpenGL(R) ** not been independently verified as being compliant with the OpenGL(R)
@ -1419,6 +1419,11 @@ extern "C" {
#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF #define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF
#endif #endif
#ifndef GL_EXT_texture_env_dot3
#define GL_DOT3_RGB_EXT 0x8740
#define GL_DOT3_RGBA_EXT 0x8741
#endif
/*************************************************************/ /*************************************************************/

View File

@ -1,21 +1,21 @@
/* $Id: enums.c,v 1.9 2000/06/27 21:42:13 brianp Exp $ */ /* $Id: enums.c,v 1.10 2001/01/06 22:46:13 gareth Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.3 * Version: 3.3
* *
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included * The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software. * in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@ -34,12 +34,12 @@
#endif #endif
typedef struct { typedef struct {
const char *c; const char *c;
int n; int n;
} enum_elt; } enum_elt;
enum_elt all_enums[] = enum_elt all_enums[] =
{ {
/* Boolean values */ /* Boolean values */
{ "GL_FALSE", 0 }, { "GL_FALSE", 0 },
@ -828,7 +828,11 @@ enum_elt all_enums[] =
{ "GL_INTERPOLATE_EXT", 0x8575 }, { "GL_INTERPOLATE_EXT", 0x8575 },
{ "GL_CONSTANT_EXT", 0x8576 }, { "GL_CONSTANT_EXT", 0x8576 },
{ "GL_PRIMARY_COLOR_EXT", 0x8577 }, { "GL_PRIMARY_COLOR_EXT", 0x8577 },
{ "GL_PREVIOUS_EXT", 0x8578 } { "GL_PREVIOUS_EXT", 0x8578 },
/* GL_EXT_texture_env_dot3 */
{ "GL_DOT3_RGB_EXT", 0x8740 },
{ "GL_DOT3_RGBA_EXT", 0x8741 },
}; };
@ -839,7 +843,7 @@ typedef int (GLWINAPIV *cfunc)(const void *, const void *);
static enum_elt **index1 = 0; static enum_elt **index1 = 0;
static int sorted = 0; static int sorted = 0;
static int compar_name( const enum_elt *a, const enum_elt *b ) static int compar_name( const enum_elt *a, const enum_elt *b )
{ {
return strcmp(a->c, b->c); return strcmp(a->c, b->c);
} }
@ -847,7 +851,7 @@ static int compar_name( const enum_elt *a, const enum_elt *b )
/* note the extra level of indirection /* note the extra level of indirection
*/ */
static int compar_nr( const enum_elt **a, const enum_elt **b ) static int compar_nr( const enum_elt **a, const enum_elt **b )
{ {
return (*a)->n - (*b)->n; return (*a)->n - (*b)->n;
} }
@ -859,10 +863,10 @@ static void sort_enums( void )
index1 = (enum_elt **)MALLOC( Elements(all_enums) * sizeof(enum_elt *) ); index1 = (enum_elt **)MALLOC( Elements(all_enums) * sizeof(enum_elt *) );
sorted = 1; sorted = 1;
qsort( all_enums, Elements(all_enums), sizeof(*all_enums), qsort( all_enums, Elements(all_enums), sizeof(*all_enums),
(cfunc) compar_name ); (cfunc) compar_name );
for (i = 0 ; i < Elements(all_enums) ; i++) for (i = 0 ; i < Elements(all_enums) ; i++)
index1[i] = &all_enums[i]; index1[i] = &all_enums[i];
qsort( index1, Elements(all_enums), sizeof(*index1), (cfunc) compar_nr ); qsort( index1, Elements(all_enums), sizeof(*index1), (cfunc) compar_nr );
@ -875,14 +879,14 @@ int gl_lookup_enum_by_name( const char *symbol )
enum_elt tmp; enum_elt tmp;
enum_elt *e; enum_elt *e;
if (!sorted) if (!sorted)
sort_enums(); sort_enums();
if (!symbol) if (!symbol)
return 0; return 0;
tmp.c = symbol; tmp.c = symbol;
e = (enum_elt *)bsearch( &tmp, all_enums, Elements(all_enums), e = (enum_elt *)bsearch( &tmp, all_enums, Elements(all_enums),
sizeof(*all_enums), (cfunc) compar_name ); sizeof(*all_enums), (cfunc) compar_name );
return e ? e->n : -1; return e ? e->n : -1;
@ -893,13 +897,13 @@ const char *gl_lookup_enum_by_nr( int nr )
{ {
enum_elt tmp, *e, **f; enum_elt tmp, *e, **f;
if (!sorted) if (!sorted)
sort_enums(); sort_enums();
tmp.n = nr; tmp.n = nr;
e = &tmp; e = &tmp;
f = (enum_elt **)bsearch( &e, index1, Elements(all_enums), f = (enum_elt **)bsearch( &e, index1, Elements(all_enums),
sizeof(*index1), (cfunc) compar_nr ); sizeof(*index1), (cfunc) compar_nr );
return f ? (*f)->c : "(unknown)"; return f ? (*f)->c : "(unknown)";
@ -920,6 +924,6 @@ int main()
for (i = 0 ; i < Elements(test) ; i++) { for (i = 0 ; i < Elements(test) ; i++) {
int d = gl_lookup_enum_by_name( test[i] ); int d = gl_lookup_enum_by_name( test[i] );
printf("%s --> %d --> %s\n", test[i], d, gl_lookup_enum_by_nr( d )); printf("%s --> %d --> %s\n", test[i], d, gl_lookup_enum_by_nr( d ));
} }
} }
#endif #endif

View File

@ -1,4 +1,4 @@
/* $Id: extensions.c,v 1.43 2000/12/08 00:20:15 brianp Exp $ */ /* $Id: extensions.c,v 1.44 2001/01/06 22:46:13 gareth Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@ -87,6 +87,7 @@ static struct {
{ OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) }, { OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) },
{ ON, "GL_EXT_texture_env_add", F(EXT_texture_env_add) }, { ON, "GL_EXT_texture_env_add", F(EXT_texture_env_add) },
{ OFF, "GL_EXT_texture_env_combine", F(EXT_texture_env_combine) }, { OFF, "GL_EXT_texture_env_combine", F(EXT_texture_env_combine) },
{ OFF, "GL_EXT_texture_env_dot3", F(EXT_texture_env_dot3) },
{ ON, "GL_EXT_texture_object", F(EXT_texture_object) }, { ON, "GL_EXT_texture_object", F(EXT_texture_object) },
{ ON, "GL_EXT_texture_lod_bias", F(EXT_texture_lod_bias) }, { ON, "GL_EXT_texture_lod_bias", F(EXT_texture_lod_bias) },
{ ON, "GL_EXT_vertex_array", 0 }, { ON, "GL_EXT_vertex_array", 0 },
@ -120,6 +121,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
gl_extensions_enable(ctx, "GL_ARB_texture_cube_map"); gl_extensions_enable(ctx, "GL_ARB_texture_cube_map");
gl_extensions_enable(ctx, "GL_EXT_bgra"); gl_extensions_enable(ctx, "GL_EXT_bgra");
gl_extensions_enable(ctx, "GL_EXT_texture_env_combine"); gl_extensions_enable(ctx, "GL_EXT_texture_env_combine");
gl_extensions_enable(ctx, "GL_EXT_texture_env_dot3");
gl_extensions_enable(ctx, "GL_HP_occlusion_test"); gl_extensions_enable(ctx, "GL_HP_occlusion_test");
gl_extensions_enable(ctx, "GL_NV_blend_square"); gl_extensions_enable(ctx, "GL_NV_blend_square");
gl_extensions_enable(ctx, "GL_MESA_sprite_point"); gl_extensions_enable(ctx, "GL_MESA_sprite_point");

View File

@ -1,21 +1,21 @@
/* $Id: mtypes.h,v 1.10 2001/01/05 02:26:48 keithw Exp $ */ /* $Id: mtypes.h,v 1.11 2001/01/06 22:46:13 gareth Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.5 * Version: 3.5
* *
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included * The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software. * in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@ -27,7 +27,7 @@
#ifndef TYPES_H #ifndef TYPES_H
#define TYPES_H #define TYPES_H
#include "glheader.h" #include "glheader.h"
#include "config.h" /* Hardwired parameters */ #include "config.h" /* Hardwired parameters */
@ -211,7 +211,7 @@ struct gl_light {
GLfloat _VP_inf_norm[3]; /* Norm direction to infinite light */ GLfloat _VP_inf_norm[3]; /* Norm direction to infinite light */
GLfloat _h_inf_norm[3]; /* Norm( _VP_inf_norm + <0,0,1> ) */ GLfloat _h_inf_norm[3]; /* Norm( _VP_inf_norm + <0,0,1> ) */
GLfloat _NormDirection[4]; /* normalized spotlight direction */ GLfloat _NormDirection[4]; /* normalized spotlight direction */
GLfloat _VP_inf_spot_attenuation; GLfloat _VP_inf_spot_attenuation;
GLfloat _SpotExpTable[EXP_TABLE_SIZE][2]; /* to replace a pow() call */ GLfloat _SpotExpTable[EXP_TABLE_SIZE][2]; /* to replace a pow() call */
GLfloat _MatAmbient[2][3]; /* material ambient * light ambient */ GLfloat _MatAmbient[2][3]; /* material ambient * light ambient */
@ -231,7 +231,7 @@ struct gl_lightmodel {
}; };
struct gl_material struct gl_material
{ {
GLfloat Ambient[4]; GLfloat Ambient[4];
GLfloat Diffuse[4]; GLfloat Diffuse[4];
@ -308,7 +308,7 @@ struct gl_current_attrib {
GLuint Index; /* Current color index */ GLuint Index; /* Current color index */
GLboolean EdgeFlag; /* Current edge flag */ GLboolean EdgeFlag; /* Current edge flag */
GLfloat Texcoord[MAX_TEXTURE_UNITS][4]; /* Current texture coords */ GLfloat Texcoord[MAX_TEXTURE_UNITS][4]; /* Current texture coords */
/* These values are always valid. /* These values are always valid.
*/ */
GLfloat RasterPos[4]; /* Current raster position */ GLfloat RasterPos[4]; /* Current raster position */
@ -744,7 +744,7 @@ struct gl_stencil_attrib {
#define ENABLE_TEXMAT1 0x200 #define ENABLE_TEXMAT1 0x200
#define ENABLE_TEXMAT2 0x400 #define ENABLE_TEXMAT2 0x400
#define ENABLE_TEXMAT3 0x800 #define ENABLE_TEXMAT3 0x800
#define ENABLE_TEXMAT4 0x1000 #define ENABLE_TEXMAT4 0x1000
#define ENABLE_TEXMAT5 0x2000 #define ENABLE_TEXMAT5 0x2000
#define ENABLE_TEXMAT6 0x4000 #define ENABLE_TEXMAT6 0x4000
#define ENABLE_TEXMAT7 0x8000 #define ENABLE_TEXMAT7 0x8000
@ -910,7 +910,7 @@ struct gl_texture_attrib {
GLuint _GenFlags; /* for texgen */ GLuint _GenFlags; /* for texgen */
struct gl_texture_unit Unit[MAX_TEXTURE_UNITS]; struct gl_texture_unit Unit[MAX_TEXTURE_UNITS];
struct gl_texture_object *Proxy1D; struct gl_texture_object *Proxy1D;
struct gl_texture_object *Proxy2D; struct gl_texture_object *Proxy2D;
struct gl_texture_object *Proxy3D; struct gl_texture_object *Proxy3D;
@ -1033,7 +1033,7 @@ struct gl_1d_map {
GLfloat u1, u2, du; /* u1, u2, 1.0/(u2-u1) */ GLfloat u1, u2, du; /* u1, u2, 1.0/(u2-u1) */
GLfloat *Points; /* Points to contiguous control points */ GLfloat *Points; /* Points to contiguous control points */
}; };
/* /*
* 2-D Evaluator control points * 2-D Evaluator control points
@ -1231,6 +1231,7 @@ struct gl_extensions {
GLboolean EXT_texture_compression_s3tc; GLboolean EXT_texture_compression_s3tc;
GLboolean EXT_texture_env_add; GLboolean EXT_texture_env_add;
GLboolean EXT_texture_env_combine; GLboolean EXT_texture_env_combine;
GLboolean EXT_texture_env_dot3;
GLboolean EXT_texture_object; GLboolean EXT_texture_object;
GLboolean EXT_texture_lod_bias; GLboolean EXT_texture_lod_bias;
GLboolean EXT_vertex_array_set; GLboolean EXT_vertex_array_set;
@ -1321,18 +1322,18 @@ struct gl_extensions {
/* Bits to track array state changes (also used to summarize array enabled) /* Bits to track array state changes (also used to summarize array enabled)
*/ */
#define _NEW_ARRAY_VERTEX 0x1 #define _NEW_ARRAY_VERTEX 0x1
#define _NEW_ARRAY_COLOR 0x2 #define _NEW_ARRAY_COLOR 0x2
#define _NEW_ARRAY_NORMAL 0x4 #define _NEW_ARRAY_NORMAL 0x4
#define _NEW_ARRAY_INDEX 0x8 #define _NEW_ARRAY_INDEX 0x8
#define _NEW_ARRAY_EDGEFLAG 0x10 #define _NEW_ARRAY_EDGEFLAG 0x10
#define _NEW_ARRAY_SECONDARYCOLOR 0x20 #define _NEW_ARRAY_SECONDARYCOLOR 0x20
#define _NEW_ARRAY_FOGCOORD 0x40 #define _NEW_ARRAY_FOGCOORD 0x40
#define _NEW_ARRAY_TEXCOORD_0 0x80 #define _NEW_ARRAY_TEXCOORD_0 0x80
#define _NEW_ARRAY_TEXCOORD_1 0x100 #define _NEW_ARRAY_TEXCOORD_1 0x100
#define _NEW_ARRAY_TEXCOORD_2 0x200 #define _NEW_ARRAY_TEXCOORD_2 0x200
#define _NEW_ARRAY_TEXCOORD_3 0x400 #define _NEW_ARRAY_TEXCOORD_3 0x400
#define _NEW_ARRAY_TEXCOORD_4 0x800 #define _NEW_ARRAY_TEXCOORD_4 0x800
#define _NEW_ARRAY_TEXCOORD_5 0x1000 #define _NEW_ARRAY_TEXCOORD_5 0x1000
#define _NEW_ARRAY_TEXCOORD_6 0x2000 #define _NEW_ARRAY_TEXCOORD_6 0x2000
#define _NEW_ARRAY_TEXCOORD_7 0x4000 #define _NEW_ARRAY_TEXCOORD_7 0x4000
@ -1359,7 +1360,7 @@ struct gl_extensions {
#define DD_POINT_ATTEN 0x10000 #define DD_POINT_ATTEN 0x10000
#define DD_TRI_CULL_FRONT_BACK 0x400000 /* special case on some hw */ #define DD_TRI_CULL_FRONT_BACK 0x400000 /* special case on some hw */
#define DD_Z_NEVER 0x800000 /* special case on some hw */ #define DD_Z_NEVER 0x800000 /* special case on some hw */
#define DD_STENCIL 0x1000000 #define DD_STENCIL 0x1000000
/* Define the state changes under which each of these bits might change /* Define the state changes under which each of these bits might change
*/ */
@ -1380,7 +1381,7 @@ struct gl_extensions {
#define _DD_NEW_POINT_SIZE _NEW_POINT #define _DD_NEW_POINT_SIZE _NEW_POINT
#define _DD_NEW_POINT_ATTEN _NEW_POINT #define _DD_NEW_POINT_ATTEN _NEW_POINT
#define _DD_NEW_LIGHTING_CULL _NEW_LIGHT #define _DD_NEW_LIGHTING_CULL _NEW_LIGHT
#define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON #define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON
#define _DD_NEW_Z_NEVER _NEW_DEPTH #define _DD_NEW_Z_NEVER _NEW_DEPTH
#define _DD_NEW_STENCIL _NEW_STENCIL #define _DD_NEW_STENCIL _NEW_STENCIL
@ -1388,7 +1389,7 @@ struct gl_extensions {
#define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT| \ #define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT| \
_NEW_TEXTURE| \ _NEW_TEXTURE| \
_NEW_POINT| \ _NEW_POINT| \
_NEW_MODELVIEW) _NEW_MODELVIEW)
#define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT| \ #define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT| \
_NEW_TEXTURE) _NEW_TEXTURE)
@ -1420,7 +1421,7 @@ typedef union node Node;
/* /*
* The library context: * The library context:
*/ */
struct __GLcontextRec { struct __GLcontextRec {
/* /*
@ -1438,7 +1439,7 @@ struct __GLcontextRec {
struct _glapi_table *Save; /* Display list save funcs */ struct _glapi_table *Save; /* Display list save funcs */
struct _glapi_table *Exec; /* Execute funcs */ struct _glapi_table *Exec; /* Execute funcs */
struct _glapi_table *CurrentDispatch; /* == Save or Exec !! */ struct _glapi_table *CurrentDispatch; /* == Save or Exec !! */
GLboolean ExecPrefersFloat; /* What preference for color conversion? */ GLboolean ExecPrefersFloat; /* What preference for color conversion? */
GLboolean SavePrefersFloat; GLboolean SavePrefersFloat;
@ -1566,7 +1567,7 @@ struct __GLcontextRec {
/* Should 3Dfx Glide driver catch signals? */ /* Should 3Dfx Glide driver catch signals? */
GLboolean CatchSignals; GLboolean CatchSignals;
/* For debugging/development only */ /* For debugging/development only */
GLboolean NoRaster; GLboolean NoRaster;
GLboolean FirstTimeCurrent; GLboolean FirstTimeCurrent;
@ -1601,7 +1602,7 @@ extern GLenum gl_reduce_prim[];
#ifdef MESA_DEBUG #ifdef MESA_DEBUG
extern int MESA_VERBOSE; extern int MESA_VERBOSE;
extern int MESA_DEBUG_FLAGS; extern int MESA_DEBUG_FLAGS;
#else #else
# define MESA_VERBOSE 0 # define MESA_VERBOSE 0
@ -1622,12 +1623,12 @@ enum _verbose {
VERBOSE_API = 0x40, VERBOSE_API = 0x40,
VERBOSE_DISPLAY_LIST = 0x200, VERBOSE_DISPLAY_LIST = 0x200,
VERBOSE_LIGHTING = 0x400 VERBOSE_LIGHTING = 0x400
}; };
enum _debug { enum _debug {
DEBUG_ALWAYS_FLUSH = 0x1 DEBUG_ALWAYS_FLUSH = 0x1
}; };

View File

@ -1,4 +1,4 @@
/* $Id: texstate.c,v 1.26 2000/12/26 05:09:29 keithw Exp $ */ /* $Id: texstate.c,v 1.27 2001/01/06 22:46:13 gareth Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@ -100,7 +100,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
} }
if (texUnit->EnvMode == mode) if (texUnit->EnvMode == mode)
return; return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE); FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->EnvMode = mode; texUnit->EnvMode = mode;
break; break;
@ -117,7 +117,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
COPY_4FV(texUnit->EnvColor, tmp); COPY_4FV(texUnit->EnvColor, tmp);
break; break;
} }
case GL_COMBINE_RGB_EXT: case GL_COMBINE_RGB_EXT:
if (ctx->Extensions.EXT_texture_env_combine) { if (ctx->Extensions.EXT_texture_env_combine) {
GLenum mode = (GLenum) (GLint) *param; GLenum mode = (GLenum) (GLint) *param;
switch (mode) { switch (mode) {
@ -127,12 +127,19 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
case GL_ADD_SIGNED_EXT: case GL_ADD_SIGNED_EXT:
case GL_INTERPOLATE_EXT: case GL_INTERPOLATE_EXT:
break; break;
case GL_DOT3_RGB_EXT:
case GL_DOT3_RGBA_EXT:
if (!ctx->Extensions.EXT_texture_env_dot3) {
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
return;
}
break;
default: default:
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
return; return;
} }
if (texUnit->CombineModeRGB == mode) if (texUnit->CombineModeRGB == mode)
return; return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE); FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->CombineModeRGB = mode; texUnit->CombineModeRGB = mode;
} }
@ -140,7 +147,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
return; return;
} }
case GL_COMBINE_ALPHA_EXT: case GL_COMBINE_ALPHA_EXT:
if (ctx->Extensions.EXT_texture_env_combine) { if (ctx->Extensions.EXT_texture_env_combine) {
GLenum mode = (GLenum) (GLint) *param; GLenum mode = (GLenum) (GLint) *param;
switch (mode) { switch (mode) {
@ -150,7 +157,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
case GL_ADD_SIGNED_EXT: case GL_ADD_SIGNED_EXT:
case GL_INTERPOLATE_EXT: case GL_INTERPOLATE_EXT:
if (texUnit->CombineModeA == mode) if (texUnit->CombineModeA == mode)
return; return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE); FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->CombineModeA = mode; texUnit->CombineModeA = mode;
break; break;
@ -1326,7 +1333,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(coord)" ); gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(coord)" );
return; return;
} }
if (ctx->Driver.TexGen) if (ctx->Driver.TexGen)
ctx->Driver.TexGen( ctx, coord, pname, params ); ctx->Driver.TexGen( ctx, coord, pname, params );
} }

View File

@ -1,21 +1,21 @@
/* $Id: s_texture.c,v 1.7 2001/01/05 21:28:31 brianp Exp $ */ /* $Id: s_texture.c,v 1.8 2001/01/06 22:46:13 gareth Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 3.5 * Version: 3.5
* *
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included * The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software. * in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@ -197,7 +197,7 @@ palette_sample(const struct gl_texture_object *tObj,
} }
/* /*
* Bitflags for texture border color sampling. * Bitflags for texture border color sampling.
@ -1830,6 +1830,7 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit,
#define PROD(A,B) ( (GLuint)(A) * ((GLuint)(B)+1) ) #define PROD(A,B) ( (GLuint)(A) * ((GLuint)(B)+1) )
#define S_PROD(A,B) ( (GLint)(A) * ((GLint)(B)+1) )
static INLINE void static INLINE void
_mesa_texture_combine(const GLcontext *ctx, _mesa_texture_combine(const GLcontext *ctx,
@ -2044,6 +2045,28 @@ _mesa_texture_combine(const GLcontext *ctx,
} }
} }
break; break;
case GL_DOT3_RGB_EXT:
case GL_DOT3_RGBA_EXT:
{
const GLubyte (*arg0)[4] = (const GLubyte (*)[4]) argRGB[0];
const GLubyte (*arg1)[4] = (const GLubyte (*)[4]) argRGB[1];
/* ATI's EXT extension has a constant scale by 4. The ARB
* one will likely remove this restriction, and we should
* drop the EXT extension in favour of the ARB one.
*/
for (i = 0; i < n; i++) {
GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - 128,
(GLint)arg1[i][RCOMP] - 128) +
S_PROD((GLint)arg0[i][GCOMP] - 128,
(GLint)arg1[i][GCOMP] - 128) +
S_PROD((GLint)arg0[i][BCOMP] - 128,
(GLint)arg1[i][BCOMP] - 128)) >> 6;
rgba[i][RCOMP] = (GLubyte) CLAMP(dot, 0, 255);
rgba[i][GCOMP] = (GLubyte) CLAMP(dot, 0, 255);
rgba[i][BCOMP] = (GLubyte) CLAMP(dot, 0, 255);
}
}
break;
default: default:
gl_problem(NULL, "invalid combine mode"); gl_problem(NULL, "invalid combine mode");
} }
@ -2114,6 +2137,14 @@ _mesa_texture_combine(const GLcontext *ctx,
default: default:
gl_problem(NULL, "invalid combine mode"); gl_problem(NULL, "invalid combine mode");
} }
/* Fix the alpha component for GL_DOT3_RGBA_EXT combining.
*/
if (textureUnit->CombineModeRGB == GL_DOT3_RGBA_EXT) {
for (i = 0; i < n; i++) {
rgba[i][ACOMP] = rgba[i][RCOMP];
}
}
} }
#undef PROD #undef PROD
@ -2563,8 +2594,8 @@ _swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, GLuint n,
/* Sample the texture. */ /* Sample the texture. */
SWRAST_CONTEXT(ctx)->TextureSample[texUnit]( ctx, texUnit, SWRAST_CONTEXT(ctx)->TextureSample[texUnit]( ctx, texUnit,
textureUnit->_Current, textureUnit->_Current,
n, s, t, r, n, s, t, r,
lambda, texel ); lambda, texel );
apply_texture( ctx, textureUnit, n, primary_rgba, texel, rgba ); apply_texture( ctx, textureUnit, n, primary_rgba, texel, rgba );