aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/light.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/light.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/light.c')
-rw-r--r--mesalib/src/mesa/main/light.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c
index d6fbcd9be..cfb53dc06 100644
--- a/mesalib/src/mesa/main/light.c
+++ b/mesalib/src/mesa/main/light.c
@@ -466,6 +466,8 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
COPY_4V( ctx->Light.Model.Ambient, params );
break;
case GL_LIGHT_MODEL_LOCAL_VIEWER:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
newbool = (params[0]!=0.0);
if (ctx->Light.Model.LocalViewer == newbool)
return;
@@ -484,6 +486,8 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
break;
case GL_LIGHT_MODEL_COLOR_CONTROL:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
if (params[0] == (GLfloat) GL_SINGLE_COLOR)
newenum = GL_SINGLE_COLOR;
else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR)
@@ -499,12 +503,17 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
ctx->Light.Model.ColorControl = newenum;
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(pname=0x%x)", pname );
- break;
+ goto invalid_pname;
}
if (ctx->Driver.LightModelfv)
ctx->Driver.LightModelfv( ctx, pname, params );
+
+ return;
+
+invalid_pname:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(pname=0x%x)", pname );
+ return;
}
@@ -789,6 +798,10 @@ _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
*params = mat[MAT_ATTRIB_SHININESS(f)][0];
break;
case GL_COLOR_INDEXES:
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(pname)" );
+ return;
+ }
params[0] = mat[MAT_ATTRIB_INDEXES(f)][0];
params[1] = mat[MAT_ATTRIB_INDEXES(f)][1];
params[2] = mat[MAT_ATTRIB_INDEXES(f)][2];
@@ -807,6 +820,8 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */
+ ASSERT(ctx->API == API_OPENGL);
+
FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */
if (face==GL_FRONT) {