* commit '28ea64ef29a6a0359e346fd01189d1d646a0d2fe': validateing client's arrays type
This commit is contained in:
@@ -396,6 +396,7 @@ GL_API void GL_APIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean
|
||||
GL_API void GL_APIENTRY glColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!GLEScmValidate::colorPointerParams(size,stride),GL_INVALID_VALUE);
|
||||
SET_ERROR_IF(!GLEScmValidate::colorPointerType(type),GL_INVALID_ENUM);
|
||||
ctx->setPointer(GL_COLOR_ARRAY,size,type,stride,pointer);
|
||||
}
|
||||
|
||||
@@ -1159,6 +1160,7 @@ GL_API void GL_APIENTRY glNormal3x( GLfixed nx, GLfixed ny, GLfixed nz) {
|
||||
GL_API void GL_APIENTRY glNormalPointer( GLenum type, GLsizei stride, const GLvoid *pointer) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(stride < 0,GL_INVALID_VALUE);
|
||||
SET_ERROR_IF(!GLEScmValidate::normalPointerType(type),GL_INVALID_ENUM);
|
||||
ctx->setPointer(GL_NORMAL_ARRAY,3,type,stride,pointer);//3 normal verctor
|
||||
}
|
||||
|
||||
@@ -1208,6 +1210,7 @@ GL_API void GL_APIENTRY glPointSize( GLfloat size) {
|
||||
GL_API void GL_APIENTRY glPointSizePointerOES( GLenum type, GLsizei stride, const GLvoid *pointer) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(stride < 0,GL_INVALID_VALUE);
|
||||
SET_ERROR_IF(!GLEScmValidate::pointPointerType(type),GL_INVALID_ENUM);
|
||||
ctx->setPointer(GL_POINT_SIZE_ARRAY_OES,1,type,stride,pointer);
|
||||
}
|
||||
|
||||
@@ -1303,6 +1306,7 @@ GL_API void GL_APIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass) {
|
||||
GL_API void GL_APIENTRY glTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!GLEScmValidate::texCoordPointerParams(size,stride),GL_INVALID_VALUE);
|
||||
SET_ERROR_IF(!GLEScmValidate::texCoordPointerType(type),GL_INVALID_ENUM);
|
||||
ctx->setPointer(GL_TEXTURE_COORD_ARRAY,size,type,stride,pointer);
|
||||
}
|
||||
|
||||
@@ -1459,6 +1463,7 @@ GL_API void GL_APIENTRY glTranslatex( GLfixed x, GLfixed y, GLfixed z) {
|
||||
GL_API void GL_APIENTRY glVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
|
||||
GET_CTX()
|
||||
SET_ERROR_IF(!GLEScmValidate::vertexPointerParams(size,stride),GL_INVALID_VALUE);
|
||||
SET_ERROR_IF(!GLEScmValidate::vertexPointerType(type),GL_INVALID_ENUM);
|
||||
ctx->setPointer(GL_VERTEX_ARRAY,size,type,stride,pointer);
|
||||
}
|
||||
|
||||
|
||||
@@ -263,3 +263,51 @@ bool GLEScmValidate::texGen(GLenum coord, GLenum pname) {
|
||||
return (coord == GL_TEXTURE_GEN_STR_OES && pname == GL_TEXTURE_GEN_MODE_OES);
|
||||
}
|
||||
|
||||
bool GLEScmValidate::colorPointerType(GLenum type){
|
||||
switch(type){
|
||||
case GL_UNSIGNED_BYTE:
|
||||
case GL_FIXED:
|
||||
case GL_FLOAT:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLEScmValidate::normalPointerType(GLenum type){
|
||||
|
||||
switch(type){
|
||||
case GL_BYTE:
|
||||
case GL_SHORT:
|
||||
case GL_FLOAT:
|
||||
case GL_FIXED:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLEScmValidate::pointPointerType(GLenum type){
|
||||
return type == GL_FIXED || type == GL_FLOAT;
|
||||
}
|
||||
|
||||
bool GLEScmValidate::texCoordPointerType(GLenum type){
|
||||
switch(type){
|
||||
case GL_BYTE:
|
||||
case GL_SHORT:
|
||||
case GL_FLOAT:
|
||||
case GL_FIXED:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GLEScmValidate::vertexPointerType(GLenum type){
|
||||
switch(type){
|
||||
case GL_BYTE:
|
||||
case GL_SHORT:
|
||||
case GL_FLOAT:
|
||||
case GL_FIXED:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,12 @@ static bool texImgDim(GLsizei width,GLsizei height,int maxTexSize);
|
||||
static bool renderbufferInternalFrmt(GLEScontext * ctx, GLenum internalformat);
|
||||
static bool stencilOp(GLenum param);
|
||||
static bool texGen(GLenum coord,GLenum pname);
|
||||
|
||||
static bool colorPointerType(GLenum type);
|
||||
static bool normalPointerType(GLenum type);
|
||||
static bool pointPointerType(GLenum type);
|
||||
static bool texCoordPointerType(GLenum type);
|
||||
static bool vertexPointerType(GLenum type);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user