-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 09/19/2011 12:03 AM, Yuanhan Liu wrote: > Trigger GL_INVALID_ENUM error if the face paramter is not a valid > value. > > Trigger GL_INVALID_VALUE error if the GL_SHININESS value is out > side [0,128]. > > Signed-off-by: Yuanhan Liu <yuanhan....@linux.intel.com> --- > src/mesa/vbo/vbo_attrib_tmp.h | 10 +++++++++- 1 files changed, 9 > insertions(+), 1 deletions(-) > > diff --git a/src/mesa/vbo/vbo_attrib_tmp.h > b/src/mesa/vbo/vbo_attrib_tmp.h index 65717eb..c79bfc2 100644 --- > a/src/mesa/vbo/vbo_attrib_tmp.h +++ > b/src/mesa/vbo/vbo_attrib_tmp.h @@ -795,6 +795,11 @@ > TAG(VertexAttrib4fvNV)(GLuint index, const GLfloat * v) > > #define MAT( ATTR, N, face, params ) \ do { > \ + if (face > != GL_FRONT && face != GL_BACK && \ + face != > GL_FRONT_AND_BACK) { \ + _mesa_error(ctx, > GL_INVALID_ENUM, "Invalid value for parameter face"); \ + > break; \ + } > \ if (face != GL_BACK) \ MAT_ATTR( > ATTR, N, params ); /* front > */ \ if (face != GL_FRONT) \ @@ -823,7 > +828,10 @@ > TAG(Materialfv)(GLenum face, GLenum pname, > MAT(VBO_ATTRIB_MAT_FRONT_SPECULAR, 4, face, params); break; case > GL_SHININESS: - MAT(VBO_ATTRIB_MAT_FRONT_SHININESS, 1, face, > params); + if (*params < 0 || *params > 128) + > _mesa_error(ctx, GL_INVALID_VALUE, "GL_SHININESS value out side > [0,128]");
This should check ctx->Const.MaxShininess instead of 128. Since Mesa supports GL_NV_light_max_exponent, the valid maximum can be larger than 128. > + else + MAT(VBO_ATTRIB_MAT_FRONT_SHININESS, 1, face, > params); break; case GL_COLOR_INDEXES: > MAT(VBO_ATTRIB_MAT_FRONT_INDEXES, 3, face, params); -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk53hywACgkQX1gOwKyEAw88CACdHUVywIN0ttRraCLTiAEYbI2/ l6wAn2MwzOqz1ZfAzEpDGkkow+LG3lZv =F77M -----END PGP SIGNATURE----- _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev