aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/texgen.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-31 15:18:29 +0200
committermarha <marha@users.sourceforge.net>2012-08-31 15:18:29 +0200
commit53192e17e55aa9ed3e3721bf4fdcb2b01a595202 (patch)
tree01d81bc7cfb5dc92584f4b7615d2ac1b09fe5411 /mesalib/src/mesa/main/texgen.c
parent05d67ae9117e5157fd1a5175dde6d7e48caf4653 (diff)
downloadvcxsrv-53192e17e55aa9ed3e3721bf4fdcb2b01a595202.tar.gz
vcxsrv-53192e17e55aa9ed3e3721bf4fdcb2b01a595202.tar.bz2
vcxsrv-53192e17e55aa9ed3e3721bf4fdcb2b01a595202.zip
randrproto xwininfo fontconfig libxcb mesa xkeyboard-config pixman xserver
git update 31 Aug 2012
Diffstat (limited to 'mesalib/src/mesa/main/texgen.c')
-rw-r--r--mesalib/src/mesa/main/texgen.c63
1 files changed, 54 insertions, 9 deletions
diff --git a/mesalib/src/mesa/main/texgen.c b/mesalib/src/mesa/main/texgen.c
index 0ace0b936..3788669d4 100644
--- a/mesalib/src/mesa/main/texgen.c
+++ b/mesalib/src/mesa/main/texgen.c
@@ -48,8 +48,14 @@
* Return texgen state for given coordinate
*/
static struct gl_texgen *
-get_texgen(struct gl_texture_unit *texUnit, GLenum coord)
+get_texgen(struct gl_context *ctx, struct gl_texture_unit *texUnit,
+ GLenum coord)
{
+ if (ctx->API == API_OPENGLES) {
+ return (coord == GL_TEXTURE_GEN_STR_OES)
+ ? &texUnit->GenS : NULL;
+ }
+
switch (coord) {
case GL_S:
return &texUnit->GenS;
@@ -87,7 +93,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
texUnit = _mesa_get_current_tex_unit(ctx);
- texgen = get_texgen(texUnit, coord);
+ texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
_mesa_error(ctx, GL_INVALID_ENUM, "glTexGen(coord)");
return;
@@ -126,6 +132,12 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
+ if (ctx->API != API_OPENGL
+ && (bit & (TEXGEN_REFLECTION_MAP_NV | TEXGEN_NORMAL_MAP_NV)) == 0) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
+
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texgen->Mode = mode;
texgen->_ModeBit = bit;
@@ -134,6 +146,10 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
case GL_OBJECT_PLANE:
{
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
if (TEST_EQ_4V(texgen->ObjectPlane, params))
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
@@ -144,6 +160,12 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
case GL_EYE_PLANE:
{
GLfloat tmp[4];
+
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
+
/* Transform plane equation by the inverse modelview matrix */
if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
_math_matrix_analyse(ctx->ModelviewMatrixStack.Top);
@@ -198,7 +220,6 @@ _mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
void GLAPIENTRY
_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
{
- ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
_mesa_GetTexGenfv(GL_S, pname, params);
}
@@ -206,7 +227,11 @@ _es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
void GLAPIENTRY
_es_TexGenf(GLenum coord, GLenum pname, GLfloat param)
{
- ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
+ if (coord != GL_TEXTURE_GEN_STR_OES) {
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGen[fx](pname)" );
+ return;
+ }
/* set S, T, and R at the same time */
_mesa_TexGenf(GL_S, pname, param);
_mesa_TexGenf(GL_T, pname, param);
@@ -217,7 +242,11 @@ _es_TexGenf(GLenum coord, GLenum pname, GLfloat param)
void GLAPIENTRY
_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
{
- ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
+ if (coord != GL_TEXTURE_GEN_STR_OES) {
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGen[fx]v(pname)" );
+ return;
+ }
/* set S, T, and R at the same time */
_mesa_TexGenfv(GL_S, pname, params);
_mesa_TexGenfv(GL_T, pname, params);
@@ -279,7 +308,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
texUnit = _mesa_get_current_tex_unit(ctx);
- texgen = get_texgen(texUnit, coord);
+ texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)");
return;
@@ -317,7 +346,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
texUnit = _mesa_get_current_tex_unit(ctx);
- texgen = get_texgen(texUnit, coord);
+ texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)");
return;
@@ -328,9 +357,17 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
params[0] = ENUM_TO_FLOAT(texgen->Mode);
break;
case GL_OBJECT_PLANE:
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(param)" );
+ return;
+ }
COPY_4V(params, texgen->ObjectPlane);
break;
case GL_EYE_PLANE:
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(param)" );
+ return;
+ }
COPY_4V(params, texgen->EyePlane);
break;
default:
@@ -340,7 +377,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
-static void GLAPIENTRY
+void GLAPIENTRY
_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
{
struct gl_texture_unit *texUnit;
@@ -355,7 +392,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
texUnit = _mesa_get_current_tex_unit(ctx);
- texgen = get_texgen(texUnit, coord);
+ texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)");
return;
@@ -366,12 +403,20 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
params[0] = texgen->Mode;
break;
case GL_OBJECT_PLANE:
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(param)" );
+ return;
+ }
params[0] = (GLint) texgen->ObjectPlane[0];
params[1] = (GLint) texgen->ObjectPlane[1];
params[2] = (GLint) texgen->ObjectPlane[2];
params[3] = (GLint) texgen->ObjectPlane[3];
break;
case GL_EYE_PLANE:
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(param)" );
+ return;
+ }
params[0] = (GLint) texgen->EyePlane[0];
params[1] = (GLint) texgen->EyePlane[1];
params[2] = (GLint) texgen->EyePlane[2];