summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/api_arrayelt.c96
-rw-r--r--src/mesa/main/api_exec.c884
-rw-r--r--src/mesa/main/api_exec.h37
-rw-r--r--src/mesa/main/api_noop.c9
-rw-r--r--src/mesa/main/api_validate.c2
-rw-r--r--src/mesa/main/attrib.c30
-rw-r--r--src/mesa/main/blend.c11
-rw-r--r--src/mesa/main/buffers.c336
-rw-r--r--src/mesa/main/buffers.h30
-rw-r--r--src/mesa/main/clear.c179
-rw-r--r--src/mesa/main/clear.h (renamed from src/mesa/main/api_eval.h)28
-rw-r--r--src/mesa/main/config.h38
-rw-r--r--[-rwxr-xr-x]src/mesa/main/context.c83
-rw-r--r--src/mesa/main/dd.h6
-rw-r--r--src/mesa/main/dlist.c12
-rw-r--r--src/mesa/main/drawpix.c165
-rw-r--r--src/mesa/main/drawpix.h12
-rw-r--r--src/mesa/main/enable.c5
-rw-r--r--src/mesa/main/ffvertex_prog.c287
-rw-r--r--src/mesa/main/framebuffer.c80
-rw-r--r--src/mesa/main/framebuffer.h8
-rw-r--r--src/mesa/main/get.c52
-rw-r--r--src/mesa/main/get_gen.py4
-rw-r--r--src/mesa/main/glheader.h5
-rw-r--r--src/mesa/main/histogram.c65
-rw-r--r--src/mesa/main/histogram.h6
-rw-r--r--src/mesa/main/image.c497
-rw-r--r--src/mesa/main/image.h47
-rw-r--r--src/mesa/main/light.c3
-rw-r--r--src/mesa/main/macros.h7
-rw-r--r--src/mesa/main/mfeatures.h80
-rw-r--r--src/mesa/main/mipmap.c2
-rw-r--r--src/mesa/main/mm.c8
-rw-r--r--src/mesa/main/mm.h5
-rw-r--r--src/mesa/main/mtypes.h3
-rw-r--r--src/mesa/main/multisample.c66
-rw-r--r--src/mesa/main/multisample.h38
-rw-r--r--src/mesa/main/pixel.c679
-rw-r--r--src/mesa/main/pixel.h67
-rw-r--r--src/mesa/main/pixelstore.c283
-rw-r--r--src/mesa/main/pixelstore.h50
-rw-r--r--src/mesa/main/points.c29
-rw-r--r--src/mesa/main/points.h8
-rw-r--r--src/mesa/main/queryobj.c4
-rw-r--r--src/mesa/main/rastpos.c4
-rw-r--r--src/mesa/main/readpix.c191
-rw-r--r--src/mesa/main/readpix.h42
-rw-r--r--src/mesa/main/renderbuffer.c2
-rw-r--r--src/mesa/main/scissor.c99
-rw-r--r--src/mesa/main/scissor.h46
-rw-r--r--src/mesa/main/sources19
-rw-r--r--src/mesa/main/state.c833
-rw-r--r--src/mesa/main/state.h12
-rw-r--r--src/mesa/main/texcompress.c17
-rw-r--r--src/mesa/main/texenv.c861
-rw-r--r--src/mesa/main/texenv.h52
-rw-r--r--src/mesa/main/texenvprogram.c10
-rw-r--r--src/mesa/main/texformat.c61
-rw-r--r--src/mesa/main/texformat.h10
-rw-r--r--src/mesa/main/texformat_tmp.h26
-rw-r--r--src/mesa/main/texgen.c601
-rw-r--r--src/mesa/main/texgen.h62
-rw-r--r--src/mesa/main/teximage.c21
-rw-r--r--src/mesa/main/texobj.c4
-rw-r--r--src/mesa/main/texparam.c1035
-rw-r--r--src/mesa/main/texparam.h63
-rw-r--r--src/mesa/main/texstate.c2408
-rw-r--r--src/mesa/main/texstate.h75
-rw-r--r--src/mesa/main/texstore.c106
-rw-r--r--src/mesa/main/texstore.h1
-rw-r--r--src/mesa/main/varray.c30
-rw-r--r--src/mesa/main/varray.h14
72 files changed, 6147 insertions, 4904 deletions
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index 72091b0789..d124c724c9 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -166,7 +166,7 @@ static void GLAPIENTRY VertexAttrib1NbvNV(GLuint index, const GLbyte *v)
static void GLAPIENTRY VertexAttrib1bvNV(GLuint index, const GLbyte *v)
{
- CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0]));
+ CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
static void GLAPIENTRY VertexAttrib2NbvNV(GLuint index, const GLbyte *v)
@@ -176,7 +176,7 @@ static void GLAPIENTRY VertexAttrib2NbvNV(GLuint index, const GLbyte *v)
static void GLAPIENTRY VertexAttrib2bvNV(GLuint index, const GLbyte *v)
{
- CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1]));
+ CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
static void GLAPIENTRY VertexAttrib3NbvNV(GLuint index, const GLbyte *v)
@@ -188,7 +188,7 @@ static void GLAPIENTRY VertexAttrib3NbvNV(GLuint index, const GLbyte *v)
static void GLAPIENTRY VertexAttrib3bvNV(GLuint index, const GLbyte *v)
{
- CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+ CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
}
static void GLAPIENTRY VertexAttrib4NbvNV(GLuint index, const GLbyte *v)
@@ -201,7 +201,7 @@ static void GLAPIENTRY VertexAttrib4NbvNV(GLuint index, const GLbyte *v)
static void GLAPIENTRY VertexAttrib4bvNV(GLuint index, const GLbyte *v)
{
- CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+ CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
}
/* GL_UNSIGNED_BYTE attributes */
@@ -213,7 +213,7 @@ static void GLAPIENTRY VertexAttrib1NubvNV(GLuint index, const GLubyte *v)
static void GLAPIENTRY VertexAttrib1ubvNV(GLuint index, const GLubyte *v)
{
- CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0]));
+ CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
static void GLAPIENTRY VertexAttrib2NubvNV(GLuint index, const GLubyte *v)
@@ -224,7 +224,7 @@ static void GLAPIENTRY VertexAttrib2NubvNV(GLuint index, const GLubyte *v)
static void GLAPIENTRY VertexAttrib2ubvNV(GLuint index, const GLubyte *v)
{
- CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1]));
+ CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
static void GLAPIENTRY VertexAttrib3NubvNV(GLuint index, const GLubyte *v)
@@ -235,7 +235,7 @@ static void GLAPIENTRY VertexAttrib3NubvNV(GLuint index, const GLubyte *v)
}
static void GLAPIENTRY VertexAttrib3ubvNV(GLuint index, const GLubyte *v)
{
- CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+ CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
}
static void GLAPIENTRY VertexAttrib4NubvNV(GLuint index, const GLubyte *v)
@@ -248,7 +248,7 @@ static void GLAPIENTRY VertexAttrib4NubvNV(GLuint index, const GLubyte *v)
static void GLAPIENTRY VertexAttrib4ubvNV(GLuint index, const GLubyte *v)
{
- CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+ CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
}
/* GL_SHORT attributes */
@@ -260,7 +260,7 @@ static void GLAPIENTRY VertexAttrib1NsvNV(GLuint index, const GLshort *v)
static void GLAPIENTRY VertexAttrib1svNV(GLuint index, const GLshort *v)
{
- CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0]));
+ CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
static void GLAPIENTRY VertexAttrib2NsvNV(GLuint index, const GLshort *v)
@@ -271,7 +271,7 @@ static void GLAPIENTRY VertexAttrib2NsvNV(GLuint index, const GLshort *v)
static void GLAPIENTRY VertexAttrib2svNV(GLuint index, const GLshort *v)
{
- CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1]));
+ CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
static void GLAPIENTRY VertexAttrib3NsvNV(GLuint index, const GLshort *v)
@@ -283,7 +283,7 @@ static void GLAPIENTRY VertexAttrib3NsvNV(GLuint index, const GLshort *v)
static void GLAPIENTRY VertexAttrib3svNV(GLuint index, const GLshort *v)
{
- CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+ CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
}
static void GLAPIENTRY VertexAttrib4NsvNV(GLuint index, const GLshort *v)
@@ -296,7 +296,7 @@ static void GLAPIENTRY VertexAttrib4NsvNV(GLuint index, const GLshort *v)
static void GLAPIENTRY VertexAttrib4svNV(GLuint index, const GLshort *v)
{
- CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+ CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
}
/* GL_UNSIGNED_SHORT attributes */
@@ -308,7 +308,7 @@ static void GLAPIENTRY VertexAttrib1NusvNV(GLuint index, const GLushort *v)
static void GLAPIENTRY VertexAttrib1usvNV(GLuint index, const GLushort *v)
{
- CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0]));
+ CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
static void GLAPIENTRY VertexAttrib2NusvNV(GLuint index, const GLushort *v)
@@ -319,7 +319,7 @@ static void GLAPIENTRY VertexAttrib2NusvNV(GLuint index, const GLushort *v)
static void GLAPIENTRY VertexAttrib2usvNV(GLuint index, const GLushort *v)
{
- CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1]));
+ CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
static void GLAPIENTRY VertexAttrib3NusvNV(GLuint index, const GLushort *v)
@@ -331,7 +331,7 @@ static void GLAPIENTRY VertexAttrib3NusvNV(GLuint index, const GLushort *v)
static void GLAPIENTRY VertexAttrib3usvNV(GLuint index, const GLushort *v)
{
- CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+ CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
}
static void GLAPIENTRY VertexAttrib4NusvNV(GLuint index, const GLushort *v)
@@ -344,7 +344,7 @@ static void GLAPIENTRY VertexAttrib4NusvNV(GLuint index, const GLushort *v)
static void GLAPIENTRY VertexAttrib4usvNV(GLuint index, const GLushort *v)
{
- CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+ CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
}
/* GL_INT attributes */
@@ -356,7 +356,7 @@ static void GLAPIENTRY VertexAttrib1NivNV(GLuint index, const GLint *v)
static void GLAPIENTRY VertexAttrib1ivNV(GLuint index, const GLint *v)
{
- CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0]));
+ CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
static void GLAPIENTRY VertexAttrib2NivNV(GLuint index, const GLint *v)
@@ -367,7 +367,7 @@ static void GLAPIENTRY VertexAttrib2NivNV(GLuint index, const GLint *v)
static void GLAPIENTRY VertexAttrib2ivNV(GLuint index, const GLint *v)
{
- CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1]));
+ CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
static void GLAPIENTRY VertexAttrib3NivNV(GLuint index, const GLint *v)
@@ -379,7 +379,7 @@ static void GLAPIENTRY VertexAttrib3NivNV(GLuint index, const GLint *v)
static void GLAPIENTRY VertexAttrib3ivNV(GLuint index, const GLint *v)
{
- CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+ CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
}
static void GLAPIENTRY VertexAttrib4NivNV(GLuint index, const GLint *v)
@@ -392,7 +392,7 @@ static void GLAPIENTRY VertexAttrib4NivNV(GLuint index, const GLint *v)
static void GLAPIENTRY VertexAttrib4ivNV(GLuint index, const GLint *v)
{
- CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+ CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
}
/* GL_UNSIGNED_INT attributes */
@@ -404,7 +404,7 @@ static void GLAPIENTRY VertexAttrib1NuivNV(GLuint index, const GLuint *v)
static void GLAPIENTRY VertexAttrib1uivNV(GLuint index, const GLuint *v)
{
- CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0]));
+ CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
static void GLAPIENTRY VertexAttrib2NuivNV(GLuint index, const GLuint *v)
@@ -415,7 +415,7 @@ static void GLAPIENTRY VertexAttrib2NuivNV(GLuint index, const GLuint *v)
static void GLAPIENTRY VertexAttrib2uivNV(GLuint index, const GLuint *v)
{
- CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1]));
+ CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
static void GLAPIENTRY VertexAttrib3NuivNV(GLuint index, const GLuint *v)
@@ -427,7 +427,7 @@ static void GLAPIENTRY VertexAttrib3NuivNV(GLuint index, const GLuint *v)
static void GLAPIENTRY VertexAttrib3uivNV(GLuint index, const GLuint *v)
{
- CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+ CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
}
static void GLAPIENTRY VertexAttrib4NuivNV(GLuint index, const GLuint *v)
@@ -440,7 +440,7 @@ static void GLAPIENTRY VertexAttrib4NuivNV(GLuint index, const GLuint *v)
static void GLAPIENTRY VertexAttrib4uivNV(GLuint index, const GLuint *v)
{
- CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+ CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
}
/* GL_FLOAT attributes */
@@ -602,7 +602,7 @@ static void GLAPIENTRY VertexAttrib1NbvARB(GLuint index, const GLbyte *v)
static void GLAPIENTRY VertexAttrib1bvARB(GLuint index, const GLbyte *v)
{
- CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0]));
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
static void GLAPIENTRY VertexAttrib2NbvARB(GLuint index, const GLbyte *v)
@@ -612,7 +612,7 @@ static void GLAPIENTRY VertexAttrib2NbvARB(GLuint index, const GLbyte *v)
static void GLAPIENTRY VertexAttrib2bvARB(GLuint index, const GLbyte *v)
{
- CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1]));
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
static void GLAPIENTRY VertexAttrib3NbvARB(GLuint index, const GLbyte *v)
@@ -624,7 +624,7 @@ static void GLAPIENTRY VertexAttrib3NbvARB(GLuint index, const GLbyte *v)
static void GLAPIENTRY VertexAttrib3bvARB(GLuint index, const GLbyte *v)
{
- CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
}
static void GLAPIENTRY VertexAttrib4NbvARB(GLuint index, const GLbyte *v)
@@ -637,7 +637,7 @@ static void GLAPIENTRY VertexAttrib4NbvARB(GLuint index, const GLbyte *v)
static void GLAPIENTRY VertexAttrib4bvARB(GLuint index, const GLbyte *v)
{
- CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
}
/* GL_UNSIGNED_BYTE attributes */
@@ -649,7 +649,7 @@ static void GLAPIENTRY VertexAttrib1NubvARB(GLuint index, const GLubyte *v)
static void GLAPIENTRY VertexAttrib1ubvARB(GLuint index, const GLubyte *v)
{
- CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0]));
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
static void GLAPIENTRY VertexAttrib2NubvARB(GLuint index, const GLubyte *v)
@@ -660,7 +660,7 @@ static void GLAPIENTRY VertexAttrib2NubvARB(GLuint index, const GLubyte *v)
static void GLAPIENTRY VertexAttrib2ubvARB(GLuint index, const GLubyte *v)
{
- CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1]));
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
static void GLAPIENTRY VertexAttrib3NubvARB(GLuint index, const GLubyte *v)
@@ -671,7 +671,7 @@ static void GLAPIENTRY VertexAttrib3NubvARB(GLuint index, const GLubyte *v)
}
static void GLAPIENTRY VertexAttrib3ubvARB(GLuint index, const GLubyte *v)
{
- CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
}
static void GLAPIENTRY VertexAttrib4NubvARB(GLuint index, const GLubyte *v)
@@ -684,7 +684,7 @@ static void GLAPIENTRY VertexAttrib4NubvARB(GLuint index, const GLubyte *v)
static void GLAPIENTRY VertexAttrib4ubvARB(GLuint index, const GLubyte *v)
{
- CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
}
/* GL_SHORT attributes */
@@ -696,7 +696,7 @@ static void GLAPIENTRY VertexAttrib1NsvARB(GLuint index, const GLshort *v)
static void GLAPIENTRY VertexAttrib1svARB(GLuint index, const GLshort *v)
{
- CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0]));
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
static void GLAPIENTRY VertexAttrib2NsvARB(GLuint index, const GLshort *v)
@@ -707,7 +707,7 @@ static void GLAPIENTRY VertexAttrib2NsvARB(GLuint index, const GLshort *v)
static void GLAPIENTRY VertexAttrib2svARB(GLuint index, const GLshort *v)
{
- CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1]));
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
static void GLAPIENTRY VertexAttrib3NsvARB(GLuint index, const GLshort *v)
@@ -719,7 +719,7 @@ static void GLAPIENTRY VertexAttrib3NsvARB(GLuint index, const GLshort *v)
static void GLAPIENTRY VertexAttrib3svARB(GLuint index, const GLshort *v)
{
- CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
}
static void GLAPIENTRY VertexAttrib4NsvARB(GLuint index, const GLshort *v)
@@ -732,7 +732,7 @@ static void GLAPIENTRY VertexAttrib4NsvARB(GLuint index, const GLshort *v)
static void GLAPIENTRY VertexAttrib4svARB(GLuint index, const GLshort *v)
{
- CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
}
/* GL_UNSIGNED_SHORT attributes */
@@ -744,7 +744,7 @@ static void GLAPIENTRY VertexAttrib1NusvARB(GLuint index, const GLushort *v)
static void GLAPIENTRY VertexAttrib1usvARB(GLuint index, const GLushort *v)
{
- CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0]));
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
static void GLAPIENTRY VertexAttrib2NusvARB(GLuint index, const GLushort *v)
@@ -755,7 +755,7 @@ static void GLAPIENTRY VertexAttrib2NusvARB(GLuint index, const GLushort *v)
static void GLAPIENTRY VertexAttrib2usvARB(GLuint index, const GLushort *v)
{
- CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1]));
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
static void GLAPIENTRY VertexAttrib3NusvARB(GLuint index, const GLushort *v)
@@ -767,7 +767,7 @@ static void GLAPIENTRY VertexAttrib3NusvARB(GLuint index, const GLushort *v)
static void GLAPIENTRY VertexAttrib3usvARB(GLuint index, const GLushort *v)
{
- CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
}
static void GLAPIENTRY VertexAttrib4NusvARB(GLuint index, const GLushort *v)
@@ -780,7 +780,7 @@ static void GLAPIENTRY VertexAttrib4NusvARB(GLuint index, const GLushort *v)
static void GLAPIENTRY VertexAttrib4usvARB(GLuint index, const GLushort *v)
{
- CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
}
/* GL_INT attributes */
@@ -792,7 +792,7 @@ static void GLAPIENTRY VertexAttrib1NivARB(GLuint index, const GLint *v)
static void GLAPIENTRY VertexAttrib1ivARB(GLuint index, const GLint *v)
{
- CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0]));
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
static void GLAPIENTRY VertexAttrib2NivARB(GLuint index, const GLint *v)
@@ -803,7 +803,7 @@ static void GLAPIENTRY VertexAttrib2NivARB(GLuint index, const GLint *v)
static void GLAPIENTRY VertexAttrib2ivARB(GLuint index, const GLint *v)
{
- CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1]));
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
static void GLAPIENTRY VertexAttrib3NivARB(GLuint index, const GLint *v)
@@ -815,7 +815,7 @@ static void GLAPIENTRY VertexAttrib3NivARB(GLuint index, const GLint *v)
static void GLAPIENTRY VertexAttrib3ivARB(GLuint index, const GLint *v)
{
- CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
}
static void GLAPIENTRY VertexAttrib4NivARB(GLuint index, const GLint *v)
@@ -828,7 +828,7 @@ static void GLAPIENTRY VertexAttrib4NivARB(GLuint index, const GLint *v)
static void GLAPIENTRY VertexAttrib4ivARB(GLuint index, const GLint *v)
{
- CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
}
/* GL_UNSIGNED_INT attributes */
@@ -840,7 +840,7 @@ static void GLAPIENTRY VertexAttrib1NuivARB(GLuint index, const GLuint *v)
static void GLAPIENTRY VertexAttrib1uivARB(GLuint index, const GLuint *v)
{
- CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0]));
+ CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0]));
}
static void GLAPIENTRY VertexAttrib2NuivARB(GLuint index, const GLuint *v)
@@ -851,7 +851,7 @@ static void GLAPIENTRY VertexAttrib2NuivARB(GLuint index, const GLuint *v)
static void GLAPIENTRY VertexAttrib2uivARB(GLuint index, const GLuint *v)
{
- CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1]));
+ CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1]));
}
static void GLAPIENTRY VertexAttrib3NuivARB(GLuint index, const GLuint *v)
@@ -863,7 +863,7 @@ static void GLAPIENTRY VertexAttrib3NuivARB(GLuint index, const GLuint *v)
static void GLAPIENTRY VertexAttrib3uivARB(GLuint index, const GLuint *v)
{
- CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2]));
+ CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]));
}
static void GLAPIENTRY VertexAttrib4NuivARB(GLuint index, const GLuint *v)
@@ -876,7 +876,7 @@ static void GLAPIENTRY VertexAttrib4NuivARB(GLuint index, const GLuint *v)
static void GLAPIENTRY VertexAttrib4uivARB(GLuint index, const GLuint *v)
{
- CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3]));
+ CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]));
}
/* GL_FLOAT attributes */
diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
new file mode 100644
index 0000000000..0c3c9c4de4
--- /dev/null
+++ b/src/mesa/main/api_exec.c
@@ -0,0 +1,884 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file api_exec.c
+ * Initialize dispatch table with the immidiate mode functions.
+ */
+
+
+#include "glheader.h"
+#if FEATURE_accum
+#include "accum.h"
+#endif
+#include "api_loopback.h"
+#include "api_exec.h"
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+#include "shader/arbprogram.h"
+#endif
+#if FEATURE_ATI_fragment_shader
+#include "shader/atifragshader.h"
+#endif
+#if FEATURE_attrib_stack
+#include "attrib.h"
+#endif
+#include "blend.h"
+#if FEATURE_ARB_vertex_buffer_object
+#include "bufferobj.h"
+#endif
+#include "arrayobj.h"
+#if FEATURE_draw_read_buffer
+#include "buffers.h"
+#endif
+#include "clear.h"
+#include "clip.h"
+#if FEATURE_colortable
+#include "colortab.h"
+#endif
+#include "context.h"
+#if FEATURE_convolution
+#include "convolve.h"
+#endif
+#include "depth.h"
+#if FEATURE_dlist
+#include "dlist.h"
+#endif
+#if FEATURE_drawpix
+#include "drawpix.h"
+#include "rastpos.h"
+#endif
+#include "enable.h"
+#if FEATURE_evaluators
+#include "eval.h"
+#endif
+#include "get.h"
+#if FEATURE_feedback
+#include "feedback.h"
+#endif
+#include "fog.h"
+#if FEATURE_EXT_framebuffer_object
+#include "fbobject.h"
+#endif
+#include "ffvertex_prog.h"
+#include "framebuffer.h"
+#include "hint.h"
+#if FEATURE_histogram
+#include "histogram.h"
+#endif
+#include "imports.h"
+#include "light.h"
+#include "lines.h"
+#include "macros.h"
+#include "matrix.h"
+#include "multisample.h"
+#if FEATURE_pixel_transfer
+#include "pixel.h"
+#endif
+#include "pixelstore.h"
+#include "points.h"
+#include "polygon.h"
+#if FEATURE_ARB_occlusion_query || FEATURE_EXT_timer_query
+#include "queryobj.h"
+#endif
+#include "readpix.h"
+#include "scissor.h"
+#include "state.h"
+#include "stencil.h"
+#include "texenv.h"
+#include "teximage.h"
+#if FEATURE_texgen
+#include "texgen.h"
+#endif
+#include "texobj.h"
+#include "texparam.h"
+#include "texstate.h"
+#include "mtypes.h"
+#include "varray.h"
+#if FEATURE_NV_vertex_program
+#include "shader/nvprogram.h"
+#endif
+#if FEATURE_NV_fragment_program
+#include "shader/nvprogram.h"
+#include "shader/program.h"
+#include "texenvprogram.h"
+#endif
+#if FEATURE_ARB_shader_objects
+#include "shaders.h"
+#endif
+#include "debug.h"
+#include "glapi/dispatch.h"
+
+
+
+/**
+ * Initialize a dispatch table with pointers to Mesa's immediate-mode
+ * commands.
+ *
+ * Pointers to glBegin()/glEnd() object commands and a few others
+ * are provided via the GLvertexformat interface.
+ *
+ * \param ctx GL context to which \c exec belongs.
+ * \param exec dispatch table.
+ */
+void
+_mesa_init_exec_table(struct _glapi_table *exec)
+{
+#if _HAVE_FULL_GL
+ _mesa_loopback_init_api_table( exec );
+#endif
+
+ /* load the dispatch slots we understand */
+ SET_AlphaFunc(exec, _mesa_AlphaFunc);
+ SET_BlendFunc(exec, _mesa_BlendFunc);
+ SET_Clear(exec, _mesa_Clear);
+ SET_ClearColor(exec, _mesa_ClearColor);
+ SET_ClearStencil(exec, _mesa_ClearStencil);
+ SET_ColorMask(exec, _mesa_ColorMask);
+ SET_CullFace(exec, _mesa_CullFace);
+ SET_Disable(exec, _mesa_Disable);
+#if FEATURE_draw_read_buffer
+ SET_DrawBuffer(exec, _mesa_DrawBuffer);
+ SET_ReadBuffer(exec, _mesa_ReadBuffer);
+#endif
+ SET_Enable(exec, _mesa_Enable);
+ SET_Finish(exec, _mesa_Finish);
+ SET_Flush(exec, _mesa_Flush);
+ SET_FrontFace(exec, _mesa_FrontFace);
+ SET_Frustum(exec, _mesa_Frustum);
+ SET_GetError(exec, _mesa_GetError);
+ SET_GetFloatv(exec, _mesa_GetFloatv);
+ SET_GetString(exec, _mesa_GetString);
+ SET_LineStipple(exec, _mesa_LineStipple);
+ SET_LineWidth(exec, _mesa_LineWidth);
+ SET_LoadIdentity(exec, _mesa_LoadIdentity);
+ SET_LoadMatrixf(exec, _mesa_LoadMatrixf);
+ SET_LogicOp(exec, _mesa_LogicOp);
+ SET_MatrixMode(exec, _mesa_MatrixMode);
+ SET_MultMatrixf(exec, _mesa_MultMatrixf);
+ SET_Ortho(exec, _mesa_Ortho);
+ SET_PixelStorei(exec, _mesa_PixelStorei);
+ SET_PopMatrix(exec, _mesa_PopMatrix);
+ SET_PushMatrix(exec, _mesa_PushMatrix);
+ SET_Rotatef(exec, _mesa_Rotatef);
+ SET_Scalef(exec, _mesa_Scalef);
+ SET_Scissor(exec, _mesa_Scissor);
+ SET_ShadeModel(exec, _mesa_ShadeModel);
+ SET_StencilFunc(exec, _mesa_StencilFunc);
+ SET_StencilMask(exec, _mesa_StencilMask);
+ SET_StencilOp(exec, _mesa_StencilOp);
+ SET_TexEnvfv(exec, _mesa_TexEnvfv);
+ SET_TexEnvi(exec, _mesa_TexEnvi);
+ SET_TexImage2D(exec, _mesa_TexImage2D);
+ SET_TexParameteri(exec, _mesa_TexParameteri);
+ SET_Translatef(exec, _mesa_Translatef);
+ SET_Viewport(exec, _mesa_Viewport);
+#if FEATURE_accum
+ SET_Accum(exec, _mesa_Accum);
+ SET_ClearAccum(exec, _mesa_ClearAccum);
+#endif
+#if FEATURE_dlist
+ SET_CallList(exec, _mesa_CallList);
+ SET_CallLists(exec, _mesa_CallLists);
+ SET_DeleteLists(exec, _mesa_DeleteLists);
+ SET_EndList(exec, _mesa_EndList);
+ SET_GenLists(exec, _mesa_GenLists);
+ SET_IsList(exec, _mesa_IsList);
+ SET_ListBase(exec, _mesa_ListBase);
+ SET_NewList(exec, _mesa_NewList);
+#endif
+ SET_ClearDepth(exec, _mesa_ClearDepth);
+ SET_ClearIndex(exec, _mesa_ClearIndex);
+ SET_ClipPlane(exec, _mesa_ClipPlane);
+ SET_ColorMaterial(exec, _mesa_ColorMaterial);
+ SET_CullParameterfvEXT(exec, _mesa_CullParameterfvEXT);
+ SET_CullParameterdvEXT(exec, _mesa_CullParameterdvEXT);
+ SET_DepthFunc(exec, _mesa_DepthFunc);
+ SET_DepthMask(exec, _mesa_DepthMask);
+ SET_DepthRange(exec, _mesa_DepthRange);
+#if FEATURE_drawpix
+ SET_Bitmap(exec, _mesa_Bitmap);
+ SET_CopyPixels(exec, _mesa_CopyPixels);
+ SET_DrawPixels(exec, _mesa_DrawPixels);
+#endif
+#if FEATURE_feedback
+ SET_InitNames(exec, _mesa_InitNames);
+ SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer);
+ SET_LoadName(exec, _mesa_LoadName);
+ SET_PassThrough(exec, _mesa_PassThrough);
+ SET_PopName(exec, _mesa_PopName);
+ SET_PushName(exec, _mesa_PushName);
+ SET_SelectBuffer(exec, _mesa_SelectBuffer);
+ SET_RenderMode(exec, _mesa_RenderMode);
+#endif
+ SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT);
+ SET_Fogf(exec, _mesa_Fogf);
+ SET_Fogfv(exec, _mesa_Fogfv);
+ SET_Fogi(exec, _mesa_Fogi);
+ SET_Fogiv(exec, _mesa_Fogiv);
+ SET_GetClipPlane(exec, _mesa_GetClipPlane);
+ SET_GetBooleanv(exec, _mesa_GetBooleanv);
+ SET_GetDoublev(exec, _mesa_GetDoublev);
+ SET_GetIntegerv(exec, _mesa_GetIntegerv);
+ SET_GetLightfv(exec, _mesa_GetLightfv);
+ SET_GetLightiv(exec, _mesa_GetLightiv);
+ SET_GetMaterialfv(exec, _mesa_GetMaterialfv);
+ SET_GetMaterialiv(exec, _mesa_GetMaterialiv);
+ SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple);
+ SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv);
+ SET_GetTexEnviv(exec, _mesa_GetTexEnviv);
+ SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv);
+ SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv);
+ SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv);
+ SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv);
+ SET_GetTexImage(exec, _mesa_GetTexImage);
+ SET_Hint(exec, _mesa_Hint);
+ SET_IndexMask(exec, _mesa_IndexMask);
+ SET_IsEnabled(exec, _mesa_IsEnabled);
+ SET_LightModelf(exec, _mesa_LightModelf);
+ SET_LightModelfv(exec, _mesa_LightModelfv);
+ SET_LightModeli(exec, _mesa_LightModeli);
+ SET_LightModeliv(exec, _mesa_LightModeliv);
+ SET_Lightf(exec, _mesa_Lightf);
+ SET_Lightfv(exec, _mesa_Lightfv);
+ SET_Lighti(exec, _mesa_Lighti);
+ SET_Lightiv(exec, _mesa_Lightiv);
+ SET_LoadMatrixd(exec, _mesa_LoadMatrixd);
+#if FEATURE_evaluators
+ SET_GetMapdv(exec, _mesa_GetMapdv);
+ SET_GetMapfv(exec, _mesa_GetMapfv);
+ SET_GetMapiv(exec, _mesa_GetMapiv);
+ SET_Map1d(exec, _mesa_Map1d);
+ SET_Map1f(exec, _mesa_Map1f);
+ SET_Map2d(exec, _mesa_Map2d);
+ SET_Map2f(exec, _mesa_Map2f);
+ SET_MapGrid1d(exec, _mesa_MapGrid1d);
+ SET_MapGrid1f(exec, _mesa_MapGrid1f);
+ SET_MapGrid2d(exec, _mesa_MapGrid2d);
+ SET_MapGrid2f(exec, _mesa_MapGrid2f);
+#endif
+ SET_MultMatrixd(exec, _mesa_MultMatrixd);
+#if FEATURE_pixel_transfer
+ SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv);
+ SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv);
+ SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv);
+ SET_PixelMapfv(exec, _mesa_PixelMapfv);
+ SET_PixelMapuiv(exec, _mesa_PixelMapuiv);
+ SET_PixelMapusv(exec, _mesa_PixelMapusv);
+ SET_PixelTransferf(exec, _mesa_PixelTransferf);
+ SET_PixelTransferi(exec, _mesa_PixelTransferi);
+ SET_PixelZoom(exec, _mesa_PixelZoom);
+#endif
+ SET_PixelStoref(exec, _mesa_PixelStoref);
+ SET_PointSize(exec, _mesa_PointSize);
+ SET_PolygonMode(exec, _mesa_PolygonMode);
+ SET_PolygonOffset(exec, _mesa_PolygonOffset);
+ SET_PolygonStipple(exec, _mesa_PolygonStipple);
+#if FEATURE_attrib_stack
+ SET_PopAttrib(exec, _mesa_PopAttrib);
+ SET_PushAttrib(exec, _mesa_PushAttrib);
+ SET_PopClientAttrib(exec, _mesa_PopClientAttrib);
+ SET_PushClientAttrib(exec, _mesa_PushClientAttrib);
+#endif
+#if FEATURE_drawpix
+ SET_RasterPos2f(exec, _mesa_RasterPos2f);
+ SET_RasterPos2fv(exec, _mesa_RasterPos2fv);
+ SET_RasterPos2i(exec, _mesa_RasterPos2i);
+ SET_RasterPos2iv(exec, _mesa_RasterPos2iv);
+ SET_RasterPos2d(exec, _mesa_RasterPos2d);
+ SET_RasterPos2dv(exec, _mesa_RasterPos2dv);
+ SET_RasterPos2s(exec, _mesa_RasterPos2s);
+ SET_RasterPos2sv(exec, _mesa_RasterPos2sv);
+ SET_RasterPos3d(exec, _mesa_RasterPos3d);
+ SET_RasterPos3dv(exec, _mesa_RasterPos3dv);
+ SET_RasterPos3f(exec, _mesa_RasterPos3f);
+ SET_RasterPos3fv(exec, _mesa_RasterPos3fv);
+ SET_RasterPos3i(exec, _mesa_RasterPos3i);
+ SET_RasterPos3iv(exec, _mesa_RasterPos3iv);
+ SET_RasterPos3s(exec, _mesa_RasterPos3s);
+ SET_RasterPos3sv(exec, _mesa_RasterPos3sv);
+ SET_RasterPos4d(exec, _mesa_RasterPos4d);
+ SET_RasterPos4dv(exec, _mesa_RasterPos4dv);
+ SET_RasterPos4f(exec, _mesa_RasterPos4f);
+ SET_RasterPos4fv(exec, _mesa_RasterPos4fv);
+ SET_RasterPos4i(exec, _mesa_RasterPos4i);
+ SET_RasterPos4iv(exec, _mesa_RasterPos4iv);
+ SET_RasterPos4s(exec, _mesa_RasterPos4s);
+ SET_RasterPos4sv(exec, _mesa_RasterPos4sv);
+#endif
+ SET_ReadPixels(exec, _mesa_ReadPixels);
+ SET_Rotated(exec, _mesa_Rotated);
+ SET_Scaled(exec, _mesa_Scaled);
+ SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT);
+ SET_TexEnvf(exec, _mesa_TexEnvf);
+ SET_TexEnviv(exec, _mesa_TexEnviv);
+
+#if FEATURE_texgen
+ SET_GetTexGendv(exec, _mesa_GetTexGendv);
+ SET_GetTexGenfv(exec, _mesa_GetTexGenfv);
+ SET_GetTexGeniv(exec, _mesa_GetTexGeniv);
+ SET_TexGend(exec, _mesa_TexGend);
+ SET_TexGendv(exec, _mesa_TexGendv);
+ SET_TexGenf(exec, _mesa_TexGenf);
+ SET_TexGenfv(exec, _mesa_TexGenfv);
+ SET_TexGeni(exec, _mesa_TexGeni);
+ SET_TexGeniv(exec, _mesa_TexGeniv);
+#endif
+
+ SET_TexImage1D(exec, _mesa_TexImage1D);
+ SET_TexParameterf(exec, _mesa_TexParameterf);
+ SET_TexParameterfv(exec, _mesa_TexParameterfv);
+ SET_TexParameteriv(exec, _mesa_TexParameteriv);
+ SET_Translated(exec, _mesa_Translated);
+
+ /* 1.1 */
+ SET_BindTexture(exec, _mesa_BindTexture);
+ SET_DeleteTextures(exec, _mesa_DeleteTextures);
+ SET_GenTextures(exec, _mesa_GenTextures);
+#if _HAVE_FULL_GL
+ SET_AreTexturesResident(exec, _mesa_AreTexturesResident);
+ SET_ColorPointer(exec, _mesa_ColorPointer);
+ SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D);
+ SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D);
+ SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D);
+ SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D);
+ SET_DisableClientState(exec, _mesa_DisableClientState);
+ SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer);
+ SET_EnableClientState(exec, _mesa_EnableClientState);
+ SET_GetPointerv(exec, _mesa_GetPointerv);
+ SET_IndexPointer(exec, _mesa_IndexPointer);
+ SET_InterleavedArrays(exec, _mesa_InterleavedArrays);
+ SET_IsTexture(exec, _mesa_IsTexture);
+ SET_NormalPointer(exec, _mesa_NormalPointer);
+ SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures);
+ SET_TexCoordPointer(exec, _mesa_TexCoordPointer);
+ SET_TexSubImage1D(exec, _mesa_TexSubImage1D);
+ SET_TexSubImage2D(exec, _mesa_TexSubImage2D);
+ SET_VertexPointer(exec, _mesa_VertexPointer);
+#endif
+
+ /* 1.2 */
+#if _HAVE_FULL_GL
+ SET_CopyTexSubImage3D(exec, _mesa_CopyTexSubImage3D);
+ SET_TexImage3D(exec, _mesa_TexImage3D);
+ SET_TexSubImage3D(exec, _mesa_TexSubImage3D);
+#endif
+
+ /* OpenGL 1.2 GL_ARB_imaging */
+ SET_BlendColor(exec, _mesa_BlendColor);
+ SET_BlendEquation(exec, _mesa_BlendEquation);
+ SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT);
+
+#if FEATURE_colortable
+ SET_ColorSubTable(exec, _mesa_ColorSubTable);
+ SET_ColorTable(exec, _mesa_ColorTable);
+ SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv);
+ SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv);
+ SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable);
+ SET_CopyColorTable(exec, _mesa_CopyColorTable);
+ SET_GetColorTable(exec, _mesa_GetColorTable);
+ SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv);
+ SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv);
+#endif
+
+#if FEATURE_convolution
+ SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D);
+ SET_ConvolutionFilter2D(exec, _mesa_ConvolutionFilter2D);
+ SET_ConvolutionParameterf(exec, _mesa_ConvolutionParameterf);
+ SET_ConvolutionParameterfv(exec, _mesa_ConvolutionParameterfv);
+ SET_ConvolutionParameteri(exec, _mesa_ConvolutionParameteri);
+ SET_ConvolutionParameteriv(exec, _mesa_ConvolutionParameteriv);
+ SET_CopyConvolutionFilter1D(exec, _mesa_CopyConvolutionFilter1D);
+ SET_CopyConvolutionFilter2D(exec, _mesa_CopyConvolutionFilter2D);
+ SET_GetConvolutionFilter(exec, _mesa_GetConvolutionFilter);
+ SET_GetConvolutionParameterfv(exec, _mesa_GetConvolutionParameterfv);
+ SET_GetConvolutionParameteriv(exec, _mesa_GetConvolutionParameteriv);
+ SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D);
+#endif
+#if FEATURE_histogram
+ SET_GetHistogram(exec, _mesa_GetHistogram);
+ SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv);
+ SET_GetHistogramParameteriv(exec, _mesa_GetHistogramParameteriv);
+ SET_GetMinmax(exec, _mesa_GetMinmax);
+ SET_GetMinmaxParameterfv(exec, _mesa_GetMinmaxParameterfv);
+ SET_GetMinmaxParameteriv(exec, _mesa_GetMinmaxParameteriv);
+ SET_GetSeparableFilter(exec, _mesa_GetSeparableFilter);
+ SET_Histogram(exec, _mesa_Histogram);
+ SET_Minmax(exec, _mesa_Minmax);
+ SET_ResetHistogram(exec, _mesa_ResetHistogram);
+ SET_ResetMinmax(exec, _mesa_ResetMinmax);
+#endif
+
+ /* OpenGL 2.0 */
+ SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate);
+ SET_StencilMaskSeparate(exec, _mesa_StencilMaskSeparate);
+ SET_StencilOpSeparate(exec, _mesa_StencilOpSeparate);
+#if FEATURE_ARB_shader_objects
+ SET_AttachShader(exec, _mesa_AttachShader);
+ SET_CreateProgram(exec, _mesa_CreateProgram);
+ SET_CreateShader(exec, _mesa_CreateShader);
+ SET_DeleteProgram(exec, _mesa_DeleteProgram);
+ SET_DeleteShader(exec, _mesa_DeleteShader);
+ SET_DetachShader(exec, _mesa_DetachShader);
+ SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders);
+ SET_GetProgramiv(exec, _mesa_GetProgramiv);
+ SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog);
+ SET_GetShaderiv(exec, _mesa_GetShaderiv);
+ SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog);
+ SET_IsProgram(exec, _mesa_IsProgram);
+ SET_IsShader(exec, _mesa_IsShader);
+#endif
+
+ /* OpenGL 2.1 */
+#if FEATURE_ARB_shader_objects
+ SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv);
+ SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv);
+ SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv);
+ SET_UniformMatrix4x2fv(exec, _mesa_UniformMatrix4x2fv);
+ SET_UniformMatrix3x4fv(exec, _mesa_UniformMatrix3x4fv);
+ SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv);
+#endif
+
+
+ /* 2. GL_EXT_blend_color */
+#if 0
+/* SET_BlendColorEXT(exec, _mesa_BlendColorEXT); */
+#endif
+
+ /* 3. GL_EXT_polygon_offset */
+#if _HAVE_FULL_GL
+ SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT);
+#endif
+
+ /* 6. GL_EXT_texture3d */
+#if 0
+/* SET_CopyTexSubImage3DEXT(exec, _mesa_CopyTexSubImage3D); */
+/* SET_TexImage3DEXT(exec, _mesa_TexImage3DEXT); */
+/* SET_TexSubImage3DEXT(exec, _mesa_TexSubImage3D); */
+#endif
+
+ /* 11. GL_EXT_histogram */
+#if 0
+ SET_GetHistogramEXT(exec, _mesa_GetHistogram);
+ SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv);
+ SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv);
+ SET_GetMinmaxEXT(exec, _mesa_GetMinmax);
+ SET_GetMinmaxParameterfvEXT(exec, _mesa_GetMinmaxParameterfv);
+ SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv);
+#endif
+
+ /* 14. SGI_color_table */
+#if 0
+ SET_ColorTableSGI(exec, _mesa_ColorTable);
+ SET_ColorSubTableSGI(exec, _mesa_ColorSubTable);
+ SET_GetColorTableSGI(exec, _mesa_GetColorTable);
+ SET_GetColorTableParameterfvSGI(exec, _mesa_GetColorTableParameterfv);
+ SET_GetColorTableParameterivSGI(exec, _mesa_GetColorTableParameteriv);
+#endif
+
+ /* 30. GL_EXT_vertex_array */
+#if _HAVE_FULL_GL
+ SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT);
+ SET_EdgeFlagPointerEXT(exec, _mesa_EdgeFlagPointerEXT);
+ SET_IndexPointerEXT(exec, _mesa_IndexPointerEXT);
+ SET_NormalPointerEXT(exec, _mesa_NormalPointerEXT);
+ SET_TexCoordPointerEXT(exec, _mesa_TexCoordPointerEXT);
+ SET_VertexPointerEXT(exec, _mesa_VertexPointerEXT);
+#endif
+
+ /* 37. GL_EXT_blend_minmax */
+#if 0
+ SET_BlendEquationEXT(exec, _mesa_BlendEquationEXT);
+#endif
+
+ /* 54. GL_EXT_point_parameters */
+#if _HAVE_FULL_GL
+ SET_PointParameterfEXT(exec, _mesa_PointParameterf);
+ SET_PointParameterfvEXT(exec, _mesa_PointParameterfv);
+#endif
+
+ /* 97. GL_EXT_compiled_vertex_array */
+#if _HAVE_FULL_GL
+ SET_LockArraysEXT(exec, _mesa_LockArraysEXT);
+ SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT);
+#endif
+
+ /* 148. GL_EXT_multi_draw_arrays */
+#if _HAVE_FULL_GL
+ SET_MultiDrawArraysEXT(exec, _mesa_MultiDrawArraysEXT);
+ SET_MultiDrawElementsEXT(exec, _mesa_MultiDrawElementsEXT);
+#endif
+
+ /* 173. GL_INGR_blend_func_separate */
+#if _HAVE_FULL_GL
+ SET_BlendFuncSeparateEXT(exec, _mesa_BlendFuncSeparateEXT);
+#endif
+
+ /* 196. GL_MESA_resize_buffers */
+#if _HAVE_FULL_GL
+ SET_ResizeBuffersMESA(exec, _mesa_ResizeBuffersMESA);
+#endif
+
+ /* 197. GL_MESA_window_pos */
+#if FEATURE_drawpix
+ SET_WindowPos2dMESA(exec, _mesa_WindowPos2dMESA);
+ SET_WindowPos2dvMESA(exec, _mesa_WindowPos2dvMESA);
+ SET_WindowPos2fMESA(exec, _mesa_WindowPos2fMESA);
+ SET_WindowPos2fvMESA(exec, _mesa_WindowPos2fvMESA);
+ SET_WindowPos2iMESA(exec, _mesa_WindowPos2iMESA);
+ SET_WindowPos2ivMESA(exec, _mesa_WindowPos2ivMESA);
+ SET_WindowPos2sMESA(exec, _mesa_WindowPos2sMESA);
+ SET_WindowPos2svMESA(exec, _mesa_WindowPos2svMESA);
+ SET_WindowPos3dMESA(exec, _mesa_WindowPos3dMESA);
+ SET_WindowPos3dvMESA(exec, _mesa_WindowPos3dvMESA);
+ SET_WindowPos3fMESA(exec, _mesa_WindowPos3fMESA);
+ SET_WindowPos3fvMESA(exec, _mesa_WindowPos3fvMESA);
+ SET_WindowPos3iMESA(exec, _mesa_WindowPos3iMESA);
+ SET_WindowPos3ivMESA(exec, _mesa_WindowPos3ivMESA);
+ SET_WindowPos3sMESA(exec, _mesa_WindowPos3sMESA);
+ SET_WindowPos3svMESA(exec, _mesa_WindowPos3svMESA);
+ SET_WindowPos4dMESA(exec, _mesa_WindowPos4dMESA);
+ SET_WindowPos4dvMESA(exec, _mesa_WindowPos4dvMESA);
+ SET_WindowPos4fMESA(exec, _mesa_WindowPos4fMESA);
+ SET_WindowPos4fvMESA(exec, _mesa_WindowPos4fvMESA);
+ SET_WindowPos4iMESA(exec, _mesa_WindowPos4iMESA);
+ SET_WindowPos4ivMESA(exec, _mesa_WindowPos4ivMESA);
+ SET_WindowPos4sMESA(exec, _mesa_WindowPos4sMESA);
+ SET_WindowPos4svMESA(exec, _mesa_WindowPos4svMESA);
+#endif
+
+ /* 200. GL_IBM_multimode_draw_arrays */
+#if _HAVE_FULL_GL
+ SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM);
+ SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM);
+#endif
+
+ /* 233. GL_NV_vertex_program */
+#if FEATURE_NV_vertex_program
+ SET_BindProgramNV(exec, _mesa_BindProgram);
+ SET_DeleteProgramsNV(exec, _mesa_DeletePrograms);
+ SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV);
+ SET_GenProgramsNV(exec, _mesa_GenPrograms);
+ SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV);
+ SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV);
+ SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV);
+ SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV);
+ SET_GetProgramivNV(exec, _mesa_GetProgramivNV);
+ SET_GetProgramStringNV(exec, _mesa_GetProgramStringNV);
+ SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV);
+ SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV);
+ SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV);
+ SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV);
+ SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV);
+ SET_IsProgramNV(exec, _mesa_IsProgramARB);
+ SET_LoadProgramNV(exec, _mesa_LoadProgramNV);
+ SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */
+ SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); /* alias to ProgramParameter4dvNV */
+ SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); /* alias to ProgramParameter4fNV */
+ SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); /* alias to ProgramParameter4fvNV */
+ SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV);
+ SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV);
+ SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV);
+ SET_VertexAttribPointerNV(exec, _mesa_VertexAttribPointerNV);
+ /* glVertexAttrib*NV functions handled in api_loopback.c */
+#endif
+
+ /* 273. GL_APPLE_vertex_array_object */
+ SET_BindVertexArrayAPPLE(exec, _mesa_BindVertexArrayAPPLE);
+ SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE);
+ SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE);
+ SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE);
+
+ /* 282. GL_NV_fragment_program */
+#if FEATURE_NV_fragment_program
+ SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV);
+ SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV);
+ SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV);
+ SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV);
+ SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV);
+ SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV);
+ SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB);
+ SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB);
+ SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB);
+ SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB);
+ SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB);
+ SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB);
+#endif
+
+ /* 262. GL_NV_point_sprite */
+#if _HAVE_FULL_GL
+ SET_PointParameteriNV(exec, _mesa_PointParameteri);
+ SET_PointParameterivNV(exec, _mesa_PointParameteriv);
+#endif
+
+ /* 268. GL_EXT_stencil_two_side */
+#if _HAVE_FULL_GL
+ SET_ActiveStencilFaceEXT(exec, _mesa_ActiveStencilFaceEXT);
+#endif
+
+ /* ???. GL_EXT_depth_bounds_test */
+ SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);
+
+ /* ARB 1. GL_ARB_multitexture */
+#if _HAVE_FULL_GL
+ SET_ActiveTextureARB(exec, _mesa_ActiveTextureARB);
+ SET_ClientActiveTextureARB(exec, _mesa_ClientActiveTextureARB);
+#endif
+
+ /* ARB 3. GL_ARB_transpose_matrix */
+#if _HAVE_FULL_GL
+ SET_LoadTransposeMatrixdARB(exec, _mesa_LoadTransposeMatrixdARB);
+ SET_LoadTransposeMatrixfARB(exec, _mesa_LoadTransposeMatrixfARB);
+ SET_MultTransposeMatrixdARB(exec, _mesa_MultTransposeMatrixdARB);
+ SET_MultTransposeMatrixfARB(exec, _mesa_MultTransposeMatrixfARB);
+#endif
+
+ /* ARB 5. GL_ARB_multisample */
+#if _HAVE_FULL_GL
+ SET_SampleCoverageARB(exec, _mesa_SampleCoverageARB);
+#endif
+
+ /* ARB 12. GL_ARB_texture_compression */
+#if _HAVE_FULL_GL
+ SET_CompressedTexImage3DARB(exec, _mesa_CompressedTexImage3DARB);
+ SET_CompressedTexImage2DARB(exec, _mesa_CompressedTexImage2DARB);
+ SET_CompressedTexImage1DARB(exec, _mesa_CompressedTexImage1DARB);
+ SET_CompressedTexSubImage3DARB(exec, _mesa_CompressedTexSubImage3DARB);
+ SET_CompressedTexSubImage2DARB(exec, _mesa_CompressedTexSubImage2DARB);
+ SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB);
+ SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB);
+#endif
+
+ /* ARB 14. GL_ARB_point_parameters */
+ /* reuse EXT_point_parameters functions */
+
+ /* ARB 26. GL_ARB_vertex_program */
+ /* ARB 27. GL_ARB_fragment_program */
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+ /* glVertexAttrib1sARB aliases glVertexAttrib1sNV */
+ /* glVertexAttrib1fARB aliases glVertexAttrib1fNV */
+ /* glVertexAttrib1dARB aliases glVertexAttrib1dNV */
+ /* glVertexAttrib2sARB aliases glVertexAttrib2sNV */
+ /* glVertexAttrib2fARB aliases glVertexAttrib2fNV */
+ /* glVertexAttrib2dARB aliases glVertexAttrib2dNV */
+ /* glVertexAttrib3sARB aliases glVertexAttrib3sNV */
+ /* glVertexAttrib3fARB aliases glVertexAttrib3fNV */
+ /* glVertexAttrib3dARB aliases glVertexAttrib3dNV */
+ /* glVertexAttrib4sARB aliases glVertexAttrib4sNV */
+ /* glVertexAttrib4fARB aliases glVertexAttrib4fNV */
+ /* glVertexAttrib4dARB aliases glVertexAttrib4dNV */
+ /* glVertexAttrib4NubARB aliases glVertexAttrib4NubNV */
+ /* glVertexAttrib1svARB aliases glVertexAttrib1svNV */
+ /* glVertexAttrib1fvARB aliases glVertexAttrib1fvNV */
+ /* glVertexAttrib1dvARB aliases glVertexAttrib1dvNV */
+ /* glVertexAttrib2svARB aliases glVertexAttrib2svNV */
+ /* glVertexAttrib2fvARB aliases glVertexAttrib2fvNV */
+ /* glVertexAttrib2dvARB aliases glVertexAttrib2dvNV */
+ /* glVertexAttrib3svARB aliases glVertexAttrib3svNV */
+ /* glVertexAttrib3fvARB aliases glVertexAttrib3fvNV */
+ /* glVertexAttrib3dvARB aliases glVertexAttrib3dvNV */
+ /* glVertexAttrib4svARB aliases glVertexAttrib4svNV */
+ /* glVertexAttrib4fvARB aliases glVertexAttrib4fvNV */
+ /* glVertexAttrib4dvARB aliases glVertexAttrib4dvNV */
+ /* glVertexAttrib4NubvARB aliases glVertexAttrib4NubvNV */
+ /* glVertexAttrib4bvARB handled in api_loopback.c */
+ /* glVertexAttrib4ivARB handled in api_loopback.c */
+ /* glVertexAttrib4ubvARB handled in api_loopback.c */
+ /* glVertexAttrib4usvARB handled in api_loopback.c */
+ /* glVertexAttrib4uivARB handled in api_loopback.c */
+ /* glVertexAttrib4NbvARB handled in api_loopback.c */
+ /* glVertexAttrib4NsvARB handled in api_loopback.c */
+ /* glVertexAttrib4NivARB handled in api_loopback.c */
+ /* glVertexAttrib4NusvARB handled in api_loopback.c */
+ /* glVertexAttrib4NuivARB handled in api_loopback.c */
+ SET_VertexAttribPointerARB(exec, _mesa_VertexAttribPointerARB);
+ SET_EnableVertexAttribArrayARB(exec, _mesa_EnableVertexAttribArrayARB);
+ SET_DisableVertexAttribArrayARB(exec, _mesa_DisableVertexAttribArrayARB);
+ SET_ProgramStringARB(exec, _mesa_ProgramStringARB);
+ /* glBindProgramARB aliases glBindProgramNV */
+ /* glDeleteProgramsARB aliases glDeleteProgramsNV */
+ /* glGenProgramsARB aliases glGenProgramsNV */
+ /* glIsProgramARB aliases glIsProgramNV */
+ SET_GetVertexAttribdvARB(exec, _mesa_GetVertexAttribdvARB);
+ SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB);
+ SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB);
+ /* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */
+ SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB);
+ SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB);
+ SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB);
+ SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB);
+ SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB);
+ SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB);
+ SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB);
+ SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB);
+ SET_GetProgramEnvParameterdvARB(exec, _mesa_GetProgramEnvParameterdvARB);
+ SET_GetProgramEnvParameterfvARB(exec, _mesa_GetProgramEnvParameterfvARB);
+ SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB);
+ SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB);
+ SET_GetProgramivARB(exec, _mesa_GetProgramivARB);
+ SET_GetProgramStringARB(exec, _mesa_GetProgramStringARB);
+#endif
+
+ /* ARB 28. GL_ARB_vertex_buffer_object */
+#if FEATURE_ARB_vertex_buffer_object
+ SET_BindBufferARB(exec, _mesa_BindBufferARB);
+ SET_BufferDataARB(exec, _mesa_BufferDataARB);
+ SET_BufferSubDataARB(exec, _mesa_BufferSubDataARB);
+ SET_DeleteBuffersARB(exec, _mesa_DeleteBuffersARB);
+ SET_GenBuffersARB(exec, _mesa_GenBuffersARB);
+ SET_GetBufferParameterivARB(exec, _mesa_GetBufferParameterivARB);
+ SET_GetBufferPointervARB(exec, _mesa_GetBufferPointervARB);
+ SET_GetBufferSubDataARB(exec, _mesa_GetBufferSubDataARB);
+ SET_IsBufferARB(exec, _mesa_IsBufferARB);
+ SET_MapBufferARB(exec, _mesa_MapBufferARB);
+ SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB);
+#endif
+
+ /* ARB 29. GL_ARB_occlusion_query */
+#if FEATURE_ARB_occlusion_query
+ SET_GenQueriesARB(exec, _mesa_GenQueriesARB);
+ SET_DeleteQueriesARB(exec, _mesa_DeleteQueriesARB);
+ SET_IsQueryARB(exec, _mesa_IsQueryARB);
+ SET_BeginQueryARB(exec, _mesa_BeginQueryARB);
+ SET_EndQueryARB(exec, _mesa_EndQueryARB);
+ SET_GetQueryivARB(exec, _mesa_GetQueryivARB);
+ SET_GetQueryObjectivARB(exec, _mesa_GetQueryObjectivARB);
+ SET_GetQueryObjectuivARB(exec, _mesa_GetQueryObjectuivARB);
+#endif
+
+ /* ARB 37. GL_ARB_draw_buffers */
+#if FEATURE_draw_read_buffer
+ SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB);
+#endif
+
+#if FEATURE_ARB_shader_objects
+ SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB);
+ SET_GetHandleARB(exec, _mesa_GetHandleARB);
+ SET_DetachObjectARB(exec, _mesa_DetachObjectARB);
+ SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB);
+ SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB);
+ SET_CompileShaderARB(exec, _mesa_CompileShaderARB);
+ SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB);
+ SET_AttachObjectARB(exec, _mesa_AttachObjectARB);
+ SET_LinkProgramARB(exec, _mesa_LinkProgramARB);
+ SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB);
+ SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB);
+ SET_Uniform1fARB(exec, _mesa_Uniform1fARB);
+ SET_Uniform2fARB(exec, _mesa_Uniform2fARB);
+ SET_Uniform3fARB(exec, _mesa_Uniform3fARB);
+ SET_Uniform4fARB(exec, _mesa_Uniform4fARB);
+ SET_Uniform1iARB(exec, _mesa_Uniform1iARB);
+ SET_Uniform2iARB(exec, _mesa_Uniform2iARB);
+ SET_Uniform3iARB(exec, _mesa_Uniform3iARB);
+ SET_Uniform4iARB(exec, _mesa_Uniform4iARB);
+ SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB);
+ SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB);
+ SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB);
+ SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB);
+ SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB);
+ SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB);
+ SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB);
+ SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB);
+ SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB);
+ SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB);
+ SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB);
+ SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB);
+ SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB);
+ SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB);
+ SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB);
+ SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB);
+ SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB);
+ SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB);
+ SET_GetUniformivARB(exec, _mesa_GetUniformivARB);
+ SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB);
+#endif /* FEATURE_ARB_shader_objects */
+
+#if FEATURE_ARB_vertex_shader
+ SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB);
+ SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB);
+ SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB);
+#endif /* FEATURE_ARB_vertex_shader */
+
+ /* GL_ATI_fragment_shader */
+#if FEATURE_ATI_fragment_shader
+ SET_GenFragmentShadersATI(exec, _mesa_GenFragmentShadersATI);
+ SET_BindFragmentShaderATI(exec, _mesa_BindFragmentShaderATI);
+ SET_DeleteFragmentShaderATI(exec, _mesa_DeleteFragmentShaderATI);
+ SET_BeginFragmentShaderATI(exec, _mesa_BeginFragmentShaderATI);
+ SET_EndFragmentShaderATI(exec, _mesa_EndFragmentShaderATI);
+ SET_PassTexCoordATI(exec, _mesa_PassTexCoordATI);
+ SET_SampleMapATI(exec, _mesa_SampleMapATI);
+ SET_ColorFragmentOp1ATI(exec, _mesa_ColorFragmentOp1ATI);
+ SET_ColorFragmentOp2ATI(exec, _mesa_ColorFragmentOp2ATI);
+ SET_ColorFragmentOp3ATI(exec, _mesa_ColorFragmentOp3ATI);
+ SET_AlphaFragmentOp1ATI(exec, _mesa_AlphaFragmentOp1ATI);
+ SET_AlphaFragmentOp2ATI(exec, _mesa_AlphaFragmentOp2ATI);
+ SET_AlphaFragmentOp3ATI(exec, _mesa_AlphaFragmentOp3ATI);
+ SET_SetFragmentShaderConstantATI(exec, _mesa_SetFragmentShaderConstantATI);
+#endif
+
+#if FEATURE_EXT_framebuffer_object
+ SET_IsRenderbufferEXT(exec, _mesa_IsRenderbufferEXT);
+ SET_BindRenderbufferEXT(exec, _mesa_BindRenderbufferEXT);
+ SET_DeleteRenderbuffersEXT(exec, _mesa_DeleteRenderbuffersEXT);
+ SET_GenRenderbuffersEXT(exec, _mesa_GenRenderbuffersEXT);
+ SET_RenderbufferStorageEXT(exec, _mesa_RenderbufferStorageEXT);
+ SET_GetRenderbufferParameterivEXT(exec, _mesa_GetRenderbufferParameterivEXT);
+ SET_IsFramebufferEXT(exec, _mesa_IsFramebufferEXT);
+ SET_BindFramebufferEXT(exec, _mesa_BindFramebufferEXT);
+ SET_DeleteFramebuffersEXT(exec, _mesa_DeleteFramebuffersEXT);
+ SET_GenFramebuffersEXT(exec, _mesa_GenFramebuffersEXT);
+ SET_CheckFramebufferStatusEXT(exec, _mesa_CheckFramebufferStatusEXT);
+ SET_FramebufferTexture1DEXT(exec, _mesa_FramebufferTexture1DEXT);
+ SET_FramebufferTexture2DEXT(exec, _mesa_FramebufferTexture2DEXT);
+ SET_FramebufferTexture3DEXT(exec, _mesa_FramebufferTexture3DEXT);
+ SET_FramebufferRenderbufferEXT(exec, _mesa_FramebufferRenderbufferEXT);
+ SET_GetFramebufferAttachmentParameterivEXT(exec, _mesa_GetFramebufferAttachmentParameterivEXT);
+ SET_GenerateMipmapEXT(exec, _mesa_GenerateMipmapEXT);
+#endif
+
+#if FEATURE_EXT_timer_query
+ SET_GetQueryObjecti64vEXT(exec, _mesa_GetQueryObjecti64vEXT);
+ SET_GetQueryObjectui64vEXT(exec, _mesa_GetQueryObjectui64vEXT);
+#endif
+
+#if FEATURE_EXT_framebuffer_blit
+ SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT);
+#endif
+
+ /* GL_EXT_gpu_program_parameters */
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+ SET_ProgramEnvParameters4fvEXT(exec, _mesa_ProgramEnvParameters4fvEXT);
+ SET_ProgramLocalParameters4fvEXT(exec, _mesa_ProgramLocalParameters4fvEXT);
+#endif
+
+ /* GL_MESA_texture_array / GL_EXT_texture_array */
+#if FEATURE_EXT_framebuffer_object
+ SET_FramebufferTextureLayerEXT(exec, _mesa_FramebufferTextureLayerEXT);
+#endif
+
+ /* GL_ATI_separate_stencil */
+ SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI);
+}
+
diff --git a/src/mesa/main/api_exec.h b/src/mesa/main/api_exec.h
new file mode 100644
index 0000000000..4bd715053a
--- /dev/null
+++ b/src/mesa/main/api_exec.h
@@ -0,0 +1,37 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef API_EXEC_H
+#define API_EXEC_H
+
+
+struct _glapi_table;
+
+
+extern void
+_mesa_init_exec_table(struct _glapi_table *exec);
+
+
+#endif
diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c
index 3df64362ea..a1cc3a2a4b 100644
--- a/src/mesa/main/api_noop.c
+++ b/src/mesa/main/api_noop.c
@@ -30,7 +30,9 @@
#include "context.h"
#include "light.h"
#include "macros.h"
+#if FEATURE_dlist
#include "dlist.h"
+#endif
#include "glapi/dispatch.h"
@@ -621,6 +623,8 @@ static void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLf
(void) a; (void) b; (void) c; (void) d;
}
+
+#if FEATURE_evaluators
/* Similarly, these have no effect outside begin/end:
*/
static void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a )
@@ -652,6 +656,7 @@ static void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b )
{
(void) a; (void) b;
}
+#endif /* FEATURE_evaluators */
/* Begin -- call into driver, should result in the vtxfmt being
@@ -904,20 +909,24 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt )
{
vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */
vfmt->Begin = _mesa_noop_Begin;
+#if FEATURE_dlist
vfmt->CallList = _mesa_CallList;
vfmt->CallLists = _mesa_CallLists;
+#endif
vfmt->Color3f = _mesa_noop_Color3f;
vfmt->Color3fv = _mesa_noop_Color3fv;
vfmt->Color4f = _mesa_noop_Color4f;
vfmt->Color4fv = _mesa_noop_Color4fv;
vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
vfmt->End = _mesa_noop_End;
+#if FEATURE_evaluators
vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f;
vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv;
vfmt->EvalCoord2f = _mesa_noop_EvalCoord2f;
vfmt->EvalCoord2fv = _mesa_noop_EvalCoord2fv;
vfmt->EvalPoint1 = _mesa_noop_EvalPoint1;
vfmt->EvalPoint2 = _mesa_noop_EvalPoint2;
+#endif
vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT;
vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT;
vfmt->Indexf = _mesa_noop_Indexf;
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 64ab324af2..9144b4bc66 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -87,7 +87,7 @@ _mesa_validate_DrawElements(GLcontext *ctx,
indexBytes = count * sizeof(GLushort);
}
- if (indexBytes > ctx->Array.ElementArrayBufferObj->Size) {
+ if (indexBytes > (GLuint) ctx->Array.ElementArrayBufferObj->Size) {
_mesa_warning(ctx, "glDrawElements index out of buffer bounds");
return GL_FALSE;
}
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index b422198f92..2e6bb76586 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -30,6 +30,7 @@
#include "blend.h"
#include "buffers.h"
#include "bufferobj.h"
+#include "clear.h"
#include "colormac.h"
#include "colortab.h"
#include "context.h"
@@ -41,11 +42,16 @@
#include "light.h"
#include "lines.h"
#include "matrix.h"
+#include "multisample.h"
#include "points.h"
#include "polygon.h"
+#include "scissor.h"
#include "simple_list.h"
#include "stencil.h"
+#include "texenv.h"
+#include "texgen.h"
#include "texobj.h"
+#include "texparam.h"
#include "texstate.h"
#include "mtypes.h"
#include "math/m_xform.h"
@@ -1074,14 +1080,14 @@ _mesa_PopAttrib(void)
_mesa_PointSize(point->Size);
_mesa_set_enable(ctx, GL_POINT_SMOOTH, point->SmoothFlag);
if (ctx->Extensions.EXT_point_parameters) {
- _mesa_PointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT,
- point->Params);
- _mesa_PointParameterfEXT(GL_POINT_SIZE_MIN_EXT,
- point->MinSize);
- _mesa_PointParameterfEXT(GL_POINT_SIZE_MAX_EXT,
- point->MaxSize);
- _mesa_PointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT,
- point->Threshold);
+ _mesa_PointParameterfv(GL_DISTANCE_ATTENUATION_EXT,
+ point->Params);
+ _mesa_PointParameterf(GL_POINT_SIZE_MIN_EXT,
+ point->MinSize);
+ _mesa_PointParameterf(GL_POINT_SIZE_MAX_EXT,
+ point->MaxSize);
+ _mesa_PointParameterf(GL_POINT_FADE_THRESHOLD_SIZE_EXT,
+ point->Threshold);
}
if (ctx->Extensions.NV_point_sprite
|| ctx->Extensions.ARB_point_sprite) {
@@ -1091,10 +1097,10 @@ _mesa_PopAttrib(void)
(GLint) point->CoordReplace[u]);
}
_mesa_set_enable(ctx, GL_POINT_SPRITE_NV,point->PointSprite);
- _mesa_PointParameteriNV(GL_POINT_SPRITE_R_MODE_NV,
- ctx->Point.SpriteRMode);
- _mesa_PointParameterfEXT(GL_POINT_SPRITE_COORD_ORIGIN,
- (GLfloat)ctx->Point.SpriteOrigin);
+ _mesa_PointParameteri(GL_POINT_SPRITE_R_MODE_NV,
+ ctx->Point.SpriteRMode);
+ _mesa_PointParameterf(GL_POINT_SPRITE_COORD_ORIGIN,
+ (GLfloat)ctx->Point.SpriteOrigin);
}
}
break;
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 81bd4c2f32..4d4a897141 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -36,6 +36,7 @@
#include "enums.h"
#include "macros.h"
#include "mtypes.h"
+#include "glapi/glapitable.h"
/**
@@ -45,19 +46,11 @@
* \param dfactor destination factor operator.
*
* \sa glBlendFunc, glBlendFuncSeparateEXT
- *
- * Swizzles the inputs and calls \c glBlendFuncSeparateEXT. This is done
- * using the \c CurrentDispatch table in the context, so this same function
- * can be used while compiling display lists. Therefore, there is no need
- * for the display list code to save and restore this function.
*/
void GLAPIENTRY
_mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
{
- GET_CURRENT_CONTEXT(ctx);
-
- (*ctx->CurrentDispatch->BlendFuncSeparateEXT)( sfactor, dfactor,
- sfactor, dfactor );
+ _mesa_BlendFuncSeparateEXT(sfactor, dfactor, sfactor, dfactor);
}
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 3cbd671bab..1d07c68633 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -25,7 +25,7 @@
/**
* \file buffers.c
- * General framebuffer-related functions, like glClear, glScissor, etc.
+ * glReadBuffer, DrawBuffer functions.
*/
@@ -42,148 +42,6 @@
#define BAD_MASK ~0u
-#if _HAVE_FULL_GL
-void GLAPIENTRY
-_mesa_ClearIndex( GLfloat c )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Color.ClearIndex == (GLuint) c)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_COLOR);
- ctx->Color.ClearIndex = (GLuint) c;
-
- if (!ctx->Visual.rgbMode && ctx->Driver.ClearIndex) {
- /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */
- (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex );
- }
-}
-#endif
-
-
-/**
- * Specify the clear values for the color buffers.
- *
- * \param red red color component.
- * \param green green color component.
- * \param blue blue color component.
- * \param alpha alpha component.
- *
- * \sa glClearColor().
- *
- * Clamps the parameters and updates gl_colorbuffer_attrib::ClearColor. On a
- * change, flushes the vertices and notifies the driver via the
- * dd_function_table::ClearColor callback.
- */
-void GLAPIENTRY
-_mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
-{
- GLfloat tmp[4];
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- tmp[0] = CLAMP(red, 0.0F, 1.0F);
- tmp[1] = CLAMP(green, 0.0F, 1.0F);
- tmp[2] = CLAMP(blue, 0.0F, 1.0F);
- tmp[3] = CLAMP(alpha, 0.0F, 1.0F);
-
- if (TEST_EQ_4V(tmp, ctx->Color.ClearColor))
- return; /* no change */
-
- FLUSH_VERTICES(ctx, _NEW_COLOR);
- COPY_4V(ctx->Color.ClearColor, tmp);
-
- if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) {
- /* it's OK to call glClearColor in CI mode but it should be a NOP */
- (*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor);
- }
-}
-
-
-/**
- * Clear buffers.
- *
- * \param mask bit-mask indicating the buffers to be cleared.
- *
- * Flushes the vertices and verifies the parameter. If __GLcontextRec::NewState
- * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin,
- * etc. If the rasterization mode is set to GL_RENDER then requests the driver
- * to clear the buffers, via the dd_function_table::Clear callback.
- */
-void GLAPIENTRY
-_mesa_Clear( GLbitfield mask )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- FLUSH_CURRENT(ctx, 0);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glClear 0x%x\n", mask);
-
- if (mask & ~(GL_COLOR_BUFFER_BIT |
- GL_DEPTH_BUFFER_BIT |
- GL_STENCIL_BUFFER_BIT |
- GL_ACCUM_BUFFER_BIT)) {
- /* invalid bit set */
- _mesa_error( ctx, GL_INVALID_VALUE, "glClear(0x%x)", mask);
- return;
- }
-
- if (ctx->NewState) {
- _mesa_update_state( ctx ); /* update _Xmin, etc */
- }
-
- if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
- _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
- "glClear(incomplete framebuffer)");
- return;
- }
-
- if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0)
- return;
-
- if (ctx->RenderMode == GL_RENDER) {
- GLbitfield bufferMask;
-
- /* don't clear depth buffer if depth writing disabled */
- if (!ctx->Depth.Mask)
- mask &= ~GL_DEPTH_BUFFER_BIT;
-
- /* Build the bitmask to send to device driver's Clear function.
- * Note that the GL_COLOR_BUFFER_BIT flag will expand to 0, 1, 2 or 4
- * of the BUFFER_BIT_FRONT/BACK_LEFT/RIGHT flags, or one of the
- * BUFFER_BIT_COLORn flags.
- */
- bufferMask = 0;
- if (mask & GL_COLOR_BUFFER_BIT) {
- bufferMask |= ctx->DrawBuffer->_ColorDrawBufferMask[0];
- }
-
- if ((mask & GL_DEPTH_BUFFER_BIT)
- && ctx->DrawBuffer->Visual.haveDepthBuffer) {
- bufferMask |= BUFFER_BIT_DEPTH;
- }
-
- if ((mask & GL_STENCIL_BUFFER_BIT)
- && ctx->DrawBuffer->Visual.haveStencilBuffer) {
- bufferMask |= BUFFER_BIT_STENCIL;
- }
-
- if ((mask & GL_ACCUM_BUFFER_BIT)
- && ctx->DrawBuffer->Visual.haveAccumBuffer) {
- bufferMask |= BUFFER_BIT_ACCUM;
- }
-
- ASSERT(ctx->Driver.Clear);
- ctx->Driver.Clear(ctx, bufferMask);
- }
-}
-
-
-
/**
* Return bitmask of BUFFER_BIT_* flags indicating which color buffers are
* available to the rendering context (for drawing or reading).
@@ -596,195 +454,3 @@ _mesa_ReadBuffer(GLenum buffer)
if (ctx->Driver.ReadBuffer)
(*ctx->Driver.ReadBuffer)(ctx, buffer);
}
-
-
-#if _HAVE_FULL_GL
-
-/**
- * XXX THIS IS OBSOLETE - drivers should take care of detecting window
- * size changes and act accordingly, likely calling _mesa_resize_framebuffer().
- *
- * GL_MESA_resize_buffers extension.
- *
- * When this function is called, we'll ask the window system how large
- * the current window is. If it's a new size, we'll call the driver's
- * ResizeBuffers function. The driver will then resize its color buffers
- * as needed, and maybe call the swrast's routine for reallocating
- * swrast-managed depth/stencil/accum/etc buffers.
- * \note This function should only be called through the GL API, not
- * from device drivers (as was done in the past).
- */
-
-void _mesa_resizebuffers( GLcontext *ctx )
-{
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glResizeBuffersMESA\n");
-
- if (!ctx->Driver.GetBufferSize) {
- return;
- }
-
- if (ctx->WinSysDrawBuffer) {
- GLuint newWidth, newHeight;
- GLframebuffer *buffer = ctx->WinSysDrawBuffer;
-
- assert(buffer->Name == 0);
-
- /* ask device driver for size of output buffer */
- ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
-
- /* see if size of device driver's color buffer (window) has changed */
- if (buffer->Width != newWidth || buffer->Height != newHeight) {
- if (ctx->Driver.ResizeBuffers)
- ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight );
- }
- }
-
- if (ctx->WinSysReadBuffer
- && ctx->WinSysReadBuffer != ctx->WinSysDrawBuffer) {
- GLuint newWidth, newHeight;
- GLframebuffer *buffer = ctx->WinSysReadBuffer;
-
- assert(buffer->Name == 0);
-
- /* ask device driver for size of read buffer */
- ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
-
- /* see if size of device driver's color buffer (window) has changed */
- if (buffer->Width != newWidth || buffer->Height != newHeight) {
- if (ctx->Driver.ResizeBuffers)
- ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight );
- }
- }
-
- ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */
-}
-
-
-/*
- * XXX THIS IS OBSOLETE
- */
-void GLAPIENTRY
-_mesa_ResizeBuffersMESA( void )
-{
- GET_CURRENT_CONTEXT(ctx);
-
- if (ctx->Extensions.MESA_resize_buffers)
- _mesa_resizebuffers( ctx );
-}
-
-
-/*
- * XXX move somewhere else someday?
- */
-void GLAPIENTRY
-_mesa_SampleCoverageARB(GLclampf value, GLboolean invert)
-{
- GET_CURRENT_CONTEXT(ctx);
-
- if (!ctx->Extensions.ARB_multisample) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleCoverageARB");
- return;
- }
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
- ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0);
- ctx->Multisample.SampleCoverageInvert = invert;
- ctx->NewState |= _NEW_MULTISAMPLE;
-}
-
-#endif /* _HAVE_FULL_GL */
-
-
-
-/**
- * Define the scissor box.
- *
- * \param x, y coordinates of the scissor box lower-left corner.
- * \param width width of the scissor box.
- * \param height height of the scissor box.
- *
- * \sa glScissor().
- *
- * Verifies the parameters and updates __GLcontextRec::Scissor. On a
- * change flushes the vertices and notifies the driver via
- * the dd_function_table::Scissor callback.
- */
-void
-_mesa_set_scissor(GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height)
-{
- if (x == ctx->Scissor.X &&
- y == ctx->Scissor.Y &&
- width == ctx->Scissor.Width &&
- height == ctx->Scissor.Height)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_SCISSOR);
- ctx->Scissor.X = x;
- ctx->Scissor.Y = y;
- ctx->Scissor.Width = width;
- ctx->Scissor.Height = height;
-
- if (ctx->Driver.Scissor)
- ctx->Driver.Scissor( ctx, x, y, width, height );
-}
-
-
-void GLAPIENTRY
-_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (width < 0 || height < 0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" );
- return;
- }
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height);
-
- _mesa_set_scissor(ctx, x, y, width, height);
-}
-
-
-
-/**********************************************************************/
-/** \name Initialization */
-/*@{*/
-
-/**
- * Initialize the context's scissor state.
- * \param ctx the GL context.
- */
-void
-_mesa_init_scissor(GLcontext *ctx)
-{
- /* Scissor group */
- ctx->Scissor.Enabled = GL_FALSE;
- ctx->Scissor.X = 0;
- ctx->Scissor.Y = 0;
- ctx->Scissor.Width = 0;
- ctx->Scissor.Height = 0;
-}
-
-
-/**
- * Initialize the context's multisample state.
- * \param ctx the GL context.
- */
-void
-_mesa_init_multisample(GLcontext *ctx)
-{
- ctx->Multisample.Enabled = GL_FALSE;
- ctx->Multisample.SampleAlphaToCoverage = GL_FALSE;
- ctx->Multisample.SampleAlphaToOne = GL_FALSE;
- ctx->Multisample.SampleCoverage = GL_FALSE;
- ctx->Multisample.SampleCoverageValue = 1.0;
- ctx->Multisample.SampleCoverageInvert = GL_FALSE;
-}
-
-/*@}*/
diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h
index 208e7af2b9..53d5fb80d4 100644
--- a/src/mesa/main/buffers.h
+++ b/src/mesa/main/buffers.h
@@ -37,16 +37,6 @@
extern void GLAPIENTRY
-_mesa_ClearIndex( GLfloat c );
-
-extern void GLAPIENTRY
-_mesa_ClearColor( GLclampf red, GLclampf green,
- GLclampf blue, GLclampf alpha );
-
-extern void GLAPIENTRY
-_mesa_Clear( GLbitfield mask );
-
-extern void GLAPIENTRY
_mesa_DrawBuffer( GLenum mode );
extern void GLAPIENTRY
@@ -62,25 +52,5 @@ _mesa_readbuffer_update_fields(GLcontext *ctx, GLenum buffer);
extern void GLAPIENTRY
_mesa_ReadBuffer( GLenum mode );
-extern void GLAPIENTRY
-_mesa_ResizeBuffersMESA( void );
-
-extern void GLAPIENTRY
-_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height );
-
-extern void GLAPIENTRY
-_mesa_SampleCoverageARB(GLclampf value, GLboolean invert);
-
-extern void
-_mesa_init_scissor(GLcontext *ctx);
-
-extern void
-_mesa_init_multisample(GLcontext *ctx);
-
-extern void
-_mesa_set_scissor(GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height);
-
-extern void _mesa_resizebuffers( GLcontext *ctx );
#endif
diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
new file mode 100644
index 0000000000..434685984d
--- /dev/null
+++ b/src/mesa/main/clear.c
@@ -0,0 +1,179 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2007 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file clear.c
+ * glClearColor, glClearIndex, glClear() functions.
+ */
+
+
+
+#include "glheader.h"
+#include "clear.h"
+#include "context.h"
+#include "colormac.h"
+#include "state.h"
+
+
+
+#if _HAVE_FULL_GL
+void GLAPIENTRY
+_mesa_ClearIndex( GLfloat c )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Color.ClearIndex == (GLuint) c)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ ctx->Color.ClearIndex = (GLuint) c;
+
+ if (!ctx->Visual.rgbMode && ctx->Driver.ClearIndex) {
+ /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */
+ (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex );
+ }
+}
+#endif
+
+
+/**
+ * Specify the clear values for the color buffers.
+ *
+ * \param red red color component.
+ * \param green green color component.
+ * \param blue blue color component.
+ * \param alpha alpha component.
+ *
+ * \sa glClearColor().
+ *
+ * Clamps the parameters and updates gl_colorbuffer_attrib::ClearColor. On a
+ * change, flushes the vertices and notifies the driver via the
+ * dd_function_table::ClearColor callback.
+ */
+void GLAPIENTRY
+_mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
+{
+ GLfloat tmp[4];
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ tmp[0] = CLAMP(red, 0.0F, 1.0F);
+ tmp[1] = CLAMP(green, 0.0F, 1.0F);
+ tmp[2] = CLAMP(blue, 0.0F, 1.0F);
+ tmp[3] = CLAMP(alpha, 0.0F, 1.0F);
+
+ if (TEST_EQ_4V(tmp, ctx->Color.ClearColor))
+ return; /* no change */
+
+ FLUSH_VERTICES(ctx, _NEW_COLOR);
+ COPY_4V(ctx->Color.ClearColor, tmp);
+
+ if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) {
+ /* it's OK to call glClearColor in CI mode but it should be a NOP */
+ (*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor);
+ }
+}
+
+
+/**
+ * Clear buffers.
+ *
+ * \param mask bit-mask indicating the buffers to be cleared.
+ *
+ * Flushes the vertices and verifies the parameter. If __GLcontextRec::NewState
+ * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin,
+ * etc. If the rasterization mode is set to GL_RENDER then requests the driver
+ * to clear the buffers, via the dd_function_table::Clear callback.
+ */
+void GLAPIENTRY
+_mesa_Clear( GLbitfield mask )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_CURRENT(ctx, 0);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glClear 0x%x\n", mask);
+
+ if (mask & ~(GL_COLOR_BUFFER_BIT |
+ GL_DEPTH_BUFFER_BIT |
+ GL_STENCIL_BUFFER_BIT |
+ GL_ACCUM_BUFFER_BIT)) {
+ /* invalid bit set */
+ _mesa_error( ctx, GL_INVALID_VALUE, "glClear(0x%x)", mask);
+ return;
+ }
+
+ if (ctx->NewState) {
+ _mesa_update_state( ctx ); /* update _Xmin, etc */
+ }
+
+ if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+ _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
+ "glClear(incomplete framebuffer)");
+ return;
+ }
+
+ if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0)
+ return;
+
+ if (ctx->RenderMode == GL_RENDER) {
+ GLbitfield bufferMask;
+
+ /* don't clear depth buffer if depth writing disabled */
+ if (!ctx->Depth.Mask)
+ mask &= ~GL_DEPTH_BUFFER_BIT;
+
+ /* Build the bitmask to send to device driver's Clear function.
+ * Note that the GL_COLOR_BUFFER_BIT flag will expand to 0, 1, 2 or 4
+ * of the BUFFER_BIT_FRONT/BACK_LEFT/RIGHT flags, or one of the
+ * BUFFER_BIT_COLORn flags.
+ */
+ bufferMask = 0;
+ if (mask & GL_COLOR_BUFFER_BIT) {
+ bufferMask |= ctx->DrawBuffer->_ColorDrawBufferMask[0];
+ }
+
+ if ((mask & GL_DEPTH_BUFFER_BIT)
+ && ctx->DrawBuffer->Visual.haveDepthBuffer) {
+ bufferMask |= BUFFER_BIT_DEPTH;
+ }
+
+ if ((mask & GL_STENCIL_BUFFER_BIT)
+ && ctx->DrawBuffer->Visual.haveStencilBuffer) {
+ bufferMask |= BUFFER_BIT_STENCIL;
+ }
+
+ if ((mask & GL_ACCUM_BUFFER_BIT)
+ && ctx->DrawBuffer->Visual.haveAccumBuffer) {
+ bufferMask |= BUFFER_BIT_ACCUM;
+ }
+
+ ASSERT(ctx->Driver.Clear);
+ ctx->Driver.Clear(ctx, bufferMask);
+ }
+}
diff --git a/src/mesa/main/api_eval.h b/src/mesa/main/clear.h
index d6cb38c9f8..9a54ba14bc 100644
--- a/src/mesa/main/api_eval.h
+++ b/src/mesa/main/clear.h
@@ -1,9 +1,8 @@
-
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 7.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2007 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"),
@@ -24,19 +23,22 @@
*/
-#ifndef API_EVAL_H
-#define API_EVAL_H
+#ifndef CLEAR_H
+#define CLEAR_H
-#include "mtypes.h"
-extern void _mesa_EvalPoint1( GLint i );
-extern void _mesa_EvalPoint2( GLint i, GLint j );
-extern void _mesa_EvalCoord1f( GLfloat u );
-extern void _mesa_EvalCoord2f( GLfloat u, GLfloat v );
-extern void _mesa_EvalCoord1fv( const GLfloat *u );
-extern void _mesa_EvalCoord2fv( const GLfloat *u );
+#include "main/mtypes.h"
-#endif
+extern void GLAPIENTRY
+_mesa_ClearIndex( GLfloat c );
+
+extern void GLAPIENTRY
+_mesa_ClearColor( GLclampf red, GLclampf green,
+ GLclampf blue, GLclampf alpha );
+extern void GLAPIENTRY
+_mesa_Clear( GLbitfield mask );
+
+#endif
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index 232e698f50..9ff0b708dd 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -31,6 +31,10 @@
#ifndef MESA_CONFIG_H_INCLUDED
#define MESA_CONFIG_H_INCLUDED
+
+#include "main/mfeatures.h"
+
+
/**
* \name OpenGL implementation limits
*/
@@ -283,40 +287,6 @@
#define ACOMP 3
-/*
- * Enable/disable features (blocks of code) by setting FEATURE_xyz to 0 or 1.
- */
-#ifndef _HAVE_FULL_GL
-#define _HAVE_FULL_GL 1
-#endif
-
-#define FEATURE_userclip _HAVE_FULL_GL
-#define FEATURE_texgen _HAVE_FULL_GL
-#define FEATURE_windowpos _HAVE_FULL_GL
-#define FEATURE_ARB_occlusion_query _HAVE_FULL_GL
-#define FEATURE_ARB_fragment_program _HAVE_FULL_GL
-#define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL
-#define FEATURE_ARB_vertex_program _HAVE_FULL_GL
-
-#define FEATURE_ARB_vertex_shader _HAVE_FULL_GL
-#define FEATURE_ARB_fragment_shader _HAVE_FULL_GL
-#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader)
-#define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects
-#define FEATURE_ARB_shading_language_120 FEATURE_ARB_shader_objects
-
-#define FEATURE_EXT_framebuffer_blit _HAVE_FULL_GL
-#define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL
-#define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL
-#define FEATURE_EXT_texture_sRGB _HAVE_FULL_GL
-#define FEATURE_EXT_timer_query _HAVE_FULL_GL
-#define FEATURE_ATI_fragment_shader _HAVE_FULL_GL
-#define FEATURE_MESA_program_debug _HAVE_FULL_GL
-#define FEATURE_NV_fence _HAVE_FULL_GL
-#define FEATURE_NV_fragment_program _HAVE_FULL_GL
-#define FEATURE_NV_vertex_program _HAVE_FULL_GL
-/*@}*/
-
-
/**
* Maximum number of temporary vertices required for clipping.
*
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 2158eb6873..be93d844e0 100755..100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -78,37 +78,61 @@
#include "glheader.h"
#include "imports.h"
+#if FEATURE_accum
#include "accum.h"
+#endif
+#include "api_exec.h"
#include "arrayobj.h"
+#if FEATURE_attrib_stack
#include "attrib.h"
+#endif
#include "blend.h"
#include "buffers.h"
#include "bufferobj.h"
+#if FEATURE_colortable
#include "colortab.h"
+#endif
#include "context.h"
#include "debug.h"
#include "depth.h"
+#if FEATURE_dlist
#include "dlist.h"
+#endif
+#if FEATURE_evaluators
#include "eval.h"
+#endif
#include "enums.h"
#include "extensions.h"
#include "fbobject.h"
+#if FEATURE_feedback
#include "feedback.h"
+#endif
#include "fog.h"
#include "framebuffer.h"
#include "get.h"
+#if FEATURE_histogram
#include "histogram.h"
+#endif
#include "hint.h"
#include "hash.h"
#include "light.h"
#include "lines.h"
#include "macros.h"
#include "matrix.h"
+#include "multisample.h"
+#if FEATURE_pixel_transfer
#include "pixel.h"
+#endif
+#include "pixelstore.h"
#include "points.h"
#include "polygon.h"
+#if FEATURE_ARB_occlusion_query
#include "queryobj.h"
+#endif
+#if FEATURE_drawpix
#include "rastpos.h"
+#endif
+#include "scissor.h"
#include "simple_list.h"
#include "state.h"
#include "stencil.h"
@@ -122,11 +146,12 @@
#include "vtxfmt.h"
#include "glapi/glthread.h"
#include "glapi/glapioffsets.h"
-#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
+#include "glapi/glapitable.h"
#include "shader/program.h"
-#endif
#include "shader/shader_api.h"
+#if FEATURE_ATI_fragment_shader
#include "shader/atifragshader.h"
+#endif
#if _HAVE_FULL_GL
#include "math/m_translate.h"
#include "math/m_matrix.h"
@@ -416,9 +441,7 @@ alloc_shared_state( GLcontext *ctx )
ss->DisplayList = _mesa_NewHashTable();
ss->TexObjects = _mesa_NewHashTable();
-#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
ss->Programs = _mesa_NewHashTable();
-#endif
#if FEATURE_ARB_vertex_program
ss->DefaultVertexProgram = (struct gl_vertex_program *)
@@ -508,10 +531,8 @@ alloc_shared_state( GLcontext *ctx )
_mesa_DeleteHashTable(ss->DisplayList);
if (ss->TexObjects)
_mesa_DeleteHashTable(ss->TexObjects);
-#if FEATURE_NV_vertex_program
if (ss->Programs)
_mesa_DeleteHashTable(ss->Programs);
-#endif
#if FEATURE_ARB_vertex_program
_mesa_reference_vertprog(ctx, &ss->DefaultVertexProgram, NULL);
#endif
@@ -569,9 +590,11 @@ alloc_shared_state( GLcontext *ctx )
static void
delete_displaylist_cb(GLuint id, void *data, void *userData)
{
+#if FEATURE_dlist
struct mesa_display_list *list = (struct mesa_display_list *) data;
GLcontext *ctx = (GLcontext *) userData;
_mesa_delete_list(ctx, list);
+#endif
}
/**
@@ -598,6 +621,7 @@ delete_program_cb(GLuint id, void *data, void *userData)
ctx->Driver.DeleteProgram(ctx, prog);
}
+#if FEATURE_ATI_fragment_shader
/**
* Callback for deleting an ATI fragment shader object.
* Called by _mesa_HashDeleteAll().
@@ -609,6 +633,7 @@ delete_fragshader_cb(GLuint id, void *data, void *userData)
GLcontext *ctx = (GLcontext *) userData;
_mesa_delete_ati_fragment_shader(ctx, shader);
}
+#endif
/**
* Callback for deleting a buffer object. Called by _mesa_HashDeleteAll().
@@ -694,10 +719,9 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
_mesa_DeleteHashTable(ss->ShaderObjects);
#endif
-#if defined(FEATURE_NV_vertex_program) || defined(FEATURE_NV_fragment_program)
_mesa_HashDeleteAll(ss->Programs, delete_program_cb, ctx);
_mesa_DeleteHashTable(ss->Programs);
-#endif
+
#if FEATURE_ARB_vertex_program
_mesa_reference_vertprog(ctx, &ss->DefaultVertexProgram, NULL);
#endif
@@ -950,30 +974,55 @@ init_attrib_groups(GLcontext *ctx)
_mesa_init_extensions( ctx );
/* Attribute Groups */
+#if FEATURE_accum
_mesa_init_accum( ctx );
+#endif
+#if FEATURE_attrib_stack
_mesa_init_attrib( ctx );
+#endif
_mesa_init_buffer_objects( ctx );
_mesa_init_color( ctx );
+#if FEATURE_colortable
_mesa_init_colortables( ctx );
+#endif
_mesa_init_current( ctx );
_mesa_init_depth( ctx );
_mesa_init_debug( ctx );
+#if FEATURE_dlist
_mesa_init_display_list( ctx );
+#endif
+#if FEATURE_evaluators
_mesa_init_eval( ctx );
+#endif
+#if FEATURE_feedback
_mesa_init_feedback( ctx );
+#else
+ ctx->RenderMode = GL_RENDER;
+#endif
_mesa_init_fog( ctx );
+#if FEATURE_histogram
_mesa_init_histogram( ctx );
+#endif
_mesa_init_hint( ctx );
_mesa_init_line( ctx );
_mesa_init_lighting( ctx );
_mesa_init_matrix( ctx );
_mesa_init_multisample( ctx );
+#if FEATURE_pixel_transfer
_mesa_init_pixel( ctx );
+#else
+ ctx->Pixel.ReadBuffer = ctx->Visual.doubleBufferMode ? GL_BACK : GL_FRONT;
+#endif
+ _mesa_init_pixelstore( ctx );
_mesa_init_point( ctx );
_mesa_init_polygon( ctx );
_mesa_init_program( ctx );
+#if FEATURE_ARB_occlusion_query
_mesa_init_query( ctx );
+#endif
+#if FEATURE_drawpix
_mesa_init_rastpos( ctx );
+#endif
_mesa_init_scissor( ctx );
_mesa_init_shader_state( ctx );
_mesa_init_stencil( ctx );
@@ -984,8 +1033,12 @@ init_attrib_groups(GLcontext *ctx)
if (!_mesa_init_texture( ctx ))
return GL_FALSE;
+#if FEATURE_texture_s3tc
_mesa_init_texture_s3tc( ctx );
+#endif
+#if FEATURE_texture_fxt1
_mesa_init_texture_fxt1( ctx );
+#endif
/* Miscellaneous */
ctx->NewState = _NEW_ALL;
@@ -1116,16 +1169,18 @@ _mesa_initialize_context(GLcontext *ctx,
if (ctx->Exec)
_mesa_free(ctx->Exec);
}
+#if FEATURE_dispatch
_mesa_init_exec_table(ctx->Exec);
+#endif
ctx->CurrentDispatch = ctx->Exec;
-#if _HAVE_FULL_GL
+#if FEATURE_dlist
_mesa_init_dlist_table(ctx->Save);
_mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt );
+#endif
/* Neutral tnl module stuff */
_mesa_init_exec_vtxfmt( ctx );
ctx->TnlModule.Current = NULL;
ctx->TnlModule.SwapCount = 0;
-#endif
ctx->FragmentProgram._MaintainTexEnvProgram
= (_mesa_getenv("MESA_TEX_PROG") != NULL);
@@ -1215,14 +1270,20 @@ _mesa_free_context_data( GLcontext *ctx )
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL);
_mesa_free_lighting_data( ctx );
+#if FEATURE_evaluators
_mesa_free_eval_data( ctx );
+#endif
_mesa_free_texture_data( ctx );
_mesa_free_matrix_data( ctx );
_mesa_free_viewport_data( ctx );
+#if FEATURE_colortable
_mesa_free_colortables_data( ctx );
+#endif
_mesa_free_program_data(ctx);
_mesa_free_shader_state(ctx);
+#if FEATURE_ARB_occlusion_query
_mesa_free_query_data(ctx);
+#endif
#if FEATURE_ARB_vertex_buffer_object
_mesa_delete_buffer_object(ctx, ctx->Array.NullBufferObj);
@@ -1532,7 +1593,7 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
* if the DRIdrawable changes, and everything relies on them.
* This is a bit messy (same as needed in _mesa_BindFramebufferEXT)
*/
- int i;
+ unsigned int i;
GLenum buffers[MAX_DRAW_BUFFERS];
_mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer);
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 37ef2a865b..a24021c63f 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -912,9 +912,9 @@ struct dd_function_table {
void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state );
-#define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
-#define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
-#define PRIM_UNKNOWN GL_POLYGON+3
+#define PRIM_OUTSIDE_BEGIN_END (GL_POLYGON+1)
+#define PRIM_INSIDE_UNKNOWN_PRIM (GL_POLYGON+2)
+#define PRIM_UNKNOWN (GL_POLYGON+3)
/**
* Set by the driver-supplied T&L engine.
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 13ebd4dd0d..b4ed300b2e 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -52,6 +52,7 @@
#include "eval.h"
#include "extensions.h"
#include "feedback.h"
+#include "framebuffer.h"
#include "get.h"
#include "glapi/glapi.h"
#include "hash.h"
@@ -925,6 +926,13 @@ save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
static void GLAPIENTRY
+save_BlendFunc(GLenum srcfactor, GLenum dstfactor)
+{
+ save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor);
+}
+
+
+static void GLAPIENTRY
save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
{
GET_CURRENT_CONTEXT(ctx);
@@ -5069,7 +5077,7 @@ save_Indexfv(const GLfloat * v)
static void GLAPIENTRY
save_EdgeFlag(GLboolean x)
{
- save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0 : 0.0);
+ save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? (GLfloat)1.0 : (GLfloat)0.0);
}
static void GLAPIENTRY
@@ -7601,7 +7609,7 @@ _mesa_init_dlist_table(struct _glapi_table *table)
SET_Accum(table, save_Accum);
SET_AlphaFunc(table, save_AlphaFunc);
SET_Bitmap(table, save_Bitmap);
- SET_BlendFunc(table, _mesa_BlendFunc); /* loops-back to BlendFuncSeparate */
+ SET_BlendFunc(table, save_BlendFunc);
SET_CallList(table, _mesa_save_CallList);
SET_CallLists(table, _mesa_save_CallLists);
SET_Clear(table, save_Clear);
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index fa422bb3c7..6db198ea3b 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -30,114 +30,10 @@
#include "feedback.h"
#include "framebuffer.h"
#include "image.h"
+#include "readpix.h"
#include "state.h"
-/**
- * Do error checking of the format/type parameters to glReadPixels and
- * glDrawPixels.
- * \param drawing if GL_TRUE do checking for DrawPixels, else do checking
- * for ReadPixels.
- * \return GL_TRUE if error detected, GL_FALSE if no errors
- */
-static GLboolean
-error_check_format_type(GLcontext *ctx, GLenum format, GLenum type,
- GLboolean drawing)
-{
- const char *readDraw = drawing ? "Draw" : "Read";
-
- if (ctx->Extensions.EXT_packed_depth_stencil
- && type == GL_UNSIGNED_INT_24_8_EXT
- && format != GL_DEPTH_STENCIL_EXT) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "gl%sPixels(format is not GL_DEPTH_STENCIL_EXT)", readDraw);
- return GL_TRUE;
- }
-
- /* basic combinations test */
- if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "gl%sPixels(format or type)", readDraw);
- return GL_TRUE;
- }
-
- /* additional checks */
- switch (format) {
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_RGB:
- case GL_BGR:
- case GL_RGBA:
- case GL_BGRA:
- case GL_ABGR_EXT:
- if (drawing && !ctx->Visual.rgbMode) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glDrawPixels(drawing RGB pixels into color index buffer)");
- return GL_TRUE;
- }
- if (!drawing && !_mesa_dest_buffer_exists(ctx, GL_COLOR)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glReadPixels(no color buffer)");
- return GL_TRUE;
- }
- break;
- case GL_COLOR_INDEX:
- if (!drawing && ctx->Visual.rgbMode) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glReadPixels(reading color index format from RGB buffer)");
- return GL_TRUE;
- }
- if (!drawing && !_mesa_dest_buffer_exists(ctx, GL_COLOR)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glReadPixels(no color buffer)");
- return GL_TRUE;
- }
- break;
- case GL_STENCIL_INDEX:
- if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
- (!drawing && !_mesa_source_buffer_exists(ctx, format))) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "gl%sPixels(no stencil buffer)", readDraw);
- return GL_TRUE;
- }
- break;
- case GL_DEPTH_COMPONENT:
- if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
- (!drawing && !_mesa_source_buffer_exists(ctx, format))) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "gl%sPixels(no depth buffer)", readDraw);
- return GL_TRUE;
- }
- break;
- case GL_DEPTH_STENCIL_EXT:
- if (!ctx->Extensions.EXT_packed_depth_stencil ||
- type != GL_UNSIGNED_INT_24_8_EXT) {
- _mesa_error(ctx, GL_INVALID_ENUM, "gl%sPixels(type)", readDraw);
- return GL_TRUE;
- }
- if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
- (!drawing && !_mesa_source_buffer_exists(ctx, format))) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "gl%sPixels(no depth or stencil buffer)", readDraw);
- return GL_TRUE;
- }
- break;
- default:
- /* this should have been caught in _mesa_is_legal_format_type() */
- _mesa_problem(ctx, "unexpected format in _mesa_%sPixels", readDraw);
- return GL_TRUE;
- }
-
- /* no errors */
- return GL_FALSE;
-}
-
-
-
#if _HAVE_FULL_GL
/*
@@ -165,7 +61,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
return;
}
- if (error_check_format_type(ctx, format, type, GL_TRUE)) {
+ if (_mesa_error_check_format_type(ctx, format, type, GL_TRUE)) {
/* found an error */
return;
}
@@ -288,61 +184,6 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
void GLAPIENTRY
-_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLvoid *pixels )
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- FLUSH_CURRENT(ctx, 0);
-
- if (width < 0 || height < 0) {
- _mesa_error( ctx, GL_INVALID_VALUE,
- "glReadPixels(width=%d height=%d)", width, height );
- return;
- }
-
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
- if (error_check_format_type(ctx, format, type, GL_FALSE)) {
- /* found an error */
- return;
- }
-
- if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
- _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
- "glReadPixels(incomplete framebuffer)" );
- return;
- }
-
- if (!_mesa_source_buffer_exists(ctx, format)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(no readbuffer)");
- return;
- }
-
- if (ctx->Pack.BufferObj->Name) {
- if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1,
- format, type, pixels)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glReadPixels(invalid PBO access)");
- return;
- }
-
- if (ctx->Pack.BufferObj->Pointer) {
- /* buffer is mapped - that's an error */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)");
- return;
- }
- }
-
- ctx->Driver.ReadPixels(ctx, x, y, width, height,
- format, type, &ctx->Pack, pixels);
-}
-
-
-
-void GLAPIENTRY
_mesa_Bitmap( GLsizei width, GLsizei height,
GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove,
const GLubyte *bitmap )
@@ -377,7 +218,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
if (ctx->RenderMode == GL_RENDER) {
/* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */
- const GLfloat epsilon = 0.0001;
+ const GLfloat epsilon = (const GLfloat)0.0001;
GLint x = IFLOOR(ctx->Current.RasterPos[0] + epsilon - xorig);
GLint y = IFLOOR(ctx->Current.RasterPos[1] + epsilon - yorig);
diff --git a/src/mesa/main/drawpix.h b/src/mesa/main/drawpix.h
index 2a2d7de8d8..6177adad6d 100644
--- a/src/mesa/main/drawpix.h
+++ b/src/mesa/main/drawpix.h
@@ -1,9 +1,8 @@
-
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 7.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2008 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"),
@@ -28,7 +27,7 @@
#define DRAWPIXELS_H
-#include "mtypes.h"
+#include "main/glheader.h"
extern void GLAPIENTRY
@@ -37,11 +36,6 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
extern void GLAPIENTRY
-_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLvoid *pixels );
-
-
-extern void GLAPIENTRY
_mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
GLenum type );
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 52dd63f2ce..6b4ad8eea3 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -904,6 +904,7 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
break;
/* GL_MESA_program_debug */
+#if FEATURE_MESA_program_debug
case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
CHECK_EXTENSION(MESA_program_debug, cap);
ctx->FragmentProgram.CallbackEnabled = state;
@@ -912,6 +913,7 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
CHECK_EXTENSION(MESA_program_debug, cap);
ctx->VertexProgram.CallbackEnabled = state;
break;
+#endif
#if FEATURE_ATI_fragment_shader
case GL_FRAGMENT_SHADER_ATI:
@@ -1349,12 +1351,15 @@ _mesa_IsEnabled( GLenum cap )
return ctx->Depth.BoundsTest;
/* GL_MESA_program_debug */
+#if FEATURE_MESA_program_debug
case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
CHECK_EXTENSION(MESA_program_debug);
return ctx->FragmentProgram.CallbackEnabled;
case GL_VERTEX_PROGRAM_CALLBACK_MESA:
CHECK_EXTENSION(MESA_program_debug);
return ctx->VertexProgram.CallbackEnabled;
+#endif
+
#if FEATURE_ATI_fragment_shader
case GL_FRAGMENT_SHADER_ATI:
CHECK_EXTENSION(ATI_fragment_shader);
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index 810af9e33e..e6c7c1040f 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -53,7 +53,9 @@ struct state_key {
unsigned light_color_material:1;
unsigned light_color_material_mask:12;
unsigned light_material_mask:12;
+ unsigned material_shininess_is_zero:1;
+ unsigned need_eye_coords:1;
unsigned normalize:1;
unsigned rescale_normals:1;
unsigned fog_source_is_depth:1;
@@ -154,6 +156,26 @@ tnl_get_per_vertex_fog(GLcontext *ctx)
#endif
}
+static GLboolean check_active_shininess( GLcontext *ctx,
+ const struct state_key *key,
+ GLuint side )
+{
+ GLuint bit = 1 << (MAT_ATTRIB_FRONT_SHININESS + side);
+
+ if (key->light_color_material_mask & bit)
+ return GL_TRUE;
+
+ if (key->light_material_mask & bit)
+ return GL_TRUE;
+
+ if (ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SHININESS + side][0] != 0.0F)
+ return GL_TRUE;
+
+ return GL_FALSE;
+}
+
+
+
static struct state_key *make_state_key( GLcontext *ctx )
{
@@ -167,6 +189,8 @@ static struct state_key *make_state_key( GLcontext *ctx )
*/
assert(fp);
+ key->need_eye_coords = ctx->_NeedEyeCoords;
+
key->fragprog_inputs_read = fp->Base.InputsRead;
if (ctx->RenderMode == GL_FEEDBACK) {
@@ -211,6 +235,17 @@ static struct state_key *make_state_key( GLcontext *ctx )
key->unit[i].light_attenuated = 1;
}
}
+
+ if (check_active_shininess(ctx, key, 0)) {
+ key->material_shininess_is_zero = 0;
+ }
+ else if (key->light_twoside &&
+ check_active_shininess(ctx, key, 1)) {
+ key->material_shininess_is_zero = 0;
+ }
+ else {
+ key->material_shininess_is_zero = 1;
+ }
}
if (ctx->Transform.Normalize)
@@ -270,7 +305,7 @@ static struct state_key *make_state_key( GLcontext *ctx )
* generated program with line/function references for each
* instruction back into this file:
*/
-#define DISASSEM (MESA_VERBOSE&VERBOSE_DISASSEM)
+#define DISASSEM 0
/* Should be tunable by the driver - do we want to do matrix
* multiplications with DP4's or with MUL/MAD's? SSE works better
@@ -309,8 +344,9 @@ struct tnl_program {
GLuint temp_reserved;
struct ureg eye_position;
+ struct ureg eye_position_z;
struct ureg eye_position_normalized;
- struct ureg eye_normal;
+ struct ureg transformed_normal;
struct ureg identity;
GLuint materials;
@@ -653,9 +689,9 @@ static void emit_normalize_vec3( struct tnl_program *p,
struct ureg src )
{
struct ureg tmp = get_temp(p);
- emit_op2(p, OPCODE_DP3, tmp, 0, src, src);
- emit_op1(p, OPCODE_RSQ, tmp, 0, tmp);
- emit_op2(p, OPCODE_MUL, dest, 0, src, tmp);
+ emit_op2(p, OPCODE_DP3, tmp, WRITEMASK_X, src, src);
+ emit_op1(p, OPCODE_RSQ, tmp, WRITEMASK_X, tmp);
+ emit_op2(p, OPCODE_MUL, dest, 0, src, swizzle1(tmp, X));
release_temp(p, tmp);
}
@@ -693,6 +729,28 @@ static struct ureg get_eye_position( struct tnl_program *p )
}
+static struct ureg get_eye_position_z( struct tnl_program *p )
+{
+ if (!is_undef(p->eye_position))
+ return swizzle1(p->eye_position, Z);
+
+ if (is_undef(p->eye_position_z)) {
+ struct ureg pos = register_input( p, VERT_ATTRIB_POS );
+ struct ureg modelview[4];
+
+ p->eye_position_z = reserve_temp(p);
+
+ register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3,
+ 0, modelview );
+
+ emit_op2(p, OPCODE_DP4, p->eye_position_z, 0, pos, modelview[2]);
+ }
+
+ return p->eye_position_z;
+}
+
+
+
static struct ureg get_eye_position_normalized( struct tnl_program *p )
{
if (is_undef(p->eye_position_normalized)) {
@@ -705,36 +763,52 @@ static struct ureg get_eye_position_normalized( struct tnl_program *p )
}
-static struct ureg get_eye_normal( struct tnl_program *p )
+static struct ureg get_transformed_normal( struct tnl_program *p )
{
- if (is_undef(p->eye_normal)) {
+ if (is_undef(p->transformed_normal) &&
+ !p->state->need_eye_coords &&
+ !p->state->normalize &&
+ !(p->state->need_eye_coords == p->state->rescale_normals))
+ {
+ p->transformed_normal = register_input(p, VERT_ATTRIB_NORMAL );
+ }
+ else if (is_undef(p->transformed_normal))
+ {
struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL );
struct ureg mvinv[3];
+ struct ureg transformed_normal = reserve_temp(p);
- register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 2,
- STATE_MATRIX_INVTRANS, mvinv );
-
- p->eye_normal = reserve_temp(p);
+ if (p->state->need_eye_coords) {
+ register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 2,
+ STATE_MATRIX_INVTRANS, mvinv );
- /* Transform to eye space:
- */
- emit_matrix_transform_vec3( p, p->eye_normal, mvinv, normal );
+ /* Transform to eye space:
+ */
+ emit_matrix_transform_vec3( p, transformed_normal, mvinv, normal );
+ normal = transformed_normal;
+ }
/* Normalize/Rescale:
*/
if (p->state->normalize) {
- emit_normalize_vec3( p, p->eye_normal, p->eye_normal );
+ emit_normalize_vec3( p, transformed_normal, normal );
+ normal = transformed_normal;
}
- else if (p->state->rescale_normals) {
+ else if (p->state->need_eye_coords == p->state->rescale_normals) {
+ /* This is already adjusted for eye/non-eye rendering:
+ */
struct ureg rescale = register_param2(p, STATE_INTERNAL,
- STATE_NORMAL_SCALE);
+ STATE_NORMAL_SCALE);
- emit_op2( p, OPCODE_MUL, p->eye_normal, 0, p->eye_normal,
- swizzle1(rescale, X));
+ emit_op2( p, OPCODE_MUL, transformed_normal, 0, normal, rescale );
+ normal = transformed_normal;
}
+
+ assert(normal.file == PROGRAM_TEMPORARY);
+ p->transformed_normal = normal;
}
- return p->eye_normal;
+ return p->transformed_normal;
}
@@ -856,7 +930,7 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p,
*/
if (!p->state->unit[i].light_spotcutoff_is_180) {
struct ureg spot_dir_norm = register_param3(p, STATE_INTERNAL,
- STATE_SPOT_DIR_NORMALIZED, i);
+ STATE_LIGHT_SPOT_DIR_NORMALIZED, i);
struct ureg spot = get_temp(p);
struct ureg slt = get_temp(p);
@@ -895,7 +969,30 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p,
}
+/**
+ * Compute:
+ * lit.y = MAX(0, dots.x)
+ * lit.z = SLT(0, dots.x)
+ */
+static void emit_degenerate_lit( struct tnl_program *p,
+ struct ureg lit,
+ struct ureg dots )
+{
+ struct ureg id = get_identity_param(p); /* id = {0,0,0,1} */
+ /* Note that lit.x & lit.w will not be examined. Note also that
+ * dots.xyzw == dots.xxxx.
+ */
+
+ /* MAX lit, id, dots;
+ */
+ emit_op2(p, OPCODE_MAX, lit, WRITEMASK_XYZW, id, dots);
+
+ /* result[2] = (in > 0 ? 1 : 0)
+ * SLT lit.z, id.z, dots; # lit.z = (0 < dots.z) ? 1 : 0
+ */
+ emit_op2(p, OPCODE_SLT, lit, WRITEMASK_Z, swizzle1(id,Z), dots);
+}
/* Need to add some addtional parameters to allow lighting in object
@@ -907,13 +1004,21 @@ static void build_lighting( struct tnl_program *p )
const GLboolean twoside = p->state->light_twoside;
const GLboolean separate = p->state->separate_specular;
GLuint nr_lights = 0, count = 0;
- struct ureg normal = get_eye_normal(p);
+ struct ureg normal = get_transformed_normal(p);
struct ureg lit = get_temp(p);
struct ureg dots = get_temp(p);
struct ureg _col0 = undef, _col1 = undef;
struct ureg _bfc0 = undef, _bfc1 = undef;
GLuint i;
+ /*
+ * NOTE:
+ * dot.x = dot(normal, VPpli)
+ * dot.y = dot(normal, halfAngle)
+ * dot.z = back.shininess
+ * dot.w = front.shininess
+ */
+
for (i = 0; i < MAX_LIGHTS; i++)
if (p->state->unit[i].light_enabled)
nr_lights++;
@@ -921,9 +1026,11 @@ static void build_lighting( struct tnl_program *p )
set_material_flags(p);
{
- struct ureg shininess = get_material(p, 0, STATE_SHININESS);
- emit_op1(p, OPCODE_MOV, dots, WRITEMASK_W, swizzle1(shininess,X));
- release_temp(p, shininess);
+ if (!p->state->material_shininess_is_zero) {
+ struct ureg shininess = get_material(p, 0, STATE_SHININESS);
+ emit_op1(p, OPCODE_MOV, dots, WRITEMASK_W, swizzle1(shininess,X));
+ release_temp(p, shininess);
+ }
_col0 = make_temp(p, get_scenecolor(p, 0));
if (separate)
@@ -934,10 +1041,12 @@ static void build_lighting( struct tnl_program *p )
}
if (twoside) {
- struct ureg shininess = get_material(p, 1, STATE_SHININESS);
- emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z,
- negate(swizzle1(shininess,X)));
- release_temp(p, shininess);
+ if (!p->state->material_shininess_is_zero) {
+ struct ureg shininess = get_material(p, 1, STATE_SHININESS);
+ emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z,
+ negate(swizzle1(shininess,X)));
+ release_temp(p, shininess);
+ }
_bfc0 = make_temp(p, get_scenecolor(p, 1));
if (separate)
@@ -984,25 +1093,28 @@ static void build_lighting( struct tnl_program *p )
/* Can used precomputed constants in this case.
* Attenuation never applies to infinite lights.
*/
- VPpli = register_param3(p, STATE_LIGHT, i,
- STATE_POSITION_NORMALIZED);
- if (p->state->light_local_viewer) {
- struct ureg eye_hat = get_eye_position_normalized(p);
- half = get_temp(p);
- emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat);
- emit_normalize_vec3(p, half, half);
- } else {
- half = register_param3(p, STATE_LIGHT, i, STATE_HALF_VECTOR);
+ VPpli = register_param3(p, STATE_INTERNAL,
+ STATE_LIGHT_POSITION_NORMALIZED, i);
+
+ if (!p->state->material_shininess_is_zero) {
+ if (p->state->light_local_viewer) {
+ struct ureg eye_hat = get_eye_position_normalized(p);
+ half = get_temp(p);
+ emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat);
+ emit_normalize_vec3(p, half, half);
+ } else {
+ half = register_param3(p, STATE_INTERNAL,
+ STATE_LIGHT_HALF_VECTOR, i);
+ }
}
}
else {
- struct ureg Ppli = register_param3(p, STATE_LIGHT, i,
- STATE_POSITION);
+ struct ureg Ppli = register_param3(p, STATE_INTERNAL,
+ STATE_LIGHT_POSITION, i);
struct ureg V = get_eye_position(p);
struct ureg dist = get_temp(p);
VPpli = get_temp(p);
- half = get_temp(p);
/* Calculate VPpli vector
*/
@@ -1024,24 +1136,33 @@ static void build_lighting( struct tnl_program *p )
/* Calculate viewer direction, or use infinite viewer:
*/
- if (p->state->light_local_viewer) {
- struct ureg eye_hat = get_eye_position_normalized(p);
- emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat);
- }
- else {
- struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z);
- emit_op2(p, OPCODE_ADD, half, 0, VPpli, z_dir);
- }
-
- emit_normalize_vec3(p, half, half);
+ if (!p->state->material_shininess_is_zero) {
+ half = get_temp(p);
+
+ if (p->state->light_local_viewer) {
+ struct ureg eye_hat = get_eye_position_normalized(p);
+ emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat);
+ }
+ else {
+ struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z);
+ emit_op2(p, OPCODE_ADD, half, 0, VPpli, z_dir);
+ }
+
+ emit_normalize_vec3(p, half, half);
+ }
release_temp(p, dist);
}
/* Calculate dot products:
*/
- emit_op2(p, OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli);
- emit_op2(p, OPCODE_DP3, dots, WRITEMASK_Y, normal, half);
+ if (p->state->material_shininess_is_zero) {
+ emit_op2(p, OPCODE_DP3, dots, 0, normal, VPpli);
+ }
+ else {
+ emit_op2(p, OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli);
+ emit_op2(p, OPCODE_DP3, dots, WRITEMASK_Y, normal, half);
+ }
/* Front face lighting:
*/
@@ -1052,11 +1173,6 @@ static void build_lighting( struct tnl_program *p )
struct ureg res0, res1;
GLuint mask0, mask1;
- emit_op1(p, OPCODE_LIT, lit, 0, dots);
-
- if (!is_undef(att))
- emit_op2(p, OPCODE_MUL, lit, 0, lit, att);
-
if (count == nr_lights) {
if (separate) {
@@ -1078,7 +1194,24 @@ static void build_lighting( struct tnl_program *p )
res1 = _col1;
}
- emit_op3(p, OPCODE_MAD, _col0, 0, swizzle1(lit,X), ambient, _col0);
+
+ if (!is_undef(att)) {
+ /* light is attenuated by distance */
+ emit_op1(p, OPCODE_LIT, lit, 0, dots);
+ emit_op2(p, OPCODE_MUL, lit, 0, lit, att);
+ emit_op3(p, OPCODE_MAD, _col0, 0, swizzle1(lit,X), ambient, _col0);
+ }
+ else if (!p->state->material_shininess_is_zero) {
+ /* there's a non-zero specular term */
+ emit_op1(p, OPCODE_LIT, lit, 0, dots);
+ emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0);
+ }
+ else {
+ /* no attenutation, no specular */
+ emit_degenerate_lit(p, lit, dots);
+ emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0);
+ }
+
emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _col0);
emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _col1);
@@ -1096,11 +1229,6 @@ static void build_lighting( struct tnl_program *p )
struct ureg res0, res1;
GLuint mask0, mask1;
- emit_op1(p, OPCODE_LIT, lit, 0, negate(swizzle(dots,X,Y,W,Z)));
-
- if (!is_undef(att))
- emit_op2(p, OPCODE_MUL, lit, 0, lit, att);
-
if (count == nr_lights) {
if (separate) {
mask0 = WRITEMASK_XYZ;
@@ -1121,7 +1249,23 @@ static void build_lighting( struct tnl_program *p )
mask1 = 0;
}
- emit_op3(p, OPCODE_MAD, _bfc0, 0, swizzle1(lit,X), ambient, _bfc0);
+ dots = negate(swizzle(dots,X,Y,W,Z));
+
+ if (!is_undef(att)) {
+ emit_op1(p, OPCODE_LIT, lit, 0, dots);
+ emit_op2(p, OPCODE_MUL, lit, 0, lit, att);
+ emit_op3(p, OPCODE_MAD, _bfc0, 0, swizzle1(lit,X), ambient, _bfc0);
+ }
+ else if (!p->state->material_shininess_is_zero) {
+ emit_op1(p, OPCODE_LIT, lit, 0, dots);
+ emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0);
+ }
+ else {
+ emit_degenerate_lit(p, lit, dots);
+ emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0);
+ }
+
+ emit_op2(p, OPCODE_ADD, _bfc0, 0, ambient, _bfc0);
emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _bfc0);
emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _bfc1);
@@ -1146,7 +1290,7 @@ static void build_fog( struct tnl_program *p )
struct ureg input;
if (p->state->fog_source_is_depth) {
- input = swizzle1(get_eye_position(p), Z);
+ input = get_eye_position_z(p);
}
else {
input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X);
@@ -1201,7 +1345,7 @@ static void build_reflect_texgen( struct tnl_program *p,
struct ureg dest,
GLuint writemask )
{
- struct ureg normal = get_eye_normal(p);
+ struct ureg normal = get_transformed_normal(p);
struct ureg eye_hat = get_eye_position_normalized(p);
struct ureg tmp = get_temp(p);
@@ -1219,7 +1363,7 @@ static void build_sphere_texgen( struct tnl_program *p,
struct ureg dest,
GLuint writemask )
{
- struct ureg normal = get_eye_normal(p);
+ struct ureg normal = get_transformed_normal(p);
struct ureg eye_hat = get_eye_position_normalized(p);
struct ureg tmp = get_temp(p);
struct ureg half = register_scalar_const(p, .5);
@@ -1338,7 +1482,7 @@ static void build_texture_transform( struct tnl_program *p )
}
if (normal_mask) {
- struct ureg normal = get_eye_normal(p);
+ struct ureg normal = get_transformed_normal(p);
emit_op1(p, OPCODE_MOV, out_texgen, normal_mask, normal );
}
@@ -1376,7 +1520,7 @@ static void build_texture_transform( struct tnl_program *p )
static void build_pointsize( struct tnl_program *p )
{
- struct ureg eye = get_eye_position(p);
+ struct ureg eye = get_eye_position_z(p);
struct ureg state_size = register_param1(p, STATE_POINT_SIZE);
struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION);
struct ureg out = register_output(p, VERT_RESULT_PSIZ);
@@ -1474,8 +1618,9 @@ create_new_program( const struct state_key *key,
p.state = key;
p.program = program;
p.eye_position = undef;
+ p.eye_position_z = undef;
p.eye_position_normalized = undef;
- p.eye_normal = undef;
+ p.transformed_normal = undef;
p.identity = undef;
p.temp_in_use = 0;
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index c9b30d3252..96f1b30c9b 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -67,7 +67,7 @@ compute_depth_max(struct gl_framebuffer *fb)
fb->_DepthMaxF = (GLfloat) fb->_DepthMax;
/* Minimum resolvable depth value, for polygon offset */
- fb->_MRD = 1.0 / fb->_DepthMaxF;
+ fb->_MRD = (GLfloat)1.0 / fb->_DepthMaxF;
}
@@ -338,6 +338,84 @@ _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb,
}
+
+/**
+ * XXX THIS IS OBSOLETE - drivers should take care of detecting window
+ * size changes and act accordingly, likely calling _mesa_resize_framebuffer().
+ *
+ * GL_MESA_resize_buffers extension.
+ *
+ * When this function is called, we'll ask the window system how large
+ * the current window is. If it's a new size, we'll call the driver's
+ * ResizeBuffers function. The driver will then resize its color buffers
+ * as needed, and maybe call the swrast's routine for reallocating
+ * swrast-managed depth/stencil/accum/etc buffers.
+ * \note This function should only be called through the GL API, not
+ * from device drivers (as was done in the past).
+ */
+void
+_mesa_resizebuffers( GLcontext *ctx )
+{
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glResizeBuffersMESA\n");
+
+ if (!ctx->Driver.GetBufferSize) {
+ return;
+ }
+
+ if (ctx->WinSysDrawBuffer) {
+ GLuint newWidth, newHeight;
+ GLframebuffer *buffer = ctx->WinSysDrawBuffer;
+
+ assert(buffer->Name == 0);
+
+ /* ask device driver for size of output buffer */
+ ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
+
+ /* see if size of device driver's color buffer (window) has changed */
+ if (buffer->Width != newWidth || buffer->Height != newHeight) {
+ if (ctx->Driver.ResizeBuffers)
+ ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight );
+ }
+ }
+
+ if (ctx->WinSysReadBuffer
+ && ctx->WinSysReadBuffer != ctx->WinSysDrawBuffer) {
+ GLuint newWidth, newHeight;
+ GLframebuffer *buffer = ctx->WinSysReadBuffer;
+
+ assert(buffer->Name == 0);
+
+ /* ask device driver for size of read buffer */
+ ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
+
+ /* see if size of device driver's color buffer (window) has changed */
+ if (buffer->Width != newWidth || buffer->Height != newHeight) {
+ if (ctx->Driver.ResizeBuffers)
+ ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight );
+ }
+ }
+
+ ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */
+}
+
+
+/*
+ * XXX THIS IS OBSOLETE
+ */
+void GLAPIENTRY
+_mesa_ResizeBuffersMESA( void )
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->Extensions.MESA_resize_buffers)
+ _mesa_resizebuffers( ctx );
+}
+
+
+
/**
* Examine all the framebuffer's renderbuffers to update the Width/Height
* fields of the framebuffer. If we have renderbuffers with different
diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h
index 4d76f3a90f..e9eeed28cb 100644
--- a/src/mesa/main/framebuffer.h
+++ b/src/mesa/main/framebuffer.h
@@ -53,6 +53,14 @@ extern void
_mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb,
GLuint width, GLuint height);
+
+extern void
+_mesa_resizebuffers( GLcontext *ctx );
+
+extern void GLAPIENTRY
+_mesa_ResizeBuffersMESA( void );
+
+
extern void
_mesa_update_draw_buffer_bounds(GLcontext *ctx);
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index eb81ee4a52..ac437a86e2 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -19,10 +19,6 @@
#define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE )
-#define ENUM_TO_BOOLEAN(E) ( (E) ? GL_TRUE : GL_FALSE )
-#define ENUM_TO_INT(E) ( (GLint) (E) )
-#define ENUM_TO_FLOAT(E) ( (GLfloat) (E) )
-
#define BOOLEAN_TO_INT(B) ( (GLint) (B) )
#define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F )
@@ -870,6 +866,14 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
case GL_TEXTURE_3D:
params[0] = _mesa_IsEnabled(GL_TEXTURE_3D);
break;
+ case GL_TEXTURE_1D_ARRAY_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetBooleanv");
+ params[0] = _mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT);
+ break;
+ case GL_TEXTURE_2D_ARRAY_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetBooleanv");
+ params[0] = _mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT);
+ break;
case GL_TEXTURE_BINDING_1D:
params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name);
break;
@@ -879,6 +883,14 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
case GL_TEXTURE_BINDING_3D:
params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name);
break;
+ case GL_TEXTURE_BINDING_1D_ARRAY_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetBooleanv");
+ params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name);
+ break;
+ case GL_TEXTURE_BINDING_2D_ARRAY_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetBooleanv");
+ params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name);
+ break;
case GL_TEXTURE_ENV_COLOR:
{
const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;
@@ -2701,6 +2713,14 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
case GL_TEXTURE_3D:
params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_3D));
break;
+ case GL_TEXTURE_1D_ARRAY_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetFloatv");
+ params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT));
+ break;
+ case GL_TEXTURE_2D_ARRAY_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetFloatv");
+ params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT));
+ break;
case GL_TEXTURE_BINDING_1D:
params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name);
break;
@@ -2710,6 +2730,14 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
case GL_TEXTURE_BINDING_3D:
params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name);
break;
+ case GL_TEXTURE_BINDING_1D_ARRAY_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetFloatv");
+ params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name);
+ break;
+ case GL_TEXTURE_BINDING_2D_ARRAY_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetFloatv");
+ params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name);
+ break;
case GL_TEXTURE_ENV_COLOR:
{
const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;
@@ -4532,6 +4560,14 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
case GL_TEXTURE_3D:
params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_3D));
break;
+ case GL_TEXTURE_1D_ARRAY_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetIntegerv");
+ params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT));
+ break;
+ case GL_TEXTURE_2D_ARRAY_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetIntegerv");
+ params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT));
+ break;
case GL_TEXTURE_BINDING_1D:
params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name;
break;
@@ -4541,6 +4577,14 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
case GL_TEXTURE_BINDING_3D:
params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name;
break;
+ case GL_TEXTURE_BINDING_1D_ARRAY_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetIntegerv");
+ params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name;
+ break;
+ case GL_TEXTURE_BINDING_2D_ARRAY_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetIntegerv");
+ params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name;
+ break;
case GL_TEXTURE_ENV_COLOR:
{
const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index 9055433281..c307058da6 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -1127,10 +1127,6 @@ def EmitHeader():
#define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE )
-#define ENUM_TO_BOOLEAN(E) ( (E) ? GL_TRUE : GL_FALSE )
-#define ENUM_TO_INT(E) ( (GLint) (E) )
-#define ENUM_TO_FLOAT(E) ( (GLfloat) (E) )
-
#define BOOLEAN_TO_INT(B) ( (GLint) (B) )
#define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F )
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index fd4127558a..0f74bc83cc 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -145,6 +145,11 @@
#include "GL/glext.h"
+#ifndef GL_FIXED
+#define GL_FIXED 0x140C
+#endif
+
+
#if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP)
#define CAPI _cdecl
#endif
diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c
index 6a7f09489c..77c458d540 100644
--- a/src/mesa/main/histogram.c
+++ b/src/mesa/main/histogram.c
@@ -31,71 +31,6 @@
#include "histogram.h"
-/**********************************************************************
- * Internal functions
- */
-
-
-/*
- * Update the min/max values from an array of fragment colors.
- */
-void
-_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4])
-{
- GLuint i;
- for (i = 0; i < n; i++) {
- /* update mins */
- if (rgba[i][RCOMP] < ctx->MinMax.Min[RCOMP])
- ctx->MinMax.Min[RCOMP] = rgba[i][RCOMP];
- if (rgba[i][GCOMP] < ctx->MinMax.Min[GCOMP])
- ctx->MinMax.Min[GCOMP] = rgba[i][GCOMP];
- if (rgba[i][BCOMP] < ctx->MinMax.Min[BCOMP])
- ctx->MinMax.Min[BCOMP] = rgba[i][BCOMP];
- if (rgba[i][ACOMP] < ctx->MinMax.Min[ACOMP])
- ctx->MinMax.Min[ACOMP] = rgba[i][ACOMP];
-
- /* update maxs */
- if (rgba[i][RCOMP] > ctx->MinMax.Max[RCOMP])
- ctx->MinMax.Max[RCOMP] = rgba[i][RCOMP];
- if (rgba[i][GCOMP] > ctx->MinMax.Max[GCOMP])
- ctx->MinMax.Max[GCOMP] = rgba[i][GCOMP];
- if (rgba[i][BCOMP] > ctx->MinMax.Max[BCOMP])
- ctx->MinMax.Max[BCOMP] = rgba[i][BCOMP];
- if (rgba[i][ACOMP] > ctx->MinMax.Max[ACOMP])
- ctx->MinMax.Max[ACOMP] = rgba[i][ACOMP];
- }
-}
-
-
-/*
- * Update the histogram values from an array of fragment colors.
- */
-void
-_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4])
-{
- const GLint max = ctx->Histogram.Width - 1;
- GLfloat w = (GLfloat) max;
- GLuint i;
-
- if (ctx->Histogram.Width == 0)
- return;
-
- for (i = 0; i < n; i++) {
- GLint ri = IROUND(rgba[i][RCOMP] * w);
- GLint gi = IROUND(rgba[i][GCOMP] * w);
- GLint bi = IROUND(rgba[i][BCOMP] * w);
- GLint ai = IROUND(rgba[i][ACOMP] * w);
- ri = CLAMP(ri, 0, max);
- gi = CLAMP(gi, 0, max);
- bi = CLAMP(bi, 0, max);
- ai = CLAMP(ai, 0, max);
- ctx->Histogram.Count[ri][RCOMP]++;
- ctx->Histogram.Count[gi][GCOMP]++;
- ctx->Histogram.Count[bi][BCOMP]++;
- ctx->Histogram.Count[ai][ACOMP]++;
- }
-}
-
/*
* XXX the packed pixel formats haven't been tested.
diff --git a/src/mesa/main/histogram.h b/src/mesa/main/histogram.h
index 974447231d..367e9b11ba 100644
--- a/src/mesa/main/histogram.h
+++ b/src/mesa/main/histogram.h
@@ -71,12 +71,6 @@ _mesa_ResetHistogram(GLenum target);
extern void GLAPIENTRY
_mesa_ResetMinmax(GLenum target);
-extern void
-_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]);
-
-extern void
-_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]);
-
extern void _mesa_init_histogram( GLcontext * ctx );
#else
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 76e105e65e..52c4999e16 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 7.1
*
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2008 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"),
@@ -34,7 +34,6 @@
#include "context.h"
#include "image.h"
#include "imports.h"
-#include "histogram.h"
#include "macros.h"
#include "pixel.h"
@@ -1011,6 +1010,488 @@ _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
}
+/**********************************************************************/
+/***** Pixel processing functions ******/
+/**********************************************************************/
+
+/*
+ * Apply scale and bias factors to an array of RGBA pixels.
+ */
+void
+_mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4],
+ GLfloat rScale, GLfloat gScale,
+ GLfloat bScale, GLfloat aScale,
+ GLfloat rBias, GLfloat gBias,
+ GLfloat bBias, GLfloat aBias)
+{
+ if (rScale != 1.0 || rBias != 0.0) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][RCOMP] = rgba[i][RCOMP] * rScale + rBias;
+ }
+ }
+ if (gScale != 1.0 || gBias != 0.0) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][GCOMP] = rgba[i][GCOMP] * gScale + gBias;
+ }
+ }
+ if (bScale != 1.0 || bBias != 0.0) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][BCOMP] = rgba[i][BCOMP] * bScale + bBias;
+ }
+ }
+ if (aScale != 1.0 || aBias != 0.0) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][ACOMP] = rgba[i][ACOMP] * aScale + aBias;
+ }
+ }
+}
+
+
+/*
+ * Apply pixel mapping to an array of floating point RGBA pixels.
+ */
+void
+_mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] )
+{
+ const GLfloat rscale = (GLfloat) (ctx->PixelMaps.RtoR.Size - 1);
+ const GLfloat gscale = (GLfloat) (ctx->PixelMaps.GtoG.Size - 1);
+ const GLfloat bscale = (GLfloat) (ctx->PixelMaps.BtoB.Size - 1);
+ const GLfloat ascale = (GLfloat) (ctx->PixelMaps.AtoA.Size - 1);
+ const GLfloat *rMap = ctx->PixelMaps.RtoR.Map;
+ const GLfloat *gMap = ctx->PixelMaps.GtoG.Map;
+ const GLfloat *bMap = ctx->PixelMaps.BtoB.Map;
+ const GLfloat *aMap = ctx->PixelMaps.AtoA.Map;
+ GLuint i;
+ for (i=0;i<n;i++) {
+ GLfloat r = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F);
+ GLfloat g = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F);
+ GLfloat b = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F);
+ GLfloat a = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F);
+ rgba[i][RCOMP] = rMap[IROUND(r * rscale)];
+ rgba[i][GCOMP] = gMap[IROUND(g * gscale)];
+ rgba[i][BCOMP] = bMap[IROUND(b * bscale)];
+ rgba[i][ACOMP] = aMap[IROUND(a * ascale)];
+ }
+}
+
+
+/*
+ * Apply the color matrix and post color matrix scaling and biasing.
+ */
+void
+_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4])
+{
+ const GLfloat rs = ctx->Pixel.PostColorMatrixScale[0];
+ const GLfloat rb = ctx->Pixel.PostColorMatrixBias[0];
+ const GLfloat gs = ctx->Pixel.PostColorMatrixScale[1];
+ const GLfloat gb = ctx->Pixel.PostColorMatrixBias[1];
+ const GLfloat bs = ctx->Pixel.PostColorMatrixScale[2];
+ const GLfloat bb = ctx->Pixel.PostColorMatrixBias[2];
+ const GLfloat as = ctx->Pixel.PostColorMatrixScale[3];
+ const GLfloat ab = ctx->Pixel.PostColorMatrixBias[3];
+ const GLfloat *m = ctx->ColorMatrixStack.Top->m;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ const GLfloat r = rgba[i][RCOMP];
+ const GLfloat g = rgba[i][GCOMP];
+ const GLfloat b = rgba[i][BCOMP];
+ const GLfloat a = rgba[i][ACOMP];
+ rgba[i][RCOMP] = (m[0] * r + m[4] * g + m[ 8] * b + m[12] * a) * rs + rb;
+ rgba[i][GCOMP] = (m[1] * r + m[5] * g + m[ 9] * b + m[13] * a) * gs + gb;
+ rgba[i][BCOMP] = (m[2] * r + m[6] * g + m[10] * b + m[14] * a) * bs + bb;
+ rgba[i][ACOMP] = (m[3] * r + m[7] * g + m[11] * b + m[15] * a) * as + ab;
+ }
+}
+
+
+/**
+ * Apply a color table lookup to an array of floating point RGBA colors.
+ */
+void
+_mesa_lookup_rgba_float(const struct gl_color_table *table,
+ GLuint n, GLfloat rgba[][4])
+{
+ const GLint max = table->Size - 1;
+ const GLfloat scale = (GLfloat) max;
+ const GLfloat *lut = table->TableF;
+ GLuint i;
+
+ if (!table->TableF || table->Size == 0)
+ return;
+
+ switch (table->_BaseFormat) {
+ case GL_INTENSITY:
+ /* replace RGBA with I */
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND(rgba[i][RCOMP] * scale);
+ GLfloat c = lut[CLAMP(j, 0, max)];
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] =
+ rgba[i][ACOMP] = c;
+ }
+ break;
+ case GL_LUMINANCE:
+ /* replace RGB with L */
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND(rgba[i][RCOMP] * scale);
+ GLfloat c = lut[CLAMP(j, 0, max)];
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] = c;
+ }
+ break;
+ case GL_ALPHA:
+ /* replace A with A */
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND(rgba[i][ACOMP] * scale);
+ rgba[i][ACOMP] = lut[CLAMP(j, 0, max)];
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ /* replace RGBA with LLLA */
+ for (i = 0; i < n; i++) {
+ GLint jL = IROUND(rgba[i][RCOMP] * scale);
+ GLint jA = IROUND(rgba[i][ACOMP] * scale);
+ GLfloat luminance, alpha;
+ jL = CLAMP(jL, 0, max);
+ jA = CLAMP(jA, 0, max);
+ luminance = lut[jL * 2 + 0];
+ alpha = lut[jA * 2 + 1];
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] = luminance;
+ rgba[i][ACOMP] = alpha;;
+ }
+ break;
+ case GL_RGB:
+ /* replace RGB with RGB */
+ for (i = 0; i < n; i++) {
+ GLint jR = IROUND(rgba[i][RCOMP] * scale);
+ GLint jG = IROUND(rgba[i][GCOMP] * scale);
+ GLint jB = IROUND(rgba[i][BCOMP] * scale);
+ jR = CLAMP(jR, 0, max);
+ jG = CLAMP(jG, 0, max);
+ jB = CLAMP(jB, 0, max);
+ rgba[i][RCOMP] = lut[jR * 3 + 0];
+ rgba[i][GCOMP] = lut[jG * 3 + 1];
+ rgba[i][BCOMP] = lut[jB * 3 + 2];
+ }
+ break;
+ case GL_RGBA:
+ /* replace RGBA with RGBA */
+ for (i = 0; i < n; i++) {
+ GLint jR = IROUND(rgba[i][RCOMP] * scale);
+ GLint jG = IROUND(rgba[i][GCOMP] * scale);
+ GLint jB = IROUND(rgba[i][BCOMP] * scale);
+ GLint jA = IROUND(rgba[i][ACOMP] * scale);
+ jR = CLAMP(jR, 0, max);
+ jG = CLAMP(jG, 0, max);
+ jB = CLAMP(jB, 0, max);
+ jA = CLAMP(jA, 0, max);
+ rgba[i][RCOMP] = lut[jR * 4 + 0];
+ rgba[i][GCOMP] = lut[jG * 4 + 1];
+ rgba[i][BCOMP] = lut[jB * 4 + 2];
+ rgba[i][ACOMP] = lut[jA * 4 + 3];
+ }
+ break;
+ default:
+ _mesa_problem(NULL, "Bad format in _mesa_lookup_rgba_float");
+ return;
+ }
+}
+
+
+
+/**
+ * Apply a color table lookup to an array of ubyte/RGBA colors.
+ */
+void
+_mesa_lookup_rgba_ubyte(const struct gl_color_table *table,
+ GLuint n, GLubyte rgba[][4])
+{
+ const GLubyte *lut = table->TableUB;
+ const GLfloat scale = (GLfloat) (table->Size - 1) / (GLfloat)255.0;
+ GLuint i;
+
+ if (!table->TableUB || table->Size == 0)
+ return;
+
+ switch (table->_BaseFormat) {
+ case GL_INTENSITY:
+ /* replace RGBA with I */
+ if (table->Size == 256) {
+ for (i = 0; i < n; i++) {
+ const GLubyte c = lut[rgba[i][RCOMP]];
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] =
+ rgba[i][ACOMP] = c;
+ }
+ }
+ else {
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale);
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] =
+ rgba[i][ACOMP] = lut[j];
+ }
+ }
+ break;
+ case GL_LUMINANCE:
+ /* replace RGB with L */
+ if (table->Size == 256) {
+ for (i = 0; i < n; i++) {
+ const GLubyte c = lut[rgba[i][RCOMP]];
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] = c;
+ }
+ }
+ else {
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale);
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] = lut[j];
+ }
+ }
+ break;
+ case GL_ALPHA:
+ /* replace A with A */
+ if (table->Size == 256) {
+ for (i = 0; i < n; i++) {
+ rgba[i][ACOMP] = lut[rgba[i][ACOMP]];
+ }
+ }
+ else {
+ for (i = 0; i < n; i++) {
+ GLint j = IROUND((GLfloat) rgba[i][ACOMP] * scale);
+ rgba[i][ACOMP] = lut[j];
+ }
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ /* replace RGBA with LLLA */
+ if (table->Size == 256) {
+ for (i = 0; i < n; i++) {
+ GLubyte l = lut[rgba[i][RCOMP] * 2 + 0];
+ GLubyte a = lut[rgba[i][ACOMP] * 2 + 1];;
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] = l;
+ rgba[i][ACOMP] = a;
+ }
+ }
+ else {
+ for (i = 0; i < n; i++) {
+ GLint jL = IROUND((GLfloat) rgba[i][RCOMP] * scale);
+ GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale);
+ GLubyte luminance = lut[jL * 2 + 0];
+ GLubyte alpha = lut[jA * 2 + 1];
+ rgba[i][RCOMP] =
+ rgba[i][GCOMP] =
+ rgba[i][BCOMP] = luminance;
+ rgba[i][ACOMP] = alpha;
+ }
+ }
+ break;
+ case GL_RGB:
+ if (table->Size == 256) {
+ for (i = 0; i < n; i++) {
+ rgba[i][RCOMP] = lut[rgba[i][RCOMP] * 3 + 0];
+ rgba[i][GCOMP] = lut[rgba[i][GCOMP] * 3 + 1];
+ rgba[i][BCOMP] = lut[rgba[i][BCOMP] * 3 + 2];
+ }
+ }
+ else {
+ for (i = 0; i < n; i++) {
+ GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale);
+ GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale);
+ GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale);
+ rgba[i][RCOMP] = lut[jR * 3 + 0];
+ rgba[i][GCOMP] = lut[jG * 3 + 1];
+ rgba[i][BCOMP] = lut[jB * 3 + 2];
+ }
+ }
+ break;
+ case GL_RGBA:
+ if (table->Size == 256) {
+ for (i = 0; i < n; i++) {
+ rgba[i][RCOMP] = lut[rgba[i][RCOMP] * 4 + 0];
+ rgba[i][GCOMP] = lut[rgba[i][GCOMP] * 4 + 1];
+ rgba[i][BCOMP] = lut[rgba[i][BCOMP] * 4 + 2];
+ rgba[i][ACOMP] = lut[rgba[i][ACOMP] * 4 + 3];
+ }
+ }
+ else {
+ for (i = 0; i < n; i++) {
+ GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale);
+ GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale);
+ GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale);
+ GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], lut[jR * 4 + 0]);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], lut[jG * 4 + 1]);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], lut[jB * 4 + 2]);
+ CLAMPED_FLOAT_TO_CHAN(rgba[i][ACOMP], lut[jA * 4 + 3]);
+ }
+ }
+ break;
+ default:
+ _mesa_problem(NULL, "Bad format in _mesa_lookup_rgba_chan");
+ return;
+ }
+}
+
+
+
+/*
+ * Map color indexes to float rgba values.
+ */
+void
+_mesa_map_ci_to_rgba( const GLcontext *ctx, GLuint n,
+ const GLuint index[], GLfloat rgba[][4] )
+{
+ GLuint rmask = ctx->PixelMaps.ItoR.Size - 1;
+ GLuint gmask = ctx->PixelMaps.ItoG.Size - 1;
+ GLuint bmask = ctx->PixelMaps.ItoB.Size - 1;
+ GLuint amask = ctx->PixelMaps.ItoA.Size - 1;
+ const GLfloat *rMap = ctx->PixelMaps.ItoR.Map;
+ const GLfloat *gMap = ctx->PixelMaps.ItoG.Map;
+ const GLfloat *bMap = ctx->PixelMaps.ItoB.Map;
+ const GLfloat *aMap = ctx->PixelMaps.ItoA.Map;
+ GLuint i;
+ for (i=0;i<n;i++) {
+ rgba[i][RCOMP] = rMap[index[i] & rmask];
+ rgba[i][GCOMP] = gMap[index[i] & gmask];
+ rgba[i][BCOMP] = bMap[index[i] & bmask];
+ rgba[i][ACOMP] = aMap[index[i] & amask];
+ }
+}
+
+
+/**
+ * Map ubyte color indexes to ubyte/RGBA values.
+ */
+void
+_mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[],
+ GLubyte rgba[][4])
+{
+ GLuint rmask = ctx->PixelMaps.ItoR.Size - 1;
+ GLuint gmask = ctx->PixelMaps.ItoG.Size - 1;
+ GLuint bmask = ctx->PixelMaps.ItoB.Size - 1;
+ GLuint amask = ctx->PixelMaps.ItoA.Size - 1;
+ const GLubyte *rMap = ctx->PixelMaps.ItoR.Map8;
+ const GLubyte *gMap = ctx->PixelMaps.ItoG.Map8;
+ const GLubyte *bMap = ctx->PixelMaps.ItoB.Map8;
+ const GLubyte *aMap = ctx->PixelMaps.ItoA.Map8;
+ GLuint i;
+ for (i=0;i<n;i++) {
+ rgba[i][RCOMP] = rMap[index[i] & rmask];
+ rgba[i][GCOMP] = gMap[index[i] & gmask];
+ rgba[i][BCOMP] = bMap[index[i] & bmask];
+ rgba[i][ACOMP] = aMap[index[i] & amask];
+ }
+}
+
+
+void
+_mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n,
+ GLfloat depthValues[])
+{
+ const GLfloat scale = ctx->Pixel.DepthScale;
+ const GLfloat bias = ctx->Pixel.DepthBias;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLfloat d = depthValues[i] * scale + bias;
+ depthValues[i] = CLAMP(d, 0.0F, 1.0F);
+ }
+}
+
+
+void
+_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n,
+ GLuint depthValues[])
+{
+ const GLdouble max = (double) 0xffffffff;
+ const GLdouble scale = ctx->Pixel.DepthScale;
+ const GLdouble bias = ctx->Pixel.DepthBias * max;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLdouble d = (GLdouble) depthValues[i] * scale + bias;
+ d = CLAMP(d, 0.0, max);
+ depthValues[i] = (GLuint) d;
+ }
+}
+
+
+
+/*
+ * Update the min/max values from an array of fragment colors.
+ */
+static void
+update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4])
+{
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ /* update mins */
+ if (rgba[i][RCOMP] < ctx->MinMax.Min[RCOMP])
+ ctx->MinMax.Min[RCOMP] = rgba[i][RCOMP];
+ if (rgba[i][GCOMP] < ctx->MinMax.Min[GCOMP])
+ ctx->MinMax.Min[GCOMP] = rgba[i][GCOMP];
+ if (rgba[i][BCOMP] < ctx->MinMax.Min[BCOMP])
+ ctx->MinMax.Min[BCOMP] = rgba[i][BCOMP];
+ if (rgba[i][ACOMP] < ctx->MinMax.Min[ACOMP])
+ ctx->MinMax.Min[ACOMP] = rgba[i][ACOMP];
+
+ /* update maxs */
+ if (rgba[i][RCOMP] > ctx->MinMax.Max[RCOMP])
+ ctx->MinMax.Max[RCOMP] = rgba[i][RCOMP];
+ if (rgba[i][GCOMP] > ctx->MinMax.Max[GCOMP])
+ ctx->MinMax.Max[GCOMP] = rgba[i][GCOMP];
+ if (rgba[i][BCOMP] > ctx->MinMax.Max[BCOMP])
+ ctx->MinMax.Max[BCOMP] = rgba[i][BCOMP];
+ if (rgba[i][ACOMP] > ctx->MinMax.Max[ACOMP])
+ ctx->MinMax.Max[ACOMP] = rgba[i][ACOMP];
+ }
+}
+
+
+/*
+ * Update the histogram values from an array of fragment colors.
+ */
+static void
+update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4])
+{
+ const GLint max = ctx->Histogram.Width - 1;
+ GLfloat w = (GLfloat) max;
+ GLuint i;
+
+ if (ctx->Histogram.Width == 0)
+ return;
+
+ for (i = 0; i < n; i++) {
+ GLint ri = IROUND(rgba[i][RCOMP] * w);
+ GLint gi = IROUND(rgba[i][GCOMP] * w);
+ GLint bi = IROUND(rgba[i][BCOMP] * w);
+ GLint ai = IROUND(rgba[i][ACOMP] * w);
+ ri = CLAMP(ri, 0, max);
+ gi = CLAMP(gi, 0, max);
+ bi = CLAMP(bi, 0, max);
+ ai = CLAMP(ai, 0, max);
+ ctx->Histogram.Count[ri][RCOMP]++;
+ ctx->Histogram.Count[gi][GCOMP]++;
+ ctx->Histogram.Count[bi][BCOMP]++;
+ ctx->Histogram.Count[ai][ACOMP]++;
+ }
+}
+
+
/**
* Apply various pixel transfer operations to an array of RGBA pixels
* as indicated by the transferOps bitmask
@@ -1066,11 +1547,11 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps,
}
/* update histogram count */
if (transferOps & IMAGE_HISTOGRAM_BIT) {
- _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba);
+ update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba);
}
/* update min/max values */
if (transferOps & IMAGE_MIN_MAX_BIT) {
- _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba);
+ update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba);
}
/* clamping to [0,1] */
if (transferOps & IMAGE_CLAMP_BIT) {
@@ -1169,7 +1650,7 @@ _mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n,
GLuint mask = ctx->PixelMaps.StoS.Size - 1;
GLuint i;
for (i = 0; i < n; i++) {
- stencil[i] = ctx->PixelMaps.StoS.Map[ stencil[i] & mask ];
+ stencil[i] = (GLstencil)ctx->PixelMaps.StoS.Map[ stencil[i] & mask ];
}
}
}
@@ -3680,7 +4161,7 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
const GLuint mask = ctx->PixelMaps.StoS.Size - 1;
GLuint i;
for (i = 0; i < n; i++) {
- indexes[i] = ctx->PixelMaps.StoS.Map[ indexes[i] & mask ];
+ indexes[i] = (GLuint)ctx->PixelMaps.StoS.Map[ indexes[i] & mask ];
}
}
@@ -3966,7 +4447,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
DEPTH_VALUES(GLuint, UINT_TO_FLOAT);
break;
case GL_UNSIGNED_INT_24_8_EXT: /* GL_EXT_packed_depth_stencil */
- if (dstType == GL_UNSIGNED_INT &&
+ if (dstType == GL_UNSIGNED_INT_24_8_EXT &&
depthMax == 0xffffff &&
ctx->Pixel.DepthScale == 1.0 &&
ctx->Pixel.DepthBias == 0.0) {
@@ -4035,7 +4516,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
if (needClamp) {
GLuint i;
for (i = 0; i < n; i++) {
- depthValues[i] = CLAMP(depthValues[i], 0.0, 1.0);
+ depthValues[i] = (GLfloat)CLAMP(depthValues[i], 0.0, 1.0);
}
}
diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h
index c379d5fa7d..38e1374c20 100644
--- a/src/mesa/main/image.h
+++ b/src/mesa/main/image.h
@@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 7.1
*
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2008 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"),
@@ -111,6 +111,51 @@ _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
GLubyte *dest, const struct gl_pixelstore_attrib *packing );
+/** \name Pixel processing functions */
+/*@{*/
+
+extern void
+_mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4],
+ GLfloat rScale, GLfloat gScale,
+ GLfloat bScale, GLfloat aScale,
+ GLfloat rBias, GLfloat gBias,
+ GLfloat bBias, GLfloat aBias);
+
+extern void
+_mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
+
+
+extern void
+_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
+
+
+extern void
+_mesa_lookup_rgba_float(const struct gl_color_table *table,
+ GLuint n, GLfloat rgba[][4]);
+
+extern void
+_mesa_lookup_rgba_ubyte(const struct gl_color_table *table,
+ GLuint n, GLubyte rgba[][4]);
+
+
+extern void
+_mesa_map_ci_to_rgba(const GLcontext *ctx,
+ GLuint n, const GLuint index[], GLfloat rgba[][4]);
+
+
+extern void
+_mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[],
+ GLubyte rgba[][4]);
+
+
+extern void
+_mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n,
+ GLfloat depthValues[]);
+
+extern void
+_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n,
+ GLuint depthValues[]);
+
extern void
_mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps,
GLuint n, GLfloat rgba[][4]);
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 6e057614ba..f37d1f216f 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1119,7 +1119,7 @@ compute_light_positions( GLcontext *ctx )
}
else {
/* positional light w/ homogeneous coordinate, divide by W */
- GLfloat wInv = 1.0 / light->_Position[3];
+ GLfloat wInv = (GLfloat)1.0 / light->_Position[3];
light->_Position[0] *= wInv;
light->_Position[1] *= wInv;
light->_Position[2] *= wInv;
@@ -1357,6 +1357,7 @@ _mesa_init_lighting( GLcontext *ctx )
/* Miscellaneous */
ctx->Light._NeedEyeCoords = GL_FALSE;
ctx->_NeedEyeCoords = GL_FALSE;
+ ctx->_ForceEyeCoords = GL_FALSE;
ctx->_ModelViewInvScale = 1.0;
}
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index fbbcd4e269..2630855a0e 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -657,4 +657,11 @@ do { \
#define LEN_SQUARED_2FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1])
+/** casts to silence warnings with some compilers */
+#define ENUM_TO_INT(E) ((GLint)(E))
+#define ENUM_TO_FLOAT(E) ((GLfloat)(GLint)(E))
+#define ENUM_TO_DOUBLE(E) ((GLdouble)(GLint)(E))
+#define ENUM_TO_BOOLEAN(E) ((E) ? GL_TRUE : GL_FALSE)
+
+
#endif
diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h
new file mode 100644
index 0000000000..a305bbd605
--- /dev/null
+++ b/src/mesa/main/mfeatures.h
@@ -0,0 +1,80 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file mfeatures.h
+ * Flags to enable/disable specific parts of the API.
+ */
+
+#ifndef FEATURES_H
+#define FEATURES_H
+
+
+#ifndef _HAVE_FULL_GL
+#define _HAVE_FULL_GL 1
+#endif
+
+#define FEATURE_accum _HAVE_FULL_GL
+#define FEATURE_attrib_stack _HAVE_FULL_GL
+#define FEATURE_colortable _HAVE_FULL_GL
+#define FEATURE_convolution _HAVE_FULL_GL
+#define FEATURE_dispatch _HAVE_FULL_GL
+#define FEATURE_dlist _HAVE_FULL_GL
+#define FEATURE_draw_read_buffer _HAVE_FULL_GL
+#define FEATURE_drawpix _HAVE_FULL_GL
+#define FEATURE_evaluators _HAVE_FULL_GL
+#define FEATURE_feedback _HAVE_FULL_GL
+#define FEATURE_fixedpt 0
+#define FEATURE_histogram _HAVE_FULL_GL
+#define FEATURE_pixel_transfer _HAVE_FULL_GL
+#define FEATURE_texgen _HAVE_FULL_GL
+#define FEATURE_texture_fxt1 _HAVE_FULL_GL
+#define FEATURE_texture_s3tc _HAVE_FULL_GL
+#define FEATURE_userclip _HAVE_FULL_GL
+#define FEATURE_vertex_array_byte 0
+
+#define FEATURE_ARB_occlusion_query _HAVE_FULL_GL
+#define FEATURE_ARB_fragment_program _HAVE_FULL_GL
+#define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL
+#define FEATURE_ARB_vertex_program _HAVE_FULL_GL
+#define FEATURE_ARB_vertex_shader _HAVE_FULL_GL
+#define FEATURE_ARB_fragment_shader _HAVE_FULL_GL
+#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader)
+#define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects
+#define FEATURE_ARB_shading_language_120 FEATURE_ARB_shader_objects
+
+#define FEATURE_EXT_framebuffer_blit _HAVE_FULL_GL
+#define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL
+#define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL
+#define FEATURE_EXT_texture_sRGB _HAVE_FULL_GL
+#define FEATURE_EXT_timer_query _HAVE_FULL_GL
+#define FEATURE_ATI_fragment_shader _HAVE_FULL_GL
+#define FEATURE_MESA_program_debug _HAVE_FULL_GL
+#define FEATURE_NV_fence _HAVE_FULL_GL
+#define FEATURE_NV_fragment_program _HAVE_FULL_GL
+#define FEATURE_NV_vertex_program _HAVE_FULL_GL
+
+
+#endif /* FEATURES_H */
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index d3d1958951..061378f3b7 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -292,7 +292,7 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
GLfloat *dst = (GLfloat *) dstRow;
for (i = j = 0, k = k0; i < (GLuint) dstWidth;
i++, j += colStride, k += colStride) {
- dst[i] = rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4;
+ dst[i] = (GLfloat)(rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4);
}
}
diff --git a/src/mesa/main/mm.c b/src/mesa/main/mm.c
index 846c329c70..fb7809ed22 100644
--- a/src/mesa/main/mm.c
+++ b/src/mesa/main/mm.c
@@ -53,7 +53,7 @@ mmDumpMemInfo(const struct mem_block *heap)
}
struct mem_block *
-mmInit(int ofs, int size)
+mmInit(unsigned int ofs, int size)
{
struct mem_block *heap, *block;
@@ -91,7 +91,7 @@ mmInit(int ofs, int size)
static struct mem_block *
SliceBlock(struct mem_block *p,
- int startofs, int size,
+ unsigned int startofs, int size,
int reserved, int alignment)
{
struct mem_block *newblock;
@@ -164,8 +164,8 @@ mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
{
struct mem_block *p;
const int mask = (1 << align2)-1;
- int startofs = 0;
- int endofs;
+ unsigned int startofs = 0;
+ unsigned int endofs;
if (!heap || align2 < 0 || size <= 0)
return NULL;
diff --git a/src/mesa/main/mm.h b/src/mesa/main/mm.h
index 26d59fff13..5ad3ffd6d1 100644
--- a/src/mesa/main/mm.h
+++ b/src/mesa/main/mm.h
@@ -39,7 +39,8 @@ struct mem_block {
struct mem_block *next, *prev;
struct mem_block *next_free, *prev_free;
struct mem_block *heap;
- int ofs,size;
+ unsigned int ofs;
+ int size;
unsigned int free:1;
unsigned int reserved:1;
};
@@ -50,7 +51,7 @@ struct mem_block {
* input: total size in bytes
* return: a heap pointer if OK, NULL if error
*/
-extern struct mem_block *mmInit(int ofs, int size);
+extern struct mem_block *mmInit(unsigned int ofs, int size);
/**
* Allocate 'size' bytes with 2^align2 bytes alignment,
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 463142fe39..8a6c84368a 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -38,8 +38,7 @@
#include "glheader.h"
#include <GL/internal/glcore.h> /* __GLcontextModes (GLvisual) */
#include "config.h" /* Hardwired parameters */
-#include "glapi/glapitable.h"
-#include "glapi/glthread.h"
+#include "glapi/glapi.h"
#include "math/m_matrix.h" /* GLmatrix */
#include "bitset.h"
diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c
new file mode 100644
index 0000000000..e138087436
--- /dev/null
+++ b/src/mesa/main/multisample.c
@@ -0,0 +1,66 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2007 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/multisample.h"
+
+
+/**
+ * Called via glSampleCoverageARB
+ */
+void GLAPIENTRY
+_mesa_SampleCoverageARB(GLclampf value, GLboolean invert)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (!ctx->Extensions.ARB_multisample) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleCoverageARB");
+ return;
+ }
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
+
+ ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0);
+ ctx->Multisample.SampleCoverageInvert = invert;
+ ctx->NewState |= _NEW_MULTISAMPLE;
+}
+
+
+/**
+ * Initialize the context's multisample state.
+ * \param ctx the GL context.
+ */
+void
+_mesa_init_multisample(GLcontext *ctx)
+{
+ ctx->Multisample.Enabled = GL_FALSE;
+ ctx->Multisample.SampleAlphaToCoverage = GL_FALSE;
+ ctx->Multisample.SampleAlphaToOne = GL_FALSE;
+ ctx->Multisample.SampleCoverage = GL_FALSE;
+ ctx->Multisample.SampleCoverageValue = 1.0;
+ ctx->Multisample.SampleCoverageInvert = GL_FALSE;
+}
diff --git a/src/mesa/main/multisample.h b/src/mesa/main/multisample.h
new file mode 100644
index 0000000000..4305900cc4
--- /dev/null
+++ b/src/mesa/main/multisample.h
@@ -0,0 +1,38 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2007 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef MULTISAMPLE_H
+#define MULTISAMPLE_H
+
+
+extern void GLAPIENTRY
+_mesa_SampleCoverageARB(GLclampf value, GLboolean invert);
+
+
+extern void
+_mesa_init_multisample(GLcontext *ctx);
+
+
+#endif
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index 0e9915dd38..c98506b2bb 100644
--- a/src/mesa/main/pixel.c
+++ b/src/mesa/main/pixel.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5.3
+ * Version: 7.1
*
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2008 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"),
@@ -22,6 +22,12 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+
+/**
+ * \file pixel.c
+ * Pixel transfer functions (glPixelZoom, glPixelMap, glPixelTransfer)
+ */
+
#include "glheader.h"
#include "bufferobj.h"
#include "colormac.h"
@@ -36,8 +42,6 @@
/***** glPixelZoom *****/
/**********************************************************************/
-
-
void GLAPIENTRY
_mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor )
{
@@ -55,200 +59,6 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor )
/**********************************************************************/
-/***** glPixelStore *****/
-/**********************************************************************/
-
-
-void GLAPIENTRY
-_mesa_PixelStorei( GLenum pname, GLint param )
-{
- /* NOTE: this call can't be compiled into the display list */
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- switch (pname) {
- case GL_PACK_SWAP_BYTES:
- if (param == (GLint)ctx->Pack.SwapBytes)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE;
- break;
- case GL_PACK_LSB_FIRST:
- if (param == (GLint)ctx->Pack.LsbFirst)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE;
- break;
- case GL_PACK_ROW_LENGTH:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Pack.RowLength == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.RowLength = param;
- break;
- case GL_PACK_IMAGE_HEIGHT:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Pack.ImageHeight == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.ImageHeight = param;
- break;
- case GL_PACK_SKIP_PIXELS:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Pack.SkipPixels == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.SkipPixels = param;
- break;
- case GL_PACK_SKIP_ROWS:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Pack.SkipRows == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.SkipRows = param;
- break;
- case GL_PACK_SKIP_IMAGES:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Pack.SkipImages == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.SkipImages = param;
- break;
- case GL_PACK_ALIGNMENT:
- if (param!=1 && param!=2 && param!=4 && param!=8) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Pack.Alignment == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.Alignment = param;
- break;
- case GL_PACK_INVERT_MESA:
- if (!ctx->Extensions.MESA_pack_invert) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" );
- return;
- }
- if (ctx->Pack.Invert == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Pack.Invert = param;
- break;
-
- case GL_UNPACK_SWAP_BYTES:
- if (param == (GLint)ctx->Unpack.SwapBytes)
- return;
- if ((GLint)ctx->Unpack.SwapBytes == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE;
- break;
- case GL_UNPACK_LSB_FIRST:
- if (param == (GLint)ctx->Unpack.LsbFirst)
- return;
- if ((GLint)ctx->Unpack.LsbFirst == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE;
- break;
- case GL_UNPACK_ROW_LENGTH:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Unpack.RowLength == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.RowLength = param;
- break;
- case GL_UNPACK_IMAGE_HEIGHT:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Unpack.ImageHeight == param)
- return;
-
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.ImageHeight = param;
- break;
- case GL_UNPACK_SKIP_PIXELS:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Unpack.SkipPixels == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.SkipPixels = param;
- break;
- case GL_UNPACK_SKIP_ROWS:
- if (param<0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Unpack.SkipRows == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.SkipRows = param;
- break;
- case GL_UNPACK_SKIP_IMAGES:
- if (param < 0) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
- return;
- }
- if (ctx->Unpack.SkipImages == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.SkipImages = param;
- break;
- case GL_UNPACK_ALIGNMENT:
- if (param!=1 && param!=2 && param!=4 && param!=8) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore" );
- return;
- }
- if (ctx->Unpack.Alignment == param)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.Alignment = param;
- break;
- case GL_UNPACK_CLIENT_STORAGE_APPLE:
- if (param == (GLint)ctx->Unpack.ClientStorage)
- return;
- FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
- ctx->Unpack.ClientStorage = param ? GL_TRUE : GL_FALSE;
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
- return;
- }
-}
-
-
-void GLAPIENTRY
-_mesa_PixelStoref( GLenum pname, GLfloat param )
-{
- _mesa_PixelStorei( pname, (GLint) param );
-}
-
-
-
-/**********************************************************************/
/***** glPixelMap *****/
/**********************************************************************/
@@ -304,7 +114,7 @@ store_pixelmap(GLcontext *ctx, GLenum map, GLsizei mapsize,
/* special case */
ctx->PixelMaps.StoS.Size = mapsize;
for (i = 0; i < mapsize; i++) {
- ctx->PixelMaps.StoS.Map[i] = IROUND(values[i]);
+ ctx->PixelMaps.StoS.Map[i] = (GLfloat)IROUND(values[i]);
}
break;
case GL_PIXEL_MAP_I_TO_I:
@@ -938,426 +748,6 @@ _mesa_PixelTransferi( GLenum pname, GLint param )
/**********************************************************************/
-/***** Pixel processing functions ******/
-/**********************************************************************/
-
-/*
- * Apply scale and bias factors to an array of RGBA pixels.
- */
-void
-_mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4],
- GLfloat rScale, GLfloat gScale,
- GLfloat bScale, GLfloat aScale,
- GLfloat rBias, GLfloat gBias,
- GLfloat bBias, GLfloat aBias)
-{
- if (rScale != 1.0 || rBias != 0.0) {
- GLuint i;
- for (i = 0; i < n; i++) {
- rgba[i][RCOMP] = rgba[i][RCOMP] * rScale + rBias;
- }
- }
- if (gScale != 1.0 || gBias != 0.0) {
- GLuint i;
- for (i = 0; i < n; i++) {
- rgba[i][GCOMP] = rgba[i][GCOMP] * gScale + gBias;
- }
- }
- if (bScale != 1.0 || bBias != 0.0) {
- GLuint i;
- for (i = 0; i < n; i++) {
- rgba[i][BCOMP] = rgba[i][BCOMP] * bScale + bBias;
- }
- }
- if (aScale != 1.0 || aBias != 0.0) {
- GLuint i;
- for (i = 0; i < n; i++) {
- rgba[i][ACOMP] = rgba[i][ACOMP] * aScale + aBias;
- }
- }
-}
-
-
-/*
- * Apply pixel mapping to an array of floating point RGBA pixels.
- */
-void
-_mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] )
-{
- const GLfloat rscale = (GLfloat) (ctx->PixelMaps.RtoR.Size - 1);
- const GLfloat gscale = (GLfloat) (ctx->PixelMaps.GtoG.Size - 1);
- const GLfloat bscale = (GLfloat) (ctx->PixelMaps.BtoB.Size - 1);
- const GLfloat ascale = (GLfloat) (ctx->PixelMaps.AtoA.Size - 1);
- const GLfloat *rMap = ctx->PixelMaps.RtoR.Map;
- const GLfloat *gMap = ctx->PixelMaps.GtoG.Map;
- const GLfloat *bMap = ctx->PixelMaps.BtoB.Map;
- const GLfloat *aMap = ctx->PixelMaps.AtoA.Map;
- GLuint i;
- for (i=0;i<n;i++) {
- GLfloat r = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F);
- GLfloat g = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F);
- GLfloat b = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F);
- GLfloat a = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F);
- rgba[i][RCOMP] = rMap[IROUND(r * rscale)];
- rgba[i][GCOMP] = gMap[IROUND(g * gscale)];
- rgba[i][BCOMP] = bMap[IROUND(b * bscale)];
- rgba[i][ACOMP] = aMap[IROUND(a * ascale)];
- }
-}
-
-
-/*
- * Apply the color matrix and post color matrix scaling and biasing.
- */
-void
-_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4])
-{
- const GLfloat rs = ctx->Pixel.PostColorMatrixScale[0];
- const GLfloat rb = ctx->Pixel.PostColorMatrixBias[0];
- const GLfloat gs = ctx->Pixel.PostColorMatrixScale[1];
- const GLfloat gb = ctx->Pixel.PostColorMatrixBias[1];
- const GLfloat bs = ctx->Pixel.PostColorMatrixScale[2];
- const GLfloat bb = ctx->Pixel.PostColorMatrixBias[2];
- const GLfloat as = ctx->Pixel.PostColorMatrixScale[3];
- const GLfloat ab = ctx->Pixel.PostColorMatrixBias[3];
- const GLfloat *m = ctx->ColorMatrixStack.Top->m;
- GLuint i;
- for (i = 0; i < n; i++) {
- const GLfloat r = rgba[i][RCOMP];
- const GLfloat g = rgba[i][GCOMP];
- const GLfloat b = rgba[i][BCOMP];
- const GLfloat a = rgba[i][ACOMP];
- rgba[i][RCOMP] = (m[0] * r + m[4] * g + m[ 8] * b + m[12] * a) * rs + rb;
- rgba[i][GCOMP] = (m[1] * r + m[5] * g + m[ 9] * b + m[13] * a) * gs + gb;
- rgba[i][BCOMP] = (m[2] * r + m[6] * g + m[10] * b + m[14] * a) * bs + bb;
- rgba[i][ACOMP] = (m[3] * r + m[7] * g + m[11] * b + m[15] * a) * as + ab;
- }
-}
-
-
-/**
- * Apply a color table lookup to an array of floating point RGBA colors.
- */
-void
-_mesa_lookup_rgba_float(const struct gl_color_table *table,
- GLuint n, GLfloat rgba[][4])
-{
- const GLint max = table->Size - 1;
- const GLfloat scale = (GLfloat) max;
- const GLfloat *lut = table->TableF;
- GLuint i;
-
- if (!table->TableF || table->Size == 0)
- return;
-
- switch (table->_BaseFormat) {
- case GL_INTENSITY:
- /* replace RGBA with I */
- for (i = 0; i < n; i++) {
- GLint j = IROUND(rgba[i][RCOMP] * scale);
- GLfloat c = lut[CLAMP(j, 0, max)];
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] =
- rgba[i][ACOMP] = c;
- }
- break;
- case GL_LUMINANCE:
- /* replace RGB with L */
- for (i = 0; i < n; i++) {
- GLint j = IROUND(rgba[i][RCOMP] * scale);
- GLfloat c = lut[CLAMP(j, 0, max)];
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] = c;
- }
- break;
- case GL_ALPHA:
- /* replace A with A */
- for (i = 0; i < n; i++) {
- GLint j = IROUND(rgba[i][ACOMP] * scale);
- rgba[i][ACOMP] = lut[CLAMP(j, 0, max)];
- }
- break;
- case GL_LUMINANCE_ALPHA:
- /* replace RGBA with LLLA */
- for (i = 0; i < n; i++) {
- GLint jL = IROUND(rgba[i][RCOMP] * scale);
- GLint jA = IROUND(rgba[i][ACOMP] * scale);
- GLfloat luminance, alpha;
- jL = CLAMP(jL, 0, max);
- jA = CLAMP(jA, 0, max);
- luminance = lut[jL * 2 + 0];
- alpha = lut[jA * 2 + 1];
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] = luminance;
- rgba[i][ACOMP] = alpha;;
- }
- break;
- case GL_RGB:
- /* replace RGB with RGB */
- for (i = 0; i < n; i++) {
- GLint jR = IROUND(rgba[i][RCOMP] * scale);
- GLint jG = IROUND(rgba[i][GCOMP] * scale);
- GLint jB = IROUND(rgba[i][BCOMP] * scale);
- jR = CLAMP(jR, 0, max);
- jG = CLAMP(jG, 0, max);
- jB = CLAMP(jB, 0, max);
- rgba[i][RCOMP] = lut[jR * 3 + 0];
- rgba[i][GCOMP] = lut[jG * 3 + 1];
- rgba[i][BCOMP] = lut[jB * 3 + 2];
- }
- break;
- case GL_RGBA:
- /* replace RGBA with RGBA */
- for (i = 0; i < n; i++) {
- GLint jR = IROUND(rgba[i][RCOMP] * scale);
- GLint jG = IROUND(rgba[i][GCOMP] * scale);
- GLint jB = IROUND(rgba[i][BCOMP] * scale);
- GLint jA = IROUND(rgba[i][ACOMP] * scale);
- jR = CLAMP(jR, 0, max);
- jG = CLAMP(jG, 0, max);
- jB = CLAMP(jB, 0, max);
- jA = CLAMP(jA, 0, max);
- rgba[i][RCOMP] = lut[jR * 4 + 0];
- rgba[i][GCOMP] = lut[jG * 4 + 1];
- rgba[i][BCOMP] = lut[jB * 4 + 2];
- rgba[i][ACOMP] = lut[jA * 4 + 3];
- }
- break;
- default:
- _mesa_problem(NULL, "Bad format in _mesa_lookup_rgba_float");
- return;
- }
-}
-
-
-
-/**
- * Apply a color table lookup to an array of ubyte/RGBA colors.
- */
-void
-_mesa_lookup_rgba_ubyte(const struct gl_color_table *table,
- GLuint n, GLubyte rgba[][4])
-{
- const GLubyte *lut = table->TableUB;
- const GLfloat scale = (GLfloat) (table->Size - 1) / 255.0;
- GLuint i;
-
- if (!table->TableUB || table->Size == 0)
- return;
-
- switch (table->_BaseFormat) {
- case GL_INTENSITY:
- /* replace RGBA with I */
- if (table->Size == 256) {
- for (i = 0; i < n; i++) {
- const GLubyte c = lut[rgba[i][RCOMP]];
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] =
- rgba[i][ACOMP] = c;
- }
- }
- else {
- for (i = 0; i < n; i++) {
- GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale);
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] =
- rgba[i][ACOMP] = lut[j];
- }
- }
- break;
- case GL_LUMINANCE:
- /* replace RGB with L */
- if (table->Size == 256) {
- for (i = 0; i < n; i++) {
- const GLubyte c = lut[rgba[i][RCOMP]];
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] = c;
- }
- }
- else {
- for (i = 0; i < n; i++) {
- GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale);
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] = lut[j];
- }
- }
- break;
- case GL_ALPHA:
- /* replace A with A */
- if (table->Size == 256) {
- for (i = 0; i < n; i++) {
- rgba[i][ACOMP] = lut[rgba[i][ACOMP]];
- }
- }
- else {
- for (i = 0; i < n; i++) {
- GLint j = IROUND((GLfloat) rgba[i][ACOMP] * scale);
- rgba[i][ACOMP] = lut[j];
- }
- }
- break;
- case GL_LUMINANCE_ALPHA:
- /* replace RGBA with LLLA */
- if (table->Size == 256) {
- for (i = 0; i < n; i++) {
- GLubyte l = lut[rgba[i][RCOMP] * 2 + 0];
- GLubyte a = lut[rgba[i][ACOMP] * 2 + 1];;
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] = l;
- rgba[i][ACOMP] = a;
- }
- }
- else {
- for (i = 0; i < n; i++) {
- GLint jL = IROUND((GLfloat) rgba[i][RCOMP] * scale);
- GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale);
- GLubyte luminance = lut[jL * 2 + 0];
- GLubyte alpha = lut[jA * 2 + 1];
- rgba[i][RCOMP] =
- rgba[i][GCOMP] =
- rgba[i][BCOMP] = luminance;
- rgba[i][ACOMP] = alpha;
- }
- }
- break;
- case GL_RGB:
- if (table->Size == 256) {
- for (i = 0; i < n; i++) {
- rgba[i][RCOMP] = lut[rgba[i][RCOMP] * 3 + 0];
- rgba[i][GCOMP] = lut[rgba[i][GCOMP] * 3 + 1];
- rgba[i][BCOMP] = lut[rgba[i][BCOMP] * 3 + 2];
- }
- }
- else {
- for (i = 0; i < n; i++) {
- GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale);
- GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale);
- GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale);
- rgba[i][RCOMP] = lut[jR * 3 + 0];
- rgba[i][GCOMP] = lut[jG * 3 + 1];
- rgba[i][BCOMP] = lut[jB * 3 + 2];
- }
- }
- break;
- case GL_RGBA:
- if (table->Size == 256) {
- for (i = 0; i < n; i++) {
- rgba[i][RCOMP] = lut[rgba[i][RCOMP] * 4 + 0];
- rgba[i][GCOMP] = lut[rgba[i][GCOMP] * 4 + 1];
- rgba[i][BCOMP] = lut[rgba[i][BCOMP] * 4 + 2];
- rgba[i][ACOMP] = lut[rgba[i][ACOMP] * 4 + 3];
- }
- }
- else {
- for (i = 0; i < n; i++) {
- GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale);
- GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale);
- GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale);
- GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale);
- CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], lut[jR * 4 + 0]);
- CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], lut[jG * 4 + 1]);
- CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], lut[jB * 4 + 2]);
- CLAMPED_FLOAT_TO_CHAN(rgba[i][ACOMP], lut[jA * 4 + 3]);
- }
- }
- break;
- default:
- _mesa_problem(NULL, "Bad format in _mesa_lookup_rgba_chan");
- return;
- }
-}
-
-
-
-/*
- * Map color indexes to float rgba values.
- */
-void
-_mesa_map_ci_to_rgba( const GLcontext *ctx, GLuint n,
- const GLuint index[], GLfloat rgba[][4] )
-{
- GLuint rmask = ctx->PixelMaps.ItoR.Size - 1;
- GLuint gmask = ctx->PixelMaps.ItoG.Size - 1;
- GLuint bmask = ctx->PixelMaps.ItoB.Size - 1;
- GLuint amask = ctx->PixelMaps.ItoA.Size - 1;
- const GLfloat *rMap = ctx->PixelMaps.ItoR.Map;
- const GLfloat *gMap = ctx->PixelMaps.ItoG.Map;
- const GLfloat *bMap = ctx->PixelMaps.ItoB.Map;
- const GLfloat *aMap = ctx->PixelMaps.ItoA.Map;
- GLuint i;
- for (i=0;i<n;i++) {
- rgba[i][RCOMP] = rMap[index[i] & rmask];
- rgba[i][GCOMP] = gMap[index[i] & gmask];
- rgba[i][BCOMP] = bMap[index[i] & bmask];
- rgba[i][ACOMP] = aMap[index[i] & amask];
- }
-}
-
-
-/**
- * Map ubyte color indexes to ubyte/RGBA values.
- */
-void
-_mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[],
- GLubyte rgba[][4])
-{
- GLuint rmask = ctx->PixelMaps.ItoR.Size - 1;
- GLuint gmask = ctx->PixelMaps.ItoG.Size - 1;
- GLuint bmask = ctx->PixelMaps.ItoB.Size - 1;
- GLuint amask = ctx->PixelMaps.ItoA.Size - 1;
- const GLubyte *rMap = ctx->PixelMaps.ItoR.Map8;
- const GLubyte *gMap = ctx->PixelMaps.ItoG.Map8;
- const GLubyte *bMap = ctx->PixelMaps.ItoB.Map8;
- const GLubyte *aMap = ctx->PixelMaps.ItoA.Map8;
- GLuint i;
- for (i=0;i<n;i++) {
- rgba[i][RCOMP] = rMap[index[i] & rmask];
- rgba[i][GCOMP] = gMap[index[i] & gmask];
- rgba[i][BCOMP] = bMap[index[i] & bmask];
- rgba[i][ACOMP] = aMap[index[i] & amask];
- }
-}
-
-
-void
-_mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n,
- GLfloat depthValues[])
-{
- const GLfloat scale = ctx->Pixel.DepthScale;
- const GLfloat bias = ctx->Pixel.DepthBias;
- GLuint i;
- for (i = 0; i < n; i++) {
- GLfloat d = depthValues[i] * scale + bias;
- depthValues[i] = CLAMP(d, 0.0F, 1.0F);
- }
-}
-
-
-void
-_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n,
- GLuint depthValues[])
-{
- const GLdouble max = (double) 0xffffffff;
- const GLdouble scale = ctx->Pixel.DepthScale;
- const GLdouble bias = ctx->Pixel.DepthBias * max;
- GLuint i;
- for (i = 0; i < n; i++) {
- GLdouble d = (GLdouble) depthValues[i] * scale + bias;
- d = CLAMP(d, 0.0, max);
- depthValues[i] = (GLuint) d;
- }
-}
-
-
-/**********************************************************************/
/***** State Management *****/
/**********************************************************************/
@@ -1428,6 +818,9 @@ update_image_transfer_state(GLcontext *ctx)
}
+/**
+ * Update meas pixel transfer derived state.
+ */
void _mesa_update_pixel( GLcontext *ctx, GLuint new_state )
{
if (new_state & _NEW_COLOR_MATRIX)
@@ -1517,54 +910,6 @@ _mesa_init_pixel( GLcontext *ctx )
ASSIGN_4V(ctx->Pixel.TextureColorTableScale, 1.0, 1.0, 1.0, 1.0);
ASSIGN_4V(ctx->Pixel.TextureColorTableBias, 0.0, 0.0, 0.0, 0.0);
- /* Pixel transfer */
- ctx->Pack.Alignment = 4;
- ctx->Pack.RowLength = 0;
- ctx->Pack.ImageHeight = 0;
- ctx->Pack.SkipPixels = 0;
- ctx->Pack.SkipRows = 0;
- ctx->Pack.SkipImages = 0;
- ctx->Pack.SwapBytes = GL_FALSE;
- ctx->Pack.LsbFirst = GL_FALSE;
- ctx->Pack.ClientStorage = GL_FALSE;
- ctx->Pack.Invert = GL_FALSE;
-#if FEATURE_EXT_pixel_buffer_object
- ctx->Pack.BufferObj = ctx->Array.NullBufferObj;
-#endif
- ctx->Unpack.Alignment = 4;
- ctx->Unpack.RowLength = 0;
- ctx->Unpack.ImageHeight = 0;
- ctx->Unpack.SkipPixels = 0;
- ctx->Unpack.SkipRows = 0;
- ctx->Unpack.SkipImages = 0;
- ctx->Unpack.SwapBytes = GL_FALSE;
- ctx->Unpack.LsbFirst = GL_FALSE;
- ctx->Unpack.ClientStorage = GL_FALSE;
- ctx->Unpack.Invert = GL_FALSE;
-#if FEATURE_EXT_pixel_buffer_object
- ctx->Unpack.BufferObj = ctx->Array.NullBufferObj;
-#endif
-
- /*
- * _mesa_unpack_image() returns image data in this format. When we
- * execute image commands (glDrawPixels(), glTexImage(), etc) from
- * within display lists we have to be sure to set the current
- * unpacking parameters to these values!
- */
- ctx->DefaultPacking.Alignment = 1;
- ctx->DefaultPacking.RowLength = 0;
- ctx->DefaultPacking.SkipPixels = 0;
- ctx->DefaultPacking.SkipRows = 0;
- ctx->DefaultPacking.ImageHeight = 0;
- ctx->DefaultPacking.SkipImages = 0;
- ctx->DefaultPacking.SwapBytes = GL_FALSE;
- ctx->DefaultPacking.LsbFirst = GL_FALSE;
- ctx->DefaultPacking.ClientStorage = GL_FALSE;
- ctx->DefaultPacking.Invert = GL_FALSE;
-#if FEATURE_EXT_pixel_buffer_object
- ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj;
-#endif
-
if (ctx->Visual.doubleBufferMode) {
ctx->Pixel.ReadBuffer = GL_BACK;
}
diff --git a/src/mesa/main/pixel.h b/src/mesa/main/pixel.h
index 3ba5b6689a..cb6c5262a3 100644
--- a/src/mesa/main/pixel.h
+++ b/src/mesa/main/pixel.h
@@ -1,13 +1,8 @@
-/**
- * \file pixel.h
- * Pixel operations.
- */
-
/*
* Mesa 3-D graphics library
- * Version: 6.5.2
+ * Version: 7.1
*
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2008 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"),
@@ -28,6 +23,12 @@
*/
+/**
+ * \file pixel.h
+ * Pixel operations.
+ */
+
+
#ifndef PIXEL_H
#define PIXEL_H
@@ -57,13 +58,6 @@ extern void GLAPIENTRY
_mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values );
extern void GLAPIENTRY
-_mesa_PixelStoref( GLenum pname, GLfloat param );
-
-
-extern void GLAPIENTRY
-_mesa_PixelStorei( GLenum pname, GLint param );
-
-extern void GLAPIENTRY
_mesa_PixelTransferf( GLenum pname, GLfloat param );
extern void GLAPIENTRY
@@ -75,51 +69,6 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor );
/*@}*/
-/** \name Pixel processing functions */
-/*@{*/
-
-extern void
-_mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4],
- GLfloat rScale, GLfloat gScale,
- GLfloat bScale, GLfloat aScale,
- GLfloat rBias, GLfloat gBias,
- GLfloat bBias, GLfloat aBias);
-
-extern void
-_mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
-
-
-extern void
-_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
-
-
-extern void
-_mesa_lookup_rgba_float(const struct gl_color_table *table,
- GLuint n, GLfloat rgba[][4]);
-
-extern void
-_mesa_lookup_rgba_ubyte(const struct gl_color_table *table,
- GLuint n, GLubyte rgba[][4]);
-
-
-extern void
-_mesa_map_ci_to_rgba(const GLcontext *ctx,
- GLuint n, const GLuint index[], GLfloat rgba[][4]);
-
-
-extern void
-_mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[],
- GLubyte rgba[][4]);
-
-
-extern void
-_mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n,
- GLfloat depthValues[]);
-
-extern void
-_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n,
- GLuint depthValues[]);
-
extern void
_mesa_update_pixel( GLcontext *ctx, GLuint newstate );
diff --git a/src/mesa/main/pixelstore.c b/src/mesa/main/pixelstore.c
new file mode 100644
index 0000000000..ff1a6344cc
--- /dev/null
+++ b/src/mesa/main/pixelstore.c
@@ -0,0 +1,283 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file pixelstore.c
+ * glPixelStore functions.
+ */
+
+
+#include "glheader.h"
+#include "bufferobj.h"
+#include "colormac.h"
+#include "context.h"
+#include "image.h"
+#include "macros.h"
+#include "pixelstore.h"
+#include "mtypes.h"
+
+
+void GLAPIENTRY
+_mesa_PixelStorei( GLenum pname, GLint param )
+{
+ /* NOTE: this call can't be compiled into the display list */
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ switch (pname) {
+ case GL_PACK_SWAP_BYTES:
+ if (param == (GLint)ctx->Pack.SwapBytes)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_PACK_LSB_FIRST:
+ if (param == (GLint)ctx->Pack.LsbFirst)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_PACK_ROW_LENGTH:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Pack.RowLength == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.RowLength = param;
+ break;
+ case GL_PACK_IMAGE_HEIGHT:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Pack.ImageHeight == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.ImageHeight = param;
+ break;
+ case GL_PACK_SKIP_PIXELS:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Pack.SkipPixels == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.SkipPixels = param;
+ break;
+ case GL_PACK_SKIP_ROWS:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Pack.SkipRows == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.SkipRows = param;
+ break;
+ case GL_PACK_SKIP_IMAGES:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Pack.SkipImages == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.SkipImages = param;
+ break;
+ case GL_PACK_ALIGNMENT:
+ if (param!=1 && param!=2 && param!=4 && param!=8) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Pack.Alignment == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.Alignment = param;
+ break;
+ case GL_PACK_INVERT_MESA:
+ if (!ctx->Extensions.MESA_pack_invert) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" );
+ return;
+ }
+ if (ctx->Pack.Invert == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Pack.Invert = param;
+ break;
+
+ case GL_UNPACK_SWAP_BYTES:
+ if (param == (GLint)ctx->Unpack.SwapBytes)
+ return;
+ if ((GLint)ctx->Unpack.SwapBytes == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_UNPACK_LSB_FIRST:
+ if (param == (GLint)ctx->Unpack.LsbFirst)
+ return;
+ if ((GLint)ctx->Unpack.LsbFirst == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_UNPACK_ROW_LENGTH:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Unpack.RowLength == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.RowLength = param;
+ break;
+ case GL_UNPACK_IMAGE_HEIGHT:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Unpack.ImageHeight == param)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.ImageHeight = param;
+ break;
+ case GL_UNPACK_SKIP_PIXELS:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Unpack.SkipPixels == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.SkipPixels = param;
+ break;
+ case GL_UNPACK_SKIP_ROWS:
+ if (param<0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Unpack.SkipRows == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.SkipRows = param;
+ break;
+ case GL_UNPACK_SKIP_IMAGES:
+ if (param < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
+ return;
+ }
+ if (ctx->Unpack.SkipImages == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.SkipImages = param;
+ break;
+ case GL_UNPACK_ALIGNMENT:
+ if (param!=1 && param!=2 && param!=4 && param!=8) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore" );
+ return;
+ }
+ if (ctx->Unpack.Alignment == param)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.Alignment = param;
+ break;
+ case GL_UNPACK_CLIENT_STORAGE_APPLE:
+ if (param == (GLint)ctx->Unpack.ClientStorage)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
+ ctx->Unpack.ClientStorage = param ? GL_TRUE : GL_FALSE;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_PixelStoref( GLenum pname, GLfloat param )
+{
+ _mesa_PixelStorei( pname, (GLint) param );
+}
+
+
+
+/**
+ * Initialize the context's pixel store state.
+ */
+void
+_mesa_init_pixelstore( GLcontext *ctx )
+{
+ /* Pixel transfer */
+ ctx->Pack.Alignment = 4;
+ ctx->Pack.RowLength = 0;
+ ctx->Pack.ImageHeight = 0;
+ ctx->Pack.SkipPixels = 0;
+ ctx->Pack.SkipRows = 0;
+ ctx->Pack.SkipImages = 0;
+ ctx->Pack.SwapBytes = GL_FALSE;
+ ctx->Pack.LsbFirst = GL_FALSE;
+ ctx->Pack.ClientStorage = GL_FALSE;
+ ctx->Pack.Invert = GL_FALSE;
+#if FEATURE_EXT_pixel_buffer_object
+ ctx->Pack.BufferObj = ctx->Array.NullBufferObj;
+#endif
+ ctx->Unpack.Alignment = 4;
+ ctx->Unpack.RowLength = 0;
+ ctx->Unpack.ImageHeight = 0;
+ ctx->Unpack.SkipPixels = 0;
+ ctx->Unpack.SkipRows = 0;
+ ctx->Unpack.SkipImages = 0;
+ ctx->Unpack.SwapBytes = GL_FALSE;
+ ctx->Unpack.LsbFirst = GL_FALSE;
+ ctx->Unpack.ClientStorage = GL_FALSE;
+ ctx->Unpack.Invert = GL_FALSE;
+#if FEATURE_EXT_pixel_buffer_object
+ ctx->Unpack.BufferObj = ctx->Array.NullBufferObj;
+#endif
+
+ /*
+ * _mesa_unpack_image() returns image data in this format. When we
+ * execute image commands (glDrawPixels(), glTexImage(), etc) from
+ * within display lists we have to be sure to set the current
+ * unpacking parameters to these values!
+ */
+ ctx->DefaultPacking.Alignment = 1;
+ ctx->DefaultPacking.RowLength = 0;
+ ctx->DefaultPacking.SkipPixels = 0;
+ ctx->DefaultPacking.SkipRows = 0;
+ ctx->DefaultPacking.ImageHeight = 0;
+ ctx->DefaultPacking.SkipImages = 0;
+ ctx->DefaultPacking.SwapBytes = GL_FALSE;
+ ctx->DefaultPacking.LsbFirst = GL_FALSE;
+ ctx->DefaultPacking.ClientStorage = GL_FALSE;
+ ctx->DefaultPacking.Invert = GL_FALSE;
+#if FEATURE_EXT_pixel_buffer_object
+ ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj;
+#endif
+}
diff --git a/src/mesa/main/pixelstore.h b/src/mesa/main/pixelstore.h
new file mode 100644
index 0000000000..ee963f9ba3
--- /dev/null
+++ b/src/mesa/main/pixelstore.h
@@ -0,0 +1,50 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file pixelstore.h
+ * glPixelStore functions.
+ */
+
+
+#ifndef PIXELSTORE_H
+#define PIXELSTORE_H
+
+
+#include "glheader.h"
+
+
+extern void GLAPIENTRY
+_mesa_PixelStorei( GLenum pname, GLint param );
+
+
+extern void GLAPIENTRY
+_mesa_PixelStoref( GLenum pname, GLfloat param );
+
+
+extern void
+_mesa_init_pixelstore( GLcontext *ctx );
+
+
+#endif
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index e83db5de78..fbedbcb22c 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -65,45 +65,32 @@ _mesa_PointSize( GLfloat size )
#if _HAVE_FULL_GL
-/*
- * Added by GL_NV_point_sprite
- */
+
void GLAPIENTRY
-_mesa_PointParameteriNV( GLenum pname, GLint param )
+_mesa_PointParameteri( GLenum pname, GLint param )
{
const GLfloat value = (GLfloat) param;
- _mesa_PointParameterfvEXT(pname, &value);
+ _mesa_PointParameterfv(pname, &value);
}
-/*
- * Added by GL_NV_point_sprite
- */
void GLAPIENTRY
-_mesa_PointParameterivNV( GLenum pname, const GLint *params )
+_mesa_PointParameteriv( GLenum pname, const GLint *params )
{
const GLfloat value = (GLfloat) params[0];
- _mesa_PointParameterfvEXT(pname, &value);
+ _mesa_PointParameterfv(pname, &value);
}
-
-/*
- * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters.
- */
void GLAPIENTRY
-_mesa_PointParameterfEXT( GLenum pname, GLfloat param)
+_mesa_PointParameterf( GLenum pname, GLfloat param)
{
- _mesa_PointParameterfvEXT(pname, &param);
+ _mesa_PointParameterfv(pname, &param);
}
-
-/*
- * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters.
- */
void GLAPIENTRY
-_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
+_mesa_PointParameterfv( GLenum pname, const GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
diff --git a/src/mesa/main/points.h b/src/mesa/main/points.h
index 951ff677db..156641eab9 100644
--- a/src/mesa/main/points.h
+++ b/src/mesa/main/points.h
@@ -39,16 +39,16 @@ extern void GLAPIENTRY
_mesa_PointSize( GLfloat size );
extern void GLAPIENTRY
-_mesa_PointParameteriNV( GLenum pname, GLint param );
+_mesa_PointParameteri( GLenum pname, GLint param );
extern void GLAPIENTRY
-_mesa_PointParameterivNV( GLenum pname, const GLint *params );
+_mesa_PointParameteriv( GLenum pname, const GLint *params );
extern void GLAPIENTRY
-_mesa_PointParameterfEXT( GLenum pname, GLfloat param );
+_mesa_PointParameterf( GLenum pname, GLfloat param );
extern void GLAPIENTRY
-_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params );
+_mesa_PointParameterfv( GLenum pname, const GLfloat *params );
extern void
_mesa_init_point( GLcontext * ctx );
diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index e30f5480da..a1e32e70ba 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -382,7 +382,7 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params)
*params = 0x7fffffff;
}
else {
- *params = q->Result;
+ *params = (GLint)q->Result;
}
break;
case GL_QUERY_RESULT_AVAILABLE_ARB:
@@ -422,7 +422,7 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params)
*params = 0xffffffff;
}
else {
- *params = q->Result;
+ *params = (GLuint)q->Result;
}
break;
case GL_QUERY_RESULT_AVAILABLE_ARB:
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index ee163e0c71..155140f3cc 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -63,7 +63,7 @@ rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
void GLAPIENTRY
_mesa_RasterPos2d(GLdouble x, GLdouble y)
{
- rasterpos(x, y, 0.0F, 1.0F);
+ rasterpos((GLfloat)x, (GLfloat)y, (GLfloat)0.0, (GLfloat)1.0);
}
void GLAPIENTRY
@@ -211,7 +211,7 @@ _mesa_RasterPos4sv(const GLshort *v)
/*** GL_ARB_window_pos / GL_MESA_window_pos ***/
/**********************************************************************/
-#if FEATURE_windowpos
+#if FEATURE_drawpix
/**
* All glWindowPosMESA and glWindowPosARB commands call this function to
* update the current raster position.
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
new file mode 100644
index 0000000000..dc22808e5b
--- /dev/null
+++ b/src/mesa/main/readpix.c
@@ -0,0 +1,191 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glheader.h"
+#include "imports.h"
+#include "bufferobj.h"
+#include "context.h"
+#include "readpix.h"
+#include "framebuffer.h"
+#include "image.h"
+#include "state.h"
+
+
+/**
+ * Do error checking of the format/type parameters to glReadPixels and
+ * glDrawPixels.
+ * \param drawing if GL_TRUE do checking for DrawPixels, else do checking
+ * for ReadPixels.
+ * \return GL_TRUE if error detected, GL_FALSE if no errors
+ */
+GLboolean
+_mesa_error_check_format_type(GLcontext *ctx, GLenum format, GLenum type,
+ GLboolean drawing)
+{
+ const char *readDraw = drawing ? "Draw" : "Read";
+
+ if (ctx->Extensions.EXT_packed_depth_stencil
+ && type == GL_UNSIGNED_INT_24_8_EXT
+ && format != GL_DEPTH_STENCIL_EXT) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "gl%sPixels(format is not GL_DEPTH_STENCIL_EXT)", readDraw);
+ return GL_TRUE;
+ }
+
+ /* basic combinations test */
+ if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "gl%sPixels(format or type)", readDraw);
+ return GL_TRUE;
+ }
+
+ /* additional checks */
+ switch (format) {
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ case GL_RGB:
+ case GL_BGR:
+ case GL_RGBA:
+ case GL_BGRA:
+ case GL_ABGR_EXT:
+ if (drawing && !ctx->Visual.rgbMode) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawPixels(drawing RGB pixels into color index buffer)");
+ return GL_TRUE;
+ }
+ if (!drawing && !_mesa_dest_buffer_exists(ctx, GL_COLOR)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glReadPixels(no color buffer)");
+ return GL_TRUE;
+ }
+ break;
+ case GL_COLOR_INDEX:
+ if (!drawing && ctx->Visual.rgbMode) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glReadPixels(reading color index format from RGB buffer)");
+ return GL_TRUE;
+ }
+ if (!drawing && !_mesa_dest_buffer_exists(ctx, GL_COLOR)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glReadPixels(no color buffer)");
+ return GL_TRUE;
+ }
+ break;
+ case GL_STENCIL_INDEX:
+ if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
+ (!drawing && !_mesa_source_buffer_exists(ctx, format))) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "gl%sPixels(no stencil buffer)", readDraw);
+ return GL_TRUE;
+ }
+ break;
+ case GL_DEPTH_COMPONENT:
+ if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
+ (!drawing && !_mesa_source_buffer_exists(ctx, format))) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "gl%sPixels(no depth buffer)", readDraw);
+ return GL_TRUE;
+ }
+ break;
+ case GL_DEPTH_STENCIL_EXT:
+ if (!ctx->Extensions.EXT_packed_depth_stencil ||
+ type != GL_UNSIGNED_INT_24_8_EXT) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "gl%sPixels(type)", readDraw);
+ return GL_TRUE;
+ }
+ if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
+ (!drawing && !_mesa_source_buffer_exists(ctx, format))) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "gl%sPixels(no depth or stencil buffer)", readDraw);
+ return GL_TRUE;
+ }
+ break;
+ default:
+ /* this should have been caught in _mesa_is_legal_format_type() */
+ _mesa_problem(ctx, "unexpected format in _mesa_%sPixels", readDraw);
+ return GL_TRUE;
+ }
+
+ /* no errors */
+ return GL_FALSE;
+}
+
+
+
+void GLAPIENTRY
+_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLvoid *pixels )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ FLUSH_CURRENT(ctx, 0);
+
+ if (width < 0 || height < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glReadPixels(width=%d height=%d)", width, height );
+ return;
+ }
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+
+ if (_mesa_error_check_format_type(ctx, format, type, GL_FALSE)) {
+ /* found an error */
+ return;
+ }
+
+ if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+ _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
+ "glReadPixels(incomplete framebuffer)" );
+ return;
+ }
+
+ if (!_mesa_source_buffer_exists(ctx, format)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(no readbuffer)");
+ return;
+ }
+
+ if (ctx->Pack.BufferObj->Name) {
+ if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1,
+ format, type, pixels)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glReadPixels(invalid PBO access)");
+ return;
+ }
+
+ if (ctx->Pack.BufferObj->Pointer) {
+ /* buffer is mapped - that's an error */
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)");
+ return;
+ }
+ }
+
+ ctx->Driver.ReadPixels(ctx, x, y, width, height,
+ format, type, &ctx->Pack, pixels);
+}
diff --git a/src/mesa/main/readpix.h b/src/mesa/main/readpix.h
new file mode 100644
index 0000000000..1bf02fb8e4
--- /dev/null
+++ b/src/mesa/main/readpix.h
@@ -0,0 +1,42 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef READPIXELS_H
+#define READPIXELS_H
+
+
+#include "main/mtypes.h"
+
+
+extern GLboolean
+_mesa_error_check_format_type(GLcontext *ctx, GLenum format, GLenum type,
+ GLboolean drawing);
+
+extern void GLAPIENTRY
+_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLvoid *pixels );
+
+
+#endif
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index d576a7a121..3c37d05b40 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -49,8 +49,6 @@
#include "rbadaptors.h"
-#include "state_tracker/st_context.h"
-
/* 32-bit color index format. Not a public format. */
#define COLOR_INDEX32 0x424243
diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c
new file mode 100644
index 0000000000..b5f4cde789
--- /dev/null
+++ b/src/mesa/main/scissor.c
@@ -0,0 +1,99 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2007 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/scissor.h"
+
+
+/**
+ * Called via glScissor
+ */
+void GLAPIENTRY
+_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (width < 0 || height < 0) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" );
+ return;
+ }
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height);
+
+ _mesa_set_scissor(ctx, x, y, width, height);
+}
+
+
+/**
+ * Define the scissor box.
+ *
+ * \param x, y coordinates of the scissor box lower-left corner.
+ * \param width width of the scissor box.
+ * \param height height of the scissor box.
+ *
+ * \sa glScissor().
+ *
+ * Verifies the parameters and updates __GLcontextRec::Scissor. On a
+ * change flushes the vertices and notifies the driver via
+ * the dd_function_table::Scissor callback.
+ */
+void
+_mesa_set_scissor(GLcontext *ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ if (x == ctx->Scissor.X &&
+ y == ctx->Scissor.Y &&
+ width == ctx->Scissor.Width &&
+ height == ctx->Scissor.Height)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_SCISSOR);
+ ctx->Scissor.X = x;
+ ctx->Scissor.Y = y;
+ ctx->Scissor.Width = width;
+ ctx->Scissor.Height = height;
+
+ if (ctx->Driver.Scissor)
+ ctx->Driver.Scissor( ctx, x, y, width, height );
+}
+
+
+/**
+ * Initialize the context's scissor state.
+ * \param ctx the GL context.
+ */
+void
+_mesa_init_scissor(GLcontext *ctx)
+{
+ /* Scissor group */
+ ctx->Scissor.Enabled = GL_FALSE;
+ ctx->Scissor.X = 0;
+ ctx->Scissor.Y = 0;
+ ctx->Scissor.Width = 0;
+ ctx->Scissor.Height = 0;
+}
diff --git a/src/mesa/main/scissor.h b/src/mesa/main/scissor.h
new file mode 100644
index 0000000000..b852a2122d
--- /dev/null
+++ b/src/mesa/main/scissor.h
@@ -0,0 +1,46 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2007 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef SCISSOR_H
+#define SCISSOR_H
+
+
+#include "main/mtypes.h"
+
+
+extern void GLAPIENTRY
+_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height );
+
+
+extern void
+_mesa_set_scissor(GLcontext *ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height);
+
+
+extern void
+_mesa_init_scissor(GLcontext *ctx);
+
+
+#endif
diff --git a/src/mesa/main/sources b/src/mesa/main/sources
index dfcff89e4b..468121bd1d 100644
--- a/src/mesa/main/sources
+++ b/src/mesa/main/sources
@@ -2,6 +2,7 @@
MESA_MAIN_SOURCES = \
accum.c \
api_arrayelt.c \
+api_exec.c \
api_loopback.c \
api_noop.c \
api_validate.c \
@@ -10,6 +11,7 @@ attrib.c \
blend.c \
bufferobj.c \
buffers.c \
+clear.c \
clip.c \
colortab.c \
context.c \
@@ -40,22 +42,29 @@ lines.c \
matrix.c \
mipmap.c \
mm.c \
+multisample.c \
occlude.c \
pixel.c \
+pixelstore.c \
points.c \
polygon.c \
+readpix.c \
rastpos.c \
rbadaptors.c \
renderbuffer.c \
+scissor.c \
state.c \
stencil.c \
texcompress.c \
texcompress_fxt1.c \
texcompress_s3tc.c \
+texenv.c \
texenvprogram.c \
texformat.c \
+texgen.c \
teximage.c \
texobj.c \
+texparam.c \
texrender.c \
texstate.c \
texstore.c \
@@ -69,7 +78,7 @@ vsnprintf.c
MESA_MAIN_HEADERS = \
accum.h \
api_arrayelt.h \
-api_eval.h \
+api_exec.h \
api_loopback.h \
api_noop.h \
api_validate.h \
@@ -79,6 +88,7 @@ bitset.h \
blend.h \
bufferobj.h \
buffers.h \
+clear.h \
clip.h \
colormac.h \
colortab.h \
@@ -113,22 +123,29 @@ matrix.h \
mipmap.h \
mm.h \
mtypes.h \
+multisample.h \
occlude.h \
pixel.h \
+pixelstore.h \
points.h \
polygon.h \
rastpos.h \
rbadaptors.h \
+readpix.h \
renderbuffer.h \
simple_list.h \
+scissor.h \
state.h \
stencil.h \
texcompress.h \
+texenv.h \
texenvprogram.h \
texformat.h \
texformat_tmp.h \
+texgen.h \
teximage.h \
texobj.h \
+texparam.h \
texrender.h \
texstate.h \
texstore.h \
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index f8cb943e64..4d1fdbf47c 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5.1
+ * Version: 7.1
*
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2008 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"),
@@ -27,807 +27,28 @@
* \file state.c
* State management.
*
- * This file manages recalculation of derived values in the __GLcontextRec.
- * Also, this is where we initialize the API dispatch table.
+ * This file manages recalculation of derived values in GLcontext.
*/
+
#include "glheader.h"
-#include "accum.h"
-#include "api_loopback.h"
-#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
-#include "shader/arbprogram.h"
-#endif
-#if FEATURE_ATI_fragment_shader
-#include "shader/atifragshader.h"
-#endif
-#include "attrib.h"
-#include "blend.h"
-#if FEATURE_ARB_vertex_buffer_object
-#include "bufferobj.h"
-#endif
-#include "arrayobj.h"
-#include "buffers.h"
-#include "clip.h"
-#include "colortab.h"
+#include "mtypes.h"
#include "context.h"
-#include "convolve.h"
-#include "depth.h"
-#include "dlist.h"
-#include "drawpix.h"
-#include "enable.h"
-#include "eval.h"
-#include "get.h"
-#include "feedback.h"
-#include "fog.h"
-#if FEATURE_EXT_framebuffer_object
-#include "fbobject.h"
-#endif
+#include "debug.h"
+#include "macros.h"
#include "ffvertex_prog.h"
#include "framebuffer.h"
-#include "hint.h"
-#include "histogram.h"
-#include "imports.h"
#include "light.h"
-#include "lines.h"
-#include "macros.h"
#include "matrix.h"
+#if FEATURE_pixel_transfer
#include "pixel.h"
-#include "points.h"
-#include "polygon.h"
-#if FEATURE_ARB_occlusion_query || FEATURE_EXT_timer_query
-#include "queryobj.h"
#endif
-#include "rastpos.h"
+#include "shader/program.h"
#include "state.h"
#include "stencil.h"
-#include "teximage.h"
+#include "texenvprogram.h"
#include "texobj.h"
#include "texstate.h"
-#include "mtypes.h"
-#include "varray.h"
-#if FEATURE_NV_vertex_program
-#include "shader/nvprogram.h"
-#endif
-#if FEATURE_NV_fragment_program
-#include "shader/nvprogram.h"
-#include "shader/program.h"
-#include "texenvprogram.h"
-#endif
-#if FEATURE_ARB_shader_objects
-#include "shaders.h"
-#endif
-#include "debug.h"
-#include "glapi/dispatch.h"
-
-
-
-/**
- * Initialize a dispatch table with pointers to Mesa's immediate-mode
- * commands.
- *
- * Pointers to glBegin()/glEnd() object commands and a few others
- * are provided via the GLvertexformat interface.
- *
- * \param ctx GL context to which \c exec belongs.
- * \param exec dispatch table.
- */
-void
-_mesa_init_exec_table(struct _glapi_table *exec)
-{
-#if _HAVE_FULL_GL
- _mesa_loopback_init_api_table( exec );
-#endif
-
- /* load the dispatch slots we understand */
- SET_AlphaFunc(exec, _mesa_AlphaFunc);
- SET_BlendFunc(exec, _mesa_BlendFunc);
- SET_Clear(exec, _mesa_Clear);
- SET_ClearColor(exec, _mesa_ClearColor);
- SET_ClearStencil(exec, _mesa_ClearStencil);
- SET_ColorMask(exec, _mesa_ColorMask);
- SET_CullFace(exec, _mesa_CullFace);
- SET_Disable(exec, _mesa_Disable);
- SET_DrawBuffer(exec, _mesa_DrawBuffer);
- SET_Enable(exec, _mesa_Enable);
- SET_Finish(exec, _mesa_Finish);
- SET_Flush(exec, _mesa_Flush);
- SET_FrontFace(exec, _mesa_FrontFace);
- SET_Frustum(exec, _mesa_Frustum);
- SET_GetError(exec, _mesa_GetError);
- SET_GetFloatv(exec, _mesa_GetFloatv);
- SET_GetString(exec, _mesa_GetString);
- SET_InitNames(exec, _mesa_InitNames);
- SET_LineStipple(exec, _mesa_LineStipple);
- SET_LineWidth(exec, _mesa_LineWidth);
- SET_LoadIdentity(exec, _mesa_LoadIdentity);
- SET_LoadMatrixf(exec, _mesa_LoadMatrixf);
- SET_LoadName(exec, _mesa_LoadName);
- SET_LogicOp(exec, _mesa_LogicOp);
- SET_MatrixMode(exec, _mesa_MatrixMode);
- SET_MultMatrixf(exec, _mesa_MultMatrixf);
- SET_Ortho(exec, _mesa_Ortho);
- SET_PixelStorei(exec, _mesa_PixelStorei);
- SET_PopMatrix(exec, _mesa_PopMatrix);
- SET_PopName(exec, _mesa_PopName);
- SET_PushMatrix(exec, _mesa_PushMatrix);
- SET_PushName(exec, _mesa_PushName);
- SET_RasterPos2f(exec, _mesa_RasterPos2f);
- SET_RasterPos2fv(exec, _mesa_RasterPos2fv);
- SET_RasterPos2i(exec, _mesa_RasterPos2i);
- SET_RasterPos2iv(exec, _mesa_RasterPos2iv);
- SET_ReadBuffer(exec, _mesa_ReadBuffer);
- SET_RenderMode(exec, _mesa_RenderMode);
- SET_Rotatef(exec, _mesa_Rotatef);
- SET_Scalef(exec, _mesa_Scalef);
- SET_Scissor(exec, _mesa_Scissor);
- SET_SelectBuffer(exec, _mesa_SelectBuffer);
- SET_ShadeModel(exec, _mesa_ShadeModel);
- SET_StencilFunc(exec, _mesa_StencilFunc);
- SET_StencilMask(exec, _mesa_StencilMask);
- SET_StencilOp(exec, _mesa_StencilOp);
- SET_TexEnvfv(exec, _mesa_TexEnvfv);
- SET_TexEnvi(exec, _mesa_TexEnvi);
- SET_TexImage2D(exec, _mesa_TexImage2D);
- SET_TexParameteri(exec, _mesa_TexParameteri);
- SET_Translatef(exec, _mesa_Translatef);
- SET_Viewport(exec, _mesa_Viewport);
-#if _HAVE_FULL_GL
- SET_Accum(exec, _mesa_Accum);
- SET_Bitmap(exec, _mesa_Bitmap);
- SET_CallList(exec, _mesa_CallList);
- SET_CallLists(exec, _mesa_CallLists);
- SET_ClearAccum(exec, _mesa_ClearAccum);
- SET_ClearDepth(exec, _mesa_ClearDepth);
- SET_ClearIndex(exec, _mesa_ClearIndex);
- SET_ClipPlane(exec, _mesa_ClipPlane);
- SET_ColorMaterial(exec, _mesa_ColorMaterial);
- SET_CopyPixels(exec, _mesa_CopyPixels);
- SET_CullParameterfvEXT(exec, _mesa_CullParameterfvEXT);
- SET_CullParameterdvEXT(exec, _mesa_CullParameterdvEXT);
- SET_DeleteLists(exec, _mesa_DeleteLists);
- SET_DepthFunc(exec, _mesa_DepthFunc);
- SET_DepthMask(exec, _mesa_DepthMask);
- SET_DepthRange(exec, _mesa_DepthRange);
- SET_DrawPixels(exec, _mesa_DrawPixels);
- SET_EndList(exec, _mesa_EndList);
- SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer);
- SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT);
- SET_Fogf(exec, _mesa_Fogf);
- SET_Fogfv(exec, _mesa_Fogfv);
- SET_Fogi(exec, _mesa_Fogi);
- SET_Fogiv(exec, _mesa_Fogiv);
- SET_GenLists(exec, _mesa_GenLists);
- SET_GetClipPlane(exec, _mesa_GetClipPlane);
- SET_GetBooleanv(exec, _mesa_GetBooleanv);
- SET_GetDoublev(exec, _mesa_GetDoublev);
- SET_GetIntegerv(exec, _mesa_GetIntegerv);
- SET_GetLightfv(exec, _mesa_GetLightfv);
- SET_GetLightiv(exec, _mesa_GetLightiv);
- SET_GetMapdv(exec, _mesa_GetMapdv);
- SET_GetMapfv(exec, _mesa_GetMapfv);
- SET_GetMapiv(exec, _mesa_GetMapiv);
- SET_GetMaterialfv(exec, _mesa_GetMaterialfv);
- SET_GetMaterialiv(exec, _mesa_GetMaterialiv);
- SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv);
- SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv);
- SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv);
- SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple);
- SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv);
- SET_GetTexEnviv(exec, _mesa_GetTexEnviv);
- SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv);
- SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv);
- SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv);
- SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv);
- SET_GetTexGendv(exec, _mesa_GetTexGendv);
- SET_GetTexGenfv(exec, _mesa_GetTexGenfv);
- SET_GetTexGeniv(exec, _mesa_GetTexGeniv);
- SET_GetTexImage(exec, _mesa_GetTexImage);
- SET_Hint(exec, _mesa_Hint);
- SET_IndexMask(exec, _mesa_IndexMask);
- SET_IsEnabled(exec, _mesa_IsEnabled);
- SET_IsList(exec, _mesa_IsList);
- SET_LightModelf(exec, _mesa_LightModelf);
- SET_LightModelfv(exec, _mesa_LightModelfv);
- SET_LightModeli(exec, _mesa_LightModeli);
- SET_LightModeliv(exec, _mesa_LightModeliv);
- SET_Lightf(exec, _mesa_Lightf);
- SET_Lightfv(exec, _mesa_Lightfv);
- SET_Lighti(exec, _mesa_Lighti);
- SET_Lightiv(exec, _mesa_Lightiv);
- SET_ListBase(exec, _mesa_ListBase);
- SET_LoadMatrixd(exec, _mesa_LoadMatrixd);
- SET_Map1d(exec, _mesa_Map1d);
- SET_Map1f(exec, _mesa_Map1f);
- SET_Map2d(exec, _mesa_Map2d);
- SET_Map2f(exec, _mesa_Map2f);
- SET_MapGrid1d(exec, _mesa_MapGrid1d);
- SET_MapGrid1f(exec, _mesa_MapGrid1f);
- SET_MapGrid2d(exec, _mesa_MapGrid2d);
- SET_MapGrid2f(exec, _mesa_MapGrid2f);
- SET_MultMatrixd(exec, _mesa_MultMatrixd);
- SET_NewList(exec, _mesa_NewList);
- SET_PassThrough(exec, _mesa_PassThrough);
- SET_PixelMapfv(exec, _mesa_PixelMapfv);
- SET_PixelMapuiv(exec, _mesa_PixelMapuiv);
- SET_PixelMapusv(exec, _mesa_PixelMapusv);
- SET_PixelStoref(exec, _mesa_PixelStoref);
- SET_PixelTransferf(exec, _mesa_PixelTransferf);
- SET_PixelTransferi(exec, _mesa_PixelTransferi);
- SET_PixelZoom(exec, _mesa_PixelZoom);
- SET_PointSize(exec, _mesa_PointSize);
- SET_PolygonMode(exec, _mesa_PolygonMode);
- SET_PolygonOffset(exec, _mesa_PolygonOffset);
- SET_PolygonStipple(exec, _mesa_PolygonStipple);
- SET_PopAttrib(exec, _mesa_PopAttrib);
- SET_PushAttrib(exec, _mesa_PushAttrib);
- SET_RasterPos2d(exec, _mesa_RasterPos2d);
- SET_RasterPos2dv(exec, _mesa_RasterPos2dv);
- SET_RasterPos2s(exec, _mesa_RasterPos2s);
- SET_RasterPos2sv(exec, _mesa_RasterPos2sv);
- SET_RasterPos3d(exec, _mesa_RasterPos3d);
- SET_RasterPos3dv(exec, _mesa_RasterPos3dv);
- SET_RasterPos3f(exec, _mesa_RasterPos3f);
- SET_RasterPos3fv(exec, _mesa_RasterPos3fv);
- SET_RasterPos3i(exec, _mesa_RasterPos3i);
- SET_RasterPos3iv(exec, _mesa_RasterPos3iv);
- SET_RasterPos3s(exec, _mesa_RasterPos3s);
- SET_RasterPos3sv(exec, _mesa_RasterPos3sv);
- SET_RasterPos4d(exec, _mesa_RasterPos4d);
- SET_RasterPos4dv(exec, _mesa_RasterPos4dv);
- SET_RasterPos4f(exec, _mesa_RasterPos4f);
- SET_RasterPos4fv(exec, _mesa_RasterPos4fv);
- SET_RasterPos4i(exec, _mesa_RasterPos4i);
- SET_RasterPos4iv(exec, _mesa_RasterPos4iv);
- SET_RasterPos4s(exec, _mesa_RasterPos4s);
- SET_RasterPos4sv(exec, _mesa_RasterPos4sv);
- SET_ReadPixels(exec, _mesa_ReadPixels);
- SET_Rotated(exec, _mesa_Rotated);
- SET_Scaled(exec, _mesa_Scaled);
- SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT);
- SET_TexEnvf(exec, _mesa_TexEnvf);
- SET_TexEnviv(exec, _mesa_TexEnviv);
- SET_TexGend(exec, _mesa_TexGend);
- SET_TexGendv(exec, _mesa_TexGendv);
- SET_TexGenf(exec, _mesa_TexGenf);
- SET_TexGenfv(exec, _mesa_TexGenfv);
- SET_TexGeni(exec, _mesa_TexGeni);
- SET_TexGeniv(exec, _mesa_TexGeniv);
- SET_TexImage1D(exec, _mesa_TexImage1D);
- SET_TexParameterf(exec, _mesa_TexParameterf);
- SET_TexParameterfv(exec, _mesa_TexParameterfv);
- SET_TexParameteriv(exec, _mesa_TexParameteriv);
- SET_Translated(exec, _mesa_Translated);
-#endif
-
- /* 1.1 */
- SET_BindTexture(exec, _mesa_BindTexture);
- SET_DeleteTextures(exec, _mesa_DeleteTextures);
- SET_GenTextures(exec, _mesa_GenTextures);
-#if _HAVE_FULL_GL
- SET_AreTexturesResident(exec, _mesa_AreTexturesResident);
- SET_ColorPointer(exec, _mesa_ColorPointer);
- SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D);
- SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D);
- SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D);
- SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D);
- SET_DisableClientState(exec, _mesa_DisableClientState);
- SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer);
- SET_EnableClientState(exec, _mesa_EnableClientState);
- SET_GetPointerv(exec, _mesa_GetPointerv);
- SET_IndexPointer(exec, _mesa_IndexPointer);
- SET_InterleavedArrays(exec, _mesa_InterleavedArrays);
- SET_IsTexture(exec, _mesa_IsTexture);
- SET_NormalPointer(exec, _mesa_NormalPointer);
- SET_PopClientAttrib(exec, _mesa_PopClientAttrib);
- SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures);
- SET_PushClientAttrib(exec, _mesa_PushClientAttrib);
- SET_TexCoordPointer(exec, _mesa_TexCoordPointer);
- SET_TexSubImage1D(exec, _mesa_TexSubImage1D);
- SET_TexSubImage2D(exec, _mesa_TexSubImage2D);
- SET_VertexPointer(exec, _mesa_VertexPointer);
-#endif
-
- /* 1.2 */
-#if _HAVE_FULL_GL
- SET_CopyTexSubImage3D(exec, _mesa_CopyTexSubImage3D);
- SET_TexImage3D(exec, _mesa_TexImage3D);
- SET_TexSubImage3D(exec, _mesa_TexSubImage3D);
-#endif
-
- /* OpenGL 1.2 GL_ARB_imaging */
-#if _HAVE_FULL_GL
- SET_BlendColor(exec, _mesa_BlendColor);
- SET_BlendEquation(exec, _mesa_BlendEquation);
- SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT);
- SET_ColorSubTable(exec, _mesa_ColorSubTable);
- SET_ColorTable(exec, _mesa_ColorTable);
- SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv);
- SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv);
- SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D);
- SET_ConvolutionFilter2D(exec, _mesa_ConvolutionFilter2D);
- SET_ConvolutionParameterf(exec, _mesa_ConvolutionParameterf);
- SET_ConvolutionParameterfv(exec, _mesa_ConvolutionParameterfv);
- SET_ConvolutionParameteri(exec, _mesa_ConvolutionParameteri);
- SET_ConvolutionParameteriv(exec, _mesa_ConvolutionParameteriv);
- SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable);
- SET_CopyColorTable(exec, _mesa_CopyColorTable);
- SET_CopyConvolutionFilter1D(exec, _mesa_CopyConvolutionFilter1D);
- SET_CopyConvolutionFilter2D(exec, _mesa_CopyConvolutionFilter2D);
- SET_GetColorTable(exec, _mesa_GetColorTable);
- SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv);
- SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv);
- SET_GetConvolutionFilter(exec, _mesa_GetConvolutionFilter);
- SET_GetConvolutionParameterfv(exec, _mesa_GetConvolutionParameterfv);
- SET_GetConvolutionParameteriv(exec, _mesa_GetConvolutionParameteriv);
- SET_GetHistogram(exec, _mesa_GetHistogram);
- SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv);
- SET_GetHistogramParameteriv(exec, _mesa_GetHistogramParameteriv);
- SET_GetMinmax(exec, _mesa_GetMinmax);
- SET_GetMinmaxParameterfv(exec, _mesa_GetMinmaxParameterfv);
- SET_GetMinmaxParameteriv(exec, _mesa_GetMinmaxParameteriv);
- SET_GetSeparableFilter(exec, _mesa_GetSeparableFilter);
- SET_Histogram(exec, _mesa_Histogram);
- SET_Minmax(exec, _mesa_Minmax);
- SET_ResetHistogram(exec, _mesa_ResetHistogram);
- SET_ResetMinmax(exec, _mesa_ResetMinmax);
- SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D);
-#endif
-
- /* OpenGL 2.0 */
- SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate);
- SET_StencilMaskSeparate(exec, _mesa_StencilMaskSeparate);
- SET_StencilOpSeparate(exec, _mesa_StencilOpSeparate);
-#if FEATURE_ARB_shader_objects
- SET_AttachShader(exec, _mesa_AttachShader);
- SET_CreateProgram(exec, _mesa_CreateProgram);
- SET_CreateShader(exec, _mesa_CreateShader);
- SET_DeleteProgram(exec, _mesa_DeleteProgram);
- SET_DeleteShader(exec, _mesa_DeleteShader);
- SET_DetachShader(exec, _mesa_DetachShader);
- SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders);
- SET_GetProgramiv(exec, _mesa_GetProgramiv);
- SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog);
- SET_GetShaderiv(exec, _mesa_GetShaderiv);
- SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog);
- SET_IsProgram(exec, _mesa_IsProgram);
- SET_IsShader(exec, _mesa_IsShader);
-#endif
-
- /* OpenGL 2.1 */
-#if FEATURE_ARB_shader_objects
- SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv);
- SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv);
- SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv);
- SET_UniformMatrix4x2fv(exec, _mesa_UniformMatrix4x2fv);
- SET_UniformMatrix3x4fv(exec, _mesa_UniformMatrix3x4fv);
- SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv);
-#endif
-
-
- /* 2. GL_EXT_blend_color */
-#if 0
-/* SET_BlendColorEXT(exec, _mesa_BlendColorEXT); */
-#endif
-
- /* 3. GL_EXT_polygon_offset */
-#if _HAVE_FULL_GL
- SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT);
-#endif
-
- /* 6. GL_EXT_texture3d */
-#if 0
-/* SET_CopyTexSubImage3DEXT(exec, _mesa_CopyTexSubImage3D); */
-/* SET_TexImage3DEXT(exec, _mesa_TexImage3DEXT); */
-/* SET_TexSubImage3DEXT(exec, _mesa_TexSubImage3D); */
-#endif
-
- /* 11. GL_EXT_histogram */
-#if 0
- SET_GetHistogramEXT(exec, _mesa_GetHistogram);
- SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv);
- SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv);
- SET_GetMinmaxEXT(exec, _mesa_GetMinmax);
- SET_GetMinmaxParameterfvEXT(exec, _mesa_GetMinmaxParameterfv);
- SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv);
-#endif
-
- /* 14. SGI_color_table */
-#if 0
- SET_ColorTableSGI(exec, _mesa_ColorTable);
- SET_ColorSubTableSGI(exec, _mesa_ColorSubTable);
- SET_GetColorTableSGI(exec, _mesa_GetColorTable);
- SET_GetColorTableParameterfvSGI(exec, _mesa_GetColorTableParameterfv);
- SET_GetColorTableParameterivSGI(exec, _mesa_GetColorTableParameteriv);
-#endif
-
- /* 30. GL_EXT_vertex_array */
-#if _HAVE_FULL_GL
- SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT);
- SET_EdgeFlagPointerEXT(exec, _mesa_EdgeFlagPointerEXT);
- SET_IndexPointerEXT(exec, _mesa_IndexPointerEXT);
- SET_NormalPointerEXT(exec, _mesa_NormalPointerEXT);
- SET_TexCoordPointerEXT(exec, _mesa_TexCoordPointerEXT);
- SET_VertexPointerEXT(exec, _mesa_VertexPointerEXT);
-#endif
-
- /* 37. GL_EXT_blend_minmax */
-#if 0
- SET_BlendEquationEXT(exec, _mesa_BlendEquationEXT);
-#endif
-
- /* 54. GL_EXT_point_parameters */
-#if _HAVE_FULL_GL
- SET_PointParameterfEXT(exec, _mesa_PointParameterfEXT);
- SET_PointParameterfvEXT(exec, _mesa_PointParameterfvEXT);
-#endif
-
- /* 97. GL_EXT_compiled_vertex_array */
-#if _HAVE_FULL_GL
- SET_LockArraysEXT(exec, _mesa_LockArraysEXT);
- SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT);
-#endif
-
- /* 148. GL_EXT_multi_draw_arrays */
-#if _HAVE_FULL_GL
- SET_MultiDrawArraysEXT(exec, _mesa_MultiDrawArraysEXT);
- SET_MultiDrawElementsEXT(exec, _mesa_MultiDrawElementsEXT);
-#endif
-
- /* 173. GL_INGR_blend_func_separate */
-#if _HAVE_FULL_GL
- SET_BlendFuncSeparateEXT(exec, _mesa_BlendFuncSeparateEXT);
-#endif
-
- /* 196. GL_MESA_resize_buffers */
-#if _HAVE_FULL_GL
- SET_ResizeBuffersMESA(exec, _mesa_ResizeBuffersMESA);
-#endif
-
- /* 197. GL_MESA_window_pos */
-#if _HAVE_FULL_GL
- SET_WindowPos2dMESA(exec, _mesa_WindowPos2dMESA);
- SET_WindowPos2dvMESA(exec, _mesa_WindowPos2dvMESA);
- SET_WindowPos2fMESA(exec, _mesa_WindowPos2fMESA);
- SET_WindowPos2fvMESA(exec, _mesa_WindowPos2fvMESA);
- SET_WindowPos2iMESA(exec, _mesa_WindowPos2iMESA);
- SET_WindowPos2ivMESA(exec, _mesa_WindowPos2ivMESA);
- SET_WindowPos2sMESA(exec, _mesa_WindowPos2sMESA);
- SET_WindowPos2svMESA(exec, _mesa_WindowPos2svMESA);
- SET_WindowPos3dMESA(exec, _mesa_WindowPos3dMESA);
- SET_WindowPos3dvMESA(exec, _mesa_WindowPos3dvMESA);
- SET_WindowPos3fMESA(exec, _mesa_WindowPos3fMESA);
- SET_WindowPos3fvMESA(exec, _mesa_WindowPos3fvMESA);
- SET_WindowPos3iMESA(exec, _mesa_WindowPos3iMESA);
- SET_WindowPos3ivMESA(exec, _mesa_WindowPos3ivMESA);
- SET_WindowPos3sMESA(exec, _mesa_WindowPos3sMESA);
- SET_WindowPos3svMESA(exec, _mesa_WindowPos3svMESA);
- SET_WindowPos4dMESA(exec, _mesa_WindowPos4dMESA);
- SET_WindowPos4dvMESA(exec, _mesa_WindowPos4dvMESA);
- SET_WindowPos4fMESA(exec, _mesa_WindowPos4fMESA);
- SET_WindowPos4fvMESA(exec, _mesa_WindowPos4fvMESA);
- SET_WindowPos4iMESA(exec, _mesa_WindowPos4iMESA);
- SET_WindowPos4ivMESA(exec, _mesa_WindowPos4ivMESA);
- SET_WindowPos4sMESA(exec, _mesa_WindowPos4sMESA);
- SET_WindowPos4svMESA(exec, _mesa_WindowPos4svMESA);
-#endif
-
- /* 200. GL_IBM_multimode_draw_arrays */
-#if _HAVE_FULL_GL
- SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM);
- SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM);
-#endif
-
- /* 233. GL_NV_vertex_program */
-#if FEATURE_NV_vertex_program
- SET_BindProgramNV(exec, _mesa_BindProgram);
- SET_DeleteProgramsNV(exec, _mesa_DeletePrograms);
- SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV);
- SET_GenProgramsNV(exec, _mesa_GenPrograms);
- SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV);
- SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV);
- SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV);
- SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV);
- SET_GetProgramivNV(exec, _mesa_GetProgramivNV);
- SET_GetProgramStringNV(exec, _mesa_GetProgramStringNV);
- SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV);
- SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV);
- SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV);
- SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV);
- SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV);
- SET_IsProgramNV(exec, _mesa_IsProgramARB);
- SET_LoadProgramNV(exec, _mesa_LoadProgramNV);
- SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */
- SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); /* alias to ProgramParameter4dvNV */
- SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); /* alias to ProgramParameter4fNV */
- SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); /* alias to ProgramParameter4fvNV */
- SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV);
- SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV);
- SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV);
- SET_VertexAttribPointerNV(exec, _mesa_VertexAttribPointerNV);
- /* glVertexAttrib*NV functions handled in api_loopback.c */
-#endif
-
- /* 273. GL_APPLE_vertex_array_object */
- SET_BindVertexArrayAPPLE(exec, _mesa_BindVertexArrayAPPLE);
- SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE);
- SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE);
- SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE);
-
- /* 282. GL_NV_fragment_program */
-#if FEATURE_NV_fragment_program
- SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV);
- SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV);
- SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV);
- SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV);
- SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV);
- SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV);
- SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB);
- SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB);
- SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB);
- SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB);
- SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB);
- SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB);
-#endif
-
- /* 262. GL_NV_point_sprite */
-#if _HAVE_FULL_GL
- SET_PointParameteriNV(exec, _mesa_PointParameteriNV);
- SET_PointParameterivNV(exec, _mesa_PointParameterivNV);
-#endif
-
- /* 268. GL_EXT_stencil_two_side */
-#if _HAVE_FULL_GL
- SET_ActiveStencilFaceEXT(exec, _mesa_ActiveStencilFaceEXT);
-#endif
-
- /* ???. GL_EXT_depth_bounds_test */
- SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);
-
- /* ARB 1. GL_ARB_multitexture */
-#if _HAVE_FULL_GL
- SET_ActiveTextureARB(exec, _mesa_ActiveTextureARB);
- SET_ClientActiveTextureARB(exec, _mesa_ClientActiveTextureARB);
-#endif
-
- /* ARB 3. GL_ARB_transpose_matrix */
-#if _HAVE_FULL_GL
- SET_LoadTransposeMatrixdARB(exec, _mesa_LoadTransposeMatrixdARB);
- SET_LoadTransposeMatrixfARB(exec, _mesa_LoadTransposeMatrixfARB);
- SET_MultTransposeMatrixdARB(exec, _mesa_MultTransposeMatrixdARB);
- SET_MultTransposeMatrixfARB(exec, _mesa_MultTransposeMatrixfARB);
-#endif
-
- /* ARB 5. GL_ARB_multisample */
-#if _HAVE_FULL_GL
- SET_SampleCoverageARB(exec, _mesa_SampleCoverageARB);
-#endif
-
- /* ARB 12. GL_ARB_texture_compression */
-#if _HAVE_FULL_GL
- SET_CompressedTexImage3DARB(exec, _mesa_CompressedTexImage3DARB);
- SET_CompressedTexImage2DARB(exec, _mesa_CompressedTexImage2DARB);
- SET_CompressedTexImage1DARB(exec, _mesa_CompressedTexImage1DARB);
- SET_CompressedTexSubImage3DARB(exec, _mesa_CompressedTexSubImage3DARB);
- SET_CompressedTexSubImage2DARB(exec, _mesa_CompressedTexSubImage2DARB);
- SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB);
- SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB);
-#endif
-
- /* ARB 14. GL_ARB_point_parameters */
- /* reuse EXT_point_parameters functions */
-
- /* ARB 26. GL_ARB_vertex_program */
- /* ARB 27. GL_ARB_fragment_program */
-#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
- /* glVertexAttrib1sARB aliases glVertexAttrib1sNV */
- /* glVertexAttrib1fARB aliases glVertexAttrib1fNV */
- /* glVertexAttrib1dARB aliases glVertexAttrib1dNV */
- /* glVertexAttrib2sARB aliases glVertexAttrib2sNV */
- /* glVertexAttrib2fARB aliases glVertexAttrib2fNV */
- /* glVertexAttrib2dARB aliases glVertexAttrib2dNV */
- /* glVertexAttrib3sARB aliases glVertexAttrib3sNV */
- /* glVertexAttrib3fARB aliases glVertexAttrib3fNV */
- /* glVertexAttrib3dARB aliases glVertexAttrib3dNV */
- /* glVertexAttrib4sARB aliases glVertexAttrib4sNV */
- /* glVertexAttrib4fARB aliases glVertexAttrib4fNV */
- /* glVertexAttrib4dARB aliases glVertexAttrib4dNV */
- /* glVertexAttrib4NubARB aliases glVertexAttrib4NubNV */
- /* glVertexAttrib1svARB aliases glVertexAttrib1svNV */
- /* glVertexAttrib1fvARB aliases glVertexAttrib1fvNV */
- /* glVertexAttrib1dvARB aliases glVertexAttrib1dvNV */
- /* glVertexAttrib2svARB aliases glVertexAttrib2svNV */
- /* glVertexAttrib2fvARB aliases glVertexAttrib2fvNV */
- /* glVertexAttrib2dvARB aliases glVertexAttrib2dvNV */
- /* glVertexAttrib3svARB aliases glVertexAttrib3svNV */
- /* glVertexAttrib3fvARB aliases glVertexAttrib3fvNV */
- /* glVertexAttrib3dvARB aliases glVertexAttrib3dvNV */
- /* glVertexAttrib4svARB aliases glVertexAttrib4svNV */
- /* glVertexAttrib4fvARB aliases glVertexAttrib4fvNV */
- /* glVertexAttrib4dvARB aliases glVertexAttrib4dvNV */
- /* glVertexAttrib4NubvARB aliases glVertexAttrib4NubvNV */
- /* glVertexAttrib4bvARB handled in api_loopback.c */
- /* glVertexAttrib4ivARB handled in api_loopback.c */
- /* glVertexAttrib4ubvARB handled in api_loopback.c */
- /* glVertexAttrib4usvARB handled in api_loopback.c */
- /* glVertexAttrib4uivARB handled in api_loopback.c */
- /* glVertexAttrib4NbvARB handled in api_loopback.c */
- /* glVertexAttrib4NsvARB handled in api_loopback.c */
- /* glVertexAttrib4NivARB handled in api_loopback.c */
- /* glVertexAttrib4NusvARB handled in api_loopback.c */
- /* glVertexAttrib4NuivARB handled in api_loopback.c */
- SET_VertexAttribPointerARB(exec, _mesa_VertexAttribPointerARB);
- SET_EnableVertexAttribArrayARB(exec, _mesa_EnableVertexAttribArrayARB);
- SET_DisableVertexAttribArrayARB(exec, _mesa_DisableVertexAttribArrayARB);
- SET_ProgramStringARB(exec, _mesa_ProgramStringARB);
- /* glBindProgramARB aliases glBindProgramNV */
- /* glDeleteProgramsARB aliases glDeleteProgramsNV */
- /* glGenProgramsARB aliases glGenProgramsNV */
- /* glIsProgramARB aliases glIsProgramNV */
- SET_GetVertexAttribdvARB(exec, _mesa_GetVertexAttribdvARB);
- SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB);
- SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB);
- /* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */
- SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB);
- SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB);
- SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB);
- SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB);
- SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB);
- SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB);
- SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB);
- SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB);
- SET_GetProgramEnvParameterdvARB(exec, _mesa_GetProgramEnvParameterdvARB);
- SET_GetProgramEnvParameterfvARB(exec, _mesa_GetProgramEnvParameterfvARB);
- SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB);
- SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB);
- SET_GetProgramivARB(exec, _mesa_GetProgramivARB);
- SET_GetProgramStringARB(exec, _mesa_GetProgramStringARB);
-#endif
-
- /* ARB 28. GL_ARB_vertex_buffer_object */
-#if FEATURE_ARB_vertex_buffer_object
- SET_BindBufferARB(exec, _mesa_BindBufferARB);
- SET_BufferDataARB(exec, _mesa_BufferDataARB);
- SET_BufferSubDataARB(exec, _mesa_BufferSubDataARB);
- SET_DeleteBuffersARB(exec, _mesa_DeleteBuffersARB);
- SET_GenBuffersARB(exec, _mesa_GenBuffersARB);
- SET_GetBufferParameterivARB(exec, _mesa_GetBufferParameterivARB);
- SET_GetBufferPointervARB(exec, _mesa_GetBufferPointervARB);
- SET_GetBufferSubDataARB(exec, _mesa_GetBufferSubDataARB);
- SET_IsBufferARB(exec, _mesa_IsBufferARB);
- SET_MapBufferARB(exec, _mesa_MapBufferARB);
- SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB);
-#endif
-
- /* ARB 29. GL_ARB_occlusion_query */
-#if FEATURE_ARB_occlusion_query
- SET_GenQueriesARB(exec, _mesa_GenQueriesARB);
- SET_DeleteQueriesARB(exec, _mesa_DeleteQueriesARB);
- SET_IsQueryARB(exec, _mesa_IsQueryARB);
- SET_BeginQueryARB(exec, _mesa_BeginQueryARB);
- SET_EndQueryARB(exec, _mesa_EndQueryARB);
- SET_GetQueryivARB(exec, _mesa_GetQueryivARB);
- SET_GetQueryObjectivARB(exec, _mesa_GetQueryObjectivARB);
- SET_GetQueryObjectuivARB(exec, _mesa_GetQueryObjectuivARB);
-#endif
-
- /* ARB 37. GL_ARB_draw_buffers */
- SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB);
-
-#if FEATURE_ARB_shader_objects
- SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB);
- SET_GetHandleARB(exec, _mesa_GetHandleARB);
- SET_DetachObjectARB(exec, _mesa_DetachObjectARB);
- SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB);
- SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB);
- SET_CompileShaderARB(exec, _mesa_CompileShaderARB);
- SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB);
- SET_AttachObjectARB(exec, _mesa_AttachObjectARB);
- SET_LinkProgramARB(exec, _mesa_LinkProgramARB);
- SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB);
- SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB);
- SET_Uniform1fARB(exec, _mesa_Uniform1fARB);
- SET_Uniform2fARB(exec, _mesa_Uniform2fARB);
- SET_Uniform3fARB(exec, _mesa_Uniform3fARB);
- SET_Uniform4fARB(exec, _mesa_Uniform4fARB);
- SET_Uniform1iARB(exec, _mesa_Uniform1iARB);
- SET_Uniform2iARB(exec, _mesa_Uniform2iARB);
- SET_Uniform3iARB(exec, _mesa_Uniform3iARB);
- SET_Uniform4iARB(exec, _mesa_Uniform4iARB);
- SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB);
- SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB);
- SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB);
- SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB);
- SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB);
- SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB);
- SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB);
- SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB);
- SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB);
- SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB);
- SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB);
- SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB);
- SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB);
- SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB);
- SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB);
- SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB);
- SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB);
- SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB);
- SET_GetUniformivARB(exec, _mesa_GetUniformivARB);
- SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB);
-#endif /* FEATURE_ARB_shader_objects */
-
-#if FEATURE_ARB_vertex_shader
- SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB);
- SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB);
- SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB);
-#endif /* FEATURE_ARB_vertex_shader */
-
- /* GL_ATI_fragment_shader */
-#if FEATURE_ATI_fragment_shader
- SET_GenFragmentShadersATI(exec, _mesa_GenFragmentShadersATI);
- SET_BindFragmentShaderATI(exec, _mesa_BindFragmentShaderATI);
- SET_DeleteFragmentShaderATI(exec, _mesa_DeleteFragmentShaderATI);
- SET_BeginFragmentShaderATI(exec, _mesa_BeginFragmentShaderATI);
- SET_EndFragmentShaderATI(exec, _mesa_EndFragmentShaderATI);
- SET_PassTexCoordATI(exec, _mesa_PassTexCoordATI);
- SET_SampleMapATI(exec, _mesa_SampleMapATI);
- SET_ColorFragmentOp1ATI(exec, _mesa_ColorFragmentOp1ATI);
- SET_ColorFragmentOp2ATI(exec, _mesa_ColorFragmentOp2ATI);
- SET_ColorFragmentOp3ATI(exec, _mesa_ColorFragmentOp3ATI);
- SET_AlphaFragmentOp1ATI(exec, _mesa_AlphaFragmentOp1ATI);
- SET_AlphaFragmentOp2ATI(exec, _mesa_AlphaFragmentOp2ATI);
- SET_AlphaFragmentOp3ATI(exec, _mesa_AlphaFragmentOp3ATI);
- SET_SetFragmentShaderConstantATI(exec, _mesa_SetFragmentShaderConstantATI);
-#endif
-
-#if FEATURE_EXT_framebuffer_object
- SET_IsRenderbufferEXT(exec, _mesa_IsRenderbufferEXT);
- SET_BindRenderbufferEXT(exec, _mesa_BindRenderbufferEXT);
- SET_DeleteRenderbuffersEXT(exec, _mesa_DeleteRenderbuffersEXT);
- SET_GenRenderbuffersEXT(exec, _mesa_GenRenderbuffersEXT);
- SET_RenderbufferStorageEXT(exec, _mesa_RenderbufferStorageEXT);
- SET_GetRenderbufferParameterivEXT(exec, _mesa_GetRenderbufferParameterivEXT);
- SET_IsFramebufferEXT(exec, _mesa_IsFramebufferEXT);
- SET_BindFramebufferEXT(exec, _mesa_BindFramebufferEXT);
- SET_DeleteFramebuffersEXT(exec, _mesa_DeleteFramebuffersEXT);
- SET_GenFramebuffersEXT(exec, _mesa_GenFramebuffersEXT);
- SET_CheckFramebufferStatusEXT(exec, _mesa_CheckFramebufferStatusEXT);
- SET_FramebufferTexture1DEXT(exec, _mesa_FramebufferTexture1DEXT);
- SET_FramebufferTexture2DEXT(exec, _mesa_FramebufferTexture2DEXT);
- SET_FramebufferTexture3DEXT(exec, _mesa_FramebufferTexture3DEXT);
- SET_FramebufferRenderbufferEXT(exec, _mesa_FramebufferRenderbufferEXT);
- SET_GetFramebufferAttachmentParameterivEXT(exec, _mesa_GetFramebufferAttachmentParameterivEXT);
- SET_GenerateMipmapEXT(exec, _mesa_GenerateMipmapEXT);
-#endif
-
-#if FEATURE_EXT_timer_query
- SET_GetQueryObjecti64vEXT(exec, _mesa_GetQueryObjecti64vEXT);
- SET_GetQueryObjectui64vEXT(exec, _mesa_GetQueryObjectui64vEXT);
-#endif
-
-#if FEATURE_EXT_framebuffer_blit
- SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT);
-#endif
-
- /* GL_EXT_gpu_program_parameters */
-#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
- SET_ProgramEnvParameters4fvEXT(exec, _mesa_ProgramEnvParameters4fvEXT);
- SET_ProgramLocalParameters4fvEXT(exec, _mesa_ProgramLocalParameters4fvEXT);
-#endif
-
- /* GL_MESA_texture_array / GL_EXT_texture_array */
-#if FEATURE_EXT_framebuffer_object
- SET_FramebufferTextureLayerEXT(exec, _mesa_FramebufferTextureLayerEXT);
-#endif
-
- /* GL_ATI_separate_stencil */
- SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI);
-}
-
-
-
-/**********************************************************************/
-/** \name State update logic */
-/*@{*/
/**
@@ -1193,8 +414,10 @@ _mesa_update_state_locked( GLcontext *ctx )
if (new_state & _NEW_STENCIL)
_mesa_update_stencil( ctx );
+#if FEATURE_pixel_transfer
if (new_state & _IMAGE_NEW_TRANSFER_STATE)
_mesa_update_pixel( ctx, new_state );
+#endif
if (new_state & (_NEW_ARRAY | _NEW_PROGRAM))
update_arrays( ctx );
@@ -1209,18 +432,6 @@ _mesa_update_state_locked( GLcontext *ctx )
| _NEW_STENCIL | _DD_NEW_SEPARATE_SPECULAR))
update_tricaps( ctx, new_state );
- if (ctx->FragmentProgram._MaintainTexEnvProgram) {
- prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR);
- }
- if (ctx->VertexProgram._MaintainTnlProgram) {
- prog_flags |= (_NEW_TEXTURE | _NEW_TEXTURE_MATRIX |
- _NEW_TRANSFORM | _NEW_POINT |
- _NEW_FOG | _NEW_LIGHT);
- }
- if (new_state & prog_flags)
- update_program( ctx );
-
-
/* ctx->_NeedEyeCoords is now up to date.
*
* If the truth value of this variable has changed, update for the
@@ -1233,6 +444,20 @@ _mesa_update_state_locked( GLcontext *ctx )
if (new_state & _MESA_NEW_NEED_EYE_COORDS)
_mesa_update_tnl_spaces( ctx, new_state );
+ if (ctx->FragmentProgram._MaintainTexEnvProgram) {
+ prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR);
+ }
+ if (ctx->VertexProgram._MaintainTnlProgram) {
+ prog_flags |= (_NEW_TEXTURE | _NEW_TEXTURE_MATRIX |
+ _NEW_TRANSFORM | _NEW_POINT |
+ _NEW_FOG | _NEW_LIGHT |
+ _MESA_NEW_NEED_EYE_COORDS);
+ }
+ if (new_state & prog_flags)
+ update_program( ctx );
+
+
+
/*
* Give the driver a chance to act upon the new_state flags.
* The driver might plug in different span functions, for example.
@@ -1258,9 +483,3 @@ _mesa_update_state( GLcontext *ctx )
_mesa_update_state_locked(ctx);
_mesa_unlock_context_textures(ctx);
}
-
-
-
-/*@}*/
-
-
diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h
index 5240d4bf93..bb7cb8f32a 100644
--- a/src/mesa/main/state.h
+++ b/src/mesa/main/state.h
@@ -1,13 +1,8 @@
-/**
- * \file state.h
- * State management.
- */
-
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 7.1
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2008 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"),
@@ -34,9 +29,6 @@
#include "mtypes.h"
extern void
-_mesa_init_exec_table(struct _glapi_table *exec);
-
-extern void
_mesa_update_state( GLcontext *ctx );
/* As above but can only be called between _mesa_lock_context_textures() and
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index c44d594d68..5ad936419b 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -137,8 +137,10 @@ _mesa_compressed_texture_size( GLcontext *ctx,
ASSERT(depth == 1);
(void) depth;
+ (void) size;
switch (mesaFormat) {
+#if FEATURE_texture_fxt1
case MESA_FORMAT_RGB_FXT1:
case MESA_FORMAT_RGBA_FXT1:
/* round up width to next multiple of 8, height to next multiple of 4 */
@@ -152,6 +154,8 @@ _mesa_compressed_texture_size( GLcontext *ctx,
if (size < 16)
size = 16;
return size;
+#endif
+#if FEATURE_texture_s3tc
case MESA_FORMAT_RGB_DXT1:
case MESA_FORMAT_RGBA_DXT1:
/* round up width, height to next multiple of 4 */
@@ -178,6 +182,7 @@ _mesa_compressed_texture_size( GLcontext *ctx,
if (size < 16)
size = 16;
return size;
+#endif
default:
_mesa_problem(ctx, "bad mesaFormat in _mesa_compressed_texture_size");
return 0;
@@ -202,12 +207,15 @@ _mesa_compressed_texture_size_glenum(GLcontext *ctx,
GLuint mesaFormat;
switch (glformat) {
+#if FEATURE_texture_fxt1
case GL_COMPRESSED_RGB_FXT1_3DFX:
mesaFormat = MESA_FORMAT_RGB_FXT1;
break;
case GL_COMPRESSED_RGBA_FXT1_3DFX:
mesaFormat = MESA_FORMAT_RGBA_FXT1;
break;
+#endif
+#if FEATURE_texture_s3tc
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_RGB_S3TC:
mesaFormat = MESA_FORMAT_RGB_DXT1;
@@ -224,6 +232,7 @@ _mesa_compressed_texture_size_glenum(GLcontext *ctx,
case GL_RGBA4_S3TC:
mesaFormat = MESA_FORMAT_RGBA_DXT5;
break;
+#endif
default:
return 0;
}
@@ -245,10 +254,13 @@ _mesa_compressed_row_stride(GLuint mesaFormat, GLsizei width)
GLint stride;
switch (mesaFormat) {
+#if FEATURE_texture_fxt1
case MESA_FORMAT_RGB_FXT1:
case MESA_FORMAT_RGBA_FXT1:
stride = ((width + 7) / 8) * 16; /* 16 bytes per 8x4 tile */
break;
+#endif
+#if FEATURE_texture_s3tc
case MESA_FORMAT_RGB_DXT1:
case MESA_FORMAT_RGBA_DXT1:
stride = ((width + 3) / 4) * 8; /* 8 bytes per 4x4 tile */
@@ -257,6 +269,7 @@ _mesa_compressed_row_stride(GLuint mesaFormat, GLsizei width)
case MESA_FORMAT_RGBA_DXT5:
stride = ((width + 3) / 4) * 16; /* 16 bytes per 4x4 tile */
break;
+#endif
default:
_mesa_problem(NULL, "bad mesaFormat in _mesa_compressed_row_stride");
return 0;
@@ -293,10 +306,13 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img,
*/
switch (mesaFormat) {
+#if FEATURE_texture_fxt1
case MESA_FORMAT_RGB_FXT1:
case MESA_FORMAT_RGBA_FXT1:
addr = (GLubyte *) image + 16 * (((width + 7) / 8) * (row / 4) + col / 8);
break;
+#endif
+#if FEATURE_texture_s3tc
case MESA_FORMAT_RGB_DXT1:
case MESA_FORMAT_RGBA_DXT1:
addr = (GLubyte *) image + 8 * (((width + 3) / 4) * (row / 4) + col / 4);
@@ -305,6 +321,7 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img,
case MESA_FORMAT_RGBA_DXT5:
addr = (GLubyte *) image + 16 * (((width + 3) / 4) * (row / 4) + col / 4);
break;
+#endif
default:
_mesa_problem(NULL, "bad mesaFormat in _mesa_compressed_image_address");
addr = NULL;
diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c
new file mode 100644
index 0000000000..e072cea136
--- /dev/null
+++ b/src/mesa/main/texenv.c
@@ -0,0 +1,861 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file texenv.c
+ *
+ * glTexEnv-related functions
+ */
+
+
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/enums.h"
+#include "main/macros.h"
+#include "main/texenv.h"
+#include "math/m_xform.h"
+
+
+
+void GLAPIENTRY
+_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
+{
+ GLuint maxUnit;
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_texture_unit *texUnit;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
+ ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits;
+ if (ctx->Texture.CurrentUnit >= maxUnit) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexEnvfv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+#define TE_ERROR(errCode, msg, value) \
+ _mesa_error(ctx, errCode, msg, _mesa_lookup_enum_by_nr(value));
+
+ if (target == GL_TEXTURE_ENV) {
+ switch (pname) {
+ case GL_TEXTURE_ENV_MODE:
+ {
+ GLenum mode = (GLenum) (GLint) *param;
+ if (mode == GL_REPLACE_EXT)
+ mode = GL_REPLACE;
+ if (texUnit->EnvMode == mode)
+ return;
+ if (mode == GL_MODULATE ||
+ mode == GL_BLEND ||
+ mode == GL_DECAL ||
+ mode == GL_REPLACE ||
+ (mode == GL_ADD && ctx->Extensions.EXT_texture_env_add) ||
+ (mode == GL_COMBINE &&
+ (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine))) {
+ /* legal */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->EnvMode = mode;
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ }
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ {
+ GLfloat tmp[4];
+ tmp[0] = CLAMP( param[0], 0.0F, 1.0F );
+ tmp[1] = CLAMP( param[1], 0.0F, 1.0F );
+ tmp[2] = CLAMP( param[2], 0.0F, 1.0F );
+ tmp[3] = CLAMP( param[3], 0.0F, 1.0F );
+ if (TEST_EQ_4V(tmp, texUnit->EnvColor))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EnvColor, tmp);
+ }
+ break;
+ case GL_COMBINE_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum mode = (GLenum) (GLint) *param;
+ if (texUnit->Combine.ModeRGB == mode)
+ return;
+ switch (mode) {
+ case GL_REPLACE:
+ case GL_MODULATE:
+ case GL_ADD:
+ case GL_ADD_SIGNED:
+ case GL_INTERPOLATE:
+ /* OK */
+ break;
+ case GL_SUBTRACT:
+ if (!ctx->Extensions.ARB_texture_env_combine) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
+ case GL_DOT3_RGB_EXT:
+ case GL_DOT3_RGBA_EXT:
+ if (!ctx->Extensions.EXT_texture_env_dot3) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
+ case GL_DOT3_RGB:
+ case GL_DOT3_RGBA:
+ if (!ctx->Extensions.ARB_texture_env_dot3) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
+ case GL_MODULATE_ADD_ATI:
+ case GL_MODULATE_SIGNED_ADD_ATI:
+ case GL_MODULATE_SUBTRACT_ATI:
+ if (!ctx->Extensions.ATI_texture_env_combine3) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
+ default:
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.ModeRGB = mode;
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_COMBINE_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum mode = (GLenum) (GLint) *param;
+ if (texUnit->Combine.ModeA == mode)
+ return;
+ switch (mode) {
+ case GL_REPLACE:
+ case GL_MODULATE:
+ case GL_ADD:
+ case GL_ADD_SIGNED:
+ case GL_INTERPOLATE:
+ /* OK */
+ break;
+ case GL_SUBTRACT:
+ if (!ctx->Extensions.ARB_texture_env_combine) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
+ case GL_MODULATE_ADD_ATI:
+ case GL_MODULATE_SIGNED_ADD_ATI:
+ case GL_MODULATE_SUBTRACT_ATI:
+ if (!ctx->Extensions.ATI_texture_env_combine3) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ break;
+ default:
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
+ return;
+ }
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.ModeA = mode;
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_SOURCE0_RGB:
+ case GL_SOURCE1_RGB:
+ case GL_SOURCE2_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum source = (GLenum) (GLint) *param;
+ const GLuint s = pname - GL_SOURCE0_RGB;
+ if (texUnit->Combine.SourceRGB[s] == source)
+ return;
+ if (source == GL_TEXTURE ||
+ source == GL_CONSTANT ||
+ source == GL_PRIMARY_COLOR ||
+ source == GL_PREVIOUS ||
+ (ctx->Extensions.ARB_texture_env_crossbar &&
+ source >= GL_TEXTURE0 &&
+ source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) ||
+ (ctx->Extensions.ATI_texture_env_combine3 &&
+ (source == GL_ZERO || source == GL_ONE))) {
+ /* legal */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.SourceRGB[s] = source;
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source);
+ return;
+ }
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_SOURCE0_ALPHA:
+ case GL_SOURCE1_ALPHA:
+ case GL_SOURCE2_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum source = (GLenum) (GLint) *param;
+ const GLuint s = pname - GL_SOURCE0_ALPHA;
+ if (texUnit->Combine.SourceA[s] == source)
+ return;
+ if (source == GL_TEXTURE ||
+ source == GL_CONSTANT ||
+ source == GL_PRIMARY_COLOR ||
+ source == GL_PREVIOUS ||
+ (ctx->Extensions.ARB_texture_env_crossbar &&
+ source >= GL_TEXTURE0 &&
+ source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) ||
+ (ctx->Extensions.ATI_texture_env_combine3 &&
+ (source == GL_ZERO || source == GL_ONE))) {
+ /* legal */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.SourceA[s] = source;
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source);
+ return;
+ }
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_OPERAND0_RGB:
+ case GL_OPERAND1_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum operand = (GLenum) (GLint) *param;
+ const GLuint s = pname - GL_OPERAND0_RGB;
+ if (texUnit->Combine.OperandRGB[s] == operand)
+ return;
+ switch (operand) {
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.OperandRGB[s] = operand;
+ break;
+ default:
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
+ return;
+ }
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_OPERAND0_ALPHA:
+ case GL_OPERAND1_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum operand = (GLenum) (GLint) *param;
+ if (texUnit->Combine.OperandA[pname-GL_OPERAND0_ALPHA] == operand)
+ return;
+ switch (operand) {
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.OperandA[pname-GL_OPERAND0_ALPHA] = operand;
+ break;
+ default:
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
+ return;
+ }
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_OPERAND2_RGB:
+ if (ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum operand = (GLenum) (GLint) *param;
+ if (texUnit->Combine.OperandRGB[2] == operand)
+ return;
+ switch (operand) {
+ case GL_SRC_COLOR: /* ARB combine only */
+ case GL_ONE_MINUS_SRC_COLOR: /* ARB combine only */
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.OperandRGB[2] = operand;
+ break;
+ default:
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
+ return;
+ }
+ }
+ else if (ctx->Extensions.EXT_texture_env_combine) {
+ const GLenum operand = (GLenum) (GLint) *param;
+ if (texUnit->Combine.OperandRGB[2] == operand)
+ return;
+ /* operand must be GL_SRC_ALPHA which is the initial value - thus
+ don't need to actually compare the operand to the possible value */
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
+ return;
+ }
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_OPERAND2_ALPHA:
+ if (ctx->Extensions.ARB_texture_env_combine) {
+ const GLenum operand = (GLenum) (GLint) *param;
+ if (texUnit->Combine.OperandA[2] == operand)
+ return;
+ switch (operand) {
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.OperandA[2] = operand;
+ break;
+ default:
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
+ return;
+ }
+ }
+ else if (ctx->Extensions.EXT_texture_env_combine) {
+ const GLenum operand = (GLenum) (GLint) *param;
+ if (texUnit->Combine.OperandA[2] == operand)
+ return;
+ /* operand must be GL_SRC_ALPHA which is the initial value - thus
+ don't need to actually compare the operand to the possible value */
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
+ return;
+ }
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_RGB_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ GLuint newshift;
+ if (*param == 1.0) {
+ newshift = 0;
+ }
+ else if (*param == 2.0) {
+ newshift = 1;
+ }
+ else if (*param == 4.0) {
+ newshift = 2;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" );
+ return;
+ }
+ if (texUnit->Combine.ScaleShiftRGB == newshift)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.ScaleShiftRGB = newshift;
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ case GL_ALPHA_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ GLuint newshift;
+ if (*param == 1.0) {
+ newshift = 0;
+ }
+ else if (*param == 2.0) {
+ newshift = 1;
+ }
+ else if (*param == 4.0) {
+ newshift = 2;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_VALUE,
+ "glTexEnv(GL_ALPHA_SCALE not 1, 2 or 4)" );
+ return;
+ }
+ if (texUnit->Combine.ScaleShiftA == newshift)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Combine.ScaleShiftA = newshift;
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
+ return;
+ }
+ }
+ else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
+ /* GL_EXT_texture_lod_bias */
+ if (!ctx->Extensions.EXT_texture_lod_bias) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target );
+ return;
+ }
+ if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
+ if (texUnit->LodBias == param[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->LodBias = param[0];
+ }
+ else {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+ }
+ else if (target == GL_POINT_SPRITE_NV) {
+ /* GL_ARB_point_sprite / GL_NV_point_sprite */
+ if (!ctx->Extensions.NV_point_sprite
+ && !ctx->Extensions.ARB_point_sprite) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target );
+ return;
+ }
+ if (pname == GL_COORD_REPLACE_NV) {
+ const GLenum value = (GLenum) param[0];
+ if (value == GL_TRUE || value == GL_FALSE) {
+ /* It's kind of weird to set point state via glTexEnv,
+ * but that's what the spec calls for.
+ */
+ const GLboolean state = (GLboolean) value;
+ if (ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_POINT);
+ ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] = state;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", value);
+ return;
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname );
+ return;
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)",target );
+ return;
+ }
+
+ if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "glTexEnv %s %s %.1f(%s) ...\n",
+ _mesa_lookup_enum_by_nr(target),
+ _mesa_lookup_enum_by_nr(pname),
+ *param,
+ _mesa_lookup_enum_by_nr((GLenum) (GLint) *param));
+
+ /* Tell device driver about the new texture environment */
+ if (ctx->Driver.TexEnv) {
+ (*ctx->Driver.TexEnv)( ctx, target, pname, param );
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param )
+{
+ _mesa_TexEnvfv( target, pname, &param );
+}
+
+
+
+void GLAPIENTRY
+_mesa_TexEnvi( GLenum target, GLenum pname, GLint param )
+{
+ GLfloat p[4];
+ p[0] = (GLfloat) param;
+ p[1] = p[2] = p[3] = 0.0;
+ _mesa_TexEnvfv( target, pname, p );
+}
+
+
+void GLAPIENTRY
+_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param )
+{
+ GLfloat p[4];
+ if (pname == GL_TEXTURE_ENV_COLOR) {
+ p[0] = INT_TO_FLOAT( param[0] );
+ p[1] = INT_TO_FLOAT( param[1] );
+ p[2] = INT_TO_FLOAT( param[2] );
+ p[3] = INT_TO_FLOAT( param[3] );
+ }
+ else {
+ p[0] = (GLfloat) param[0];
+ p[1] = p[2] = p[3] = 0; /* init to zero, just to be safe */
+ }
+ _mesa_TexEnvfv( target, pname, p );
+}
+
+
+void GLAPIENTRY
+_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
+{
+ GLuint maxUnit;
+ const struct gl_texture_unit *texUnit;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
+ ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits;
+ if (ctx->Texture.CurrentUnit >= maxUnit) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnvfv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+ if (target == GL_TEXTURE_ENV) {
+ switch (pname) {
+ case GL_TEXTURE_ENV_MODE:
+ *params = ENUM_TO_FLOAT(texUnit->EnvMode);
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ COPY_4FV( params, texUnit->EnvColor );
+ break;
+ case GL_COMBINE_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.ModeRGB;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_COMBINE_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLfloat) texUnit->Combine.ModeA;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE0_RGB:
+ case GL_SOURCE1_RGB:
+ case GL_SOURCE2_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const unsigned rgb_idx = pname - GL_SOURCE0_RGB;
+ *params = (GLfloat) texUnit->Combine.SourceRGB[rgb_idx];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_SOURCE0_ALPHA:
+ case GL_SOURCE1_ALPHA:
+ case GL_SOURCE2_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const unsigned alpha_idx = pname - GL_SOURCE0_ALPHA;
+ *params = (GLfloat) texUnit->Combine.SourceA[alpha_idx];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND0_RGB:
+ case GL_OPERAND1_RGB:
+ case GL_OPERAND2_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const unsigned op_rgb = pname - GL_OPERAND0_RGB;
+ *params = (GLfloat) texUnit->Combine.OperandRGB[op_rgb];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_OPERAND0_ALPHA:
+ case GL_OPERAND1_ALPHA:
+ case GL_OPERAND2_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const unsigned op_alpha = pname - GL_OPERAND0_ALPHA;
+ *params = (GLfloat) texUnit->Combine.OperandA[op_alpha];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ }
+ break;
+ case GL_RGB_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->Combine.ScaleShiftRGB == 0)
+ *params = 1.0;
+ else if (texUnit->Combine.ScaleShiftRGB == 1)
+ *params = 2.0;
+ else
+ *params = 4.0;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ return;
+ }
+ break;
+ case GL_ALPHA_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->Combine.ScaleShiftA == 0)
+ *params = 1.0;
+ else if (texUnit->Combine.ScaleShiftA == 1)
+ *params = 2.0;
+ else
+ *params = 4.0;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
+ return;
+ }
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname=0x%x)", pname);
+ }
+ }
+ else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
+ /* GL_EXT_texture_lod_bias */
+ if (!ctx->Extensions.EXT_texture_lod_bias) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
+ return;
+ }
+ if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
+ *params = texUnit->LodBias;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
+ return;
+ }
+ }
+ else if (target == GL_POINT_SPRITE_NV) {
+ /* GL_ARB_point_sprite / GL_NV_point_sprite */
+ if (!ctx->Extensions.NV_point_sprite
+ && !ctx->Extensions.ARB_point_sprite) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
+ return;
+ }
+ if (pname == GL_COORD_REPLACE_NV) {
+ *params = (GLfloat) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
+ return;
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
+ return;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
+{
+ GLuint maxUnit;
+ const struct gl_texture_unit *texUnit;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
+ ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits;
+ if (ctx->Texture.CurrentUnit >= maxUnit) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnviv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+ if (target == GL_TEXTURE_ENV) {
+ switch (pname) {
+ case GL_TEXTURE_ENV_MODE:
+ *params = (GLint) texUnit->EnvMode;
+ break;
+ case GL_TEXTURE_ENV_COLOR:
+ params[0] = FLOAT_TO_INT( texUnit->EnvColor[0] );
+ params[1] = FLOAT_TO_INT( texUnit->EnvColor[1] );
+ params[2] = FLOAT_TO_INT( texUnit->EnvColor[2] );
+ params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] );
+ break;
+ case GL_COMBINE_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.ModeRGB;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_COMBINE_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ *params = (GLint) texUnit->Combine.ModeA;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE0_RGB:
+ case GL_SOURCE1_RGB:
+ case GL_SOURCE2_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const unsigned rgb_idx = pname - GL_SOURCE0_RGB;
+ *params = (GLint) texUnit->Combine.SourceRGB[rgb_idx];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_SOURCE0_ALPHA:
+ case GL_SOURCE1_ALPHA:
+ case GL_SOURCE2_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const unsigned alpha_idx = pname - GL_SOURCE0_ALPHA;
+ *params = (GLint) texUnit->Combine.SourceA[alpha_idx];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND0_RGB:
+ case GL_OPERAND1_RGB:
+ case GL_OPERAND2_RGB:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const unsigned op_rgb = pname - GL_OPERAND0_RGB;
+ *params = (GLint) texUnit->Combine.OperandRGB[op_rgb];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_OPERAND0_ALPHA:
+ case GL_OPERAND1_ALPHA:
+ case GL_OPERAND2_ALPHA:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ const unsigned op_alpha = pname - GL_OPERAND0_ALPHA;
+ *params = (GLint) texUnit->Combine.OperandA[op_alpha];
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ }
+ break;
+ case GL_RGB_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->Combine.ScaleShiftRGB == 0)
+ *params = 1;
+ else if (texUnit->Combine.ScaleShiftRGB == 1)
+ *params = 2;
+ else
+ *params = 4;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ return;
+ }
+ break;
+ case GL_ALPHA_SCALE:
+ if (ctx->Extensions.EXT_texture_env_combine ||
+ ctx->Extensions.ARB_texture_env_combine) {
+ if (texUnit->Combine.ScaleShiftA == 0)
+ *params = 1;
+ else if (texUnit->Combine.ScaleShiftA == 1)
+ *params = 2;
+ else
+ *params = 4;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
+ return;
+ }
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname=0x%x)",
+ pname);
+ }
+ }
+ else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
+ /* GL_EXT_texture_lod_bias */
+ if (!ctx->Extensions.EXT_texture_lod_bias) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
+ return;
+ }
+ if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
+ *params = (GLint) texUnit->LodBias;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );
+ return;
+ }
+ }
+ else if (target == GL_POINT_SPRITE_NV) {
+ /* GL_ARB_point_sprite / GL_NV_point_sprite */
+ if (!ctx->Extensions.NV_point_sprite
+ && !ctx->Extensions.ARB_point_sprite) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
+ return;
+ }
+ if (pname == GL_COORD_REPLACE_NV) {
+ *params = (GLint) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );
+ return;
+ }
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
+ return;
+ }
+}
+
+
diff --git a/src/mesa/main/texenv.h b/src/mesa/main/texenv.h
new file mode 100644
index 0000000000..bdff7fdb82
--- /dev/null
+++ b/src/mesa/main/texenv.h
@@ -0,0 +1,52 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef TEXENV_H
+#define TEXENV_H
+
+
+#include "main/glheader.h"
+
+
+extern void GLAPIENTRY
+_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params );
+
+extern void GLAPIENTRY
+_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param );
+
+extern void GLAPIENTRY
+_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param );
+
+extern void GLAPIENTRY
+_mesa_TexEnvi( GLenum target, GLenum pname, GLint param );
+
+extern void GLAPIENTRY
+_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param );
+
+
+#endif /* TEXENV_H */
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 644b1f39c7..6877ef96f2 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -904,14 +904,14 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit)
*/
if (alpha_shift || rgb_shift) {
if (rgb_shift == alpha_shift) {
- shift = register_scalar_const(p, 1<<rgb_shift);
+ shift = register_scalar_const(p, (GLfloat)(1<<rgb_shift));
}
else {
shift = register_const4f(p,
- 1<<rgb_shift,
- 1<<rgb_shift,
- 1<<rgb_shift,
- 1<<alpha_shift);
+ (GLfloat)(1<<rgb_shift),
+ (GLfloat)(1<<rgb_shift),
+ (GLfloat)(1<<rgb_shift),
+ (GLfloat)(1<<alpha_shift));
}
return emit_arith( p, OPCODE_MUL, dest, WRITEMASK_XYZW,
saturate, out, shift, undef );
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 88fbd8f07c..11e7755960 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -1207,6 +1207,30 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = {
store_texel_z24_s8 /* StoreTexel */
};
+const struct gl_texture_format _mesa_texformat_s8_z24 = {
+ MESA_FORMAT_S8_Z24, /* MesaFormat */
+ GL_DEPTH_STENCIL_EXT, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 24, /* DepthBits */
+ 8, /* StencilBits */
+ 4, /* TexelBytes */
+ _mesa_texstore_s8_z24, /* StoreTexImageFunc */
+ NULL, /* FetchTexel1D */
+ NULL, /* FetchTexel2D */
+ NULL, /* FetchTexel3D */
+ fetch_texel_1d_f_s8_z24, /* FetchTexel1Df */
+ fetch_texel_2d_f_s8_z24, /* FetchTexel2Df */
+ fetch_texel_3d_f_s8_z24, /* FetchTexel3Df */
+ store_texel_s8_z24 /* StoreTexel */
+};
+
const struct gl_texture_format _mesa_texformat_z16 = {
MESA_FORMAT_Z16, /* MesaFormat */
GL_DEPTH_COMPONENT, /* BaseFormat */
@@ -1421,21 +1445,27 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
case GL_COMPRESSED_INTENSITY_ARB:
return &_mesa_texformat_intensity;
case GL_COMPRESSED_RGB_ARB:
+#if FEATURE_texture_fxt1
if (ctx->Extensions.TDFX_texture_compression_FXT1)
return &_mesa_texformat_rgb_fxt1;
- else if (ctx->Extensions.EXT_texture_compression_s3tc ||
- ctx->Extensions.S3_s3tc)
+#endif
+#if FEATURE_texture_s3tc
+ if (ctx->Extensions.EXT_texture_compression_s3tc ||
+ ctx->Extensions.S3_s3tc)
return &_mesa_texformat_rgb_dxt1;
- else
- return &_mesa_texformat_rgb;
+#endif
+ return &_mesa_texformat_rgb;
case GL_COMPRESSED_RGBA_ARB:
+#if FEATURE_texture_fxt1
if (ctx->Extensions.TDFX_texture_compression_FXT1)
return &_mesa_texformat_rgba_fxt1;
- else if (ctx->Extensions.EXT_texture_compression_s3tc ||
- ctx->Extensions.S3_s3tc)
+#endif
+#if FEATURE_texture_s3tc
+ if (ctx->Extensions.EXT_texture_compression_s3tc ||
+ ctx->Extensions.S3_s3tc)
return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */
- else
- return &_mesa_texformat_rgba;
+#endif
+ return &_mesa_texformat_rgba;
default:
; /* fallthrough */
}
@@ -1450,6 +1480,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
}
}
+#if FEATURE_texture_fxt1
if (ctx->Extensions.TDFX_texture_compression_FXT1) {
switch (internalFormat) {
case GL_COMPRESSED_RGB_FXT1_3DFX:
@@ -1460,7 +1491,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
; /* fallthrough */
}
}
+#endif
+#if FEATURE_texture_s3tc
if (ctx->Extensions.EXT_texture_compression_s3tc) {
switch (internalFormat) {
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
@@ -1488,6 +1521,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
; /* fallthrough */
}
}
+#endif
if (ctx->Extensions.ARB_texture_float) {
switch (internalFormat) {
@@ -1640,6 +1674,11 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format,
*comps = 1; /* XXX OK? */
return;
+ case MESA_FORMAT_S8_Z24:
+ *datatype = GL_UNSIGNED_INT;
+ *comps = 1; /* XXX OK? */
+ return;
+
case MESA_FORMAT_Z16:
*datatype = GL_UNSIGNED_SHORT;
*comps = 1;
@@ -1650,6 +1689,7 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format,
*comps = 1;
return;
+#if FEATURE_EXT_texture_sRGB
case MESA_FORMAT_SRGB8:
*datatype = GL_UNSIGNED_BYTE;
*comps = 3;
@@ -1666,9 +1706,13 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format,
*datatype = GL_UNSIGNED_BYTE;
*comps = 2;
return;
+#endif
+#if FEATURE_texture_fxt1
case MESA_FORMAT_RGB_FXT1:
case MESA_FORMAT_RGBA_FXT1:
+#endif
+#if FEATURE_texture_s3tc
case MESA_FORMAT_RGB_DXT1:
case MESA_FORMAT_RGBA_DXT1:
case MESA_FORMAT_RGBA_DXT3:
@@ -1677,6 +1721,7 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format,
*datatype = GL_UNSIGNED_BYTE;
*comps = 0;
return;
+#endif
case MESA_FORMAT_RGBA:
*datatype = CHAN_TYPE;
diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h
index 48f0fe99f2..3b6d05612d 100644
--- a/src/mesa/main/texformat.h
+++ b/src/mesa/main/texformat.h
@@ -84,6 +84,7 @@ enum _format {
MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */
MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */
MESA_FORMAT_Z24_S8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
+ MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */
MESA_FORMAT_Z32, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
/*@}*/
@@ -104,12 +105,16 @@ enum _format {
* \name Compressed texture formats.
*/
/*@{*/
+#if FEATURE_texture_fxt1
MESA_FORMAT_RGB_FXT1,
MESA_FORMAT_RGBA_FXT1,
+#endif
+#if FEATURE_texture_s3tc
MESA_FORMAT_RGB_DXT1,
MESA_FORMAT_RGBA_DXT1,
MESA_FORMAT_RGBA_DXT3,
MESA_FORMAT_RGBA_DXT5,
+#endif
/*@}*/
/**
@@ -209,6 +214,7 @@ extern const struct gl_texture_format _mesa_texformat_l8;
extern const struct gl_texture_format _mesa_texformat_i8;
extern const struct gl_texture_format _mesa_texformat_ci8;
extern const struct gl_texture_format _mesa_texformat_z24_s8;
+extern const struct gl_texture_format _mesa_texformat_s8_z24;
extern const struct gl_texture_format _mesa_texformat_z16;
extern const struct gl_texture_format _mesa_texformat_z32;
/*@}*/
@@ -221,12 +227,16 @@ extern const struct gl_texture_format _mesa_texformat_ycbcr_rev;
/** \name Compressed formats */
/*@{*/
+#if FEATURE_texture_fxt1
extern const struct gl_texture_format _mesa_texformat_rgb_fxt1;
extern const struct gl_texture_format _mesa_texformat_rgba_fxt1;
+#endif
+#if FEATURE_texture_s3tc
extern const struct gl_texture_format _mesa_texformat_rgb_dxt1;
extern const struct gl_texture_format _mesa_texformat_rgba_dxt1;
extern const struct gl_texture_format _mesa_texformat_rgba_dxt3;
extern const struct gl_texture_format _mesa_texformat_rgba_dxt5;
+#endif
/*@}*/
/** \name The null format */
diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h
index 99785da1a0..63939f4011 100644
--- a/src/mesa/main/texformat_tmp.h
+++ b/src/mesa/main/texformat_tmp.h
@@ -1363,6 +1363,32 @@ static void store_texel_z24_s8(struct gl_texture_image *texImage,
#endif
+/* MESA_TEXFORMAT_S8_Z24 ***************************************************/
+
+static void FETCH(f_s8_z24)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* only return Z, not stencil data */
+ const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
+ texel[0] = ((*src) & 0x00ffffff) * scale;
+ ASSERT(texImage->TexFormat->MesaFormat == MESA_FORMAT_S8_Z24);
+ ASSERT(texel[0] >= 0.0F);
+ ASSERT(texel[0] <= 1.0F);
+}
+
+#if DIM == 3
+static void store_texel_s8_z24(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ /* only store Z, not stencil */
+ GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ GLfloat depth = *((GLfloat *) texel);
+ GLuint zi = (GLuint) (depth * 0xffffff);
+ *dst = zi | (*dst & 0xff000000);
+}
+#endif
+
#undef TEXEL_ADDR
#undef DIM
diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c
new file mode 100644
index 0000000000..244c7aaafc
--- /dev/null
+++ b/src/mesa/main/texgen.c
@@ -0,0 +1,601 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file texgen.c
+ *
+ * glTexGen-related functions
+ */
+
+
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/enums.h"
+#include "main/macros.h"
+#include "main/texgen.h"
+#include "math/m_xform.h"
+
+
+
+void GLAPIENTRY
+_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_texture_unit *texUnit;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n",
+ _mesa_lookup_enum_by_nr(coord),
+ _mesa_lookup_enum_by_nr(pname),
+ *params,
+ _mesa_lookup_enum_by_nr((GLenum) (GLint) *params));
+
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexGen(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+ switch (coord) {
+ case GL_S:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ GLenum mode = (GLenum) (GLint) *params;
+ GLbitfield bits;
+ switch (mode) {
+ case GL_OBJECT_LINEAR:
+ bits = TEXGEN_OBJ_LINEAR;
+ break;
+ case GL_EYE_LINEAR:
+ bits = TEXGEN_EYE_LINEAR;
+ break;
+ case GL_REFLECTION_MAP_NV:
+ bits = TEXGEN_REFLECTION_MAP_NV;
+ break;
+ case GL_NORMAL_MAP_NV:
+ bits = TEXGEN_NORMAL_MAP_NV;
+ break;
+ case GL_SPHERE_MAP:
+ bits = TEXGEN_SPHERE_MAP;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
+ if (texUnit->GenModeS == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->GenModeS = mode;
+ texUnit->_GenBitS = bits;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ if (TEST_EQ_4V(texUnit->ObjectPlaneS, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->ObjectPlaneS, params);
+ }
+ else if (pname==GL_EYE_PLANE) {
+ GLfloat tmp[4];
+ /* Transform plane equation by the inverse modelview matrix */
+ if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
+ }
+ _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
+ if (TEST_EQ_4V(texUnit->EyePlaneS, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EyePlaneS, tmp);
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
+ return;
+ }
+ break;
+ case GL_T:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ GLenum mode = (GLenum) (GLint) *params;
+ GLbitfield bitt;
+ switch (mode) {
+ case GL_OBJECT_LINEAR:
+ bitt = TEXGEN_OBJ_LINEAR;
+ break;
+ case GL_EYE_LINEAR:
+ bitt = TEXGEN_EYE_LINEAR;
+ break;
+ case GL_REFLECTION_MAP_NV:
+ bitt = TEXGEN_REFLECTION_MAP_NV;
+ break;
+ case GL_NORMAL_MAP_NV:
+ bitt = TEXGEN_NORMAL_MAP_NV;
+ break;
+ case GL_SPHERE_MAP:
+ bitt = TEXGEN_SPHERE_MAP;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
+ if (texUnit->GenModeT == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->GenModeT = mode;
+ texUnit->_GenBitT = bitt;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ if (TEST_EQ_4V(texUnit->ObjectPlaneT, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->ObjectPlaneT, params);
+ }
+ else if (pname==GL_EYE_PLANE) {
+ GLfloat tmp[4];
+ /* Transform plane equation by the inverse modelview matrix */
+ if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
+ }
+ _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
+ if (TEST_EQ_4V(texUnit->EyePlaneT, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EyePlaneT, tmp);
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
+ return;
+ }
+ break;
+ case GL_R:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ GLenum mode = (GLenum) (GLint) *params;
+ GLbitfield bitr;
+ switch (mode) {
+ case GL_OBJECT_LINEAR:
+ bitr = TEXGEN_OBJ_LINEAR;
+ break;
+ case GL_REFLECTION_MAP_NV:
+ bitr = TEXGEN_REFLECTION_MAP_NV;
+ break;
+ case GL_NORMAL_MAP_NV:
+ bitr = TEXGEN_NORMAL_MAP_NV;
+ break;
+ case GL_EYE_LINEAR:
+ bitr = TEXGEN_EYE_LINEAR;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
+ if (texUnit->GenModeR == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->GenModeR = mode;
+ texUnit->_GenBitR = bitr;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ if (TEST_EQ_4V(texUnit->ObjectPlaneR, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->ObjectPlaneR, params);
+ }
+ else if (pname==GL_EYE_PLANE) {
+ GLfloat tmp[4];
+ /* Transform plane equation by the inverse modelview matrix */
+ if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
+ }
+ _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
+ if (TEST_EQ_4V(texUnit->EyePlaneR, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EyePlaneR, tmp);
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
+ return;
+ }
+ break;
+ case GL_Q:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ GLenum mode = (GLenum) (GLint) *params;
+ GLbitfield bitq;
+ switch (mode) {
+ case GL_OBJECT_LINEAR:
+ bitq = TEXGEN_OBJ_LINEAR;
+ break;
+ case GL_EYE_LINEAR:
+ bitq = TEXGEN_EYE_LINEAR;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
+ if (texUnit->GenModeQ == mode)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->GenModeQ = mode;
+ texUnit->_GenBitQ = bitq;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ if (TEST_EQ_4V(texUnit->ObjectPlaneQ, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->ObjectPlaneQ, params);
+ }
+ else if (pname==GL_EYE_PLANE) {
+ GLfloat tmp[4];
+ /* Transform plane equation by the inverse modelview matrix */
+ if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
+ }
+ _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
+ if (TEST_EQ_4V(texUnit->EyePlaneQ, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texUnit->EyePlaneQ, tmp);
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(coord)" );
+ return;
+ }
+
+ if (ctx->Driver.TexGen)
+ ctx->Driver.TexGen( ctx, coord, pname, params );
+}
+
+
+void GLAPIENTRY
+_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
+{
+ GLfloat p[4];
+ p[0] = (GLfloat) params[0];
+ if (pname == GL_TEXTURE_GEN_MODE) {
+ p[1] = p[2] = p[3] = 0.0F;
+ }
+ else {
+ p[1] = (GLfloat) params[1];
+ p[2] = (GLfloat) params[2];
+ p[3] = (GLfloat) params[3];
+ }
+ _mesa_TexGenfv(coord, pname, p);
+}
+
+
+void GLAPIENTRY
+_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
+{
+ GLfloat p = (GLfloat) param;
+ _mesa_TexGenfv( coord, pname, &p );
+}
+
+
+void GLAPIENTRY
+_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params )
+{
+ GLfloat p[4];
+ p[0] = (GLfloat) params[0];
+ if (pname == GL_TEXTURE_GEN_MODE) {
+ p[1] = p[2] = p[3] = 0.0F;
+ }
+ else {
+ p[1] = (GLfloat) params[1];
+ p[2] = (GLfloat) params[2];
+ p[3] = (GLfloat) params[3];
+ }
+ _mesa_TexGenfv( coord, pname, p );
+}
+
+
+void GLAPIENTRY
+_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param )
+{
+ _mesa_TexGenfv(coord, pname, &param);
+}
+
+
+void GLAPIENTRY
+_mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
+{
+ _mesa_TexGeniv( coord, pname, &param );
+}
+
+
+
+void GLAPIENTRY
+_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
+{
+ const struct gl_texture_unit *texUnit;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+ switch (coord) {
+ case GL_S:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_DOUBLE(texUnit->GenModeS);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneS );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneS );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
+ return;
+ }
+ break;
+ case GL_T:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_DOUBLE(texUnit->GenModeT);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneT );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneT );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
+ return;
+ }
+ break;
+ case GL_R:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_DOUBLE(texUnit->GenModeR);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneR );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneR );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
+ return;
+ }
+ break;
+ case GL_Q:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_DOUBLE(texUnit->GenModeQ);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneQ );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneQ );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)" );
+ return;
+ }
+}
+
+
+
+void GLAPIENTRY
+_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
+{
+ const struct gl_texture_unit *texUnit;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+ switch (coord) {
+ case GL_S:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_FLOAT(texUnit->GenModeS);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneS );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneS );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
+ return;
+ }
+ break;
+ case GL_T:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_FLOAT(texUnit->GenModeT);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneT );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneT );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
+ return;
+ }
+ break;
+ case GL_R:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_FLOAT(texUnit->GenModeR);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneR );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneR );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
+ return;
+ }
+ break;
+ case GL_Q:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = ENUM_TO_FLOAT(texUnit->GenModeQ);
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ COPY_4V( params, texUnit->ObjectPlaneQ );
+ }
+ else if (pname==GL_EYE_PLANE) {
+ COPY_4V( params, texUnit->EyePlaneQ );
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)" );
+ return;
+ }
+}
+
+
+
+void GLAPIENTRY
+_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
+{
+ const struct gl_texture_unit *texUnit;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+ switch (coord) {
+ case GL_S:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = texUnit->GenModeS;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ params[0] = (GLint) texUnit->ObjectPlaneS[0];
+ params[1] = (GLint) texUnit->ObjectPlaneS[1];
+ params[2] = (GLint) texUnit->ObjectPlaneS[2];
+ params[3] = (GLint) texUnit->ObjectPlaneS[3];
+ }
+ else if (pname==GL_EYE_PLANE) {
+ params[0] = (GLint) texUnit->EyePlaneS[0];
+ params[1] = (GLint) texUnit->EyePlaneS[1];
+ params[2] = (GLint) texUnit->EyePlaneS[2];
+ params[3] = (GLint) texUnit->EyePlaneS[3];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
+ return;
+ }
+ break;
+ case GL_T:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = texUnit->GenModeT;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ params[0] = (GLint) texUnit->ObjectPlaneT[0];
+ params[1] = (GLint) texUnit->ObjectPlaneT[1];
+ params[2] = (GLint) texUnit->ObjectPlaneT[2];
+ params[3] = (GLint) texUnit->ObjectPlaneT[3];
+ }
+ else if (pname==GL_EYE_PLANE) {
+ params[0] = (GLint) texUnit->EyePlaneT[0];
+ params[1] = (GLint) texUnit->EyePlaneT[1];
+ params[2] = (GLint) texUnit->EyePlaneT[2];
+ params[3] = (GLint) texUnit->EyePlaneT[3];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
+ return;
+ }
+ break;
+ case GL_R:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = texUnit->GenModeR;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ params[0] = (GLint) texUnit->ObjectPlaneR[0];
+ params[1] = (GLint) texUnit->ObjectPlaneR[1];
+ params[2] = (GLint) texUnit->ObjectPlaneR[2];
+ params[3] = (GLint) texUnit->ObjectPlaneR[3];
+ }
+ else if (pname==GL_EYE_PLANE) {
+ params[0] = (GLint) texUnit->EyePlaneR[0];
+ params[1] = (GLint) texUnit->EyePlaneR[1];
+ params[2] = (GLint) texUnit->EyePlaneR[2];
+ params[3] = (GLint) texUnit->EyePlaneR[3];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
+ return;
+ }
+ break;
+ case GL_Q:
+ if (pname==GL_TEXTURE_GEN_MODE) {
+ params[0] = texUnit->GenModeQ;
+ }
+ else if (pname==GL_OBJECT_PLANE) {
+ params[0] = (GLint) texUnit->ObjectPlaneQ[0];
+ params[1] = (GLint) texUnit->ObjectPlaneQ[1];
+ params[2] = (GLint) texUnit->ObjectPlaneQ[2];
+ params[3] = (GLint) texUnit->ObjectPlaneQ[3];
+ }
+ else if (pname==GL_EYE_PLANE) {
+ params[0] = (GLint) texUnit->EyePlaneQ[0];
+ params[1] = (GLint) texUnit->EyePlaneQ[1];
+ params[2] = (GLint) texUnit->EyePlaneQ[2];
+ params[3] = (GLint) texUnit->EyePlaneQ[3];
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
+ return;
+ }
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)" );
+ return;
+ }
+}
+
+
diff --git a/src/mesa/main/texgen.h b/src/mesa/main/texgen.h
new file mode 100644
index 0000000000..073588efcd
--- /dev/null
+++ b/src/mesa/main/texgen.h
@@ -0,0 +1,62 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef TEXGEN_H
+#define TEXGEN_H
+
+
+#include "main/glheader.h"
+
+
+extern void GLAPIENTRY
+_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params );
+
+extern void GLAPIENTRY
+_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params );
+
+extern void GLAPIENTRY
+_mesa_TexGend( GLenum coord, GLenum pname, GLdouble param );
+
+extern void GLAPIENTRY
+_mesa_TexGendv( GLenum coord, GLenum pname, const GLdouble *params );
+
+extern void GLAPIENTRY
+_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param );
+
+extern void GLAPIENTRY
+_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_TexGeni( GLenum coord, GLenum pname, GLint param );
+
+extern void GLAPIENTRY
+_mesa_TexGeniv( GLenum coord, GLenum pname, const GLint *params );
+
+
+
+#endif /* TEXGEN_H */
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 384e145520..eed1937517 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -32,7 +32,9 @@
#include "glheader.h"
#include "bufferobj.h"
#include "context.h"
+#if FEATURE_convolve
#include "convolve.h"
+#endif
#include "fbobject.h"
#include "framebuffer.h"
#include "image.h"
@@ -2429,9 +2431,11 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+#if FEATURE_convolve
if (is_color_format(internalFormat)) {
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
}
+#endif
if (target == GL_TEXTURE_1D) {
/* non-proxy target */
@@ -2524,10 +2528,12 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+#if FEATURE_convolve
if (is_color_format(internalFormat)) {
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
&postConvHeight);
}
+#endif
if (target == GL_TEXTURE_2D ||
(ctx->Extensions.ARB_texture_cube_map &&
@@ -2746,10 +2752,12 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
+#if FEATURE_convolve
/* XXX should test internal format */
if (is_color_format(format)) {
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
}
+#endif
if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0,
postConvWidth, 1, 1, format, type)) {
@@ -2804,11 +2812,13 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
+#if FEATURE_convolve
/* XXX should test internal format */
if (is_color_format(format)) {
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
&postConvHeight);
}
+#endif
if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0,
postConvWidth, postConvHeight, 1, format, type)) {
@@ -2918,9 +2928,11 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
+#if FEATURE_convolve
if (is_color_format(internalFormat)) {
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
}
+#endif
if (copytexture_error_check(ctx, 1, target, level, internalFormat,
postConvWidth, 1, border))
@@ -2981,11 +2993,12 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
+#if FEATURE_convolve
if (is_color_format(internalFormat)) {
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
&postConvHeight);
}
-
+#endif
if (copytexture_error_check(ctx, 2, target, level, internalFormat,
postConvWidth, postConvHeight, border))
return;
@@ -3047,8 +3060,10 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
+#if FEATURE_convolve
/* XXX should test internal format */
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
+#endif
if (copytexsubimage_error_check(ctx, 1, target, level,
xoffset, 0, 0, postConvWidth, 1))
@@ -3100,8 +3115,10 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
+#if FEATURE_convolve
/* XXX should test internal format */
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight);
+#endif
if (copytexsubimage_error_check(ctx, 2, target, level, xoffset, yoffset, 0,
postConvWidth, postConvHeight))
@@ -3152,8 +3169,10 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
+#if FEATURE_convolve
/* XXX should test internal format */
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight);
+#endif
if (copytexsubimage_error_check(ctx, 3, target, level, xoffset, yoffset,
zoffset, postConvWidth, postConvHeight))
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index df64002f99..606e62d7a0 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -29,7 +29,9 @@
#include "glheader.h"
+#if FEATURE_colortable
#include "colortab.h"
+#endif
#include "context.h"
#include "enums.h"
#include "fbobject.h"
@@ -153,7 +155,9 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj )
(void) ctx;
+#if FEATURE_colortable
_mesa_free_colortable_data(&texObj->Palette);
+#endif
/* free the texture images */
for (face = 0; face < 6; face++) {
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
new file mode 100644
index 0000000000..af288c4e18
--- /dev/null
+++ b/src/mesa/main/texparam.c
@@ -0,0 +1,1035 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file texparam.c
+ *
+ * glTexParameter-related functions
+ */
+
+
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/enums.h"
+#include "main/colormac.h"
+#include "main/macros.h"
+#include "main/texcompress.h"
+#include "main/texparam.h"
+#include "main/teximage.h"
+
+
+/**
+ * Check if a coordinate wrap mode is supported for the texture target.
+ * \return GL_TRUE if legal, GL_FALSE otherwise
+ */
+static GLboolean
+validate_texture_wrap_mode(GLcontext * ctx, GLenum target, GLenum wrap)
+{
+ const struct gl_extensions * const e = & ctx->Extensions;
+
+ if (wrap == GL_CLAMP || wrap == GL_CLAMP_TO_EDGE ||
+ (wrap == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp)) {
+ /* any texture target */
+ return GL_TRUE;
+ }
+ else if (target != GL_TEXTURE_RECTANGLE_NV &&
+ (wrap == GL_REPEAT ||
+ (wrap == GL_MIRRORED_REPEAT &&
+ e->ARB_texture_mirrored_repeat) ||
+ (wrap == GL_MIRROR_CLAMP_EXT &&
+ (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) ||
+ (wrap == GL_MIRROR_CLAMP_TO_EDGE_EXT &&
+ (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) ||
+ (wrap == GL_MIRROR_CLAMP_TO_BORDER_EXT &&
+ (e->EXT_texture_mirror_clamp)))) {
+ /* non-rectangle texture */
+ return GL_TRUE;
+ }
+
+ _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ return GL_FALSE;
+}
+
+
+void GLAPIENTRY
+_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param )
+{
+ _mesa_TexParameterfv(target, pname, &param);
+}
+
+
+void GLAPIENTRY
+_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
+{
+ const GLenum eparam = (GLenum) (GLint) params[0];
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "glTexParameter %s %s %.1f(%s)...\n",
+ _mesa_lookup_enum_by_nr(target),
+ _mesa_lookup_enum_by_nr(pname),
+ *params,
+ _mesa_lookup_enum_by_nr(eparam));
+
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameterfv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+ switch (target) {
+ case GL_TEXTURE_1D:
+ texObj = texUnit->Current1D;
+ break;
+ case GL_TEXTURE_2D:
+ texObj = texUnit->Current2D;
+ break;
+ case GL_TEXTURE_3D:
+ texObj = texUnit->Current3D;
+ break;
+ case GL_TEXTURE_CUBE_MAP:
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
+ return;
+ }
+ texObj = texUnit->CurrentCubeMap;
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ if (!ctx->Extensions.NV_texture_rectangle) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
+ return;
+ }
+ texObj = texUnit->CurrentRect;
+ break;
+ case GL_TEXTURE_1D_ARRAY_EXT:
+ if (!ctx->Extensions.MESA_texture_array) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
+ return;
+ }
+ texObj = texUnit->Current1DArray;
+ break;
+ case GL_TEXTURE_2D_ARRAY_EXT:
+ if (!ctx->Extensions.MESA_texture_array) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
+ return;
+ }
+ texObj = texUnit->Current2DArray;
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
+ return;
+ }
+
+ switch (pname) {
+ case GL_TEXTURE_MIN_FILTER:
+ /* A small optimization */
+ if (texObj->MinFilter == eparam)
+ return;
+ if (eparam==GL_NEAREST || eparam==GL_LINEAR) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->MinFilter = eparam;
+ }
+ else if ((eparam==GL_NEAREST_MIPMAP_NEAREST ||
+ eparam==GL_LINEAR_MIPMAP_NEAREST ||
+ eparam==GL_NEAREST_MIPMAP_LINEAR ||
+ eparam==GL_LINEAR_MIPMAP_LINEAR) &&
+ texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->MinFilter = eparam;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ return;
+ }
+ break;
+ case GL_TEXTURE_MAG_FILTER:
+ /* A small optimization */
+ if (texObj->MagFilter == eparam)
+ return;
+
+ if (eparam==GL_NEAREST || eparam==GL_LINEAR) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->MagFilter = eparam;
+ }
+ else {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ return;
+ }
+ break;
+ case GL_TEXTURE_WRAP_S:
+ if (texObj->WrapS == eparam)
+ return;
+ if (validate_texture_wrap_mode(ctx, texObj->Target, eparam)) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->WrapS = eparam;
+ }
+ else {
+ return;
+ }
+ break;
+ case GL_TEXTURE_WRAP_T:
+ if (texObj->WrapT == eparam)
+ return;
+ if (validate_texture_wrap_mode(ctx, texObj->Target, eparam)) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->WrapT = eparam;
+ }
+ else {
+ return;
+ }
+ break;
+ case GL_TEXTURE_WRAP_R:
+ if (texObj->WrapR == eparam)
+ return;
+ if (validate_texture_wrap_mode(ctx, texObj->Target, eparam)) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->WrapR = eparam;
+ }
+ else {
+ return;
+ }
+ break;
+ case GL_TEXTURE_BORDER_COLOR:
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->BorderColor[RCOMP] = params[0];
+ texObj->BorderColor[GCOMP] = params[1];
+ texObj->BorderColor[BCOMP] = params[2];
+ texObj->BorderColor[ACOMP] = params[3];
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[RCOMP], params[0]);
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[GCOMP], params[1]);
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[BCOMP], params[2]);
+ UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[ACOMP], params[3]);
+ break;
+ case GL_TEXTURE_MIN_LOD:
+ if (texObj->MinLod == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->MinLod = params[0];
+ break;
+ case GL_TEXTURE_MAX_LOD:
+ if (texObj->MaxLod == params[0])
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->MaxLod = params[0];
+ break;
+ case GL_TEXTURE_BASE_LEVEL:
+ if (params[0] < 0.0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)");
+ return;
+ }
+ if (target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0.0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)");
+ return;
+ }
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->BaseLevel = (GLint) params[0];
+ break;
+ case GL_TEXTURE_MAX_LEVEL:
+ if (params[0] < 0.0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)");
+ return;
+ }
+ if (target == GL_TEXTURE_RECTANGLE_ARB) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(param)");
+ return;
+ }
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->MaxLevel = (GLint) params[0];
+ break;
+ case GL_TEXTURE_PRIORITY:
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->Priority = CLAMP( params[0], 0.0F, 1.0F );
+ break;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (ctx->Extensions.EXT_texture_filter_anisotropic) {
+ if (params[0] < 1.0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ return;
+ }
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ /* clamp to max, that's what NVIDIA does */
+ texObj->MaxAnisotropy = MIN2(params[0],
+ ctx->Const.MaxTextureMaxAnisotropy);
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)");
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_SGIX:
+ if (ctx->Extensions.SGIX_shadow) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->CompareFlag = params[0] ? GL_TRUE : GL_FALSE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_TEXTURE_COMPARE_SGIX)");
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
+ if (ctx->Extensions.SGIX_shadow) {
+ GLenum op = (GLenum) params[0];
+ if (op == GL_TEXTURE_LEQUAL_R_SGIX ||
+ op == GL_TEXTURE_GEQUAL_R_SGIX) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->CompareOperator = op;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)");
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_TEXTURE_COMPARE_OPERATOR_SGIX)");
+ return;
+ }
+ break;
+ case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+ if (ctx->Extensions.SGIX_shadow_ambient) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->ShadowAmbient = CLAMP(params[0], 0.0F, 1.0F);
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_SHADOW_AMBIENT_SGIX)");
+ return;
+ }
+ break;
+ case GL_GENERATE_MIPMAP_SGIS:
+ if (ctx->Extensions.SGIS_generate_mipmap) {
+ texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_GENERATE_MIPMAP_SGIS)");
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_MODE_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ const GLenum mode = (GLenum) params[0];
+ if (mode == GL_NONE || mode == GL_COMPARE_R_TO_TEXTURE_ARB) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->CompareMode = mode;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(bad GL_TEXTURE_COMPARE_MODE_ARB: 0x%x)", mode);
+ return;
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_TEXTURE_COMPARE_MODE_ARB)");
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_FUNC_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ const GLenum func = (GLenum) params[0];
+ if (func == GL_LEQUAL || func == GL_GEQUAL) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->CompareFunc = func;
+ }
+ else if (ctx->Extensions.EXT_shadow_funcs &&
+ (func == GL_EQUAL ||
+ func == GL_NOTEQUAL ||
+ func == GL_LESS ||
+ func == GL_GREATER ||
+ func == GL_ALWAYS ||
+ func == GL_NEVER)) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->CompareFunc = func;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(bad GL_TEXTURE_COMPARE_FUNC_ARB)");
+ return;
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_TEXTURE_COMPARE_FUNC_ARB)");
+ return;
+ }
+ break;
+ case GL_DEPTH_TEXTURE_MODE_ARB:
+ if (ctx->Extensions.ARB_depth_texture) {
+ const GLenum result = (GLenum) params[0];
+ if (result == GL_LUMINANCE || result == GL_INTENSITY
+ || result == GL_ALPHA) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->DepthMode = result;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(bad GL_DEPTH_TEXTURE_MODE_ARB)");
+ return;
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=GL_DEPTH_TEXTURE_MODE_ARB)");
+ return;
+ }
+ break;
+ case GL_TEXTURE_LOD_BIAS:
+ /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias*/
+ if (ctx->Extensions.EXT_texture_lod_bias) {
+ if (texObj->LodBias != params[0]) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->LodBias = params[0];
+ }
+ }
+ break;
+
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexParameter(pname=0x%x)", pname);
+ return;
+ }
+
+ texObj->_Complete = GL_FALSE;
+
+ if (ctx->Driver.TexParameter) {
+ (*ctx->Driver.TexParameter)( ctx, target, texObj, pname, params );
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_TexParameteri( GLenum target, GLenum pname, GLint param )
+{
+ GLfloat fparam[4];
+ if (pname == GL_TEXTURE_PRIORITY)
+ fparam[0] = INT_TO_FLOAT(param);
+ else
+ fparam[0] = (GLfloat) param;
+ fparam[1] = fparam[2] = fparam[3] = 0.0;
+ _mesa_TexParameterfv(target, pname, fparam);
+}
+
+
+void GLAPIENTRY
+_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params )
+{
+ GLfloat fparam[4];
+ if (pname == GL_TEXTURE_BORDER_COLOR) {
+ fparam[0] = INT_TO_FLOAT(params[0]);
+ fparam[1] = INT_TO_FLOAT(params[1]);
+ fparam[2] = INT_TO_FLOAT(params[2]);
+ fparam[3] = INT_TO_FLOAT(params[3]);
+ }
+ else {
+ if (pname == GL_TEXTURE_PRIORITY)
+ fparam[0] = INT_TO_FLOAT(params[0]);
+ else
+ fparam[0] = (GLfloat) params[0];
+ fparam[1] = fparam[2] = fparam[3] = 0.0F;
+ }
+ _mesa_TexParameterfv(target, pname, fparam);
+}
+
+
+void GLAPIENTRY
+_mesa_GetTexLevelParameterfv( GLenum target, GLint level,
+ GLenum pname, GLfloat *params )
+{
+ GLint iparam;
+ _mesa_GetTexLevelParameteriv( target, level, pname, &iparam );
+ *params = (GLfloat) iparam;
+}
+
+
+static GLuint
+tex_image_dimensions(GLcontext *ctx, GLenum target)
+{
+ switch (target) {
+ case GL_TEXTURE_1D:
+ case GL_PROXY_TEXTURE_1D:
+ return 1;
+ case GL_TEXTURE_2D:
+ case GL_PROXY_TEXTURE_2D:
+ return 2;
+ case GL_TEXTURE_3D:
+ case GL_PROXY_TEXTURE_3D:
+ return 3;
+ case GL_TEXTURE_CUBE_MAP:
+ case GL_PROXY_TEXTURE_CUBE_MAP:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ return ctx->Extensions.ARB_texture_cube_map ? 2 : 0;
+ case GL_TEXTURE_RECTANGLE_NV:
+ case GL_PROXY_TEXTURE_RECTANGLE_NV:
+ return ctx->Extensions.NV_texture_rectangle ? 2 : 0;
+ case GL_TEXTURE_1D_ARRAY_EXT:
+ case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
+ return ctx->Extensions.MESA_texture_array ? 2 : 0;
+ case GL_TEXTURE_2D_ARRAY_EXT:
+ case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
+ return ctx->Extensions.MESA_texture_array ? 3 : 0;
+ default:
+ _mesa_problem(ctx, "bad target in _mesa_tex_target_dimensions()");
+ return 0;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetTexLevelParameteriv( GLenum target, GLint level,
+ GLenum pname, GLint *params )
+{
+ const struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ const struct gl_texture_image *img = NULL;
+ GLuint dimensions;
+ GLboolean isProxy;
+ GLint maxLevels;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetTexLevelParameteriv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+ /* this will catch bad target values */
+ dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */
+ if (dimensions == 0) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)");
+ return;
+ }
+
+ maxLevels = _mesa_max_texture_levels(ctx, target);
+ if (maxLevels == 0) {
+ /* should not happen since <target> was just checked above */
+ _mesa_problem(ctx, "maxLevels=0 in _mesa_GetTexLevelParameter");
+ return;
+ }
+
+ if (level < 0 || level >= maxLevels) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" );
+ return;
+ }
+
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ _mesa_lock_texture(ctx, texObj);
+
+ img = _mesa_select_tex_image(ctx, texObj, target, level);
+ if (!img || !img->TexFormat) {
+ /* undefined texture image */
+ if (pname == GL_TEXTURE_COMPONENTS)
+ *params = 1;
+ else
+ *params = 0;
+ goto out;
+ }
+
+ isProxy = _mesa_is_proxy_texture(target);
+
+ switch (pname) {
+ case GL_TEXTURE_WIDTH:
+ *params = img->Width;
+ break;
+ case GL_TEXTURE_HEIGHT:
+ *params = img->Height;
+ break;
+ case GL_TEXTURE_DEPTH:
+ *params = img->Depth;
+ break;
+ case GL_TEXTURE_INTERNAL_FORMAT:
+ *params = img->InternalFormat;
+ break;
+ case GL_TEXTURE_BORDER:
+ *params = img->Border;
+ break;
+ case GL_TEXTURE_RED_SIZE:
+ if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
+ *params = img->TexFormat->RedBits;
+ else
+ *params = 0;
+ break;
+ case GL_TEXTURE_GREEN_SIZE:
+ if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
+ *params = img->TexFormat->GreenBits;
+ else
+ *params = 0;
+ break;
+ case GL_TEXTURE_BLUE_SIZE:
+ if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
+ *params = img->TexFormat->BlueBits;
+ else
+ *params = 0;
+ break;
+ case GL_TEXTURE_ALPHA_SIZE:
+ if (img->_BaseFormat == GL_ALPHA ||
+ img->_BaseFormat == GL_LUMINANCE_ALPHA ||
+ img->_BaseFormat == GL_RGBA)
+ *params = img->TexFormat->AlphaBits;
+ else
+ *params = 0;
+ break;
+ case GL_TEXTURE_INTENSITY_SIZE:
+ if (img->_BaseFormat != GL_INTENSITY)
+ *params = 0;
+ else if (img->TexFormat->IntensityBits > 0)
+ *params = img->TexFormat->IntensityBits;
+ else /* intensity probably stored as rgb texture */
+ *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
+ break;
+ case GL_TEXTURE_LUMINANCE_SIZE:
+ if (img->_BaseFormat != GL_LUMINANCE &&
+ img->_BaseFormat != GL_LUMINANCE_ALPHA)
+ *params = 0;
+ else if (img->TexFormat->LuminanceBits > 0)
+ *params = img->TexFormat->LuminanceBits;
+ else /* luminance probably stored as rgb texture */
+ *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
+ break;
+ case GL_TEXTURE_INDEX_SIZE_EXT:
+ if (img->_BaseFormat == GL_COLOR_INDEX)
+ *params = img->TexFormat->IndexBits;
+ else
+ *params = 0;
+ break;
+ case GL_TEXTURE_DEPTH_SIZE_ARB:
+ if (ctx->Extensions.SGIX_depth_texture ||
+ ctx->Extensions.ARB_depth_texture)
+ *params = img->TexFormat->DepthBits;
+ else
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ break;
+ case GL_TEXTURE_STENCIL_SIZE_EXT:
+ if (ctx->Extensions.EXT_packed_depth_stencil) {
+ *params = img->TexFormat->StencilBits;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ break;
+
+ /* GL_ARB_texture_compression */
+ case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
+ if (ctx->Extensions.ARB_texture_compression) {
+ if (img->IsCompressed && !isProxy) {
+ /* Don't use ctx->Driver.CompressedTextureSize() since that
+ * may returned a padded hardware size.
+ */
+ *params = _mesa_compressed_texture_size(ctx, img->Width,
+ img->Height, img->Depth,
+ img->TexFormat->MesaFormat);
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ break;
+ case GL_TEXTURE_COMPRESSED:
+ if (ctx->Extensions.ARB_texture_compression) {
+ *params = (GLint) img->IsCompressed;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ break;
+
+ /* GL_ARB_texture_float */
+ case GL_TEXTURE_RED_TYPE_ARB:
+ if (ctx->Extensions.ARB_texture_float) {
+ *params = img->TexFormat->RedBits ? img->TexFormat->DataType : GL_NONE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ break;
+ case GL_TEXTURE_GREEN_TYPE_ARB:
+ if (ctx->Extensions.ARB_texture_float) {
+ *params = img->TexFormat->GreenBits ? img->TexFormat->DataType : GL_NONE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ break;
+ case GL_TEXTURE_BLUE_TYPE_ARB:
+ if (ctx->Extensions.ARB_texture_float) {
+ *params = img->TexFormat->BlueBits ? img->TexFormat->DataType : GL_NONE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ break;
+ case GL_TEXTURE_ALPHA_TYPE_ARB:
+ if (ctx->Extensions.ARB_texture_float) {
+ *params = img->TexFormat->AlphaBits ? img->TexFormat->DataType : GL_NONE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ break;
+ case GL_TEXTURE_LUMINANCE_TYPE_ARB:
+ if (ctx->Extensions.ARB_texture_float) {
+ *params = img->TexFormat->LuminanceBits ? img->TexFormat->DataType : GL_NONE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ break;
+ case GL_TEXTURE_INTENSITY_TYPE_ARB:
+ if (ctx->Extensions.ARB_texture_float) {
+ *params = img->TexFormat->IntensityBits ? img->TexFormat->DataType : GL_NONE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ break;
+ case GL_TEXTURE_DEPTH_TYPE_ARB:
+ if (ctx->Extensions.ARB_texture_float) {
+ *params = img->TexFormat->DepthBits ? img->TexFormat->DataType : GL_NONE;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ break;
+
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+
+ out:
+ _mesa_unlock_texture(ctx, texObj);
+}
+
+
+
+void GLAPIENTRY
+_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
+{
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *obj;
+ GLboolean error = GL_FALSE;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetTexParameterfv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+ obj = _mesa_select_tex_object(ctx, texUnit, target);
+ if (!obj) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)");
+ return;
+ }
+
+ _mesa_lock_texture(ctx, obj);
+ switch (pname) {
+ case GL_TEXTURE_MAG_FILTER:
+ *params = ENUM_TO_FLOAT(obj->MagFilter);
+ break;
+ case GL_TEXTURE_MIN_FILTER:
+ *params = ENUM_TO_FLOAT(obj->MinFilter);
+ break;
+ case GL_TEXTURE_WRAP_S:
+ *params = ENUM_TO_FLOAT(obj->WrapS);
+ break;
+ case GL_TEXTURE_WRAP_T:
+ *params = ENUM_TO_FLOAT(obj->WrapT);
+ break;
+ case GL_TEXTURE_WRAP_R:
+ *params = ENUM_TO_FLOAT(obj->WrapR);
+ break;
+ case GL_TEXTURE_BORDER_COLOR:
+ params[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F);
+ params[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F);
+ params[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F);
+ params[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F);
+ break;
+ case GL_TEXTURE_RESIDENT:
+ {
+ GLboolean resident;
+ if (ctx->Driver.IsTextureResident)
+ resident = ctx->Driver.IsTextureResident(ctx, obj);
+ else
+ resident = GL_TRUE;
+ *params = ENUM_TO_FLOAT(resident);
+ }
+ break;
+ case GL_TEXTURE_PRIORITY:
+ *params = obj->Priority;
+ break;
+ case GL_TEXTURE_MIN_LOD:
+ *params = obj->MinLod;
+ break;
+ case GL_TEXTURE_MAX_LOD:
+ *params = obj->MaxLod;
+ break;
+ case GL_TEXTURE_BASE_LEVEL:
+ *params = (GLfloat) obj->BaseLevel;
+ break;
+ case GL_TEXTURE_MAX_LEVEL:
+ *params = (GLfloat) obj->MaxLevel;
+ break;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (ctx->Extensions.EXT_texture_filter_anisotropic) {
+ *params = obj->MaxAnisotropy;
+ }
+ else
+ error = 1;
+ break;
+ case GL_TEXTURE_COMPARE_SGIX:
+ if (ctx->Extensions.SGIX_shadow) {
+ *params = (GLfloat) obj->CompareFlag;
+ }
+ else
+ error = 1;
+ break;
+ case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
+ if (ctx->Extensions.SGIX_shadow) {
+ *params = (GLfloat) obj->CompareOperator;
+ }
+ else
+ error = 1;
+ break;
+ case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+ if (ctx->Extensions.SGIX_shadow_ambient) {
+ *params = obj->ShadowAmbient;
+ }
+ else
+ error = 1;
+ break;
+ case GL_GENERATE_MIPMAP_SGIS:
+ if (ctx->Extensions.SGIS_generate_mipmap) {
+ *params = (GLfloat) obj->GenerateMipmap;
+ }
+ else
+ error = 1;
+ break;
+ case GL_TEXTURE_COMPARE_MODE_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ *params = (GLfloat) obj->CompareMode;
+ }
+ else
+ error = 1;
+ break;
+ case GL_TEXTURE_COMPARE_FUNC_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ *params = (GLfloat) obj->CompareFunc;
+ }
+ else
+ error = 1;
+ break;
+ case GL_DEPTH_TEXTURE_MODE_ARB:
+ if (ctx->Extensions.ARB_depth_texture) {
+ *params = (GLfloat) obj->DepthMode;
+ }
+ else
+ error = 1;
+ break;
+ case GL_TEXTURE_LOD_BIAS:
+ if (ctx->Extensions.EXT_texture_lod_bias) {
+ *params = obj->LodBias;
+ }
+ else
+ error = 1;
+ break;
+ default:
+ error = 1;
+ break;
+ }
+ if (error)
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname=0x%x)",
+ pname);
+
+ _mesa_unlock_texture(ctx, obj);
+}
+
+
+void GLAPIENTRY
+_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
+{
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *obj;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetTexParameteriv(current unit)");
+ return;
+ }
+
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+ obj = _mesa_select_tex_object(ctx, texUnit, target);
+ if (!obj) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_TEXTURE_MAG_FILTER:
+ *params = (GLint) obj->MagFilter;
+ return;
+ case GL_TEXTURE_MIN_FILTER:
+ *params = (GLint) obj->MinFilter;
+ return;
+ case GL_TEXTURE_WRAP_S:
+ *params = (GLint) obj->WrapS;
+ return;
+ case GL_TEXTURE_WRAP_T:
+ *params = (GLint) obj->WrapT;
+ return;
+ case GL_TEXTURE_WRAP_R:
+ *params = (GLint) obj->WrapR;
+ return;
+ case GL_TEXTURE_BORDER_COLOR:
+ {
+ GLfloat b[4];
+ b[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F);
+ b[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F);
+ b[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F);
+ b[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F);
+ params[0] = FLOAT_TO_INT(b[0]);
+ params[1] = FLOAT_TO_INT(b[1]);
+ params[2] = FLOAT_TO_INT(b[2]);
+ params[3] = FLOAT_TO_INT(b[3]);
+ }
+ return;
+ case GL_TEXTURE_RESIDENT:
+ {
+ GLboolean resident;
+ if (ctx->Driver.IsTextureResident)
+ resident = ctx->Driver.IsTextureResident(ctx, obj);
+ else
+ resident = GL_TRUE;
+ *params = (GLint) resident;
+ }
+ return;
+ case GL_TEXTURE_PRIORITY:
+ *params = FLOAT_TO_INT(obj->Priority);
+ return;
+ case GL_TEXTURE_MIN_LOD:
+ *params = (GLint) obj->MinLod;
+ return;
+ case GL_TEXTURE_MAX_LOD:
+ *params = (GLint) obj->MaxLod;
+ return;
+ case GL_TEXTURE_BASE_LEVEL:
+ *params = obj->BaseLevel;
+ return;
+ case GL_TEXTURE_MAX_LEVEL:
+ *params = obj->MaxLevel;
+ return;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (ctx->Extensions.EXT_texture_filter_anisotropic) {
+ *params = (GLint) obj->MaxAnisotropy;
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_SGIX:
+ if (ctx->Extensions.SGIX_shadow) {
+ *params = (GLint) obj->CompareFlag;
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
+ if (ctx->Extensions.SGIX_shadow) {
+ *params = (GLint) obj->CompareOperator;
+ return;
+ }
+ break;
+ case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+ if (ctx->Extensions.SGIX_shadow_ambient) {
+ *params = (GLint) FLOAT_TO_INT(obj->ShadowAmbient);
+ return;
+ }
+ break;
+ case GL_GENERATE_MIPMAP_SGIS:
+ if (ctx->Extensions.SGIS_generate_mipmap) {
+ *params = (GLint) obj->GenerateMipmap;
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_MODE_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ *params = (GLint) obj->CompareMode;
+ return;
+ }
+ break;
+ case GL_TEXTURE_COMPARE_FUNC_ARB:
+ if (ctx->Extensions.ARB_shadow) {
+ *params = (GLint) obj->CompareFunc;
+ return;
+ }
+ break;
+ case GL_DEPTH_TEXTURE_MODE_ARB:
+ if (ctx->Extensions.ARB_depth_texture) {
+ *params = (GLint) obj->DepthMode;
+ return;
+ }
+ break;
+ case GL_TEXTURE_LOD_BIAS:
+ if (ctx->Extensions.EXT_texture_lod_bias) {
+ *params = (GLint) obj->LodBias;
+ return;
+ }
+ break;
+ default:
+ ; /* silence warnings */
+ }
+ /* If we get here, pname was an unrecognized enum */
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname=0x%x)", pname);
+}
diff --git a/src/mesa/main/texparam.h b/src/mesa/main/texparam.h
new file mode 100644
index 0000000000..454b96350e
--- /dev/null
+++ b/src/mesa/main/texparam.h
@@ -0,0 +1,63 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef TEXPARAM_H
+#define TEXPARAM_H
+
+
+#include "main/glheader.h"
+
+
+extern void GLAPIENTRY
+_mesa_GetTexLevelParameterfv( GLenum target, GLint level,
+ GLenum pname, GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_GetTexLevelParameteriv( GLenum target, GLint level,
+ GLenum pname, GLint *params );
+
+extern void GLAPIENTRY
+_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params );
+
+
+
+extern void GLAPIENTRY
+_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param );
+
+
+extern void GLAPIENTRY
+_mesa_TexParameteri( GLenum target, GLenum pname, GLint param );
+
+extern void GLAPIENTRY
+_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params );
+
+
+#endif /* TEXPARAM_H */
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 84acfbd92c..421f912849 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -30,7 +30,9 @@
#include "glheader.h"
#include "colormac.h"
+#if FEATURE_colortable
#include "colortab.h"
+#endif
#include "context.h"
#include "enums.h"
#include "macros.h"
@@ -43,9 +45,6 @@
#include "math/m_xform.h"
-#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X))
-#define ENUM_TO_DOUBLE(X) ((GLdouble)(GLint)(X))
-
/**
* Default texture combine environment state. This is used to initialize
@@ -319,2396 +318,6 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
}
-void GLAPIENTRY
-_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
-{
- GLuint maxUnit;
- GET_CURRENT_CONTEXT(ctx);
- struct gl_texture_unit *texUnit;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
- ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits;
- if (ctx->Texture.CurrentUnit >= maxUnit) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexEnvfv(current unit)");
- return;
- }
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
-
-#define TE_ERROR(errCode, msg, value) \
- _mesa_error(ctx, errCode, msg, _mesa_lookup_enum_by_nr(value));
-
- if (target == GL_TEXTURE_ENV) {
- switch (pname) {
- case GL_TEXTURE_ENV_MODE:
- {
- GLenum mode = (GLenum) (GLint) *param;
- if (mode == GL_REPLACE_EXT)
- mode = GL_REPLACE;
- if (texUnit->EnvMode == mode)
- return;
- if (mode == GL_MODULATE ||
- mode == GL_BLEND ||
- mode == GL_DECAL ||
- mode == GL_REPLACE ||
- (mode == GL_ADD && ctx->Extensions.EXT_texture_env_add) ||
- (mode == GL_COMBINE &&
- (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine))) {
- /* legal */
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->EnvMode = mode;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
- return;
- }
- }
- break;
- case GL_TEXTURE_ENV_COLOR:
- {
- GLfloat tmp[4];
- tmp[0] = CLAMP( param[0], 0.0F, 1.0F );
- tmp[1] = CLAMP( param[1], 0.0F, 1.0F );
- tmp[2] = CLAMP( param[2], 0.0F, 1.0F );
- tmp[3] = CLAMP( param[3], 0.0F, 1.0F );
- if (TEST_EQ_4V(tmp, texUnit->EnvColor))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texUnit->EnvColor, tmp);
- }
- break;
- case GL_COMBINE_RGB:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const GLenum mode = (GLenum) (GLint) *param;
- if (texUnit->Combine.ModeRGB == mode)
- return;
- switch (mode) {
- case GL_REPLACE:
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED:
- case GL_INTERPOLATE:
- /* OK */
- break;
- case GL_SUBTRACT:
- if (!ctx->Extensions.ARB_texture_env_combine) {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
- return;
- }
- break;
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGBA_EXT:
- if (!ctx->Extensions.EXT_texture_env_dot3) {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
- return;
- }
- break;
- case GL_DOT3_RGB:
- case GL_DOT3_RGBA:
- if (!ctx->Extensions.ARB_texture_env_dot3) {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
- return;
- }
- break;
- case GL_MODULATE_ADD_ATI:
- case GL_MODULATE_SIGNED_ADD_ATI:
- case GL_MODULATE_SUBTRACT_ATI:
- if (!ctx->Extensions.ATI_texture_env_combine3) {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
- return;
- }
- break;
- default:
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
- return;
- }
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->Combine.ModeRGB = mode;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
- break;
- case GL_COMBINE_ALPHA:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const GLenum mode = (GLenum) (GLint) *param;
- if (texUnit->Combine.ModeA == mode)
- return;
- switch (mode) {
- case GL_REPLACE:
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED:
- case GL_INTERPOLATE:
- /* OK */
- break;
- case GL_SUBTRACT:
- if (!ctx->Extensions.ARB_texture_env_combine) {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
- return;
- }
- break;
- case GL_MODULATE_ADD_ATI:
- case GL_MODULATE_SIGNED_ADD_ATI:
- case GL_MODULATE_SUBTRACT_ATI:
- if (!ctx->Extensions.ATI_texture_env_combine3) {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
- return;
- }
- break;
- default:
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
- return;
- }
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->Combine.ModeA = mode;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
- break;
- case GL_SOURCE0_RGB:
- case GL_SOURCE1_RGB:
- case GL_SOURCE2_RGB:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const GLenum source = (GLenum) (GLint) *param;
- const GLuint s = pname - GL_SOURCE0_RGB;
- if (texUnit->Combine.SourceRGB[s] == source)
- return;
- if (source == GL_TEXTURE ||
- source == GL_CONSTANT ||
- source == GL_PRIMARY_COLOR ||
- source == GL_PREVIOUS ||
- (ctx->Extensions.ARB_texture_env_crossbar &&
- source >= GL_TEXTURE0 &&
- source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) ||
- (ctx->Extensions.ATI_texture_env_combine3 &&
- (source == GL_ZERO || source == GL_ONE))) {
- /* legal */
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->Combine.SourceRGB[s] = source;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source);
- return;
- }
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
- break;
- case GL_SOURCE0_ALPHA:
- case GL_SOURCE1_ALPHA:
- case GL_SOURCE2_ALPHA:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const GLenum source = (GLenum) (GLint) *param;
- const GLuint s = pname - GL_SOURCE0_ALPHA;
- if (texUnit->Combine.SourceA[s] == source)
- return;
- if (source == GL_TEXTURE ||
- source == GL_CONSTANT ||
- source == GL_PRIMARY_COLOR ||
- source == GL_PREVIOUS ||
- (ctx->Extensions.ARB_texture_env_crossbar &&
- source >= GL_TEXTURE0 &&
- source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) ||
- (ctx->Extensions.ATI_texture_env_combine3 &&
- (source == GL_ZERO || source == GL_ONE))) {
- /* legal */
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->Combine.SourceA[s] = source;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source);
- return;
- }
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
- break;
- case GL_OPERAND0_RGB:
- case GL_OPERAND1_RGB:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const GLenum operand = (GLenum) (GLint) *param;
- const GLuint s = pname - GL_OPERAND0_RGB;
- if (texUnit->Combine.OperandRGB[s] == operand)
- return;
- switch (operand) {
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->Combine.OperandRGB[s] = operand;
- break;
- default:
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
- return;
- }
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
- break;
- case GL_OPERAND0_ALPHA:
- case GL_OPERAND1_ALPHA:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const GLenum operand = (GLenum) (GLint) *param;
- if (texUnit->Combine.OperandA[pname-GL_OPERAND0_ALPHA] == operand)
- return;
- switch (operand) {
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->Combine.OperandA[pname-GL_OPERAND0_ALPHA] = operand;
- break;
- default:
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
- return;
- }
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
- break;
- case GL_OPERAND2_RGB:
- if (ctx->Extensions.ARB_texture_env_combine) {
- const GLenum operand = (GLenum) (GLint) *param;
- if (texUnit->Combine.OperandRGB[2] == operand)
- return;
- switch (operand) {
- case GL_SRC_COLOR: /* ARB combine only */
- case GL_ONE_MINUS_SRC_COLOR: /* ARB combine only */
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->Combine.OperandRGB[2] = operand;
- break;
- default:
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
- return;
- }
- }
- else if (ctx->Extensions.EXT_texture_env_combine) {
- const GLenum operand = (GLenum) (GLint) *param;
- if (texUnit->Combine.OperandRGB[2] == operand)
- return;
- /* operand must be GL_SRC_ALPHA which is the initial value - thus
- don't need to actually compare the operand to the possible value */
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
- return;
- }
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
- break;
- case GL_OPERAND2_ALPHA:
- if (ctx->Extensions.ARB_texture_env_combine) {
- const GLenum operand = (GLenum) (GLint) *param;
- if (texUnit->Combine.OperandA[2] == operand)
- return;
- switch (operand) {
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->Combine.OperandA[2] = operand;
- break;
- default:
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
- return;
- }
- }
- else if (ctx->Extensions.EXT_texture_env_combine) {
- const GLenum operand = (GLenum) (GLint) *param;
- if (texUnit->Combine.OperandA[2] == operand)
- return;
- /* operand must be GL_SRC_ALPHA which is the initial value - thus
- don't need to actually compare the operand to the possible value */
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand);
- return;
- }
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
- break;
- case GL_RGB_SCALE:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- GLuint newshift;
- if (*param == 1.0) {
- newshift = 0;
- }
- else if (*param == 2.0) {
- newshift = 1;
- }
- else if (*param == 4.0) {
- newshift = 2;
- }
- else {
- _mesa_error( ctx, GL_INVALID_VALUE,
- "glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" );
- return;
- }
- if (texUnit->Combine.ScaleShiftRGB == newshift)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->Combine.ScaleShiftRGB = newshift;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
- break;
- case GL_ALPHA_SCALE:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- GLuint newshift;
- if (*param == 1.0) {
- newshift = 0;
- }
- else if (*param == 2.0) {
- newshift = 1;
- }
- else if (*param == 4.0) {
- newshift = 2;
- }
- else {
- _mesa_error( ctx, GL_INVALID_VALUE,
- "glTexEnv(GL_ALPHA_SCALE not 1, 2 or 4)" );
- return;
- }
- if (texUnit->Combine.ScaleShiftA == newshift)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->Combine.ScaleShiftA = newshift;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
- return;
- }
- }
- else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
- /* GL_EXT_texture_lod_bias */
- if (!ctx->Extensions.EXT_texture_lod_bias) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target );
- return;
- }
- if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
- if (texUnit->LodBias == param[0])
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->LodBias = param[0];
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
- }
- else if (target == GL_POINT_SPRITE_NV) {
- /* GL_ARB_point_sprite / GL_NV_point_sprite */
- if (!ctx->Extensions.NV_point_sprite
- && !ctx->Extensions.ARB_point_sprite) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target );
- return;
- }
- if (pname == GL_COORD_REPLACE_NV) {
- const GLenum value = (GLenum) param[0];
- if (value == GL_TRUE || value == GL_FALSE) {
- /* It's kind of weird to set point state via glTexEnv,
- * but that's what the spec calls for.
- */
- const GLboolean state = (GLboolean) value;
- if (ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] == state)
- return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] = state;
- }
- else {
- _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", value);
- return;
- }
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname );
- return;
- }
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)",target );
- return;
- }
-
- if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx, "glTexEnv %s %s %.1f(%s) ...\n",
- _mesa_lookup_enum_by_nr(target),
- _mesa_lookup_enum_by_nr(pname),
- *param,
- _mesa_lookup_enum_by_nr((GLenum) (GLint) *param));
-
- /* Tell device driver about the new texture environment */
- if (ctx->Driver.TexEnv) {
- (*ctx->Driver.TexEnv)( ctx, target, pname, param );
- }
-}
-
-
-void GLAPIENTRY
-_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param )
-{
- _mesa_TexEnvfv( target, pname, &param );
-}
-
-
-
-void GLAPIENTRY
-_mesa_TexEnvi( GLenum target, GLenum pname, GLint param )
-{
- GLfloat p[4];
- p[0] = (GLfloat) param;
- p[1] = p[2] = p[3] = 0.0;
- _mesa_TexEnvfv( target, pname, p );
-}
-
-
-void GLAPIENTRY
-_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param )
-{
- GLfloat p[4];
- if (pname == GL_TEXTURE_ENV_COLOR) {
- p[0] = INT_TO_FLOAT( param[0] );
- p[1] = INT_TO_FLOAT( param[1] );
- p[2] = INT_TO_FLOAT( param[2] );
- p[3] = INT_TO_FLOAT( param[3] );
- }
- else {
- p[0] = (GLfloat) param[0];
- p[1] = p[2] = p[3] = 0; /* init to zero, just to be safe */
- }
- _mesa_TexEnvfv( target, pname, p );
-}
-
-
-void GLAPIENTRY
-_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
-{
- GLuint maxUnit;
- const struct gl_texture_unit *texUnit;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
- ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits;
- if (ctx->Texture.CurrentUnit >= maxUnit) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnvfv(current unit)");
- return;
- }
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
-
- if (target == GL_TEXTURE_ENV) {
- switch (pname) {
- case GL_TEXTURE_ENV_MODE:
- *params = ENUM_TO_FLOAT(texUnit->EnvMode);
- break;
- case GL_TEXTURE_ENV_COLOR:
- COPY_4FV( params, texUnit->EnvColor );
- break;
- case GL_COMBINE_RGB:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->Combine.ModeRGB;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_COMBINE_ALPHA:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLfloat) texUnit->Combine.ModeA;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE0_RGB:
- case GL_SOURCE1_RGB:
- case GL_SOURCE2_RGB:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const unsigned rgb_idx = pname - GL_SOURCE0_RGB;
- *params = (GLfloat) texUnit->Combine.SourceRGB[rgb_idx];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_SOURCE0_ALPHA:
- case GL_SOURCE1_ALPHA:
- case GL_SOURCE2_ALPHA:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const unsigned alpha_idx = pname - GL_SOURCE0_ALPHA;
- *params = (GLfloat) texUnit->Combine.SourceA[alpha_idx];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND0_RGB:
- case GL_OPERAND1_RGB:
- case GL_OPERAND2_RGB:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const unsigned op_rgb = pname - GL_OPERAND0_RGB;
- *params = (GLfloat) texUnit->Combine.OperandRGB[op_rgb];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_OPERAND0_ALPHA:
- case GL_OPERAND1_ALPHA:
- case GL_OPERAND2_ALPHA:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const unsigned op_alpha = pname - GL_OPERAND0_ALPHA;
- *params = (GLfloat) texUnit->Combine.OperandA[op_alpha];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
- case GL_RGB_SCALE:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- if (texUnit->Combine.ScaleShiftRGB == 0)
- *params = 1.0;
- else if (texUnit->Combine.ScaleShiftRGB == 1)
- *params = 2.0;
- else
- *params = 4.0;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- return;
- }
- break;
- case GL_ALPHA_SCALE:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- if (texUnit->Combine.ScaleShiftA == 0)
- *params = 1.0;
- else if (texUnit->Combine.ScaleShiftA == 1)
- *params = 2.0;
- else
- *params = 4.0;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- return;
- }
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname=0x%x)", pname);
- }
- }
- else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
- /* GL_EXT_texture_lod_bias */
- if (!ctx->Extensions.EXT_texture_lod_bias) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
- return;
- }
- if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
- *params = texUnit->LodBias;
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
- return;
- }
- }
- else if (target == GL_POINT_SPRITE_NV) {
- /* GL_ARB_point_sprite / GL_NV_point_sprite */
- if (!ctx->Extensions.NV_point_sprite
- && !ctx->Extensions.ARB_point_sprite) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
- return;
- }
- if (pname == GL_COORD_REPLACE_NV) {
- *params = (GLfloat) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit];
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
- return;
- }
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
- return;
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
-{
- GLuint maxUnit;
- const struct gl_texture_unit *texUnit;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
- ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits;
- if (ctx->Texture.CurrentUnit >= maxUnit) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnviv(current unit)");
- return;
- }
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
-
- if (target == GL_TEXTURE_ENV) {
- switch (pname) {
- case GL_TEXTURE_ENV_MODE:
- *params = (GLint) texUnit->EnvMode;
- break;
- case GL_TEXTURE_ENV_COLOR:
- params[0] = FLOAT_TO_INT( texUnit->EnvColor[0] );
- params[1] = FLOAT_TO_INT( texUnit->EnvColor[1] );
- params[2] = FLOAT_TO_INT( texUnit->EnvColor[2] );
- params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] );
- break;
- case GL_COMBINE_RGB:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->Combine.ModeRGB;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_COMBINE_ALPHA:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- *params = (GLint) texUnit->Combine.ModeA;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_SOURCE0_RGB:
- case GL_SOURCE1_RGB:
- case GL_SOURCE2_RGB:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const unsigned rgb_idx = pname - GL_SOURCE0_RGB;
- *params = (GLint) texUnit->Combine.SourceRGB[rgb_idx];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_SOURCE0_ALPHA:
- case GL_SOURCE1_ALPHA:
- case GL_SOURCE2_ALPHA:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const unsigned alpha_idx = pname - GL_SOURCE0_ALPHA;
- *params = (GLint) texUnit->Combine.SourceA[alpha_idx];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_OPERAND0_RGB:
- case GL_OPERAND1_RGB:
- case GL_OPERAND2_RGB:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const unsigned op_rgb = pname - GL_OPERAND0_RGB;
- *params = (GLint) texUnit->Combine.OperandRGB[op_rgb];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_OPERAND0_ALPHA:
- case GL_OPERAND1_ALPHA:
- case GL_OPERAND2_ALPHA:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- const unsigned op_alpha = pname - GL_OPERAND0_ALPHA;
- *params = (GLint) texUnit->Combine.OperandA[op_alpha];
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- }
- break;
- case GL_RGB_SCALE:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- if (texUnit->Combine.ScaleShiftRGB == 0)
- *params = 1;
- else if (texUnit->Combine.ScaleShiftRGB == 1)
- *params = 2;
- else
- *params = 4;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- return;
- }
- break;
- case GL_ALPHA_SCALE:
- if (ctx->Extensions.EXT_texture_env_combine ||
- ctx->Extensions.ARB_texture_env_combine) {
- if (texUnit->Combine.ScaleShiftA == 0)
- *params = 1;
- else if (texUnit->Combine.ScaleShiftA == 1)
- *params = 2;
- else
- *params = 4;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)");
- return;
- }
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname=0x%x)",
- pname);
- }
- }
- else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
- /* GL_EXT_texture_lod_bias */
- if (!ctx->Extensions.EXT_texture_lod_bias) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
- return;
- }
- if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
- *params = (GLint) texUnit->LodBias;
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );
- return;
- }
- }
- else if (target == GL_POINT_SPRITE_NV) {
- /* GL_ARB_point_sprite / GL_NV_point_sprite */
- if (!ctx->Extensions.NV_point_sprite
- && !ctx->Extensions.ARB_point_sprite) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
- return;
- }
- if (pname == GL_COORD_REPLACE_NV) {
- *params = (GLint) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit];
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );
- return;
- }
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
- return;
- }
-}
-
-
-
-
-/**********************************************************************/
-/* Texture Parameters */
-/**********************************************************************/
-
-/**
- * Check if a coordinate wrap mode is supported for the texture target.
- * \return GL_TRUE if legal, GL_FALSE otherwise
- */
-static GLboolean
-validate_texture_wrap_mode(GLcontext * ctx, GLenum target, GLenum wrap)
-{
- const struct gl_extensions * const e = & ctx->Extensions;
-
- if (wrap == GL_CLAMP || wrap == GL_CLAMP_TO_EDGE ||
- (wrap == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp)) {
- /* any texture target */
- return GL_TRUE;
- }
- else if (target != GL_TEXTURE_RECTANGLE_NV &&
- (wrap == GL_REPEAT ||
- (wrap == GL_MIRRORED_REPEAT &&
- e->ARB_texture_mirrored_repeat) ||
- (wrap == GL_MIRROR_CLAMP_EXT &&
- (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) ||
- (wrap == GL_MIRROR_CLAMP_TO_EDGE_EXT &&
- (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) ||
- (wrap == GL_MIRROR_CLAMP_TO_BORDER_EXT &&
- (e->EXT_texture_mirror_clamp)))) {
- /* non-rectangle texture */
- return GL_TRUE;
- }
-
- _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
- return GL_FALSE;
-}
-
-
-void GLAPIENTRY
-_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param )
-{
- _mesa_TexParameterfv(target, pname, &param);
-}
-
-
-void GLAPIENTRY
-_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
-{
- const GLenum eparam = (GLenum) (GLint) params[0];
- struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx, "glTexParameter %s %s %.1f(%s)...\n",
- _mesa_lookup_enum_by_nr(target),
- _mesa_lookup_enum_by_nr(pname),
- *params,
- _mesa_lookup_enum_by_nr(eparam));
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameterfv(current unit)");
- return;
- }
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
-
- switch (target) {
- case GL_TEXTURE_1D:
- texObj = texUnit->Current1D;
- break;
- case GL_TEXTURE_2D:
- texObj = texUnit->Current2D;
- break;
- case GL_TEXTURE_3D:
- texObj = texUnit->Current3D;
- break;
- case GL_TEXTURE_CUBE_MAP:
- if (!ctx->Extensions.ARB_texture_cube_map) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
- return;
- }
- texObj = texUnit->CurrentCubeMap;
- break;
- case GL_TEXTURE_RECTANGLE_NV:
- if (!ctx->Extensions.NV_texture_rectangle) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
- return;
- }
- texObj = texUnit->CurrentRect;
- break;
- case GL_TEXTURE_1D_ARRAY_EXT:
- if (!ctx->Extensions.MESA_texture_array) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
- return;
- }
- texObj = texUnit->Current1DArray;
- break;
- case GL_TEXTURE_2D_ARRAY_EXT:
- if (!ctx->Extensions.MESA_texture_array) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
- return;
- }
- texObj = texUnit->Current2DArray;
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
- return;
- }
-
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- /* A small optimization */
- if (texObj->MinFilter == eparam)
- return;
- if (eparam==GL_NEAREST || eparam==GL_LINEAR) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->MinFilter = eparam;
- }
- else if ((eparam==GL_NEAREST_MIPMAP_NEAREST ||
- eparam==GL_LINEAR_MIPMAP_NEAREST ||
- eparam==GL_NEAREST_MIPMAP_LINEAR ||
- eparam==GL_LINEAR_MIPMAP_LINEAR) &&
- texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->MinFilter = eparam;
- }
- else {
- _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
- return;
- }
- break;
- case GL_TEXTURE_MAG_FILTER:
- /* A small optimization */
- if (texObj->MagFilter == eparam)
- return;
-
- if (eparam==GL_NEAREST || eparam==GL_LINEAR) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->MagFilter = eparam;
- }
- else {
- _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
- return;
- }
- break;
- case GL_TEXTURE_WRAP_S:
- if (texObj->WrapS == eparam)
- return;
- if (validate_texture_wrap_mode(ctx, texObj->Target, eparam)) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->WrapS = eparam;
- }
- else {
- return;
- }
- break;
- case GL_TEXTURE_WRAP_T:
- if (texObj->WrapT == eparam)
- return;
- if (validate_texture_wrap_mode(ctx, texObj->Target, eparam)) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->WrapT = eparam;
- }
- else {
- return;
- }
- break;
- case GL_TEXTURE_WRAP_R:
- if (texObj->WrapR == eparam)
- return;
- if (validate_texture_wrap_mode(ctx, texObj->Target, eparam)) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->WrapR = eparam;
- }
- else {
- return;
- }
- break;
- case GL_TEXTURE_BORDER_COLOR:
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->BorderColor[RCOMP] = params[0];
- texObj->BorderColor[GCOMP] = params[1];
- texObj->BorderColor[BCOMP] = params[2];
- texObj->BorderColor[ACOMP] = params[3];
- UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[RCOMP], params[0]);
- UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[GCOMP], params[1]);
- UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[BCOMP], params[2]);
- UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[ACOMP], params[3]);
- break;
- case GL_TEXTURE_MIN_LOD:
- if (texObj->MinLod == params[0])
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->MinLod = params[0];
- break;
- case GL_TEXTURE_MAX_LOD:
- if (texObj->MaxLod == params[0])
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->MaxLod = params[0];
- break;
- case GL_TEXTURE_BASE_LEVEL:
- if (params[0] < 0.0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)");
- return;
- }
- if (target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0.0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)");
- return;
- }
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->BaseLevel = (GLint) params[0];
- break;
- case GL_TEXTURE_MAX_LEVEL:
- if (params[0] < 0.0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)");
- return;
- }
- if (target == GL_TEXTURE_RECTANGLE_ARB) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(param)");
- return;
- }
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->MaxLevel = (GLint) params[0];
- break;
- case GL_TEXTURE_PRIORITY:
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->Priority = CLAMP( params[0], 0.0F, 1.0F );
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if (ctx->Extensions.EXT_texture_filter_anisotropic) {
- if (params[0] < 1.0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
- return;
- }
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- /* clamp to max, that's what NVIDIA does */
- texObj->MaxAnisotropy = MIN2(params[0],
- ctx->Const.MaxTextureMaxAnisotropy);
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)");
- return;
- }
- break;
- case GL_TEXTURE_COMPARE_SGIX:
- if (ctx->Extensions.SGIX_shadow) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->CompareFlag = params[0] ? GL_TRUE : GL_FALSE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(pname=GL_TEXTURE_COMPARE_SGIX)");
- return;
- }
- break;
- case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
- if (ctx->Extensions.SGIX_shadow) {
- GLenum op = (GLenum) params[0];
- if (op == GL_TEXTURE_LEQUAL_R_SGIX ||
- op == GL_TEXTURE_GEQUAL_R_SGIX) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->CompareOperator = op;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)");
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(pname=GL_TEXTURE_COMPARE_OPERATOR_SGIX)");
- return;
- }
- break;
- case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
- if (ctx->Extensions.SGIX_shadow_ambient) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->ShadowAmbient = CLAMP(params[0], 0.0F, 1.0F);
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(pname=GL_SHADOW_AMBIENT_SGIX)");
- return;
- }
- break;
- case GL_GENERATE_MIPMAP_SGIS:
- if (ctx->Extensions.SGIS_generate_mipmap) {
- texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(pname=GL_GENERATE_MIPMAP_SGIS)");
- return;
- }
- break;
- case GL_TEXTURE_COMPARE_MODE_ARB:
- if (ctx->Extensions.ARB_shadow) {
- const GLenum mode = (GLenum) params[0];
- if (mode == GL_NONE || mode == GL_COMPARE_R_TO_TEXTURE_ARB) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->CompareMode = mode;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(bad GL_TEXTURE_COMPARE_MODE_ARB: 0x%x)", mode);
- return;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(pname=GL_TEXTURE_COMPARE_MODE_ARB)");
- return;
- }
- break;
- case GL_TEXTURE_COMPARE_FUNC_ARB:
- if (ctx->Extensions.ARB_shadow) {
- const GLenum func = (GLenum) params[0];
- if (func == GL_LEQUAL || func == GL_GEQUAL) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->CompareFunc = func;
- }
- else if (ctx->Extensions.EXT_shadow_funcs &&
- (func == GL_EQUAL ||
- func == GL_NOTEQUAL ||
- func == GL_LESS ||
- func == GL_GREATER ||
- func == GL_ALWAYS ||
- func == GL_NEVER)) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->CompareFunc = func;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(bad GL_TEXTURE_COMPARE_FUNC_ARB)");
- return;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(pname=GL_TEXTURE_COMPARE_FUNC_ARB)");
- return;
- }
- break;
- case GL_DEPTH_TEXTURE_MODE_ARB:
- if (ctx->Extensions.ARB_depth_texture) {
- const GLenum result = (GLenum) params[0];
- if (result == GL_LUMINANCE || result == GL_INTENSITY
- || result == GL_ALPHA) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->DepthMode = result;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(bad GL_DEPTH_TEXTURE_MODE_ARB)");
- return;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(pname=GL_DEPTH_TEXTURE_MODE_ARB)");
- return;
- }
- break;
- case GL_TEXTURE_LOD_BIAS:
- /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias*/
- if (ctx->Extensions.EXT_texture_lod_bias) {
- if (texObj->LodBias != params[0]) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->LodBias = params[0];
- }
- }
- break;
-
- default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(pname=0x%x)", pname);
- return;
- }
-
- texObj->_Complete = GL_FALSE;
-
- if (ctx->Driver.TexParameter) {
- (*ctx->Driver.TexParameter)( ctx, target, texObj, pname, params );
- }
-}
-
-
-void GLAPIENTRY
-_mesa_TexParameteri( GLenum target, GLenum pname, GLint param )
-{
- GLfloat fparam[4];
- if (pname == GL_TEXTURE_PRIORITY)
- fparam[0] = INT_TO_FLOAT(param);
- else
- fparam[0] = (GLfloat) param;
- fparam[1] = fparam[2] = fparam[3] = 0.0;
- _mesa_TexParameterfv(target, pname, fparam);
-}
-
-
-void GLAPIENTRY
-_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params )
-{
- GLfloat fparam[4];
- if (pname == GL_TEXTURE_BORDER_COLOR) {
- fparam[0] = INT_TO_FLOAT(params[0]);
- fparam[1] = INT_TO_FLOAT(params[1]);
- fparam[2] = INT_TO_FLOAT(params[2]);
- fparam[3] = INT_TO_FLOAT(params[3]);
- }
- else {
- if (pname == GL_TEXTURE_PRIORITY)
- fparam[0] = INT_TO_FLOAT(params[0]);
- else
- fparam[0] = (GLfloat) params[0];
- fparam[1] = fparam[2] = fparam[3] = 0.0F;
- }
- _mesa_TexParameterfv(target, pname, fparam);
-}
-
-
-void GLAPIENTRY
-_mesa_GetTexLevelParameterfv( GLenum target, GLint level,
- GLenum pname, GLfloat *params )
-{
- GLint iparam;
- _mesa_GetTexLevelParameteriv( target, level, pname, &iparam );
- *params = (GLfloat) iparam;
-}
-
-
-static GLuint
-tex_image_dimensions(GLcontext *ctx, GLenum target)
-{
- switch (target) {
- case GL_TEXTURE_1D:
- case GL_PROXY_TEXTURE_1D:
- return 1;
- case GL_TEXTURE_2D:
- case GL_PROXY_TEXTURE_2D:
- return 2;
- case GL_TEXTURE_3D:
- case GL_PROXY_TEXTURE_3D:
- return 3;
- case GL_TEXTURE_CUBE_MAP:
- case GL_PROXY_TEXTURE_CUBE_MAP:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- return ctx->Extensions.ARB_texture_cube_map ? 2 : 0;
- case GL_TEXTURE_RECTANGLE_NV:
- case GL_PROXY_TEXTURE_RECTANGLE_NV:
- return ctx->Extensions.NV_texture_rectangle ? 2 : 0;
- case GL_TEXTURE_1D_ARRAY_EXT:
- case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
- return ctx->Extensions.MESA_texture_array ? 2 : 0;
- case GL_TEXTURE_2D_ARRAY_EXT:
- case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
- return ctx->Extensions.MESA_texture_array ? 3 : 0;
- default:
- _mesa_problem(ctx, "bad target in _mesa_tex_target_dimensions()");
- return 0;
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetTexLevelParameteriv( GLenum target, GLint level,
- GLenum pname, GLint *params )
-{
- const struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
- const struct gl_texture_image *img = NULL;
- GLuint dimensions;
- GLboolean isProxy;
- GLint maxLevels;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTexLevelParameteriv(current unit)");
- return;
- }
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
-
- /* this will catch bad target values */
- dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */
- if (dimensions == 0) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)");
- return;
- }
-
- maxLevels = _mesa_max_texture_levels(ctx, target);
- if (maxLevels == 0) {
- /* should not happen since <target> was just checked above */
- _mesa_problem(ctx, "maxLevels=0 in _mesa_GetTexLevelParameter");
- return;
- }
-
- if (level < 0 || level >= maxLevels) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" );
- return;
- }
-
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
- _mesa_lock_texture(ctx, texObj);
-
- img = _mesa_select_tex_image(ctx, texObj, target, level);
- if (!img || !img->TexFormat) {
- /* undefined texture image */
- if (pname == GL_TEXTURE_COMPONENTS)
- *params = 1;
- else
- *params = 0;
- goto out;
- }
-
- isProxy = _mesa_is_proxy_texture(target);
-
- switch (pname) {
- case GL_TEXTURE_WIDTH:
- *params = img->Width;
- break;
- case GL_TEXTURE_HEIGHT:
- *params = img->Height;
- break;
- case GL_TEXTURE_DEPTH:
- *params = img->Depth;
- break;
- case GL_TEXTURE_INTERNAL_FORMAT:
- *params = img->InternalFormat;
- break;
- case GL_TEXTURE_BORDER:
- *params = img->Border;
- break;
- case GL_TEXTURE_RED_SIZE:
- if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
- *params = img->TexFormat->RedBits;
- else
- *params = 0;
- break;
- case GL_TEXTURE_GREEN_SIZE:
- if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
- *params = img->TexFormat->GreenBits;
- else
- *params = 0;
- break;
- case GL_TEXTURE_BLUE_SIZE:
- if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
- *params = img->TexFormat->BlueBits;
- else
- *params = 0;
- break;
- case GL_TEXTURE_ALPHA_SIZE:
- if (img->_BaseFormat == GL_ALPHA ||
- img->_BaseFormat == GL_LUMINANCE_ALPHA ||
- img->_BaseFormat == GL_RGBA)
- *params = img->TexFormat->AlphaBits;
- else
- *params = 0;
- break;
- case GL_TEXTURE_INTENSITY_SIZE:
- if (img->_BaseFormat != GL_INTENSITY)
- *params = 0;
- else if (img->TexFormat->IntensityBits > 0)
- *params = img->TexFormat->IntensityBits;
- else /* intensity probably stored as rgb texture */
- *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
- break;
- case GL_TEXTURE_LUMINANCE_SIZE:
- if (img->_BaseFormat != GL_LUMINANCE &&
- img->_BaseFormat != GL_LUMINANCE_ALPHA)
- *params = 0;
- else if (img->TexFormat->LuminanceBits > 0)
- *params = img->TexFormat->LuminanceBits;
- else /* luminance probably stored as rgb texture */
- *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
- break;
- case GL_TEXTURE_INDEX_SIZE_EXT:
- if (img->_BaseFormat == GL_COLOR_INDEX)
- *params = img->TexFormat->IndexBits;
- else
- *params = 0;
- break;
- case GL_TEXTURE_DEPTH_SIZE_ARB:
- if (ctx->Extensions.SGIX_depth_texture ||
- ctx->Extensions.ARB_depth_texture)
- *params = img->TexFormat->DepthBits;
- else
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- break;
- case GL_TEXTURE_STENCIL_SIZE_EXT:
- if (ctx->Extensions.EXT_packed_depth_stencil) {
- *params = img->TexFormat->StencilBits;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
-
- /* GL_ARB_texture_compression */
- case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
- if (ctx->Extensions.ARB_texture_compression) {
- if (img->IsCompressed && !isProxy) {
- /* Don't use ctx->Driver.CompressedTextureSize() since that
- * may returned a padded hardware size.
- */
- *params = _mesa_compressed_texture_size(ctx, img->Width,
- img->Height, img->Depth,
- img->TexFormat->MesaFormat);
- }
- else {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTexLevelParameter[if]v(pname)");
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
- case GL_TEXTURE_COMPRESSED:
- if (ctx->Extensions.ARB_texture_compression) {
- *params = (GLint) img->IsCompressed;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
-
- /* GL_ARB_texture_float */
- case GL_TEXTURE_RED_TYPE_ARB:
- if (ctx->Extensions.ARB_texture_float) {
- *params = img->TexFormat->RedBits ? img->TexFormat->DataType : GL_NONE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
- case GL_TEXTURE_GREEN_TYPE_ARB:
- if (ctx->Extensions.ARB_texture_float) {
- *params = img->TexFormat->GreenBits ? img->TexFormat->DataType : GL_NONE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
- case GL_TEXTURE_BLUE_TYPE_ARB:
- if (ctx->Extensions.ARB_texture_float) {
- *params = img->TexFormat->BlueBits ? img->TexFormat->DataType : GL_NONE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
- case GL_TEXTURE_ALPHA_TYPE_ARB:
- if (ctx->Extensions.ARB_texture_float) {
- *params = img->TexFormat->AlphaBits ? img->TexFormat->DataType : GL_NONE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
- case GL_TEXTURE_LUMINANCE_TYPE_ARB:
- if (ctx->Extensions.ARB_texture_float) {
- *params = img->TexFormat->LuminanceBits ? img->TexFormat->DataType : GL_NONE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
- case GL_TEXTURE_INTENSITY_TYPE_ARB:
- if (ctx->Extensions.ARB_texture_float) {
- *params = img->TexFormat->IntensityBits ? img->TexFormat->DataType : GL_NONE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
- case GL_TEXTURE_DEPTH_TYPE_ARB:
- if (ctx->Extensions.ARB_texture_float) {
- *params = img->TexFormat->DepthBits ? img->TexFormat->DataType : GL_NONE;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
- break;
-
- default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetTexLevelParameter[if]v(pname)");
- }
-
- out:
- _mesa_unlock_texture(ctx, texObj);
-}
-
-
-
-void GLAPIENTRY
-_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texture_object *obj;
- GLboolean error = GL_FALSE;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTexParameterfv(current unit)");
- return;
- }
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
-
- obj = _mesa_select_tex_object(ctx, texUnit, target);
- if (!obj) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)");
- return;
- }
-
- _mesa_lock_texture(ctx, obj);
- switch (pname) {
- case GL_TEXTURE_MAG_FILTER:
- *params = ENUM_TO_FLOAT(obj->MagFilter);
- break;
- case GL_TEXTURE_MIN_FILTER:
- *params = ENUM_TO_FLOAT(obj->MinFilter);
- break;
- case GL_TEXTURE_WRAP_S:
- *params = ENUM_TO_FLOAT(obj->WrapS);
- break;
- case GL_TEXTURE_WRAP_T:
- *params = ENUM_TO_FLOAT(obj->WrapT);
- break;
- case GL_TEXTURE_WRAP_R:
- *params = ENUM_TO_FLOAT(obj->WrapR);
- break;
- case GL_TEXTURE_BORDER_COLOR:
- params[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F);
- params[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F);
- params[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F);
- params[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F);
- break;
- case GL_TEXTURE_RESIDENT:
- {
- GLboolean resident;
- if (ctx->Driver.IsTextureResident)
- resident = ctx->Driver.IsTextureResident(ctx, obj);
- else
- resident = GL_TRUE;
- *params = ENUM_TO_FLOAT(resident);
- }
- break;
- case GL_TEXTURE_PRIORITY:
- *params = obj->Priority;
- break;
- case GL_TEXTURE_MIN_LOD:
- *params = obj->MinLod;
- break;
- case GL_TEXTURE_MAX_LOD:
- *params = obj->MaxLod;
- break;
- case GL_TEXTURE_BASE_LEVEL:
- *params = (GLfloat) obj->BaseLevel;
- break;
- case GL_TEXTURE_MAX_LEVEL:
- *params = (GLfloat) obj->MaxLevel;
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if (ctx->Extensions.EXT_texture_filter_anisotropic) {
- *params = obj->MaxAnisotropy;
- }
- else
- error = 1;
- break;
- case GL_TEXTURE_COMPARE_SGIX:
- if (ctx->Extensions.SGIX_shadow) {
- *params = (GLfloat) obj->CompareFlag;
- }
- else
- error = 1;
- break;
- case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
- if (ctx->Extensions.SGIX_shadow) {
- *params = (GLfloat) obj->CompareOperator;
- }
- else
- error = 1;
- break;
- case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
- if (ctx->Extensions.SGIX_shadow_ambient) {
- *params = obj->ShadowAmbient;
- }
- else
- error = 1;
- break;
- case GL_GENERATE_MIPMAP_SGIS:
- if (ctx->Extensions.SGIS_generate_mipmap) {
- *params = (GLfloat) obj->GenerateMipmap;
- }
- else
- error = 1;
- break;
- case GL_TEXTURE_COMPARE_MODE_ARB:
- if (ctx->Extensions.ARB_shadow) {
- *params = (GLfloat) obj->CompareMode;
- }
- else
- error = 1;
- break;
- case GL_TEXTURE_COMPARE_FUNC_ARB:
- if (ctx->Extensions.ARB_shadow) {
- *params = (GLfloat) obj->CompareFunc;
- }
- else
- error = 1;
- break;
- case GL_DEPTH_TEXTURE_MODE_ARB:
- if (ctx->Extensions.ARB_depth_texture) {
- *params = (GLfloat) obj->DepthMode;
- }
- else
- error = 1;
- break;
- case GL_TEXTURE_LOD_BIAS:
- if (ctx->Extensions.EXT_texture_lod_bias) {
- *params = obj->LodBias;
- }
- else
- error = 1;
- break;
- default:
- error = 1;
- break;
- }
- if (error)
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname=0x%x)",
- pname);
-
- _mesa_unlock_texture(ctx, obj);
-}
-
-
-void GLAPIENTRY
-_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texture_object *obj;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetTexParameteriv(current unit)");
- return;
- }
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
-
- obj = _mesa_select_tex_object(ctx, texUnit, target);
- if (!obj) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)");
- return;
- }
-
- switch (pname) {
- case GL_TEXTURE_MAG_FILTER:
- *params = (GLint) obj->MagFilter;
- return;
- case GL_TEXTURE_MIN_FILTER:
- *params = (GLint) obj->MinFilter;
- return;
- case GL_TEXTURE_WRAP_S:
- *params = (GLint) obj->WrapS;
- return;
- case GL_TEXTURE_WRAP_T:
- *params = (GLint) obj->WrapT;
- return;
- case GL_TEXTURE_WRAP_R:
- *params = (GLint) obj->WrapR;
- return;
- case GL_TEXTURE_BORDER_COLOR:
- {
- GLfloat b[4];
- b[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F);
- b[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F);
- b[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F);
- b[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F);
- params[0] = FLOAT_TO_INT(b[0]);
- params[1] = FLOAT_TO_INT(b[1]);
- params[2] = FLOAT_TO_INT(b[2]);
- params[3] = FLOAT_TO_INT(b[3]);
- }
- return;
- case GL_TEXTURE_RESIDENT:
- {
- GLboolean resident;
- if (ctx->Driver.IsTextureResident)
- resident = ctx->Driver.IsTextureResident(ctx, obj);
- else
- resident = GL_TRUE;
- *params = (GLint) resident;
- }
- return;
- case GL_TEXTURE_PRIORITY:
- *params = FLOAT_TO_INT(obj->Priority);
- return;
- case GL_TEXTURE_MIN_LOD:
- *params = (GLint) obj->MinLod;
- return;
- case GL_TEXTURE_MAX_LOD:
- *params = (GLint) obj->MaxLod;
- return;
- case GL_TEXTURE_BASE_LEVEL:
- *params = obj->BaseLevel;
- return;
- case GL_TEXTURE_MAX_LEVEL:
- *params = obj->MaxLevel;
- return;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if (ctx->Extensions.EXT_texture_filter_anisotropic) {
- *params = (GLint) obj->MaxAnisotropy;
- return;
- }
- break;
- case GL_TEXTURE_COMPARE_SGIX:
- if (ctx->Extensions.SGIX_shadow) {
- *params = (GLint) obj->CompareFlag;
- return;
- }
- break;
- case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
- if (ctx->Extensions.SGIX_shadow) {
- *params = (GLint) obj->CompareOperator;
- return;
- }
- break;
- case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
- if (ctx->Extensions.SGIX_shadow_ambient) {
- *params = (GLint) FLOAT_TO_INT(obj->ShadowAmbient);
- return;
- }
- break;
- case GL_GENERATE_MIPMAP_SGIS:
- if (ctx->Extensions.SGIS_generate_mipmap) {
- *params = (GLint) obj->GenerateMipmap;
- return;
- }
- break;
- case GL_TEXTURE_COMPARE_MODE_ARB:
- if (ctx->Extensions.ARB_shadow) {
- *params = (GLint) obj->CompareMode;
- return;
- }
- break;
- case GL_TEXTURE_COMPARE_FUNC_ARB:
- if (ctx->Extensions.ARB_shadow) {
- *params = (GLint) obj->CompareFunc;
- return;
- }
- break;
- case GL_DEPTH_TEXTURE_MODE_ARB:
- if (ctx->Extensions.ARB_depth_texture) {
- *params = (GLint) obj->DepthMode;
- return;
- }
- break;
- case GL_TEXTURE_LOD_BIAS:
- if (ctx->Extensions.EXT_texture_lod_bias) {
- *params = (GLint) obj->LodBias;
- return;
- }
- break;
- default:
- ; /* silence warnings */
- }
- /* If we get here, pname was an unrecognized enum */
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname=0x%x)", pname);
-}
-
-
-
-
-/**********************************************************************/
-/* Texture Coord Generation */
-/**********************************************************************/
-
-#if FEATURE_texgen
-void GLAPIENTRY
-_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_texture_unit *texUnit;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n",
- _mesa_lookup_enum_by_nr(coord),
- _mesa_lookup_enum_by_nr(pname),
- *params,
- _mesa_lookup_enum_by_nr((GLenum) (GLint) *params));
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexGen(current unit)");
- return;
- }
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
-
- switch (coord) {
- case GL_S:
- if (pname==GL_TEXTURE_GEN_MODE) {
- GLenum mode = (GLenum) (GLint) *params;
- GLbitfield bits;
- switch (mode) {
- case GL_OBJECT_LINEAR:
- bits = TEXGEN_OBJ_LINEAR;
- break;
- case GL_EYE_LINEAR:
- bits = TEXGEN_EYE_LINEAR;
- break;
- case GL_REFLECTION_MAP_NV:
- bits = TEXGEN_REFLECTION_MAP_NV;
- break;
- case GL_NORMAL_MAP_NV:
- bits = TEXGEN_NORMAL_MAP_NV;
- break;
- case GL_SPHERE_MAP:
- bits = TEXGEN_SPHERE_MAP;
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
- return;
- }
- if (texUnit->GenModeS == mode)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->GenModeS = mode;
- texUnit->_GenBitS = bits;
- }
- else if (pname==GL_OBJECT_PLANE) {
- if (TEST_EQ_4V(texUnit->ObjectPlaneS, params))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texUnit->ObjectPlaneS, params);
- }
- else if (pname==GL_EYE_PLANE) {
- GLfloat tmp[4];
- /* Transform plane equation by the inverse modelview matrix */
- if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
- _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
- }
- _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
- if (TEST_EQ_4V(texUnit->EyePlaneS, tmp))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texUnit->EyePlaneS, tmp);
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
- return;
- }
- break;
- case GL_T:
- if (pname==GL_TEXTURE_GEN_MODE) {
- GLenum mode = (GLenum) (GLint) *params;
- GLbitfield bitt;
- switch (mode) {
- case GL_OBJECT_LINEAR:
- bitt = TEXGEN_OBJ_LINEAR;
- break;
- case GL_EYE_LINEAR:
- bitt = TEXGEN_EYE_LINEAR;
- break;
- case GL_REFLECTION_MAP_NV:
- bitt = TEXGEN_REFLECTION_MAP_NV;
- break;
- case GL_NORMAL_MAP_NV:
- bitt = TEXGEN_NORMAL_MAP_NV;
- break;
- case GL_SPHERE_MAP:
- bitt = TEXGEN_SPHERE_MAP;
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
- return;
- }
- if (texUnit->GenModeT == mode)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->GenModeT = mode;
- texUnit->_GenBitT = bitt;
- }
- else if (pname==GL_OBJECT_PLANE) {
- if (TEST_EQ_4V(texUnit->ObjectPlaneT, params))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texUnit->ObjectPlaneT, params);
- }
- else if (pname==GL_EYE_PLANE) {
- GLfloat tmp[4];
- /* Transform plane equation by the inverse modelview matrix */
- if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
- _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
- }
- _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
- if (TEST_EQ_4V(texUnit->EyePlaneT, tmp))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texUnit->EyePlaneT, tmp);
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
- return;
- }
- break;
- case GL_R:
- if (pname==GL_TEXTURE_GEN_MODE) {
- GLenum mode = (GLenum) (GLint) *params;
- GLbitfield bitr;
- switch (mode) {
- case GL_OBJECT_LINEAR:
- bitr = TEXGEN_OBJ_LINEAR;
- break;
- case GL_REFLECTION_MAP_NV:
- bitr = TEXGEN_REFLECTION_MAP_NV;
- break;
- case GL_NORMAL_MAP_NV:
- bitr = TEXGEN_NORMAL_MAP_NV;
- break;
- case GL_EYE_LINEAR:
- bitr = TEXGEN_EYE_LINEAR;
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
- return;
- }
- if (texUnit->GenModeR == mode)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->GenModeR = mode;
- texUnit->_GenBitR = bitr;
- }
- else if (pname==GL_OBJECT_PLANE) {
- if (TEST_EQ_4V(texUnit->ObjectPlaneR, params))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texUnit->ObjectPlaneR, params);
- }
- else if (pname==GL_EYE_PLANE) {
- GLfloat tmp[4];
- /* Transform plane equation by the inverse modelview matrix */
- if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
- _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
- }
- _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
- if (TEST_EQ_4V(texUnit->EyePlaneR, tmp))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texUnit->EyePlaneR, tmp);
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
- return;
- }
- break;
- case GL_Q:
- if (pname==GL_TEXTURE_GEN_MODE) {
- GLenum mode = (GLenum) (GLint) *params;
- GLbitfield bitq;
- switch (mode) {
- case GL_OBJECT_LINEAR:
- bitq = TEXGEN_OBJ_LINEAR;
- break;
- case GL_EYE_LINEAR:
- bitq = TEXGEN_EYE_LINEAR;
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
- return;
- }
- if (texUnit->GenModeQ == mode)
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->GenModeQ = mode;
- texUnit->_GenBitQ = bitq;
- }
- else if (pname==GL_OBJECT_PLANE) {
- if (TEST_EQ_4V(texUnit->ObjectPlaneQ, params))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texUnit->ObjectPlaneQ, params);
- }
- else if (pname==GL_EYE_PLANE) {
- GLfloat tmp[4];
- /* Transform plane equation by the inverse modelview matrix */
- if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
- _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
- }
- _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv );
- if (TEST_EQ_4V(texUnit->EyePlaneQ, tmp))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texUnit->EyePlaneQ, tmp);
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
- return;
- }
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(coord)" );
- return;
- }
-
- if (ctx->Driver.TexGen)
- ctx->Driver.TexGen( ctx, coord, pname, params );
-}
-
-
-void GLAPIENTRY
-_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
-{
- GLfloat p[4];
- p[0] = (GLfloat) params[0];
- if (pname == GL_TEXTURE_GEN_MODE) {
- p[1] = p[2] = p[3] = 0.0F;
- }
- else {
- p[1] = (GLfloat) params[1];
- p[2] = (GLfloat) params[2];
- p[3] = (GLfloat) params[3];
- }
- _mesa_TexGenfv(coord, pname, p);
-}
-
-
-void GLAPIENTRY
-_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
-{
- GLfloat p = (GLfloat) param;
- _mesa_TexGenfv( coord, pname, &p );
-}
-
-
-void GLAPIENTRY
-_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params )
-{
- GLfloat p[4];
- p[0] = (GLfloat) params[0];
- if (pname == GL_TEXTURE_GEN_MODE) {
- p[1] = p[2] = p[3] = 0.0F;
- }
- else {
- p[1] = (GLfloat) params[1];
- p[2] = (GLfloat) params[2];
- p[3] = (GLfloat) params[3];
- }
- _mesa_TexGenfv( coord, pname, p );
-}
-
-
-void GLAPIENTRY
-_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param )
-{
- _mesa_TexGenfv(coord, pname, &param);
-}
-
-
-void GLAPIENTRY
-_mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
-{
- _mesa_TexGeniv( coord, pname, &param );
-}
-
-
-
-void GLAPIENTRY
-_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
-{
- const struct gl_texture_unit *texUnit;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)");
- return;
- }
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
-
- switch (coord) {
- case GL_S:
- if (pname==GL_TEXTURE_GEN_MODE) {
- params[0] = ENUM_TO_DOUBLE(texUnit->GenModeS);
- }
- else if (pname==GL_OBJECT_PLANE) {
- COPY_4V( params, texUnit->ObjectPlaneS );
- }
- else if (pname==GL_EYE_PLANE) {
- COPY_4V( params, texUnit->EyePlaneS );
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
- return;
- }
- break;
- case GL_T:
- if (pname==GL_TEXTURE_GEN_MODE) {
- params[0] = ENUM_TO_DOUBLE(texUnit->GenModeT);
- }
- else if (pname==GL_OBJECT_PLANE) {
- COPY_4V( params, texUnit->ObjectPlaneT );
- }
- else if (pname==GL_EYE_PLANE) {
- COPY_4V( params, texUnit->EyePlaneT );
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
- return;
- }
- break;
- case GL_R:
- if (pname==GL_TEXTURE_GEN_MODE) {
- params[0] = ENUM_TO_DOUBLE(texUnit->GenModeR);
- }
- else if (pname==GL_OBJECT_PLANE) {
- COPY_4V( params, texUnit->ObjectPlaneR );
- }
- else if (pname==GL_EYE_PLANE) {
- COPY_4V( params, texUnit->EyePlaneR );
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
- return;
- }
- break;
- case GL_Q:
- if (pname==GL_TEXTURE_GEN_MODE) {
- params[0] = ENUM_TO_DOUBLE(texUnit->GenModeQ);
- }
- else if (pname==GL_OBJECT_PLANE) {
- COPY_4V( params, texUnit->ObjectPlaneQ );
- }
- else if (pname==GL_EYE_PLANE) {
- COPY_4V( params, texUnit->EyePlaneQ );
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
- return;
- }
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)" );
- return;
- }
-}
-
-
-
-void GLAPIENTRY
-_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
-{
- const struct gl_texture_unit *texUnit;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)");
- return;
- }
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
-
- switch (coord) {
- case GL_S:
- if (pname==GL_TEXTURE_GEN_MODE) {
- params[0] = ENUM_TO_FLOAT(texUnit->GenModeS);
- }
- else if (pname==GL_OBJECT_PLANE) {
- COPY_4V( params, texUnit->ObjectPlaneS );
- }
- else if (pname==GL_EYE_PLANE) {
- COPY_4V( params, texUnit->EyePlaneS );
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
- return;
- }
- break;
- case GL_T:
- if (pname==GL_TEXTURE_GEN_MODE) {
- params[0] = ENUM_TO_FLOAT(texUnit->GenModeT);
- }
- else if (pname==GL_OBJECT_PLANE) {
- COPY_4V( params, texUnit->ObjectPlaneT );
- }
- else if (pname==GL_EYE_PLANE) {
- COPY_4V( params, texUnit->EyePlaneT );
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
- return;
- }
- break;
- case GL_R:
- if (pname==GL_TEXTURE_GEN_MODE) {
- params[0] = ENUM_TO_FLOAT(texUnit->GenModeR);
- }
- else if (pname==GL_OBJECT_PLANE) {
- COPY_4V( params, texUnit->ObjectPlaneR );
- }
- else if (pname==GL_EYE_PLANE) {
- COPY_4V( params, texUnit->EyePlaneR );
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
- return;
- }
- break;
- case GL_Q:
- if (pname==GL_TEXTURE_GEN_MODE) {
- params[0] = ENUM_TO_FLOAT(texUnit->GenModeQ);
- }
- else if (pname==GL_OBJECT_PLANE) {
- COPY_4V( params, texUnit->ObjectPlaneQ );
- }
- else if (pname==GL_EYE_PLANE) {
- COPY_4V( params, texUnit->EyePlaneQ );
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
- return;
- }
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)" );
- return;
- }
-}
-
-
-
-void GLAPIENTRY
-_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
-{
- const struct gl_texture_unit *texUnit;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)");
- return;
- }
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
-
- switch (coord) {
- case GL_S:
- if (pname==GL_TEXTURE_GEN_MODE) {
- params[0] = texUnit->GenModeS;
- }
- else if (pname==GL_OBJECT_PLANE) {
- params[0] = (GLint) texUnit->ObjectPlaneS[0];
- params[1] = (GLint) texUnit->ObjectPlaneS[1];
- params[2] = (GLint) texUnit->ObjectPlaneS[2];
- params[3] = (GLint) texUnit->ObjectPlaneS[3];
- }
- else if (pname==GL_EYE_PLANE) {
- params[0] = (GLint) texUnit->EyePlaneS[0];
- params[1] = (GLint) texUnit->EyePlaneS[1];
- params[2] = (GLint) texUnit->EyePlaneS[2];
- params[3] = (GLint) texUnit->EyePlaneS[3];
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
- return;
- }
- break;
- case GL_T:
- if (pname==GL_TEXTURE_GEN_MODE) {
- params[0] = texUnit->GenModeT;
- }
- else if (pname==GL_OBJECT_PLANE) {
- params[0] = (GLint) texUnit->ObjectPlaneT[0];
- params[1] = (GLint) texUnit->ObjectPlaneT[1];
- params[2] = (GLint) texUnit->ObjectPlaneT[2];
- params[3] = (GLint) texUnit->ObjectPlaneT[3];
- }
- else if (pname==GL_EYE_PLANE) {
- params[0] = (GLint) texUnit->EyePlaneT[0];
- params[1] = (GLint) texUnit->EyePlaneT[1];
- params[2] = (GLint) texUnit->EyePlaneT[2];
- params[3] = (GLint) texUnit->EyePlaneT[3];
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
- return;
- }
- break;
- case GL_R:
- if (pname==GL_TEXTURE_GEN_MODE) {
- params[0] = texUnit->GenModeR;
- }
- else if (pname==GL_OBJECT_PLANE) {
- params[0] = (GLint) texUnit->ObjectPlaneR[0];
- params[1] = (GLint) texUnit->ObjectPlaneR[1];
- params[2] = (GLint) texUnit->ObjectPlaneR[2];
- params[3] = (GLint) texUnit->ObjectPlaneR[3];
- }
- else if (pname==GL_EYE_PLANE) {
- params[0] = (GLint) texUnit->EyePlaneR[0];
- params[1] = (GLint) texUnit->EyePlaneR[1];
- params[2] = (GLint) texUnit->EyePlaneR[2];
- params[3] = (GLint) texUnit->EyePlaneR[3];
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
- return;
- }
- break;
- case GL_Q:
- if (pname==GL_TEXTURE_GEN_MODE) {
- params[0] = texUnit->GenModeQ;
- }
- else if (pname==GL_OBJECT_PLANE) {
- params[0] = (GLint) texUnit->ObjectPlaneQ[0];
- params[1] = (GLint) texUnit->ObjectPlaneQ[1];
- params[2] = (GLint) texUnit->ObjectPlaneQ[2];
- params[3] = (GLint) texUnit->ObjectPlaneQ[3];
- }
- else if (pname==GL_EYE_PLANE) {
- params[0] = (GLint) texUnit->EyePlaneQ[0];
- params[1] = (GLint) texUnit->EyePlaneQ[1];
- params[2] = (GLint) texUnit->EyePlaneQ[2];
- params[3] = (GLint) texUnit->EyePlaneQ[3];
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
- return;
- }
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)" );
- return;
- }
-}
-#endif
/* GL_ARB_multitexture */
@@ -3213,7 +822,9 @@ _mesa_init_texture(GLcontext *ctx)
for (i=0; i<MAX_TEXTURE_UNITS; i++)
init_texture_unit( ctx, i );
ctx->Texture.SharedPalette = GL_FALSE;
+#if FEATURE_colortable
_mesa_init_colortable(&ctx->Texture.Palette);
+#endif
/* Allocate proxy textures */
if (!alloc_proxy_textures( ctx ))
@@ -3229,8 +840,6 @@ _mesa_init_texture(GLcontext *ctx)
void
_mesa_free_texture_data(GLcontext *ctx)
{
- GLuint i;
-
/* Free proxy texture objects */
(ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1D );
(ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2D );
@@ -3240,6 +849,11 @@ _mesa_free_texture_data(GLcontext *ctx)
(ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1DArray );
(ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2DArray );
- for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++)
- _mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable );
+#if FEATURE_colortable
+ {
+ GLuint i;
+ for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++)
+ _mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable );
+ }
+#endif
}
diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h
index 60145691b8..b5003d5d6e 100644
--- a/src/mesa/main/texstate.h
+++ b/src/mesa/main/texstate.h
@@ -48,81 +48,6 @@ _mesa_print_texunit_state( GLcontext *ctx, GLuint unit );
*/
/*@{*/
-extern void GLAPIENTRY
-_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params );
-
-extern void GLAPIENTRY
-_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params );
-
-extern void GLAPIENTRY
-_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params );
-
-extern void GLAPIENTRY
-_mesa_GetTexLevelParameterfv( GLenum target, GLint level,
- GLenum pname, GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_GetTexLevelParameteriv( GLenum target, GLint level,
- GLenum pname, GLint *params );
-
-extern void GLAPIENTRY
-_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params );
-
-
-extern void GLAPIENTRY
-_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param );
-
-extern void GLAPIENTRY
-_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param );
-
-extern void GLAPIENTRY
-_mesa_TexEnvi( GLenum target, GLenum pname, GLint param );
-
-extern void GLAPIENTRY
-_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param );
-
-
-extern void GLAPIENTRY
-_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param );
-
-
-extern void GLAPIENTRY
-_mesa_TexParameteri( GLenum target, GLenum pname, GLint param );
-
-extern void GLAPIENTRY
-_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params );
-
-
-extern void GLAPIENTRY
-_mesa_TexGend( GLenum coord, GLenum pname, GLdouble param );
-
-extern void GLAPIENTRY
-_mesa_TexGendv( GLenum coord, GLenum pname, const GLdouble *params );
-
-extern void GLAPIENTRY
-_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param );
-
-extern void GLAPIENTRY
-_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_TexGeni( GLenum coord, GLenum pname, GLint param );
-
-extern void GLAPIENTRY
-_mesa_TexGeniv( GLenum coord, GLenum pname, const GLint *params );
-
/*
* GL_ARB_multitexture
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index a6a18910fc..519a73b960 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -55,7 +55,9 @@
#include "bufferobj.h"
#include "colormac.h"
#include "context.h"
+#if FEATURE_convolve
#include "convolve.h"
+#endif
#include "image.h"
#include "macros.h"
#include "mipmap.h"
@@ -269,6 +271,16 @@ compute_component_mapping(GLenum inFormat, GLenum outFormat,
}
+#if !FEATURE_convolve
+static void
+_mesa_adjust_image_for_convolution(GLcontext *ctx, GLuint dims,
+ GLsizei *srcWidth, GLsizei *srcHeight)
+{
+ /* no-op */
+}
+#endif
+
+
/**
* Make a temporary (color) texture image with GLfloat components.
* Apply all needed pixel unpacking and pixel transfer operations.
@@ -368,6 +380,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims,
dst += srcWidth * 4;
}
+#if FEATURE_convolve
/* do convolution */
{
GLfloat *src = tempImage + img * (srcWidth * srcHeight * 4);
@@ -389,7 +402,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims,
}
}
}
-
+#endif
/* do post-convolution transfer and pack into tempImage */
{
const GLint logComponents
@@ -546,6 +559,7 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
textureBaseFormat == GL_ALPHA ||
textureBaseFormat == GL_INTENSITY);
+#if FEATURE_convolve
if ((dims == 1 && ctx->Pixel.Convolution1DEnabled) ||
(dims >= 2 && ctx->Pixel.Convolution2DEnabled) ||
(dims >= 2 && ctx->Pixel.Separable2DEnabled)) {
@@ -567,6 +581,7 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
transferOps = 0;
freeSrcImage = GL_TRUE;
}
+#endif
/* unpack and transfer the source image */
tempImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth
@@ -808,7 +823,8 @@ _mesa_swizzle_ubyte_image(GLcontext *ctx,
/* _mesa_printf("map %d %d %d %d\n", map[0], map[1], map[2], map[3]); */
- if (srcRowStride == dstRowStride &&
+ if (srcComponents == dstComponents &&
+ srcRowStride == dstRowStride &&
srcRowStride == srcWidth * srcComponents &&
dimensions < 3) {
/* 1 and 2D images only */
@@ -2321,7 +2337,7 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS)
GLboolean
_mesa_texstore_z24_s8(TEXSTORE_PARAMS)
{
- const GLuint depthScale = 0xffffff;
+ const GLfloat depthScale = (GLfloat) 0xffffff;
ASSERT(dstFormat == &_mesa_texformat_z24_s8);
ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT);
@@ -2359,7 +2375,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
GLint i;
/* the 24 depth bits will be in the high position: */
_mesa_unpack_depth_span(ctx, srcWidth,
- GL_UNSIGNED_INT, /* dst type */
+ GL_UNSIGNED_INT_24_8_EXT, /* dst type */
dstRow, /* dst addr */
depthScale,
srcType, src, srcPacking);
@@ -2382,6 +2398,88 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
}
+/**
+ * Store a combined depth/stencil texture image.
+ */
+GLboolean
+_mesa_texstore_s8_z24(TEXSTORE_PARAMS)
+{
+ const GLuint depthScale = 0xffffff;
+
+ ASSERT(dstFormat == &_mesa_texformat_s8_z24);
+ ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT);
+ ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT);
+
+ const GLint srcRowStride
+ = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType)
+ / sizeof(GLuint);
+ GLint img, row;
+
+ /* Incase we only upload depth we need to preserve the stencil */
+ if (srcFormat == GL_DEPTH_COMPONENT) {
+ for (img = 0; img < srcDepth; img++) {
+ GLuint *dstRow = (GLuint *) dstAddr
+ + dstImageOffsets[dstZoffset + img]
+ + dstYoffset * dstRowStride / sizeof(GLuint)
+ + dstXoffset;
+ const GLuint *src
+ = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr,
+ srcWidth, srcHeight,
+ srcFormat, srcType,
+ img, 0, 0);
+ for (row = 0; row < srcHeight; row++) {
+ GLuint depth[MAX_WIDTH];
+ GLint i;
+ _mesa_unpack_depth_span(ctx, srcWidth,
+ GL_UNSIGNED_INT, /* dst type */
+ depth, /* dst addr */
+ depthScale,
+ srcType, src, srcPacking);
+
+ for (i = 0; i < srcWidth; i++)
+ dstRow[i] = depth[i] | (dstRow[i] & 0xFF000000);
+
+ src += srcRowStride;
+ dstRow += dstRowStride / sizeof(GLuint);
+ }
+ }
+ } else {
+ for (img = 0; img < srcDepth; img++) {
+ GLuint *dstRow = (GLuint *) dstAddr
+ + dstImageOffsets[dstZoffset + img]
+ + dstYoffset * dstRowStride / sizeof(GLuint)
+ + dstXoffset;
+ const GLuint *src
+ = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr,
+ srcWidth, srcHeight,
+ srcFormat, srcType,
+ img, 0, 0);
+ for (row = 0; row < srcHeight; row++) {
+ GLubyte stencil[MAX_WIDTH];
+ GLint i;
+ /* the 24 depth bits will be in the high position: */
+ _mesa_unpack_depth_span(ctx, srcWidth,
+ GL_UNSIGNED_INT, /* dst type */
+ dstRow, /* dst addr */
+ depthScale,
+ srcType, src, srcPacking);
+ /* get the 8-bit stencil values */
+ _mesa_unpack_stencil_span(ctx, srcWidth,
+ GL_UNSIGNED_BYTE, /* dst type */
+ stencil, /* dst addr */
+ srcType, src, srcPacking,
+ ctx->_ImageTransferState);
+ /* merge stencil values into depth values */
+ for (i = 0; i < srcWidth; i++)
+ dstRow[i] = stencil[i] << 24;
+
+ src += srcRowStride;
+ dstRow += dstRowStride / sizeof(GLuint);
+ }
+ }
+ }
+ return GL_TRUE;
+}
/**
* Store an image in any of the formats:
diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h
index da0c7cb78e..c5813fbeee 100644
--- a/src/mesa/main/texstore.h
+++ b/src/mesa/main/texstore.h
@@ -57,6 +57,7 @@ extern GLboolean _mesa_texstore_a8(TEXSTORE_PARAMS);
extern GLboolean _mesa_texstore_ci8(TEXSTORE_PARAMS);
extern GLboolean _mesa_texstore_ycbcr(TEXSTORE_PARAMS);
extern GLboolean _mesa_texstore_z24_s8(TEXSTORE_PARAMS);
+extern GLboolean _mesa_texstore_s8_z24(TEXSTORE_PARAMS);
extern GLboolean _mesa_texstore_z16(TEXSTORE_PARAMS);
extern GLboolean _mesa_texstore_z32(TEXSTORE_PARAMS);
extern GLboolean _mesa_texstore_rgba_float32(TEXSTORE_PARAMS);
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index fe4a7c684f..220db35855 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -121,6 +121,16 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
case GL_DOUBLE:
elementSize = size * sizeof(GLdouble);
break;
+#if FEATURE_fixedpt
+ case GL_FIXED:
+ elementSize = size * sizeof(GLfixed);
+ break;
+#endif
+#if FEATURE_vertex_array_byte
+ case GL_BYTE:
+ elementSize = size * sizeof(GLbyte);
+ break;
+#endif
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glVertexPointer(type)" );
return;
@@ -166,6 +176,11 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
case GL_DOUBLE:
elementSize = 3 * sizeof(GLdouble);
break;
+#if FEATURE_fixedpt
+ case GL_FIXED:
+ elementSize = 3 * sizeof(GLfixed);
+ break;
+#endif
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glNormalPointer(type)" );
return;
@@ -224,6 +239,11 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
case GL_DOUBLE:
elementSize = size * sizeof(GLdouble);
break;
+#if FEATURE_fixedpt
+ case GL_FIXED:
+ elementSize = size * sizeof(GLfixed);
+ break;
+#endif
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glColorPointer(type)" );
return;
@@ -405,6 +425,16 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
case GL_DOUBLE:
elementSize = size * sizeof(GLdouble);
break;
+#if FEATURE_fixedpt
+ case GL_FIXED:
+ elementSize = size * sizeof(GLfixed);
+ break;
+#endif
+#if FEATURE_vertex_array_byte
+ case GL_BYTE:
+ elementSize = size * sizeof(GLbyte);
+ break;
+#endif
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glTexCoordPointer(type)" );
return;
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 3589735f68..ba91ecf5f6 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -147,6 +147,20 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
GLsizei primcount, GLint modestride );
+
+extern void GLAPIENTRY
+_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count);
+
+extern void GLAPIENTRY
+_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
+ const GLvoid *indices);
+
+extern void GLAPIENTRY
+_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
+ GLenum type, const GLvoid *indices);
+
+
+
extern void
_mesa_init_varray( GLcontext * ctx );