summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-06-11 20:13:07 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-06-11 20:17:08 -0600
commit222c80893a738b964dc75796d47545d88e6a6973 (patch)
treeef2bc44d24b5a1bcd7b0f9602d2d004fed9bad98 /src
parent77b794201a96300af4473307a7663500d62296e8 (diff)
mesa: refactor: move various ENUM_TO_x macros into macros.h
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/get.c56
-rw-r--r--src/mesa/main/get_gen.py4
-rw-r--r--src/mesa/main/macros.h7
-rw-r--r--src/mesa/main/texenv.c2
-rw-r--r--src/mesa/main/texgen.c4
-rw-r--r--src/mesa/main/texparam.c3
-rw-r--r--src/mesa/main/texstate.c3
7 files changed, 57 insertions, 22 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index ee48b78318..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;
@@ -2124,7 +2136,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
params[0] = (GLfloat)(ctx->DrawBuffer->Visual.depthBits);
break;
case GL_DEPTH_CLEAR_VALUE:
- params[0] = (GLfloat)ctx->Depth.Clear;
+ params[0] = ctx->Depth.Clear;
break;
case GL_DEPTH_FUNC:
params[0] = ENUM_TO_FLOAT(ctx->Depth.Func);
@@ -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;
@@ -2914,7 +2942,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE);
ASSERT(n <= 100);
for (i = 0; i < n; i++)
- params[i] = (GLfloat)(ENUM_TO_INT(formats[i]));
+ params[i] = ENUM_TO_INT(formats[i]);
}
break;
case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT:
@@ -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/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/texenv.c b/src/mesa/main/texenv.c
index 2b5b15524e..e072cea136 100644
--- a/src/mesa/main/texenv.c
+++ b/src/mesa/main/texenv.c
@@ -37,8 +37,6 @@
#include "math/m_xform.h"
-#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X))
-
void GLAPIENTRY
_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c
index 1018c3037b..244c7aaafc 100644
--- a/src/mesa/main/texgen.c
+++ b/src/mesa/main/texgen.c
@@ -37,10 +37,6 @@
#include "math/m_xform.h"
-#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X))
-#define ENUM_TO_DOUBLE(X) ((GLdouble)(GLint)(X))
-
-
void GLAPIENTRY
_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 10ad0ef1d8..af288c4e18 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -39,9 +39,6 @@
#include "main/teximage.h"
-#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X))
-
-
/**
* Check if a coordinate wrap mode is supported for the texture target.
* \return GL_TRUE if legal, GL_FALSE otherwise
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index dbd769d740..421f912849 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -45,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