summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2002-06-15 03:03:06 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2002-06-15 03:03:06 +0000
commit8afe7de8deaf3c9613fd68b344de8c52b02b1879 (patch)
treef600a192c9d0136faea8864a53eabc819eeb791f /src/mesa/drivers
parent8bdd0dc8d0e9c9cb2c71fbdd4c77e982cfc0b350 (diff)
Implemented GL_NV_texture_rectangle extension.
Replace struct gl_texure_object's Dimension w/ Target field. Added _EnabledUnits to struct gl_texture_attrib - the _ReallyEnabled field is obsolete, but still present for now. This effectively removes the 8-texture units limit, 32 units now possible, but unlikely! New TEXTURE_1D/2D/3D/CUBE/RECT_BIT tokens for unit->_ReallyEnabled field. Updated device drivers to use ctx->Texture._EnabledUnits.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/d3d/D3Dvbrender.c6
-rw-r--r--src/mesa/drivers/dos/dmesa.c2
-rw-r--r--src/mesa/drivers/glide/fxdd.c32
-rw-r--r--src/mesa/drivers/glide/fxsetup.c38
-rw-r--r--src/mesa/drivers/glide/fxvb.c8
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c6
-rw-r--r--src/mesa/drivers/windows/wmesa.c4
-rw-r--r--src/mesa/drivers/windows/wmesa_stereo.c8
-rw-r--r--src/mesa/drivers/x11/xm_line.c6
-rw-r--r--src/mesa/drivers/x11/xm_tri.c4
10 files changed, 49 insertions, 65 deletions
diff --git a/src/mesa/drivers/d3d/D3Dvbrender.c b/src/mesa/drivers/d3d/D3Dvbrender.c
index a3a18323fe..7f60ca82a6 100644
--- a/src/mesa/drivers/d3d/D3Dvbrender.c
+++ b/src/mesa/drivers/d3d/D3Dvbrender.c
@@ -1511,7 +1511,7 @@ static void SetRenderStates( GLcontext *ctx )
/*================================================*/
/* Check too see if there are new TEXTURE states. */
/*================================================*/
- if ( ctx->Texture._ReallyEnabled )
+ if ( ctx->Texture._EnabledUnits )
{
switch( ctx->Texture.Set[ctx->Texture.CurrentSet].EnvMode )
{
@@ -1871,9 +1871,9 @@ static void DebugRenderStates( GLcontext *ctx, BOOL bForce )
/*================================================*/
/* Check too see if there are new TEXTURE states. */
/*================================================*/
- if ( texture != ctx->Texture._ReallyEnabled )
+ if ( texture != ctx->Texture._EnabledUnits )
{
- texture = ctx->Texture._ReallyEnabled;
+ texture = ctx->Texture._EnabledUnits;
DPF(( 0, "\tTexture\t\t%s", (texture) ? "ENABLED" : "--------" ));
}
diff --git a/src/mesa/drivers/dos/dmesa.c b/src/mesa/drivers/dos/dmesa.c
index d05d436c1e..c9bc898dcb 100644
--- a/src/mesa/drivers/dos/dmesa.c
+++ b/src/mesa/drivers/dos/dmesa.c
@@ -413,7 +413,7 @@ static swrast_tri_func dmesa_choose_tri_function (GLcontext *ctx)
if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL;
if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL;
- if (ctx->Texture._ReallyEnabled) return (swrast_tri_func) NULL;
+ if (ctx->Texture._EnabledUnits) return (swrast_tri_func) NULL;
if (ctx->Light.ShadeModel==GL_SMOOTH
&& swrast->_RasterMask==DEPTH_BIT
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index caff948851..2fb1a2ada4 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -1,4 +1,4 @@
-/* $Id: fxdd.c,v 1.87 2002/06/15 02:38:16 brianp Exp $ */
+/* $Id: fxdd.c,v 1.88 2002/06/15 03:03:10 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -841,14 +841,15 @@ fx_check_IsInHardware(GLcontext * ctx)
/* Unsupported texture/multitexture cases */
if (fxMesa->haveTwoTMUs) {
- if (ctx->Texture._ReallyEnabled & (TEXTURE0_3D | TEXTURE1_3D))
- return GL_FALSE; /* can't do 3D textures */
- if (ctx->Texture._ReallyEnabled & (TEXTURE0_1D | TEXTURE1_1D))
- return GL_FALSE; /* can't do 1D textures */
+ /* we can only do 2D textures */
+ if (ctx->Texture.Unit[0]._ReallyEnabled & ~TEXTURE_2D_BIT)
+ return GL_FALSE;
+ if (ctx->Texture.Unit[1]._ReallyEnabled & ~TEXTURE_2D_BIT)
+ return GL_FALSE;
- if (ctx->Texture._ReallyEnabled & TEXTURE0_2D) {
+ if (ctx->Texture.Unit[0]._ReallyEnabled & TEXTURE_2D_BIT) {
if (ctx->Texture.Unit[0].EnvMode == GL_BLEND &&
- (ctx->Texture._ReallyEnabled & TEXTURE1_2D ||
+ (ctx->Texture.Unit[1]._ReallyEnabled & TEXTURE_2D_BIT ||
ctx->Texture.Unit[0].EnvColor[0] != 0 ||
ctx->Texture.Unit[0].EnvColor[1] != 0 ||
ctx->Texture.Unit[0].EnvColor[2] != 0 ||
@@ -859,7 +860,7 @@ fx_check_IsInHardware(GLcontext * ctx)
return GL_FALSE;
}
- if (ctx->Texture._ReallyEnabled & TEXTURE1_2D) {
+ if (ctx->Texture.Unit[1]._ReallyEnabled & TEXTURE_2D_BIT) {
if (ctx->Texture.Unit[1].EnvMode == GL_BLEND)
return GL_FALSE;
if (ctx->Texture.Unit[1]._Current->Image[0]->Border > 0)
@@ -873,9 +874,10 @@ fx_check_IsInHardware(GLcontext * ctx)
/* KW: This was wrong (I think) and I changed it... which doesn't mean
* it is now correct...
+ * BP: The old condition just seemed to test if both texture units
+ * were enabled. That's easy!
*/
- if ((ctx->Texture._ReallyEnabled & (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D)) &&
- (ctx->Texture._ReallyEnabled & (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D))) {
+ if (ctx->Texture._EnabledUnits == 0x3) {
/* Can't use multipass to blend a multitextured triangle - fall
* back to software.
*/
@@ -893,16 +895,12 @@ fx_check_IsInHardware(GLcontext * ctx)
}
}
else {
- if ((ctx->Texture._ReallyEnabled & (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D)) ||
- /* Not very well written ... */
- ((ctx->Texture._ReallyEnabled & TEXTURE0_1D) &&
- (!(ctx->Texture._ReallyEnabled & TEXTURE0_2D)))
- ) {
+ /* we have just one texture unit */
+ if (ctx->Texture._EnabledUnits > 0x1) {
return GL_FALSE;
}
-
- if ((ctx->Texture._ReallyEnabled & TEXTURE0_2D) &&
+ if ((ctx->Texture.Unit[0]._ReallyEnabled & TEXTURE_2D_BIT) &&
(ctx->Texture.Unit[0].EnvMode == GL_BLEND)) {
return GL_FALSE;
}
diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c
index 431b02a9ba..bf51635b31 100644
--- a/src/mesa/drivers/glide/fxsetup.c
+++ b/src/mesa/drivers/glide/fxsetup.c
@@ -1,4 +1,4 @@
-/* $Id: fxsetup.c,v 1.36 2001/09/23 16:50:01 brianp Exp $ */
+/* $Id: fxsetup.c,v 1.37 2002/06/15 03:03:10 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1002,39 +1002,25 @@ static void
fxSetupTexture_NoLock(GLcontext * ctx)
{
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
- GLuint tex2Denabled;
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxSetupTexture(...)\n");
}
- /* Texture Combine, Color Combine and Alpha Combine.
- */
- tex2Denabled = (ctx->Texture._ReallyEnabled & TEXTURE0_2D);
-
- if (fxMesa->haveTwoTMUs)
- tex2Denabled |= (ctx->Texture._ReallyEnabled & TEXTURE1_2D);
-
- switch (tex2Denabled) {
- case TEXTURE0_2D:
+ /* Texture Combine, Color Combine and Alpha Combine. */
+ if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
+ ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT &&
+ fxMesa->haveTwoTMUs) {
+ fxSetupTextureDoubleTMU_NoLock(ctx);
+ }
+ else if (ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT) {
fxSetupTextureSingleTMU_NoLock(ctx, 0);
- break;
- case TEXTURE1_2D:
+ }
+ else if (ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT) {
fxSetupTextureSingleTMU_NoLock(ctx, 1);
- break;
- case (TEXTURE0_2D | TEXTURE1_2D):
- if (fxMesa->haveTwoTMUs)
- fxSetupTextureDoubleTMU_NoLock(ctx);
- else {
- if (MESA_VERBOSE & VERBOSE_DRIVER)
- fprintf(stderr, "fxmesa: enabling fake multitexture\n");
-
- fxSetupTextureSingleTMU_NoLock(ctx, 0);
- }
- break;
- default:
+ }
+ else {
fxSetupTextureNone_NoLock(ctx);
- break;
}
}
diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c
index f0534b65ec..24e01af096 100644
--- a/src/mesa/drivers/glide/fxvb.c
+++ b/src/mesa/drivers/glide/fxvb.c
@@ -1,4 +1,4 @@
-/* $Id: fxvb.c,v 1.13 2002/06/15 02:38:16 brianp Exp $ */
+/* $Id: fxvb.c,v 1.14 2002/06/15 03:03:10 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -342,8 +342,8 @@ void fxChooseVertexState( GLcontext *ctx )
fxMesa->tmu_source[0] = 0;
fxMesa->tmu_source[1] = 1;
- if (ctx->Texture._ReallyEnabled & TEXTURE1_ANY) {
- if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY) {
+ if (ctx->Texture._EnabledUnits & 0x2) {
+ if (ctx->Texture._EnabledUnits & 0x1) {
ind |= SETUP_TMU1|SETUP_TMU0;
}
else {
@@ -352,7 +352,7 @@ void fxChooseVertexState( GLcontext *ctx )
ind |= SETUP_TMU0;
}
}
- else if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY) {
+ else if (ctx->Texture._EnabledUnits & 0x1) {
ind |= SETUP_TMU0;
}
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 4b69df600f..5675171b96 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -1,4 +1,4 @@
-/* $Id: osmesa.c,v 1.81 2002/06/15 02:38:17 brianp Exp $ */
+/* $Id: osmesa.c,v 1.82 2002/06/15 03:03:10 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1802,7 +1802,7 @@ osmesa_choose_line_function( GLcontext *ctx )
if (CHAN_BITS != 8) return NULL;
if (ctx->RenderMode != GL_RENDER) return NULL;
if (ctx->Line.SmoothFlag) return NULL;
- if (ctx->Texture._ReallyEnabled) return NULL;
+ if (ctx->Texture._EnabledUnits) return NULL;
if (ctx->Light.ShadeModel != GL_FLAT) return NULL;
if (ctx->Line.Width != 1.0F) return NULL;
if (ctx->Line.StippleFlag) return NULL;
@@ -1956,7 +1956,7 @@ osmesa_choose_triangle_function( GLcontext *ctx )
if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL;
if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL;
if (ctx->Polygon.StippleFlag) return (swrast_tri_func) NULL;
- if (ctx->Texture._ReallyEnabled) return (swrast_tri_func) NULL;
+ if (ctx->Texture._EnabledUnits) return (swrast_tri_func) NULL;
if (osmesa->format != OSMESA_RGBA &&
osmesa->format != OSMESA_BGRA &&
osmesa->format != OSMESA_ARGB) return (swrast_tri_func) NULL;
diff --git a/src/mesa/drivers/windows/wmesa.c b/src/mesa/drivers/windows/wmesa.c
index 94a23d2d75..09fa23737f 100644
--- a/src/mesa/drivers/windows/wmesa.c
+++ b/src/mesa/drivers/windows/wmesa.c
@@ -1,4 +1,4 @@
-/* $Id: wmesa.c,v 1.30 2002/06/15 02:38:17 brianp Exp $ */
+/* $Id: wmesa.c,v 1.31 2002/06/15 03:03:10 brianp Exp $ */
/*
* Windows (Win32) device driver for Mesa 3.4
@@ -3201,7 +3201,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx )
int depth = wmesa->cColorBits;
if (ctx->Polygon.SmoothFlag) return NULL;
- if (ctx->Texture._ReallyEnabled) return NULL;
+ if (ctx->Texture._EnabledUnits) return NULL;
if (!wmesa->db_flag) return NULL;
if (ctx->swrast->_RasterMask & MULTI_DRAW_BIT) return NULL;
diff --git a/src/mesa/drivers/windows/wmesa_stereo.c b/src/mesa/drivers/windows/wmesa_stereo.c
index a4397c41bf..fea0dc4229 100644
--- a/src/mesa/drivers/windows/wmesa_stereo.c
+++ b/src/mesa/drivers/windows/wmesa_stereo.c
@@ -421,7 +421,7 @@ extern points_func choose_points_function( GLcontext* ctx )
{
STARTPROFILE
if (ctx->Point.Size==1.0 && !ctx->Point.SmoothFlag && ctx->_RasterMask==0
- && !ctx->Texture._ReallyEnabled && ctx->Visual->RGBAflag) {
+ && ctx->Texture._EnabledUnits == 0 && ctx->Visual->RGBAflag) {
ENDPROFILE(choose_points_function)
return fast_rgb_points;
}
@@ -479,7 +479,7 @@ static line_func choose_line_function( GLcontext* ctx )
STARTPROFILE
if (ctx->Line.Width==1.0 && !ctx->Line.SmoothFlag && !ctx->Line.StippleFlag
&& ctx->Light.ShadeModel==GL_FLAT && ctx->_RasterMask==0
- && !ctx->Texture._ReallyEnabled && Current->rgb_flag) {
+ && ctx->Texture._EnabledUnits == 0 && Current->rgb_flag) {
ENDPROFILE(choose_line_function)
return fast_flat_rgb_line;
}
@@ -590,7 +590,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx )
{
if (ctx->Polygon.SmoothFlag) return NULL;
if (ctx->Polygon.StippleFlag) return NULL;
- if (ctx->Texture._ReallyEnabled) return NULL;
+ if (ctx->Texture._EnabledUnits) return NULL;
if (ctx->_RasterMask==DEPTH_BIT
&& ctx->Depth.Func==GL_LESS
@@ -661,7 +661,7 @@ static polygon_func choose_polygon_function( GLcontext* ctx )
STARTPROFILE
if (!ctx->Polygon.SmoothFlag && !ctx->Polygon.StippleFlag
&& ctx->Light.ShadeModel==GL_FLAT && ctx->_RasterMask==0
- && !ctx->Texture._ReallyEnabled && Current->rgb_flag==GL_TRUE) {
+ && ctx->Texture._EnabledUnits == 0 && Current->rgb_flag==GL_TRUE) {
ENDPROFILE(choose_polygon_function)
return fast_flat_rgb_polygon;
}
diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c
index ce70680901..989969d024 100644
--- a/src/mesa/drivers/x11/xm_line.c
+++ b/src/mesa/drivers/x11/xm_line.c
@@ -1,4 +1,4 @@
-/* $Id: xm_line.c,v 1.19 2002/06/15 02:38:17 brianp Exp $ */
+/* $Id: xm_line.c,v 1.20 2002/06/15 03:03:10 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -101,7 +101,7 @@ void xmesa_choose_point( GLcontext *ctx )
if (ctx->RenderMode == GL_RENDER
&& ctx->Point.Size == 1.0F && !ctx->Point.SmoothFlag
&& swrast->_RasterMask == 0
- && !ctx->Texture._ReallyEnabled
+ && !ctx->Texture._EnabledUnits
&& xmesa->xm_buffer->buffer != XIMAGE) {
swrast->Point = draw_points_ANY_pixmap;
}
@@ -557,7 +557,7 @@ static swrast_line_func get_line_func( GLcontext *ctx )
if (ctx->RenderMode != GL_RENDER) return (swrast_line_func) NULL;
if (ctx->Line.SmoothFlag) return (swrast_line_func) NULL;
- if (ctx->Texture._ReallyEnabled) return (swrast_line_func) NULL;
+ if (ctx->Texture._EnabledUnits) return (swrast_line_func) NULL;
if (ctx->Light.ShadeModel != GL_FLAT) return (swrast_line_func) NULL;
if (ctx->Line.StippleFlag) return (swrast_line_func) NULL;
if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL;
diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c
index f0aef4c0ec..4b3f02677e 100644
--- a/src/mesa/drivers/x11/xm_tri.c
+++ b/src/mesa/drivers/x11/xm_tri.c
@@ -1,4 +1,4 @@
-/* $Id: xm_tri.c,v 1.23 2002/06/15 02:38:17 brianp Exp $ */
+/* $Id: xm_tri.c,v 1.24 2002/06/15 03:03:10 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1529,7 +1529,7 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx )
if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL;
if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL;
- if (ctx->Texture._ReallyEnabled) return (swrast_tri_func) NULL;
+ if (ctx->Texture._EnabledUnits) return (swrast_tri_func) NULL;
if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_tri_func) NULL;
if (xmesa->xm_buffer->buffer==XIMAGE) {