summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-16 18:19:46 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-16 18:19:46 +0000
commitba3176a8f0a18527c0af5896f9d595d866e5ceeb (patch)
treeb7b4d6422738a7c236ed0f87f0fb4405be2bfcdf /gpu
parent515ae05e6ed31da81d992c55d64378fe9b7b84c7 (diff)
downloadchromium_src-ba3176a8f0a18527c0af5896f9d595d866e5ceeb.zip
chromium_src-ba3176a8f0a18527c0af5896f9d595d866e5ceeb.tar.gz
chromium_src-ba3176a8f0a18527c0af5896f9d595d866e5ceeb.tar.bz2
Implements Validation for all GLenum arguments and
GLint arguments that have specific valid values. Will add unit tests in separate CL as I expect to be able to auto generate unit tests. TEST=none BUG=none Review URL: http://codereview.chromium.org/505016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34726 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py807
-rw-r--r--gpu/command_buffer/common/gles2_cmd_id_test.cc359
-rw-r--r--gpu/command_buffer/common/gles2_cmd_id_test_autogen.h359
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc185
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_autogen.h1485
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_validate.h1262
-rw-r--r--gpu/command_buffer/service/gles2_cmd_validation.cc22
-rw-r--r--gpu/command_buffer/service/gles2_cmd_validation.h21
-rw-r--r--gpu/command_buffer/service/gles2_cmd_validation_autogen.h42
-rw-r--r--gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h487
10 files changed, 2397 insertions, 2632 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 4456db0..b5bed72 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -24,71 +24,66 @@ _LICENSE = """
"""
# This string is copied directly out of the gl2.h file from GLES2.0
-# the reasons it is copied out instead of parsed directly are
-#
-# 1) Because order is important. The command IDs need to stay constant forever
-# so if you add a new command it needs to be added to the bottom of the list.
-#
-# 2) So we can add more commands easily that are unrelated to GLES2.0 but still
-# needed for GLES2.0 command buffers.
#
# Edits:
#
# *) Any argument that is a resourceID has been changed to GLresourceID.
# (not pointer arguments)
#
+# *) All GLenums have been changed to GLenumTypeOfEnum
+#
_GL_FUNCTIONS = """
GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
GL_APICALL void GL_APIENTRY glAttachShader (GLResourceId program, GLResourceId shader);
GL_APICALL void GL_APIENTRY glBindAttribLocation (GLResourceId program, GLuint index, const char* name);
-GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLResourceId buffer);
-GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLResourceId framebuffer);
-GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLResourceId renderbuffer);
-GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLResourceId texture);
+GL_APICALL void GL_APIENTRY glBindBuffer (GLenumBufferTarget target, GLResourceId buffer);
+GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenumFrameBufferTarget target, GLResourceId framebuffer);
+GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenumRenderBufferTarget target, GLResourceId renderbuffer);
+GL_APICALL void GL_APIENTRY glBindTexture (GLenumTextureBindTarget target, GLResourceId texture);
GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode );
-GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
-GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
-GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void* data, GLenum usage);
-GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void* data);
-GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
+GL_APICALL void GL_APIENTRY glBlendEquation ( GLenumEquation mode );
+GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenumEquation modeRGB, GLenumEquation modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunc (GLenumSrcBlendFactor sfactor, GLenumDstBlendFactor dfactor);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenumSrcBlendFactor srcRGB, GLenumDstBlendFactor dstRGB, GLenumSrcBlendFactor srcAlpha, GLenumDstBlendFactor dstAlpha);
+GL_APICALL void GL_APIENTRY glBufferData (GLenumBufferTarget target, GLsizeiptr size, const void* data, GLenumBufferUsage usage);
+GL_APICALL void GL_APIENTRY glBufferSubData (GLenumBufferTarget target, GLintptr offset, GLsizeiptr size, const void* data);
+GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenumFrameBufferTarget target);
GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth);
GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
GL_APICALL void GL_APIENTRY glCompileShader (GLResourceId shader);
-GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
-GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenumTextureTarget target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenumTextureTarget target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
+GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenumTextureTarget target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenumTextureTarget target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
-GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
-GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
+GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenumShaderType type);
+GL_APICALL void GL_APIENTRY glCullFace (GLenumFaceType mode);
GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
GL_APICALL void GL_APIENTRY glDeleteProgram (GLResourceId program);
GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
GL_APICALL void GL_APIENTRY glDeleteShader (GLResourceId shader);
GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
-GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
+GL_APICALL void GL_APIENTRY glDepthFunc (GLenumCmpFunction func);
GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
GL_APICALL void GL_APIENTRY glDetachShader (GLResourceId program, GLResourceId shader);
-GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
+GL_APICALL void GL_APIENTRY glDisable (GLenumCapability cap);
GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
-GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
-GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void* indices);
-GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
+GL_APICALL void GL_APIENTRY glDrawArrays (GLenumDrawMode mode, GLint first, GLsizei count);
+GL_APICALL void GL_APIENTRY glDrawElements (GLenumDrawMode mode, GLsizei count, GLenumIndexType type, const void* indices);
+GL_APICALL void GL_APIENTRY glEnable (GLenumCapability cap);
GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
GL_APICALL void GL_APIENTRY glFinish (void);
GL_APICALL void GL_APIENTRY glFlush (void);
-GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLResourceId renderbuffer);
-GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLResourceId texture, GLint level);
-GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenumFrameBufferTarget target, GLenumAttachment attachment, GLenumRenderBufferTarget renderbuffertarget, GLResourceId renderbuffer);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenumFrameBufferTarget target, GLenumAttachment attachment, GLenumTextureTarget textarget, GLResourceId texture, GLint level);
+GL_APICALL void GL_APIENTRY glFrontFace (GLenumFaceMode mode);
GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
-GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
+GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenumTextureBindTarget target);
GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
@@ -97,30 +92,30 @@ GL_APICALL void GL_APIENTRY glGetActiveUniform (GLResourceId program, GL
GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLResourceId program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLResourceId program, const char* name);
GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
-GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenumBufferTarget target, GLenumBufferParameter pname, GLint* params);
GL_APICALL GLenum GL_APIENTRY glGetError (void);
GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
-GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenumFrameBufferTarget target, GLenumAttachment attachment, GLenumFrameBufferParameter pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetProgramiv (GLResourceId program, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLResourceId program, GLenumProgramParameter pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLResourceId program, GLsizei bufsize, GLsizei* length, char* infolog);
-GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetShaderiv (GLResourceId shader, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenumRenderBufferTarget target, GLenumRenderBufferParameter pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLResourceId shader, GLenumShaderParameter pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLResourceId shader, GLsizei bufsize, GLsizei* length, char* infolog);
-GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenumShaderType shadertype, GLenumShaderPercision precisiontype, GLint* range, GLint* precision);
GL_APICALL void GL_APIENTRY glGetShaderSource (GLResourceId shader, GLsizei bufsize, GLsizei* length, char* source);
-GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
-GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
-GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenumStringType name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenumTextureTarget target, GLenumTextureParameter pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenumTextureTarget target, GLenumTextureParameter pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetUniformfv (GLResourceId program, GLint location, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetUniformiv (GLResourceId program, GLint location, GLint* params);
GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLResourceId program, const char* name);
-GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
-GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void** pointer);
-GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenumVertexAttribute pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenumVertexAttribute pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenumVertexPointer pname, void** pointer);
+GL_APICALL void GL_APIENTRY glHint (GLenumHintTarget target, GLenumHintMode mode);
GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLResourceId buffer);
-GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
+GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenumCapability cap);
GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLResourceId framebuffer);
GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLResourceId program);
GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLResourceId renderbuffer);
@@ -128,27 +123,27 @@ GL_APICALL GLboolean GL_APIENTRY glIsShader (GLResourceId shader);
GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLResourceId texture);
GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
GL_APICALL void GL_APIENTRY glLinkProgram (GLResourceId program);
-GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glPixelStorei (GLenumPixelStore pname, GLintPixelStoreAlignment param);
GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
-GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels);
+GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenumReadPixelFormat format, GLenumPixelType type, void* pixels);
GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
-GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenumRenderBufferTarget target, GLenumRenderBufferFormat internalformat, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLResourceId* shaders, GLenum binaryformat, const void* binary, GLsizei length);
GL_APICALL void GL_APIENTRY glShaderSource (GLResourceId shader, GLsizei count, const char** string, const GLint* length);
-GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFunc (GLenumCmpFunction func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenumFaceType face, GLenumCmpFunction func, GLint ref, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
-GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
-GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels);
-GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
-GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
-GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
-GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);
+GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenumFaceType face, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilOp (GLenumStencilOp fail, GLenumStencilOp zfail, GLenumStencilOp zpass);
+GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenumFaceType face, GLenumStencilOp fail, GLenumStencilOp zfail, GLenumStencilOp zpass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenumTextureTarget target, GLint level, GLintTextureFormat internalformat, GLsizei width, GLsizei height, GLint border, GLenumTextureFormat format, GLenumPixelType type, const void* pixels);
+GL_APICALL void GL_APIENTRY glTexParameterf (GLenumTextureBindTarget target, GLenumTextureParameter pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glTexParameterfv (GLenumTextureBindTarget target, GLenumTextureParameter pname, const GLfloat* params);
+GL_APICALL void GL_APIENTRY glTexParameteri (GLenumTextureBindTarget target, GLenumTextureParameter pname, GLint param);
+GL_APICALL void GL_APIENTRY glTexParameteriv (GLenumTextureBindTarget target, GLenumTextureParameter pname, const GLint* params);
+GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenumTextureTarget target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenumTextureFormat format, GLenumPixelType type, const void* pixels);
GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
@@ -178,12 +173,458 @@ GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GL
GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
-GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLintVertexAttribSize size, GLenumVertexAttribType type, GLboolean normalized, GLsizei stride, const void* ptr);
GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
// Non-GL commands.
GL_APICALL void GL_APIENTRY glSwapBuffers (void);
"""
+# This is the list of all commmands that will be generated and their Id.
+# If a command is not listed in this table it is an error.
+# This lets us make sure that command ids do not change as the generator
+# generates new variations of commands.
+
+_CMD_ID_TABLE = {
+ 'ActiveTexture': 256,
+ 'AttachShader': 257,
+ 'BindAttribLocation': 258,
+ 'BindAttribLocationImmediate': 259,
+ 'BindBuffer': 260,
+ 'BindFramebuffer': 261,
+ 'BindRenderbuffer': 262,
+ 'BindTexture': 263,
+ 'BlendColor': 264,
+ 'BlendEquation': 265,
+ 'BlendEquationSeparate': 266,
+ 'BlendFunc': 267,
+ 'BlendFuncSeparate': 268,
+ 'BufferData': 269,
+ 'BufferDataImmediate': 270,
+ 'BufferSubData': 271,
+ 'BufferSubDataImmediate': 272,
+ 'CheckFramebufferStatus': 273,
+ 'Clear': 274,
+ 'ClearColor': 275,
+ 'ClearDepthf': 276,
+ 'ClearStencil': 277,
+ 'ColorMask': 278,
+ 'CompileShader': 279,
+ 'CompressedTexImage2D': 280,
+ 'CompressedTexImage2DImmediate': 281,
+ 'CompressedTexSubImage2D': 282,
+ 'CompressedTexSubImage2DImmediate': 283,
+ 'CopyTexImage2D': 284,
+ 'CopyTexSubImage2D': 285,
+ 'CreateProgram': 286,
+ 'CreateShader': 287,
+ 'CullFace': 288,
+ 'DeleteBuffers': 289,
+ 'DeleteBuffersImmediate': 290,
+ 'DeleteFramebuffers': 291,
+ 'DeleteFramebuffersImmediate': 292,
+ 'DeleteProgram': 293,
+ 'DeleteRenderbuffers': 294,
+ 'DeleteRenderbuffersImmediate': 295,
+ 'DeleteShader': 296,
+ 'DeleteTextures': 297,
+ 'DeleteTexturesImmediate': 298,
+ 'DepthFunc': 299,
+ 'DepthMask': 300,
+ 'DepthRangef': 301,
+ 'DetachShader': 302,
+ 'Disable': 303,
+ 'DisableVertexAttribArray': 304,
+ 'DrawArrays': 305,
+ 'DrawElements': 306,
+ 'Enable': 307,
+ 'EnableVertexAttribArray': 308,
+ 'Finish': 309,
+ 'Flush': 310,
+ 'FramebufferRenderbuffer': 311,
+ 'FramebufferTexture2D': 312,
+ 'FrontFace': 313,
+ 'GenBuffers': 314,
+ 'GenBuffersImmediate': 315,
+ 'GenerateMipmap': 316,
+ 'GenFramebuffers': 317,
+ 'GenFramebuffersImmediate': 318,
+ 'GenRenderbuffers': 319,
+ 'GenRenderbuffersImmediate': 320,
+ 'GenTextures': 321,
+ 'GenTexturesImmediate': 322,
+ 'GetActiveAttrib': 323,
+ 'GetActiveUniform': 324,
+ 'GetAttachedShaders': 325,
+ 'GetAttribLocation': 326,
+ 'GetAttribLocationImmediate': 327,
+ 'GetBooleanv': 328,
+ 'GetBufferParameteriv': 329,
+ 'GetError': 330,
+ 'GetFloatv': 331,
+ 'GetFramebufferAttachmentParameteriv': 332,
+ 'GetIntegerv': 333,
+ 'GetProgramiv': 334,
+ 'GetProgramInfoLog': 335,
+ 'GetRenderbufferParameteriv': 336,
+ 'GetShaderiv': 337,
+ 'GetShaderInfoLog': 338,
+ 'GetShaderPrecisionFormat': 339,
+ 'GetShaderSource': 340,
+ 'GetString': 341,
+ 'GetTexParameterfv': 342,
+ 'GetTexParameteriv': 343,
+ 'GetUniformfv': 344,
+ 'GetUniformiv': 345,
+ 'GetUniformLocation': 346,
+ 'GetUniformLocationImmediate': 347,
+ 'GetVertexAttribfv': 348,
+ 'GetVertexAttribiv': 349,
+ 'GetVertexAttribPointerv': 350,
+ 'Hint': 351,
+ 'IsBuffer': 352,
+ 'IsEnabled': 353,
+ 'IsFramebuffer': 354,
+ 'IsProgram': 355,
+ 'IsRenderbuffer': 356,
+ 'IsShader': 357,
+ 'IsTexture': 358,
+ 'LineWidth': 359,
+ 'LinkProgram': 360,
+ 'PixelStorei': 361,
+ 'PolygonOffset': 362,
+ 'ReadPixels': 363,
+ 'RenderbufferStorage': 364,
+ 'SampleCoverage': 365,
+ 'Scissor': 366,
+ 'ShaderSource': 367,
+ 'ShaderSourceImmediate': 368,
+ 'StencilFunc': 369,
+ 'StencilFuncSeparate': 370,
+ 'StencilMask': 371,
+ 'StencilMaskSeparate': 372,
+ 'StencilOp': 373,
+ 'StencilOpSeparate': 374,
+ 'TexImage2D': 375,
+ 'TexImage2DImmediate': 376,
+ 'TexParameterf': 377,
+ 'TexParameterfv': 378,
+ 'TexParameterfvImmediate': 379,
+ 'TexParameteri': 380,
+ 'TexParameteriv': 381,
+ 'TexParameterivImmediate': 382,
+ 'TexSubImage2D': 383,
+ 'TexSubImage2DImmediate': 384,
+ 'Uniform1f': 385,
+ 'Uniform1fv': 386,
+ 'Uniform1fvImmediate': 387,
+ 'Uniform1i': 388,
+ 'Uniform1iv': 389,
+ 'Uniform1ivImmediate': 390,
+ 'Uniform2f': 391,
+ 'Uniform2fv': 392,
+ 'Uniform2fvImmediate': 393,
+ 'Uniform2i': 394,
+ 'Uniform2iv': 395,
+ 'Uniform2ivImmediate': 396,
+ 'Uniform3f': 397,
+ 'Uniform3fv': 398,
+ 'Uniform3fvImmediate': 399,
+ 'Uniform3i': 400,
+ 'Uniform3iv': 401,
+ 'Uniform3ivImmediate': 402,
+ 'Uniform4f': 403,
+ 'Uniform4fv': 404,
+ 'Uniform4fvImmediate': 405,
+ 'Uniform4i': 406,
+ 'Uniform4iv': 407,
+ 'Uniform4ivImmediate': 408,
+ 'UniformMatrix2fv': 409,
+ 'UniformMatrix2fvImmediate': 410,
+ 'UniformMatrix3fv': 411,
+ 'UniformMatrix3fvImmediate': 412,
+ 'UniformMatrix4fv': 413,
+ 'UniformMatrix4fvImmediate': 414,
+ 'UseProgram': 415,
+ 'ValidateProgram': 416,
+ 'VertexAttrib1f': 417,
+ 'VertexAttrib1fv': 418,
+ 'VertexAttrib1fvImmediate': 419,
+ 'VertexAttrib2f': 420,
+ 'VertexAttrib2fv': 421,
+ 'VertexAttrib2fvImmediate': 422,
+ 'VertexAttrib3f': 423,
+ 'VertexAttrib3fv': 424,
+ 'VertexAttrib3fvImmediate': 425,
+ 'VertexAttrib4f': 426,
+ 'VertexAttrib4fv': 427,
+ 'VertexAttrib4fvImmediate': 428,
+ 'VertexAttribPointer': 429,
+ 'Viewport': 430,
+ 'SwapBuffers': 431,
+}
+
+# This is a list of enum names and their valid values. It is used to map
+# GLenum arguments to a specific set of valid values.
+_ENUM_LISTS = {
+ 'FrameBufferTarget': [
+ 'GL_FRAMEBUFFER',
+ ],
+ 'RenderBufferTarget': [
+ 'GL_RENDERBUFFER',
+ ],
+ 'BufferTarget': [
+ 'GL_ARRAY_BUFFER',
+ 'GL_ELEMENT_ARRAY_BUFFER',
+ ],
+ 'BufferUsage': [
+ 'GL_STREAM_DRAW',
+ 'GL_STATIC_DRAW',
+ 'GL_DYNAMIC_DRAW',
+ ],
+ 'TextureTarget': [
+ 'GL_TEXTURE_2D',
+ 'GL_TEXTURE_CUBE_MAP_POSITIVE_X',
+ 'GL_TEXTURE_CUBE_MAP_NEGATIVE_X',
+ 'GL_TEXTURE_CUBE_MAP_POSITIVE_Y',
+ 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Y',
+ 'GL_TEXTURE_CUBE_MAP_POSITIVE_Z',
+ 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Z',
+ ],
+ 'TextureBindTarget': [
+ 'GL_TEXTURE_2D',
+ 'GL_TEXTURE_CUBE_MAP',
+ ],
+ 'ShaderType': [
+ 'GL_VERTEX_SHADER',
+ 'GL_FRAGMENT_SHADER',
+ ],
+ 'FaceType': [
+ 'GL_FRONT',
+ 'GL_BACK',
+ 'GL_FRONT_AND_BACK',
+ ],
+ 'FaceMode': [
+ 'GL_CW',
+ 'GL_CCW',
+ ],
+ 'CmpFunction': [
+ 'GL_NEVER',
+ 'GL_LESS',
+ 'GL_EQUAL',
+ 'GL_LEQUAL',
+ 'GL_GREATER',
+ 'GL_NOTEQUAL',
+ 'GL_GEQUAL',
+ 'GL_ALWAYS',
+ ],
+ 'Equation': [
+ 'GL_FUNC_ADD',
+ 'GL_FUNC_SUBTRACT',
+ 'GL_FUNC_REVERSE_SUBTRACT',
+ ],
+ 'SrcBlendFactor': [
+ 'GL_ZERO',
+ 'GL_ONE',
+ 'GL_SRC_COLOR',
+ 'GL_ONE_MINUS_SRC_COLOR',
+ 'GL_DST_COLOR',
+ 'GL_ONE_MINUS_DST_COLOR',
+ 'GL_SRC_ALPHA',
+ 'GL_ONE_MINUS_SRC_ALPHA',
+ 'GL_DST_ALPHA',
+ 'GL_ONE_MINUS_DST_ALPHA',
+ 'GL_CONSTANT_COLOR',
+ 'GL_ONE_MINUS_CONSTANT_COLOR',
+ 'GL_CONSTANT_ALPHA',
+ 'GL_ONE_MINUS_CONSTANT_ALPHA',
+ 'GL_SRC_ALPHA_SATURATE',
+ ],
+ 'DstBlendFactor': [
+ 'GL_ZERO',
+ 'GL_ONE',
+ 'GL_SRC_COLOR',
+ 'GL_ONE_MINUS_SRC_COLOR',
+ 'GL_DST_COLOR',
+ 'GL_ONE_MINUS_DST_COLOR',
+ 'GL_SRC_ALPHA',
+ 'GL_ONE_MINUS_SRC_ALPHA',
+ 'GL_DST_ALPHA',
+ 'GL_ONE_MINUS_DST_ALPHA',
+ 'GL_CONSTANT_COLOR',
+ 'GL_ONE_MINUS_CONSTANT_COLOR',
+ 'GL_CONSTANT_ALPHA',
+ 'GL_ONE_MINUS_CONSTANT_ALPHA',
+ ],
+ 'Capability': [
+ 'GL_BLEND',
+ 'GL_CULL_FACE',
+ 'GL_DEPTH_TEST',
+ 'GL_DITHER',
+ 'GL_POLYGON_OFFSET_FILL',
+ 'GL_SAMPLE_ALPHA_TO_COVERAGE',
+ 'GL_SAMPLE_COVERAGE',
+ 'GL_SCISSOR_TEST',
+ 'GL_STENCIL_TEST',
+ ],
+ 'DrawMode': [
+ 'GL_POINTS',
+ 'GL_LINE_STRIP',
+ 'GL_LINE_LOOP',
+ 'GL_LINES',
+ 'GL_TRIANGLE_STRIP',
+ 'GL_TRIANGLE_FAN',
+ 'GL_TRIANGLES',
+ ],
+ 'IndexType': [
+ 'GL_UNSIGNED_BYTE',
+ 'GL_UNSIGNED_SHORT',
+ ],
+ 'Attachment': [
+ 'GL_COLOR_ATTACHMENT0',
+ 'GL_DEPTH_ATTACHMENT',
+ 'GL_STENCIL_ATTACHMENT',
+ ],
+ 'BufferParameter': [
+ 'GL_BUFFER_SIZE',
+ 'GL_BUFFER_USAGE',
+ ],
+ 'FrameBufferParameter': [
+ 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME',
+ 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL',
+ 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE',
+ ],
+ 'ProgramParameter': [
+ 'GL_DELETE_STATUS',
+ 'GL_LINK_STATUS',
+ 'GL_VALIDATE_STATUS',
+ 'GL_INFO_LOG_LENGTH',
+ 'GL_ATTACHED_SHADERS',
+ 'GL_ACTIVE_ATTRIBUTES',
+ 'GL_ACTIVE_ATTRIBUTE_MAX_LENGTH',
+ 'GL_ACTIVE_UNIFORMS',
+ 'GL_ACTIVE_UNIFORM_MAX_LENGTH',
+ ],
+ 'RenderBufferParameter': [
+ 'GL_RENDERBUFFER_WIDTH',
+ 'GL_RENDERBUFFER_HEIGHT',
+ 'GL_RENDERBUFFER_INTERNAL_FORMAT',
+ 'GL_RENDERBUFFER_RED_SIZE',
+ 'GL_RENDERBUFFER_GREEN_SIZE',
+ 'GL_RENDERBUFFER_BLUE_SIZE',
+ 'GL_RENDERBUFFER_ALPHA_SIZE',
+ 'GL_RENDERBUFFER_DEPTH_SIZE',
+ 'GL_RENDERBUFFER_STENCIL_SIZE',
+ ],
+ 'ShaderParameter': [
+ 'GL_SHADER_TYPE',
+ 'GL_DELETE_STATUS',
+ 'GL_COMPILE_STATUS',
+ 'GL_INFO_LOG_LENGTH',
+ 'GL_SHADER_SOURCE_LENGTH',
+ ],
+ 'ShaderPercision': [
+ 'GL_LOW_FLOAT',
+ 'GL_MEDIUM_FLOAT',
+ 'GL_HIGH_FLOAT',
+ 'GL_LOW_INT',
+ 'GL_MEDIUM_INT',
+ 'GL_HIGH_INT',
+ ],
+ 'StringType': [
+ 'GL_VENDOR',
+ 'GL_RENDERER',
+ 'GL_VERSION',
+ 'GL_SHADING_LANGUAGE_VERSION',
+ 'GL_EXTENSIONS',
+ ],
+ 'TextureParameter': [
+ 'GL_TEXTURE_MAG_FILTER',
+ 'GL_TEXTURE_MIN_FILTER',
+ 'GL_TEXTURE_WRAP_S',
+ 'GL_TEXTURE_WRAP_T',
+ ],
+ 'VertexAttribute': [
+ 'GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING',
+ 'GL_VERTEX_ATTRIB_ARRAY_ENABLED',
+ 'GL_VERTEX_ATTRIB_ARRAY_SIZE',
+ 'GL_VERTEX_ATTRIB_ARRAY_STRIDE',
+ 'GL_VERTEX_ATTRIB_ARRAY_TYPE',
+ 'GL_VERTEX_ATTRIB_ARRAY_NORMALIZED',
+ 'GL_CURRENT_VERTEX_ATTRIB',
+ ],
+ 'VertexPointer': [
+ 'GL_VERTEX_ATTRIB_ARRAY_POINTER',
+ ],
+ 'HintTarget': [
+ 'GL_GENERATE_MIPMAP_HINT',
+ ],
+ 'HintMode': [
+ 'GL_FASTEST',
+ 'GL_NICEST',
+ 'GL_DONT_CARE',
+ ],
+ 'PixelStore': [
+ 'GL_PACK_ALIGNMENT',
+ 'GL_UNPACK_ALIGNMENT',
+ ],
+ 'PixelStoreAlignment': [
+ '1',
+ '2',
+ '4',
+ '8',
+ ],
+ 'ReadPixelFormat': [
+ 'GL_ALPHA',
+ 'GL_RGB',
+ 'GL_RGBA',
+ ],
+ 'PixelType': [
+ 'GL_UNSIGNED_BYTE',
+ 'GL_UNSIGNED_SHORT_5_6_5',
+ 'GL_UNSIGNED_SHORT_4_4_4_4',
+ 'GL_UNSIGNED_SHORT_5_5_5_1',
+ ],
+ 'RenderBufferFormat': [
+ 'GL_RGBA4',
+ 'GL_RGB565',
+ 'GL_RGB5_A1',
+ 'GL_DEPTH_COMPONENT16',
+ 'GL_STENCIL_INDEX8',
+ ],
+ 'StencilOp': [
+ 'GL_KEEP',
+ 'GL_ZERO',
+ 'GL_REPLACE',
+ 'GL_INCR',
+ 'GL_INCR_WRAP',
+ 'GL_DECR',
+ 'GL_DECR_WRAP',
+ 'GL_INVERT',
+ ],
+ 'TextureFormat': [
+ 'GL_ALPHA',
+ 'GL_LUMINANCE',
+ 'GL_LUMINANCE_ALPHA',
+ 'GL_RGB',
+ 'GL_RGBA',
+ ],
+ 'VertexAttribType': [
+ 'GL_BYTE',
+ 'GL_UNSIGNED_BYTE',
+ 'GL_SHORT',
+ 'GL_UNSIGNED_SHORT',
+ #'GL_FIXED', // This is not available on Desktop GL.
+ 'GL_FLOAT',
+ ],
+ 'VertexAttribSize': [
+ '1',
+ '2',
+ '3',
+ '4',
+ ],
+}
+
# This table specifies types and other special data for the commands that
# will be generated.
#
@@ -207,19 +648,19 @@ _FUNCTION_INFO = {
'BindBuffer': {'DecoderFunc': 'DoBindBuffer'},
'BindFramebuffer': {'DecoderFunc': 'glBindFramebufferEXT'},
'BindRenderbuffer': {'DecoderFunc': 'glBindRenderbufferEXT'},
- 'BufferData': {'type': 'Manual', 'immediate': True,},
+ 'BufferData': {'type': 'Manual', 'immediate': True},
'BufferSubData': {'type': 'Data'},
'CheckFramebufferStatus': {'DecoderFunc': 'glCheckFramebufferStatusEXT'},
'ClearDepthf': {'DecoderFunc': 'glClearDepth'},
- 'CompressedTexImage2D': {'type': 'Manual', 'immediate': True,},
+ 'CompressedTexImage2D': {'type': 'Manual','immediate': True},
'CompressedTexSubImage2D': {'type': 'Data'},
'CreateProgram': {'type': 'Create'},
'CreateShader': {'type': 'Create'},
'DeleteBuffers': {'type': 'DELn'},
'DeleteFramebuffers': {'type': 'DELn'},
- 'DeleteProgram': {'DecoderFunc': 'DoDeleteProgram'},
+ 'DeleteProgram': {'type': 'Custom', 'DecoderFunc': 'DoDeleteProgram'},
'DeleteRenderbuffers': {'type': 'DELn'},
- 'DeleteShader': {'DecoderFunc': 'DoDeleteShader'},
+ 'DeleteShader': {'type': 'Custom', 'DecoderFunc': 'DoDeleteShader'},
'DeleteTextures': {'type': 'DELn'},
'DepthRangef': {'DecoderFunc': 'glDepthRange'},
'DrawElements': {
@@ -441,12 +882,6 @@ class TypeHandler(object):
def WriteHandlerImplementation(self, func, file):
"""Writes the handler implementation for this command."""
- file.Write(" parse_error::ParseError result =\n")
- file.Write(" Validate%s(this, immediate_data_size%s);\n" %
- (func.name, func.MakeOriginalArgString("", True)))
- file.Write(" if (result != parse_error::kParseNoError) {\n")
- file.Write(" return result;\n")
- file.Write(" }\n")
file.Write(" %s(%s);\n" %
(func.GetGLFunctionName(), func.MakeOriginalArgString("")))
@@ -514,12 +949,7 @@ class TypeHandler(object):
def WriteImmediateHandlerImplementation (self, func, file):
"""Writes the handler impl for the immediate version of a command."""
file.Write(" // Immediate version.\n")
- file.Write(" parse_error::ParseError result =\n")
- file.Write(" Validate%s(this, immediate_data_size%s);\n" %
- (func.name, func.MakeOriginalArgString("", True)))
- file.Write(" if (result != parse_error::kParseNoError) {\n")
- file.Write(" return result;\n")
- file.Write(" }\n")
+ func.WriteHandlerValidation(file)
file.Write(" %s(%s);\n" %
(func.GetGLFunctionName(), func.MakeOriginalArgString("")))
@@ -531,6 +961,7 @@ class TypeHandler(object):
" uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name)
for arg in func.GetOriginalArgs():
arg.WriteGetCode(file)
+ func.WriteHandlerValidation(file)
func.WriteHandlerImplementation(file)
file.Write(" return parse_error::kParseNoError;\n")
file.Write("}\n")
@@ -544,6 +975,7 @@ class TypeHandler(object):
" uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name)
for arg in func.GetOriginalArgs():
arg.WriteGetCode(file)
+ func.WriteHandlerValidation(file)
func.WriteHandlerImplementation(file)
file.Write(" return parse_error::kParseNoError;\n")
file.Write("}\n")
@@ -802,6 +1234,7 @@ class DataHandler(CustomHandler):
for arg in func.GetOriginalArgs():
arg.WriteGetAddress(file)
+ func.WriteHandlerValidation(file)
func.WriteHandlerImplementation(file)
file.Write(" return parse_error::kParseNoError;\n")
file.Write("}\n")
@@ -867,23 +1300,13 @@ class GENnHandler(TypeHandler):
def WriteHandlerImplementation (self, func, file):
"""Overrriden from TypeHandler."""
- file.Write(" parse_error::ParseError result =\n")
- file.Write(" Validate%s(this, immediate_data_size%s);\n" %
- (func.name, func.MakeOriginalArgString("", True)))
- file.Write(" if (result != parse_error::kParseNoError) {\n")
- file.Write(" return result;\n")
- file.Write(" }\n")
+ func.WriteHandlerValidation(file)
file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" %
(func.name, func.GetLastOriginalArg().name))
def WriteImmediateHandlerImplementation(self, func, file):
"""Overrriden from TypeHandler."""
- file.Write(" parse_error::ParseError result =\n")
- file.Write(" Validate%s(this, immediate_data_size%s);\n" %
- (func.name, func.MakeOriginalArgString("", True)))
- file.Write(" if (result != parse_error::kParseNoError) {\n")
- file.Write(" return result;\n")
- file.Write(" }\n")
+ func.WriteHandlerValidation(file)
file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" %
(func.original_name, func.GetLastOriginalArg().name))
@@ -1012,12 +1435,7 @@ class CreateHandler(TypeHandler):
def WriteHandlerImplementation (self, func, file):
"""Overrriden from TypeHandler."""
file.Write(" uint32 client_id = c.client_id;\n")
- file.Write(" parse_error::ParseError result =\n")
- file.Write(" Validate%s(this, immediate_data_size%s);\n" %
- (func.name, func.MakeOriginalArgString("", True)))
- file.Write(" if (result != parse_error::kParseNoError) {\n")
- file.Write(" return result;\n")
- file.Write(" }\n")
+ func.WriteHandlerValidation(file)
file.Write(" %sHelper(%s);\n" %
(func.name, func.MakeCmdArgString("")))
@@ -1047,23 +1465,13 @@ class DELnHandler(TypeHandler):
def WriteHandlerImplementation (self, func, file):
"""Overrriden from TypeHandler."""
- file.Write(" parse_error::ParseError result =\n")
- file.Write(" Validate%s(this, immediate_data_size%s);\n" %
- (func.name, func.MakeOriginalArgString("", True)))
- file.Write(" if (result != parse_error::kParseNoError) {\n")
- file.Write(" return result;\n")
- file.Write(" }\n")
+ func.WriteHandlerValidation(file)
file.Write(" DeleteGLObjects<GL%sHelper>(n, %s);\n" %
(func.name, func.GetLastOriginalArg().name))
def WriteImmediateHandlerImplementation (self, func, file):
"""Overrriden from TypeHandler."""
- file.Write(" parse_error::ParseError result =\n")
- file.Write(" Validate%s(this, immediate_data_size%s);\n" %
- (func.name, func.MakeOriginalArgString("", True)))
- file.Write(" if (result != parse_error::kParseNoError) {\n")
- file.Write(" return result;\n")
- file.Write(" }\n")
+ func.WriteHandlerValidation(file)
file.Write(" DeleteGLObjects<GL%sHelper>(n, %s);\n" %
(func.original_name, func.GetLastOriginalArg().name))
@@ -1206,6 +1614,7 @@ class GETnHandler(TypeHandler):
file.Write(" uint32 params_size = num_values * sizeof(*params);\n")
file.Write(" params = GetSharedMemoryAs<%s>(\n" % last_arg.type)
file.Write(" c.params_shm_id, c.params_shm_offset, params_size);\n")
+ func.WriteHandlerValidation(file)
func.WriteHandlerImplementation(file)
file.Write(" return parse_error::kParseNoError;\n")
file.Write("}\n")
@@ -1528,12 +1937,7 @@ class GLcharHandler(TypeHandler):
last_arg.type)
file.Write(" c.%s_shm_id, c.%s_shm_offset, name_size);\n" %
(last_arg.name, last_arg.name))
- file.Write(" parse_error::ParseError result =\n")
- file.Write(" Validate%s(this, immediate_data_size%s);\n" %
- (func.name, func.MakeOriginalArgString("", True)))
- file.Write(" if (result != parse_error::kParseNoError) {\n")
- file.Write(" return result;\n")
- file.Write(" }\n")
+ func.WriteHandlerValidation(file)
arg_string = ", ".join(["%s" % arg.name for arg in all_but_last_arg])
file.Write(" String name_str(name, name_size);\n")
file.Write(" %s(%s, name_str.c_str());\n" %
@@ -1559,12 +1963,7 @@ class GLcharHandler(TypeHandler):
" const char* name = GetImmediateDataAs<const char*>(c);\n")
file.Write(" // TODO(gman): Make sure validate checks\n")
file.Write(" // immediate_data_size covers data_size.\n")
- file.Write(" parse_error::ParseError result =\n")
- file.Write(" Validate%s(this, immediate_data_size%s);\n" %
- (func.name, func.MakeOriginalArgString("", True)))
- file.Write(" if (result != parse_error::kParseNoError) {\n")
- file.Write(" return result;\n")
- file.Write(" }\n")
+ func.WriteHandlerValidation(file)
arg_string = ", ".join(["%s" % arg.name for arg in all_but_last_arg])
file.Write(" String name_str(name, name_size);\n")
file.Write(" %s(%s, name_str.c_str());\n" %
@@ -1707,12 +2106,7 @@ class GetGLcharHandler(GLcharHandler):
file.Write(
" c.location_shm_id, c.location_shm_offset, sizeof(*location));\n")
file.Write(" // TODO(gman): Validate location.\n")
- file.Write(" parse_error::ParseError result =\n")
- file.Write(" Validate%s(this, immediate_data_size%s);\n" %
- (func.name, func.MakeOriginalArgString("", True)))
- file.Write(" if (result != parse_error::kParseNoError) {\n")
- file.Write(" return result;\n")
- file.Write(" }\n")
+ func.WriteHandlerValidation(file)
arg_string = ", ".join(["%s" % arg.name for arg in all_but_last_arg])
file.Write(" String name_str(name, name_size);\n")
file.Write(" *location = %s(%s, name_str.c_str());\n" %
@@ -1742,12 +2136,7 @@ class GetGLcharHandler(GLcharHandler):
file.Write(
" c.location_shm_id, c.location_shm_offset, sizeof(*location));\n")
file.Write(" // TODO(gman): Validate location.\n")
- file.Write(" parse_error::ParseError result =\n")
- file.Write(" Validate%s(this, immediate_data_size%s);\n" %
- (func.name, func.MakeOriginalArgString("", True)))
- file.Write(" if (result != parse_error::kParseNoError) {\n")
- file.Write(" return result;\n")
- file.Write(" }\n")
+ func.WriteHandlerValidation(file)
arg_string = ", ".join(["%s" % arg.name for arg in all_but_last_arg])
file.Write(" String name_str(name, name_size);\n")
file.Write(" *location = %s(%s, name_str.c_str());\n" %
@@ -1887,12 +2276,7 @@ class IsHandler(TypeHandler):
(func.return_type, func.return_type))
file.Write(
" c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));\n")
- file.Write(" parse_error::ParseError result =\n")
- file.Write(" Validate%s(this, immediate_data_size%s);\n" %
- (func.name, func.MakeOriginalArgString("", True)))
- file.Write(" if (result != parse_error::kParseNoError) {\n")
- file.Write(" return result;\n")
- file.Write(" }\n")
+ func.WriteHandlerValidation(file)
file.Write(" *result_dst = %s(%s);\n" %
(func.GetGLFunctionName(), func.MakeOriginalArgString("")))
file.Write(" return parse_error::kParseNoError;\n")
@@ -1993,6 +2377,40 @@ class Argument(object):
return self
+class EnumArgument(Argument):
+ """A class that represents a GLenum argument"""
+
+ def __init__(self, name, type):
+ Argument.__init__(self, name, "GLenum")
+
+ self.enum_type = type
+
+ def WriteValidationCode(self, file):
+ file.Write(" if (!Validate%s(%s)) {\n" % (self.enum_type, self.name))
+ file.Write(" SetGLError(GL_INVALID_VALUE);\n")
+ file.Write(" return parse_error::kParseNoError;\n")
+ file.Write(" }\n")
+
+
+class IntArgument(Argument):
+ """A class for a GLint argument that can only except specific values.
+
+ For example glTexImage2D takes a GLint for its internalformat
+ argument instead of a GLenum.
+ """
+
+ def __init__(self, name, type):
+ Argument.__init__(self, name, "GLint")
+
+ self.int_type = type
+
+ def WriteValidationCode(self, file):
+ file.Write(" if (!Validate%s(%s)) {\n" % (self.int_type, self.name))
+ file.Write(" SetGLError(GL_INVALID_VALUE);\n")
+ file.Write(" return parse_error::kParseNoError;\n")
+ file.Write(" }\n")
+
+
class ImmediatePointerArgument(Argument):
"""A class that represents an immediate argument to a function.
@@ -2202,6 +2620,12 @@ class Function(object):
["%s%s" % (prefix, arg.name) for arg in args])
return self.__GetArgList(arg_string, add_comma)
+ def WriteHandlerValidation(self, file):
+ """Writes validation code for the function."""
+ for arg in self.GetOriginalArgs():
+ arg.WriteValidationCode(file)
+ self.WriteValidationCode(file)
+
def WriteHandlerImplementation(self, file):
"""Writes the handler implementation for this command."""
self.type_handler.WriteHandlerImplementation(self, file)
@@ -2368,10 +2792,13 @@ def CreateArg(arg_string):
return ResourceIdArgument(
arg_parts[-1],
" ".join(arg_parts[0:-1]))
+ elif arg_parts[0].startswith('GLenum') and len(arg_parts[0]) > 6:
+ return EnumArgument(arg_parts[-1], " ".join(arg_parts[0:-1]))
+ elif (arg_parts[0].startswith('GLint') and len(arg_parts[0]) > 5 and
+ arg_parts[0] != "GLintptr"):
+ return IntArgument(arg_parts[-1], " ".join(arg_parts[0:-1]))
else:
- return Argument(
- arg_parts[-1],
- " ".join(arg_parts[0:-1]))
+ return Argument(arg_parts[-1], " ".join(arg_parts[0:-1]))
class GLGenerator(object):
@@ -2384,6 +2811,7 @@ class GLGenerator(object):
self.original_functions = []
self.functions = []
self.verbose = verbose
+ self.errors = 0
self._function_info = {}
self._empty_type_handler = TypeHandler()
self._empty_function_info = FunctionInfo({}, self._empty_type_handler)
@@ -2435,6 +2863,11 @@ class GLGenerator(object):
if self.verbose:
print msg
+ def Error(self, msg):
+ """Prints an error."""
+ print "Error: %s" % msg
+ self.errors += 1
+
def WriteHeader(self, file):
"""Writes header to file"""
file.Write(
@@ -2469,13 +2902,16 @@ class GLGenerator(object):
args = []
num_pointer_args = 0
parts = arg_string.split(',')
+ is_gl_enum = False
for arg_string in parts:
+ if arg_string.startswith('GLenum '):
+ is_gl_enum = True
arg = CreateArg(arg_string)
if arg:
args.append(arg)
if arg.IsPointer():
num_pointer_args += 1
- return (args, num_pointer_args)
+ return (args, num_pointer_args, is_gl_enum)
def ParseGLH(self, filename):
"""Parses the GL2.h file and extracts the functions"""
@@ -2487,10 +2923,12 @@ class GLGenerator(object):
if func_info.type != 'Noop':
return_type = match.group(1).strip()
arg_string = match.group(3)
- (args, num_pointer_args) = self.ParseArgs(arg_string)
+ (args, num_pointer_args, is_gl_enum) = self.ParseArgs(arg_string)
+ if is_gl_enum:
+ self.Log("%s uses bare GLenum" % func_name)
args_for_cmds = args
if hasattr(func_info, 'cmd_args'):
- (args_for_cmds, num_pointer_args) = (
+ (args_for_cmds, num_pointer_args, is_gl_enum) = (
self.ParseArgs(getattr(func_info, 'cmd_args')))
cmd_args = []
for arg in args_for_cmds:
@@ -2524,10 +2962,11 @@ class GLGenerator(object):
file = CWriter(filename)
self.WriteHeader(file)
file.Write("#define GLES2_COMMAND_LIST(OP) \\\n")
- command_id = _FIRST_SPECIFIC_COMMAND_ID
for func in self.functions:
- file.Write(" %-60s /* %d */ \\\n" % ("OP(%s)" % func.name, command_id))
- command_id += 1
+ if not func.name in _CMD_ID_TABLE:
+ self.Error("Command %s not in _CMD_ID_TABLE" % func.name)
+ file.Write(" %-60s /* %d */ \\\n" %
+ ("OP(%s)" % func.name, _CMD_ID_TABLE[func.name]))
file.Write("\n")
file.Write("enum CommandId {\n")
@@ -2571,29 +3010,21 @@ class GLGenerator(object):
def WriteCommandIdTest(self, filename):
"""Writes the command id test."""
file = CWriter(filename)
- self.WriteLicense(file)
file.Write("// This file contains unit tests for gles2 commmand ids\n")
file.Write("\n")
- file.Write("#include \"tests/common/win/testing_common.h\"\n")
- file.Write("#include \"gpu/command_buffer/common/gles2_cmd_format.h\"\n")
- file.Write("\n")
-
- self.WriteNamespaceOpen(file)
file.Write("// *** These IDs MUST NOT CHANGE!!! ***\n")
file.Write("// Changing them will break all client programs.\n")
file.Write("TEST(GLES2CommandIdTest, CommandIdsMatch) {\n")
- command_id = _FIRST_SPECIFIC_COMMAND_ID
for func in self.functions:
+ if not func.name in _CMD_ID_TABLE:
+ self.Error("Command %s not in _CMD_ID_TABLE" % func.name)
file.Write(" COMPILE_ASSERT(%s::kCmdId == %d,\n" %
- (func.name, command_id))
+ (func.name, _CMD_ID_TABLE[func.name]))
file.Write(" GLES2_%s_kCmdId_mismatch);\n" % func.name)
- command_id += 1
file.Write("}\n")
-
- self.WriteNamespaceClose(file)
-
+ file.Write("\n")
file.Close()
def WriteCmdHelperHeader(self, filename):
@@ -2617,27 +3048,6 @@ class GLGenerator(object):
file.Close()
- def WriteServiceValidation(self, filename):
- file = CWriter(filename)
- self.WriteLicense(file)
- file.Write("\n")
- self.WriteNamespaceOpen(file)
- file.Write("namespace {\n")
- file.Write("\n")
- for func in self.functions:
- file.Write("parse_error::ParseError Validate%s(\n" % func.name)
- file.Write(
- " GLES2Decoder* decoder, uint32 immediate_data_size%s) {\n" %
- func.MakeTypedOriginalArgString("", True))
- for arg in func.GetOriginalArgs():
- arg.WriteValidationCode(file)
- func.WriteValidationCode(file)
- file.Write(" return parse_error::kParseNoError;\n")
- file.Write("}\n")
- file.Write("} // anonymous namespace\n")
- self.WriteNamespaceClose(file)
- file.Close()
-
def WriteGLES2CLibImplementation(self, filename):
"""Writes the GLES2 c lib implementation."""
file = CWriter(filename)
@@ -2692,6 +3102,34 @@ class GLGenerator(object):
self.WriteNamespaceClose(file)
file.Close()
+ def WriteServiceUtilsHeader(self, filename):
+ """Writes the gles2 auto generated utility header."""
+ file = CWriter(filename)
+ self.WriteHeader(file)
+ file.Write("\n")
+ for enum in _ENUM_LISTS:
+ file.Write("bool ValidateGLenum%s(GLenum value);\n" % enum)
+ file.Write("\n")
+ file.Close()
+
+ def WriteServiceUtilsImplementation(self, filename):
+ """Writes the gles2 auto generated utility implementation."""
+ file = CWriter(filename)
+ self.WriteHeader(file)
+ file.Write("\n")
+ for enum in _ENUM_LISTS:
+ file.Write("bool ValidateGLenum%s(GLenum value) {\n" % enum)
+ file.Write(" switch (value) {\n")
+ for value in _ENUM_LISTS[enum]:
+ file.Write(" case %s:\n" % value)
+ file.Write(" return true;\n")
+ file.Write(" default:\n")
+ file.Write(" return false;\n")
+ file.Write(" }\n")
+ file.Write("}\n")
+ file.Write("\n")
+ file.Close()
+
def main(argv):
"""This is the main function."""
@@ -2717,14 +3155,19 @@ def main(argv):
gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h")
gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h")
gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h")
+ gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h")
+ gen.WriteServiceUtilsImplementation(
+ "service/gles2_cmd_validation_implementation_autogen.h")
if options.generate_implementation_templates:
gen.WriteGLES2ImplementationImpl("client/gles2_implementation_gen.h")
- gen.WriteServiceValidation("service/gles2_cmd_decoder_validate.h")
if options.generate_command_id_tests:
- gen.WriteCommandIdTest("common/gles2_cmd_id_test.cc")
+ gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h")
+ if gen.errors > 0:
+ print "%d errors" % gen.errors
+ sys.exit(1)
if __name__ == '__main__':
main(sys.argv[1:])
diff --git a/gpu/command_buffer/common/gles2_cmd_id_test.cc b/gpu/command_buffer/common/gles2_cmd_id_test.cc
index 401ce5b..5cdf61df 100644
--- a/gpu/command_buffer/common/gles2_cmd_id_test.cc
+++ b/gpu/command_buffer/common/gles2_cmd_id_test.cc
@@ -1,4 +1,3 @@
-
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,362 +10,8 @@
namespace gpu {
namespace gles2 {
-// *** These IDs MUST NOT CHANGE!!! ***
-// Changing them will break all client programs.
-TEST(GLES2CommandIdTest, CommandIdsMatch) {
- COMPILE_ASSERT(ActiveTexture::kCmdId == 256,
- GLES2_ActiveTexture_kCmdId_mismatch);
- COMPILE_ASSERT(AttachShader::kCmdId == 257,
- GLES2_AttachShader_kCmdId_mismatch);
- COMPILE_ASSERT(BindAttribLocation::kCmdId == 258,
- GLES2_BindAttribLocation_kCmdId_mismatch);
- COMPILE_ASSERT(BindAttribLocationImmediate::kCmdId == 259,
- GLES2_BindAttribLocationImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(BindBuffer::kCmdId == 260,
- GLES2_BindBuffer_kCmdId_mismatch);
- COMPILE_ASSERT(BindFramebuffer::kCmdId == 261,
- GLES2_BindFramebuffer_kCmdId_mismatch);
- COMPILE_ASSERT(BindRenderbuffer::kCmdId == 262,
- GLES2_BindRenderbuffer_kCmdId_mismatch);
- COMPILE_ASSERT(BindTexture::kCmdId == 263,
- GLES2_BindTexture_kCmdId_mismatch);
- COMPILE_ASSERT(BlendColor::kCmdId == 264,
- GLES2_BlendColor_kCmdId_mismatch);
- COMPILE_ASSERT(BlendEquation::kCmdId == 265,
- GLES2_BlendEquation_kCmdId_mismatch);
- COMPILE_ASSERT(BlendEquationSeparate::kCmdId == 266,
- GLES2_BlendEquationSeparate_kCmdId_mismatch);
- COMPILE_ASSERT(BlendFunc::kCmdId == 267,
- GLES2_BlendFunc_kCmdId_mismatch);
- COMPILE_ASSERT(BlendFuncSeparate::kCmdId == 268,
- GLES2_BlendFuncSeparate_kCmdId_mismatch);
- COMPILE_ASSERT(BufferData::kCmdId == 269,
- GLES2_BufferData_kCmdId_mismatch);
- COMPILE_ASSERT(BufferDataImmediate::kCmdId == 270,
- GLES2_BufferDataImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(BufferSubData::kCmdId == 271,
- GLES2_BufferSubData_kCmdId_mismatch);
- COMPILE_ASSERT(BufferSubDataImmediate::kCmdId == 272,
- GLES2_BufferSubDataImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(CheckFramebufferStatus::kCmdId == 273,
- GLES2_CheckFramebufferStatus_kCmdId_mismatch);
- COMPILE_ASSERT(Clear::kCmdId == 274,
- GLES2_Clear_kCmdId_mismatch);
- COMPILE_ASSERT(ClearColor::kCmdId == 275,
- GLES2_ClearColor_kCmdId_mismatch);
- COMPILE_ASSERT(ClearDepthf::kCmdId == 276,
- GLES2_ClearDepthf_kCmdId_mismatch);
- COMPILE_ASSERT(ClearStencil::kCmdId == 277,
- GLES2_ClearStencil_kCmdId_mismatch);
- COMPILE_ASSERT(ColorMask::kCmdId == 278,
- GLES2_ColorMask_kCmdId_mismatch);
- COMPILE_ASSERT(CompileShader::kCmdId == 279,
- GLES2_CompileShader_kCmdId_mismatch);
- COMPILE_ASSERT(CompressedTexImage2D::kCmdId == 280,
- GLES2_CompressedTexImage2D_kCmdId_mismatch);
- COMPILE_ASSERT(CompressedTexImage2DImmediate::kCmdId == 281,
- GLES2_CompressedTexImage2DImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(CompressedTexSubImage2D::kCmdId == 282,
- GLES2_CompressedTexSubImage2D_kCmdId_mismatch);
- COMPILE_ASSERT(CompressedTexSubImage2DImmediate::kCmdId == 283,
- GLES2_CompressedTexSubImage2DImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(CopyTexImage2D::kCmdId == 284,
- GLES2_CopyTexImage2D_kCmdId_mismatch);
- COMPILE_ASSERT(CopyTexSubImage2D::kCmdId == 285,
- GLES2_CopyTexSubImage2D_kCmdId_mismatch);
- COMPILE_ASSERT(CreateProgram::kCmdId == 286,
- GLES2_CreateProgram_kCmdId_mismatch);
- COMPILE_ASSERT(CreateShader::kCmdId == 287,
- GLES2_CreateShader_kCmdId_mismatch);
- COMPILE_ASSERT(CullFace::kCmdId == 288,
- GLES2_CullFace_kCmdId_mismatch);
- COMPILE_ASSERT(DeleteBuffers::kCmdId == 289,
- GLES2_DeleteBuffers_kCmdId_mismatch);
- COMPILE_ASSERT(DeleteBuffersImmediate::kCmdId == 290,
- GLES2_DeleteBuffersImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(DeleteFramebuffers::kCmdId == 291,
- GLES2_DeleteFramebuffers_kCmdId_mismatch);
- COMPILE_ASSERT(DeleteFramebuffersImmediate::kCmdId == 292,
- GLES2_DeleteFramebuffersImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(DeleteProgram::kCmdId == 293,
- GLES2_DeleteProgram_kCmdId_mismatch);
- COMPILE_ASSERT(DeleteRenderbuffers::kCmdId == 294,
- GLES2_DeleteRenderbuffers_kCmdId_mismatch);
- COMPILE_ASSERT(DeleteRenderbuffersImmediate::kCmdId == 295,
- GLES2_DeleteRenderbuffersImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(DeleteShader::kCmdId == 296,
- GLES2_DeleteShader_kCmdId_mismatch);
- COMPILE_ASSERT(DeleteTextures::kCmdId == 297,
- GLES2_DeleteTextures_kCmdId_mismatch);
- COMPILE_ASSERT(DeleteTexturesImmediate::kCmdId == 298,
- GLES2_DeleteTexturesImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(DepthFunc::kCmdId == 299,
- GLES2_DepthFunc_kCmdId_mismatch);
- COMPILE_ASSERT(DepthMask::kCmdId == 300,
- GLES2_DepthMask_kCmdId_mismatch);
- COMPILE_ASSERT(DepthRangef::kCmdId == 301,
- GLES2_DepthRangef_kCmdId_mismatch);
- COMPILE_ASSERT(DetachShader::kCmdId == 302,
- GLES2_DetachShader_kCmdId_mismatch);
- COMPILE_ASSERT(Disable::kCmdId == 303,
- GLES2_Disable_kCmdId_mismatch);
- COMPILE_ASSERT(DisableVertexAttribArray::kCmdId == 304,
- GLES2_DisableVertexAttribArray_kCmdId_mismatch);
- COMPILE_ASSERT(DrawArrays::kCmdId == 305,
- GLES2_DrawArrays_kCmdId_mismatch);
- COMPILE_ASSERT(DrawElements::kCmdId == 306,
- GLES2_DrawElements_kCmdId_mismatch);
- COMPILE_ASSERT(Enable::kCmdId == 307,
- GLES2_Enable_kCmdId_mismatch);
- COMPILE_ASSERT(EnableVertexAttribArray::kCmdId == 308,
- GLES2_EnableVertexAttribArray_kCmdId_mismatch);
- COMPILE_ASSERT(Finish::kCmdId == 309,
- GLES2_Finish_kCmdId_mismatch);
- COMPILE_ASSERT(Flush::kCmdId == 310,
- GLES2_Flush_kCmdId_mismatch);
- COMPILE_ASSERT(FramebufferRenderbuffer::kCmdId == 311,
- GLES2_FramebufferRenderbuffer_kCmdId_mismatch);
- COMPILE_ASSERT(FramebufferTexture2D::kCmdId == 312,
- GLES2_FramebufferTexture2D_kCmdId_mismatch);
- COMPILE_ASSERT(FrontFace::kCmdId == 313,
- GLES2_FrontFace_kCmdId_mismatch);
- COMPILE_ASSERT(GenBuffers::kCmdId == 314,
- GLES2_GenBuffers_kCmdId_mismatch);
- COMPILE_ASSERT(GenBuffersImmediate::kCmdId == 315,
- GLES2_GenBuffersImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(GenerateMipmap::kCmdId == 316,
- GLES2_GenerateMipmap_kCmdId_mismatch);
- COMPILE_ASSERT(GenFramebuffers::kCmdId == 317,
- GLES2_GenFramebuffers_kCmdId_mismatch);
- COMPILE_ASSERT(GenFramebuffersImmediate::kCmdId == 318,
- GLES2_GenFramebuffersImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(GenRenderbuffers::kCmdId == 319,
- GLES2_GenRenderbuffers_kCmdId_mismatch);
- COMPILE_ASSERT(GenRenderbuffersImmediate::kCmdId == 320,
- GLES2_GenRenderbuffersImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(GenTextures::kCmdId == 321,
- GLES2_GenTextures_kCmdId_mismatch);
- COMPILE_ASSERT(GenTexturesImmediate::kCmdId == 322,
- GLES2_GenTexturesImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(GetActiveAttrib::kCmdId == 323,
- GLES2_GetActiveAttrib_kCmdId_mismatch);
- COMPILE_ASSERT(GetActiveUniform::kCmdId == 324,
- GLES2_GetActiveUniform_kCmdId_mismatch);
- COMPILE_ASSERT(GetAttachedShaders::kCmdId == 325,
- GLES2_GetAttachedShaders_kCmdId_mismatch);
- COMPILE_ASSERT(GetAttribLocation::kCmdId == 326,
- GLES2_GetAttribLocation_kCmdId_mismatch);
- COMPILE_ASSERT(GetAttribLocationImmediate::kCmdId == 327,
- GLES2_GetAttribLocationImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(GetBooleanv::kCmdId == 328,
- GLES2_GetBooleanv_kCmdId_mismatch);
- COMPILE_ASSERT(GetBufferParameteriv::kCmdId == 329,
- GLES2_GetBufferParameteriv_kCmdId_mismatch);
- COMPILE_ASSERT(GetError::kCmdId == 330,
- GLES2_GetError_kCmdId_mismatch);
- COMPILE_ASSERT(GetFloatv::kCmdId == 331,
- GLES2_GetFloatv_kCmdId_mismatch);
- COMPILE_ASSERT(GetFramebufferAttachmentParameteriv::kCmdId == 332,
- GLES2_GetFramebufferAttachmentParameteriv_kCmdId_mismatch);
- COMPILE_ASSERT(GetIntegerv::kCmdId == 333,
- GLES2_GetIntegerv_kCmdId_mismatch);
- COMPILE_ASSERT(GetProgramiv::kCmdId == 334,
- GLES2_GetProgramiv_kCmdId_mismatch);
- COMPILE_ASSERT(GetProgramInfoLog::kCmdId == 335,
- GLES2_GetProgramInfoLog_kCmdId_mismatch);
- COMPILE_ASSERT(GetRenderbufferParameteriv::kCmdId == 336,
- GLES2_GetRenderbufferParameteriv_kCmdId_mismatch);
- COMPILE_ASSERT(GetShaderiv::kCmdId == 337,
- GLES2_GetShaderiv_kCmdId_mismatch);
- COMPILE_ASSERT(GetShaderInfoLog::kCmdId == 338,
- GLES2_GetShaderInfoLog_kCmdId_mismatch);
- COMPILE_ASSERT(GetShaderPrecisionFormat::kCmdId == 339,
- GLES2_GetShaderPrecisionFormat_kCmdId_mismatch);
- COMPILE_ASSERT(GetShaderSource::kCmdId == 340,
- GLES2_GetShaderSource_kCmdId_mismatch);
- COMPILE_ASSERT(GetString::kCmdId == 341,
- GLES2_GetString_kCmdId_mismatch);
- COMPILE_ASSERT(GetTexParameterfv::kCmdId == 342,
- GLES2_GetTexParameterfv_kCmdId_mismatch);
- COMPILE_ASSERT(GetTexParameteriv::kCmdId == 343,
- GLES2_GetTexParameteriv_kCmdId_mismatch);
- COMPILE_ASSERT(GetUniformfv::kCmdId == 344,
- GLES2_GetUniformfv_kCmdId_mismatch);
- COMPILE_ASSERT(GetUniformiv::kCmdId == 345,
- GLES2_GetUniformiv_kCmdId_mismatch);
- COMPILE_ASSERT(GetUniformLocation::kCmdId == 346,
- GLES2_GetUniformLocation_kCmdId_mismatch);
- COMPILE_ASSERT(GetUniformLocationImmediate::kCmdId == 347,
- GLES2_GetUniformLocationImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(GetVertexAttribfv::kCmdId == 348,
- GLES2_GetVertexAttribfv_kCmdId_mismatch);
- COMPILE_ASSERT(GetVertexAttribiv::kCmdId == 349,
- GLES2_GetVertexAttribiv_kCmdId_mismatch);
- COMPILE_ASSERT(GetVertexAttribPointerv::kCmdId == 350,
- GLES2_GetVertexAttribPointerv_kCmdId_mismatch);
- COMPILE_ASSERT(Hint::kCmdId == 351,
- GLES2_Hint_kCmdId_mismatch);
- COMPILE_ASSERT(IsBuffer::kCmdId == 352,
- GLES2_IsBuffer_kCmdId_mismatch);
- COMPILE_ASSERT(IsEnabled::kCmdId == 353,
- GLES2_IsEnabled_kCmdId_mismatch);
- COMPILE_ASSERT(IsFramebuffer::kCmdId == 354,
- GLES2_IsFramebuffer_kCmdId_mismatch);
- COMPILE_ASSERT(IsProgram::kCmdId == 355,
- GLES2_IsProgram_kCmdId_mismatch);
- COMPILE_ASSERT(IsRenderbuffer::kCmdId == 356,
- GLES2_IsRenderbuffer_kCmdId_mismatch);
- COMPILE_ASSERT(IsShader::kCmdId == 357,
- GLES2_IsShader_kCmdId_mismatch);
- COMPILE_ASSERT(IsTexture::kCmdId == 358,
- GLES2_IsTexture_kCmdId_mismatch);
- COMPILE_ASSERT(LineWidth::kCmdId == 359,
- GLES2_LineWidth_kCmdId_mismatch);
- COMPILE_ASSERT(LinkProgram::kCmdId == 360,
- GLES2_LinkProgram_kCmdId_mismatch);
- COMPILE_ASSERT(PixelStorei::kCmdId == 361,
- GLES2_PixelStorei_kCmdId_mismatch);
- COMPILE_ASSERT(PolygonOffset::kCmdId == 362,
- GLES2_PolygonOffset_kCmdId_mismatch);
- COMPILE_ASSERT(ReadPixels::kCmdId == 363,
- GLES2_ReadPixels_kCmdId_mismatch);
- COMPILE_ASSERT(RenderbufferStorage::kCmdId == 364,
- GLES2_RenderbufferStorage_kCmdId_mismatch);
- COMPILE_ASSERT(SampleCoverage::kCmdId == 365,
- GLES2_SampleCoverage_kCmdId_mismatch);
- COMPILE_ASSERT(Scissor::kCmdId == 366,
- GLES2_Scissor_kCmdId_mismatch);
- COMPILE_ASSERT(ShaderSource::kCmdId == 367,
- GLES2_ShaderSource_kCmdId_mismatch);
- COMPILE_ASSERT(ShaderSourceImmediate::kCmdId == 368,
- GLES2_ShaderSourceImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(StencilFunc::kCmdId == 369,
- GLES2_StencilFunc_kCmdId_mismatch);
- COMPILE_ASSERT(StencilFuncSeparate::kCmdId == 370,
- GLES2_StencilFuncSeparate_kCmdId_mismatch);
- COMPILE_ASSERT(StencilMask::kCmdId == 371,
- GLES2_StencilMask_kCmdId_mismatch);
- COMPILE_ASSERT(StencilMaskSeparate::kCmdId == 372,
- GLES2_StencilMaskSeparate_kCmdId_mismatch);
- COMPILE_ASSERT(StencilOp::kCmdId == 373,
- GLES2_StencilOp_kCmdId_mismatch);
- COMPILE_ASSERT(StencilOpSeparate::kCmdId == 374,
- GLES2_StencilOpSeparate_kCmdId_mismatch);
- COMPILE_ASSERT(TexImage2D::kCmdId == 375,
- GLES2_TexImage2D_kCmdId_mismatch);
- COMPILE_ASSERT(TexImage2DImmediate::kCmdId == 376,
- GLES2_TexImage2DImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(TexParameterf::kCmdId == 377,
- GLES2_TexParameterf_kCmdId_mismatch);
- COMPILE_ASSERT(TexParameterfv::kCmdId == 378,
- GLES2_TexParameterfv_kCmdId_mismatch);
- COMPILE_ASSERT(TexParameterfvImmediate::kCmdId == 379,
- GLES2_TexParameterfvImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(TexParameteri::kCmdId == 380,
- GLES2_TexParameteri_kCmdId_mismatch);
- COMPILE_ASSERT(TexParameteriv::kCmdId == 381,
- GLES2_TexParameteriv_kCmdId_mismatch);
- COMPILE_ASSERT(TexParameterivImmediate::kCmdId == 382,
- GLES2_TexParameterivImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(TexSubImage2D::kCmdId == 383,
- GLES2_TexSubImage2D_kCmdId_mismatch);
- COMPILE_ASSERT(TexSubImage2DImmediate::kCmdId == 384,
- GLES2_TexSubImage2DImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform1f::kCmdId == 385,
- GLES2_Uniform1f_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform1fv::kCmdId == 386,
- GLES2_Uniform1fv_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform1fvImmediate::kCmdId == 387,
- GLES2_Uniform1fvImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform1i::kCmdId == 388,
- GLES2_Uniform1i_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform1iv::kCmdId == 389,
- GLES2_Uniform1iv_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform1ivImmediate::kCmdId == 390,
- GLES2_Uniform1ivImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform2f::kCmdId == 391,
- GLES2_Uniform2f_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform2fv::kCmdId == 392,
- GLES2_Uniform2fv_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform2fvImmediate::kCmdId == 393,
- GLES2_Uniform2fvImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform2i::kCmdId == 394,
- GLES2_Uniform2i_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform2iv::kCmdId == 395,
- GLES2_Uniform2iv_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform2ivImmediate::kCmdId == 396,
- GLES2_Uniform2ivImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform3f::kCmdId == 397,
- GLES2_Uniform3f_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform3fv::kCmdId == 398,
- GLES2_Uniform3fv_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform3fvImmediate::kCmdId == 399,
- GLES2_Uniform3fvImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform3i::kCmdId == 400,
- GLES2_Uniform3i_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform3iv::kCmdId == 401,
- GLES2_Uniform3iv_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform3ivImmediate::kCmdId == 402,
- GLES2_Uniform3ivImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform4f::kCmdId == 403,
- GLES2_Uniform4f_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform4fv::kCmdId == 404,
- GLES2_Uniform4fv_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform4fvImmediate::kCmdId == 405,
- GLES2_Uniform4fvImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform4i::kCmdId == 406,
- GLES2_Uniform4i_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform4iv::kCmdId == 407,
- GLES2_Uniform4iv_kCmdId_mismatch);
- COMPILE_ASSERT(Uniform4ivImmediate::kCmdId == 408,
- GLES2_Uniform4ivImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(UniformMatrix2fv::kCmdId == 409,
- GLES2_UniformMatrix2fv_kCmdId_mismatch);
- COMPILE_ASSERT(UniformMatrix2fvImmediate::kCmdId == 410,
- GLES2_UniformMatrix2fvImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(UniformMatrix3fv::kCmdId == 411,
- GLES2_UniformMatrix3fv_kCmdId_mismatch);
- COMPILE_ASSERT(UniformMatrix3fvImmediate::kCmdId == 412,
- GLES2_UniformMatrix3fvImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(UniformMatrix4fv::kCmdId == 413,
- GLES2_UniformMatrix4fv_kCmdId_mismatch);
- COMPILE_ASSERT(UniformMatrix4fvImmediate::kCmdId == 414,
- GLES2_UniformMatrix4fvImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(UseProgram::kCmdId == 415,
- GLES2_UseProgram_kCmdId_mismatch);
- COMPILE_ASSERT(ValidateProgram::kCmdId == 416,
- GLES2_ValidateProgram_kCmdId_mismatch);
- COMPILE_ASSERT(VertexAttrib1f::kCmdId == 417,
- GLES2_VertexAttrib1f_kCmdId_mismatch);
- COMPILE_ASSERT(VertexAttrib1fv::kCmdId == 418,
- GLES2_VertexAttrib1fv_kCmdId_mismatch);
- COMPILE_ASSERT(VertexAttrib1fvImmediate::kCmdId == 419,
- GLES2_VertexAttrib1fvImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(VertexAttrib2f::kCmdId == 420,
- GLES2_VertexAttrib2f_kCmdId_mismatch);
- COMPILE_ASSERT(VertexAttrib2fv::kCmdId == 421,
- GLES2_VertexAttrib2fv_kCmdId_mismatch);
- COMPILE_ASSERT(VertexAttrib2fvImmediate::kCmdId == 422,
- GLES2_VertexAttrib2fvImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(VertexAttrib3f::kCmdId == 423,
- GLES2_VertexAttrib3f_kCmdId_mismatch);
- COMPILE_ASSERT(VertexAttrib3fv::kCmdId == 424,
- GLES2_VertexAttrib3fv_kCmdId_mismatch);
- COMPILE_ASSERT(VertexAttrib3fvImmediate::kCmdId == 425,
- GLES2_VertexAttrib3fvImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(VertexAttrib4f::kCmdId == 426,
- GLES2_VertexAttrib4f_kCmdId_mismatch);
- COMPILE_ASSERT(VertexAttrib4fv::kCmdId == 427,
- GLES2_VertexAttrib4fv_kCmdId_mismatch);
- COMPILE_ASSERT(VertexAttrib4fvImmediate::kCmdId == 428,
- GLES2_VertexAttrib4fvImmediate_kCmdId_mismatch);
- COMPILE_ASSERT(VertexAttribPointer::kCmdId == 429,
- GLES2_VertexAttribPointer_kCmdId_mismatch);
- COMPILE_ASSERT(Viewport::kCmdId == 430,
- GLES2_Viewport_kCmdId_mismatch);
- COMPILE_ASSERT(SwapBuffers::kCmdId == 431,
- GLES2_SwapBuffers_kCmdId_mismatch);
-}
+#include "gpu/command_buffer/common/gles2_cmd_id_test_autogen.h"
+
} // namespace gles2
} // namespace gpu
diff --git a/gpu/command_buffer/common/gles2_cmd_id_test_autogen.h b/gpu/command_buffer/common/gles2_cmd_id_test_autogen.h
new file mode 100644
index 0000000..4f3e0d9
--- /dev/null
+++ b/gpu/command_buffer/common/gles2_cmd_id_test_autogen.h
@@ -0,0 +1,359 @@
+// This file contains unit tests for gles2 commmand ids
+
+// *** These IDs MUST NOT CHANGE!!! ***
+// Changing them will break all client programs.
+TEST(GLES2CommandIdTest, CommandIdsMatch) {
+ COMPILE_ASSERT(ActiveTexture::kCmdId == 256,
+ GLES2_ActiveTexture_kCmdId_mismatch);
+ COMPILE_ASSERT(AttachShader::kCmdId == 257,
+ GLES2_AttachShader_kCmdId_mismatch);
+ COMPILE_ASSERT(BindAttribLocation::kCmdId == 258,
+ GLES2_BindAttribLocation_kCmdId_mismatch);
+ COMPILE_ASSERT(BindAttribLocationImmediate::kCmdId == 259,
+ GLES2_BindAttribLocationImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(BindBuffer::kCmdId == 260,
+ GLES2_BindBuffer_kCmdId_mismatch);
+ COMPILE_ASSERT(BindFramebuffer::kCmdId == 261,
+ GLES2_BindFramebuffer_kCmdId_mismatch);
+ COMPILE_ASSERT(BindRenderbuffer::kCmdId == 262,
+ GLES2_BindRenderbuffer_kCmdId_mismatch);
+ COMPILE_ASSERT(BindTexture::kCmdId == 263,
+ GLES2_BindTexture_kCmdId_mismatch);
+ COMPILE_ASSERT(BlendColor::kCmdId == 264,
+ GLES2_BlendColor_kCmdId_mismatch);
+ COMPILE_ASSERT(BlendEquation::kCmdId == 265,
+ GLES2_BlendEquation_kCmdId_mismatch);
+ COMPILE_ASSERT(BlendEquationSeparate::kCmdId == 266,
+ GLES2_BlendEquationSeparate_kCmdId_mismatch);
+ COMPILE_ASSERT(BlendFunc::kCmdId == 267,
+ GLES2_BlendFunc_kCmdId_mismatch);
+ COMPILE_ASSERT(BlendFuncSeparate::kCmdId == 268,
+ GLES2_BlendFuncSeparate_kCmdId_mismatch);
+ COMPILE_ASSERT(BufferData::kCmdId == 269,
+ GLES2_BufferData_kCmdId_mismatch);
+ COMPILE_ASSERT(BufferDataImmediate::kCmdId == 270,
+ GLES2_BufferDataImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(BufferSubData::kCmdId == 271,
+ GLES2_BufferSubData_kCmdId_mismatch);
+ COMPILE_ASSERT(BufferSubDataImmediate::kCmdId == 272,
+ GLES2_BufferSubDataImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(CheckFramebufferStatus::kCmdId == 273,
+ GLES2_CheckFramebufferStatus_kCmdId_mismatch);
+ COMPILE_ASSERT(Clear::kCmdId == 274,
+ GLES2_Clear_kCmdId_mismatch);
+ COMPILE_ASSERT(ClearColor::kCmdId == 275,
+ GLES2_ClearColor_kCmdId_mismatch);
+ COMPILE_ASSERT(ClearDepthf::kCmdId == 276,
+ GLES2_ClearDepthf_kCmdId_mismatch);
+ COMPILE_ASSERT(ClearStencil::kCmdId == 277,
+ GLES2_ClearStencil_kCmdId_mismatch);
+ COMPILE_ASSERT(ColorMask::kCmdId == 278,
+ GLES2_ColorMask_kCmdId_mismatch);
+ COMPILE_ASSERT(CompileShader::kCmdId == 279,
+ GLES2_CompileShader_kCmdId_mismatch);
+ COMPILE_ASSERT(CompressedTexImage2D::kCmdId == 280,
+ GLES2_CompressedTexImage2D_kCmdId_mismatch);
+ COMPILE_ASSERT(CompressedTexImage2DImmediate::kCmdId == 281,
+ GLES2_CompressedTexImage2DImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(CompressedTexSubImage2D::kCmdId == 282,
+ GLES2_CompressedTexSubImage2D_kCmdId_mismatch);
+ COMPILE_ASSERT(CompressedTexSubImage2DImmediate::kCmdId == 283,
+ GLES2_CompressedTexSubImage2DImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(CopyTexImage2D::kCmdId == 284,
+ GLES2_CopyTexImage2D_kCmdId_mismatch);
+ COMPILE_ASSERT(CopyTexSubImage2D::kCmdId == 285,
+ GLES2_CopyTexSubImage2D_kCmdId_mismatch);
+ COMPILE_ASSERT(CreateProgram::kCmdId == 286,
+ GLES2_CreateProgram_kCmdId_mismatch);
+ COMPILE_ASSERT(CreateShader::kCmdId == 287,
+ GLES2_CreateShader_kCmdId_mismatch);
+ COMPILE_ASSERT(CullFace::kCmdId == 288,
+ GLES2_CullFace_kCmdId_mismatch);
+ COMPILE_ASSERT(DeleteBuffers::kCmdId == 289,
+ GLES2_DeleteBuffers_kCmdId_mismatch);
+ COMPILE_ASSERT(DeleteBuffersImmediate::kCmdId == 290,
+ GLES2_DeleteBuffersImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(DeleteFramebuffers::kCmdId == 291,
+ GLES2_DeleteFramebuffers_kCmdId_mismatch);
+ COMPILE_ASSERT(DeleteFramebuffersImmediate::kCmdId == 292,
+ GLES2_DeleteFramebuffersImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(DeleteProgram::kCmdId == 293,
+ GLES2_DeleteProgram_kCmdId_mismatch);
+ COMPILE_ASSERT(DeleteRenderbuffers::kCmdId == 294,
+ GLES2_DeleteRenderbuffers_kCmdId_mismatch);
+ COMPILE_ASSERT(DeleteRenderbuffersImmediate::kCmdId == 295,
+ GLES2_DeleteRenderbuffersImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(DeleteShader::kCmdId == 296,
+ GLES2_DeleteShader_kCmdId_mismatch);
+ COMPILE_ASSERT(DeleteTextures::kCmdId == 297,
+ GLES2_DeleteTextures_kCmdId_mismatch);
+ COMPILE_ASSERT(DeleteTexturesImmediate::kCmdId == 298,
+ GLES2_DeleteTexturesImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(DepthFunc::kCmdId == 299,
+ GLES2_DepthFunc_kCmdId_mismatch);
+ COMPILE_ASSERT(DepthMask::kCmdId == 300,
+ GLES2_DepthMask_kCmdId_mismatch);
+ COMPILE_ASSERT(DepthRangef::kCmdId == 301,
+ GLES2_DepthRangef_kCmdId_mismatch);
+ COMPILE_ASSERT(DetachShader::kCmdId == 302,
+ GLES2_DetachShader_kCmdId_mismatch);
+ COMPILE_ASSERT(Disable::kCmdId == 303,
+ GLES2_Disable_kCmdId_mismatch);
+ COMPILE_ASSERT(DisableVertexAttribArray::kCmdId == 304,
+ GLES2_DisableVertexAttribArray_kCmdId_mismatch);
+ COMPILE_ASSERT(DrawArrays::kCmdId == 305,
+ GLES2_DrawArrays_kCmdId_mismatch);
+ COMPILE_ASSERT(DrawElements::kCmdId == 306,
+ GLES2_DrawElements_kCmdId_mismatch);
+ COMPILE_ASSERT(Enable::kCmdId == 307,
+ GLES2_Enable_kCmdId_mismatch);
+ COMPILE_ASSERT(EnableVertexAttribArray::kCmdId == 308,
+ GLES2_EnableVertexAttribArray_kCmdId_mismatch);
+ COMPILE_ASSERT(Finish::kCmdId == 309,
+ GLES2_Finish_kCmdId_mismatch);
+ COMPILE_ASSERT(Flush::kCmdId == 310,
+ GLES2_Flush_kCmdId_mismatch);
+ COMPILE_ASSERT(FramebufferRenderbuffer::kCmdId == 311,
+ GLES2_FramebufferRenderbuffer_kCmdId_mismatch);
+ COMPILE_ASSERT(FramebufferTexture2D::kCmdId == 312,
+ GLES2_FramebufferTexture2D_kCmdId_mismatch);
+ COMPILE_ASSERT(FrontFace::kCmdId == 313,
+ GLES2_FrontFace_kCmdId_mismatch);
+ COMPILE_ASSERT(GenBuffers::kCmdId == 314,
+ GLES2_GenBuffers_kCmdId_mismatch);
+ COMPILE_ASSERT(GenBuffersImmediate::kCmdId == 315,
+ GLES2_GenBuffersImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(GenerateMipmap::kCmdId == 316,
+ GLES2_GenerateMipmap_kCmdId_mismatch);
+ COMPILE_ASSERT(GenFramebuffers::kCmdId == 317,
+ GLES2_GenFramebuffers_kCmdId_mismatch);
+ COMPILE_ASSERT(GenFramebuffersImmediate::kCmdId == 318,
+ GLES2_GenFramebuffersImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(GenRenderbuffers::kCmdId == 319,
+ GLES2_GenRenderbuffers_kCmdId_mismatch);
+ COMPILE_ASSERT(GenRenderbuffersImmediate::kCmdId == 320,
+ GLES2_GenRenderbuffersImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(GenTextures::kCmdId == 321,
+ GLES2_GenTextures_kCmdId_mismatch);
+ COMPILE_ASSERT(GenTexturesImmediate::kCmdId == 322,
+ GLES2_GenTexturesImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(GetActiveAttrib::kCmdId == 323,
+ GLES2_GetActiveAttrib_kCmdId_mismatch);
+ COMPILE_ASSERT(GetActiveUniform::kCmdId == 324,
+ GLES2_GetActiveUniform_kCmdId_mismatch);
+ COMPILE_ASSERT(GetAttachedShaders::kCmdId == 325,
+ GLES2_GetAttachedShaders_kCmdId_mismatch);
+ COMPILE_ASSERT(GetAttribLocation::kCmdId == 326,
+ GLES2_GetAttribLocation_kCmdId_mismatch);
+ COMPILE_ASSERT(GetAttribLocationImmediate::kCmdId == 327,
+ GLES2_GetAttribLocationImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(GetBooleanv::kCmdId == 328,
+ GLES2_GetBooleanv_kCmdId_mismatch);
+ COMPILE_ASSERT(GetBufferParameteriv::kCmdId == 329,
+ GLES2_GetBufferParameteriv_kCmdId_mismatch);
+ COMPILE_ASSERT(GetError::kCmdId == 330,
+ GLES2_GetError_kCmdId_mismatch);
+ COMPILE_ASSERT(GetFloatv::kCmdId == 331,
+ GLES2_GetFloatv_kCmdId_mismatch);
+ COMPILE_ASSERT(GetFramebufferAttachmentParameteriv::kCmdId == 332,
+ GLES2_GetFramebufferAttachmentParameteriv_kCmdId_mismatch);
+ COMPILE_ASSERT(GetIntegerv::kCmdId == 333,
+ GLES2_GetIntegerv_kCmdId_mismatch);
+ COMPILE_ASSERT(GetProgramiv::kCmdId == 334,
+ GLES2_GetProgramiv_kCmdId_mismatch);
+ COMPILE_ASSERT(GetProgramInfoLog::kCmdId == 335,
+ GLES2_GetProgramInfoLog_kCmdId_mismatch);
+ COMPILE_ASSERT(GetRenderbufferParameteriv::kCmdId == 336,
+ GLES2_GetRenderbufferParameteriv_kCmdId_mismatch);
+ COMPILE_ASSERT(GetShaderiv::kCmdId == 337,
+ GLES2_GetShaderiv_kCmdId_mismatch);
+ COMPILE_ASSERT(GetShaderInfoLog::kCmdId == 338,
+ GLES2_GetShaderInfoLog_kCmdId_mismatch);
+ COMPILE_ASSERT(GetShaderPrecisionFormat::kCmdId == 339,
+ GLES2_GetShaderPrecisionFormat_kCmdId_mismatch);
+ COMPILE_ASSERT(GetShaderSource::kCmdId == 340,
+ GLES2_GetShaderSource_kCmdId_mismatch);
+ COMPILE_ASSERT(GetString::kCmdId == 341,
+ GLES2_GetString_kCmdId_mismatch);
+ COMPILE_ASSERT(GetTexParameterfv::kCmdId == 342,
+ GLES2_GetTexParameterfv_kCmdId_mismatch);
+ COMPILE_ASSERT(GetTexParameteriv::kCmdId == 343,
+ GLES2_GetTexParameteriv_kCmdId_mismatch);
+ COMPILE_ASSERT(GetUniformfv::kCmdId == 344,
+ GLES2_GetUniformfv_kCmdId_mismatch);
+ COMPILE_ASSERT(GetUniformiv::kCmdId == 345,
+ GLES2_GetUniformiv_kCmdId_mismatch);
+ COMPILE_ASSERT(GetUniformLocation::kCmdId == 346,
+ GLES2_GetUniformLocation_kCmdId_mismatch);
+ COMPILE_ASSERT(GetUniformLocationImmediate::kCmdId == 347,
+ GLES2_GetUniformLocationImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(GetVertexAttribfv::kCmdId == 348,
+ GLES2_GetVertexAttribfv_kCmdId_mismatch);
+ COMPILE_ASSERT(GetVertexAttribiv::kCmdId == 349,
+ GLES2_GetVertexAttribiv_kCmdId_mismatch);
+ COMPILE_ASSERT(GetVertexAttribPointerv::kCmdId == 350,
+ GLES2_GetVertexAttribPointerv_kCmdId_mismatch);
+ COMPILE_ASSERT(Hint::kCmdId == 351,
+ GLES2_Hint_kCmdId_mismatch);
+ COMPILE_ASSERT(IsBuffer::kCmdId == 352,
+ GLES2_IsBuffer_kCmdId_mismatch);
+ COMPILE_ASSERT(IsEnabled::kCmdId == 353,
+ GLES2_IsEnabled_kCmdId_mismatch);
+ COMPILE_ASSERT(IsFramebuffer::kCmdId == 354,
+ GLES2_IsFramebuffer_kCmdId_mismatch);
+ COMPILE_ASSERT(IsProgram::kCmdId == 355,
+ GLES2_IsProgram_kCmdId_mismatch);
+ COMPILE_ASSERT(IsRenderbuffer::kCmdId == 356,
+ GLES2_IsRenderbuffer_kCmdId_mismatch);
+ COMPILE_ASSERT(IsShader::kCmdId == 357,
+ GLES2_IsShader_kCmdId_mismatch);
+ COMPILE_ASSERT(IsTexture::kCmdId == 358,
+ GLES2_IsTexture_kCmdId_mismatch);
+ COMPILE_ASSERT(LineWidth::kCmdId == 359,
+ GLES2_LineWidth_kCmdId_mismatch);
+ COMPILE_ASSERT(LinkProgram::kCmdId == 360,
+ GLES2_LinkProgram_kCmdId_mismatch);
+ COMPILE_ASSERT(PixelStorei::kCmdId == 361,
+ GLES2_PixelStorei_kCmdId_mismatch);
+ COMPILE_ASSERT(PolygonOffset::kCmdId == 362,
+ GLES2_PolygonOffset_kCmdId_mismatch);
+ COMPILE_ASSERT(ReadPixels::kCmdId == 363,
+ GLES2_ReadPixels_kCmdId_mismatch);
+ COMPILE_ASSERT(RenderbufferStorage::kCmdId == 364,
+ GLES2_RenderbufferStorage_kCmdId_mismatch);
+ COMPILE_ASSERT(SampleCoverage::kCmdId == 365,
+ GLES2_SampleCoverage_kCmdId_mismatch);
+ COMPILE_ASSERT(Scissor::kCmdId == 366,
+ GLES2_Scissor_kCmdId_mismatch);
+ COMPILE_ASSERT(ShaderSource::kCmdId == 367,
+ GLES2_ShaderSource_kCmdId_mismatch);
+ COMPILE_ASSERT(ShaderSourceImmediate::kCmdId == 368,
+ GLES2_ShaderSourceImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(StencilFunc::kCmdId == 369,
+ GLES2_StencilFunc_kCmdId_mismatch);
+ COMPILE_ASSERT(StencilFuncSeparate::kCmdId == 370,
+ GLES2_StencilFuncSeparate_kCmdId_mismatch);
+ COMPILE_ASSERT(StencilMask::kCmdId == 371,
+ GLES2_StencilMask_kCmdId_mismatch);
+ COMPILE_ASSERT(StencilMaskSeparate::kCmdId == 372,
+ GLES2_StencilMaskSeparate_kCmdId_mismatch);
+ COMPILE_ASSERT(StencilOp::kCmdId == 373,
+ GLES2_StencilOp_kCmdId_mismatch);
+ COMPILE_ASSERT(StencilOpSeparate::kCmdId == 374,
+ GLES2_StencilOpSeparate_kCmdId_mismatch);
+ COMPILE_ASSERT(TexImage2D::kCmdId == 375,
+ GLES2_TexImage2D_kCmdId_mismatch);
+ COMPILE_ASSERT(TexImage2DImmediate::kCmdId == 376,
+ GLES2_TexImage2DImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(TexParameterf::kCmdId == 377,
+ GLES2_TexParameterf_kCmdId_mismatch);
+ COMPILE_ASSERT(TexParameterfv::kCmdId == 378,
+ GLES2_TexParameterfv_kCmdId_mismatch);
+ COMPILE_ASSERT(TexParameterfvImmediate::kCmdId == 379,
+ GLES2_TexParameterfvImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(TexParameteri::kCmdId == 380,
+ GLES2_TexParameteri_kCmdId_mismatch);
+ COMPILE_ASSERT(TexParameteriv::kCmdId == 381,
+ GLES2_TexParameteriv_kCmdId_mismatch);
+ COMPILE_ASSERT(TexParameterivImmediate::kCmdId == 382,
+ GLES2_TexParameterivImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(TexSubImage2D::kCmdId == 383,
+ GLES2_TexSubImage2D_kCmdId_mismatch);
+ COMPILE_ASSERT(TexSubImage2DImmediate::kCmdId == 384,
+ GLES2_TexSubImage2DImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform1f::kCmdId == 385,
+ GLES2_Uniform1f_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform1fv::kCmdId == 386,
+ GLES2_Uniform1fv_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform1fvImmediate::kCmdId == 387,
+ GLES2_Uniform1fvImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform1i::kCmdId == 388,
+ GLES2_Uniform1i_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform1iv::kCmdId == 389,
+ GLES2_Uniform1iv_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform1ivImmediate::kCmdId == 390,
+ GLES2_Uniform1ivImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform2f::kCmdId == 391,
+ GLES2_Uniform2f_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform2fv::kCmdId == 392,
+ GLES2_Uniform2fv_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform2fvImmediate::kCmdId == 393,
+ GLES2_Uniform2fvImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform2i::kCmdId == 394,
+ GLES2_Uniform2i_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform2iv::kCmdId == 395,
+ GLES2_Uniform2iv_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform2ivImmediate::kCmdId == 396,
+ GLES2_Uniform2ivImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform3f::kCmdId == 397,
+ GLES2_Uniform3f_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform3fv::kCmdId == 398,
+ GLES2_Uniform3fv_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform3fvImmediate::kCmdId == 399,
+ GLES2_Uniform3fvImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform3i::kCmdId == 400,
+ GLES2_Uniform3i_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform3iv::kCmdId == 401,
+ GLES2_Uniform3iv_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform3ivImmediate::kCmdId == 402,
+ GLES2_Uniform3ivImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform4f::kCmdId == 403,
+ GLES2_Uniform4f_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform4fv::kCmdId == 404,
+ GLES2_Uniform4fv_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform4fvImmediate::kCmdId == 405,
+ GLES2_Uniform4fvImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform4i::kCmdId == 406,
+ GLES2_Uniform4i_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform4iv::kCmdId == 407,
+ GLES2_Uniform4iv_kCmdId_mismatch);
+ COMPILE_ASSERT(Uniform4ivImmediate::kCmdId == 408,
+ GLES2_Uniform4ivImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(UniformMatrix2fv::kCmdId == 409,
+ GLES2_UniformMatrix2fv_kCmdId_mismatch);
+ COMPILE_ASSERT(UniformMatrix2fvImmediate::kCmdId == 410,
+ GLES2_UniformMatrix2fvImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(UniformMatrix3fv::kCmdId == 411,
+ GLES2_UniformMatrix3fv_kCmdId_mismatch);
+ COMPILE_ASSERT(UniformMatrix3fvImmediate::kCmdId == 412,
+ GLES2_UniformMatrix3fvImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(UniformMatrix4fv::kCmdId == 413,
+ GLES2_UniformMatrix4fv_kCmdId_mismatch);
+ COMPILE_ASSERT(UniformMatrix4fvImmediate::kCmdId == 414,
+ GLES2_UniformMatrix4fvImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(UseProgram::kCmdId == 415,
+ GLES2_UseProgram_kCmdId_mismatch);
+ COMPILE_ASSERT(ValidateProgram::kCmdId == 416,
+ GLES2_ValidateProgram_kCmdId_mismatch);
+ COMPILE_ASSERT(VertexAttrib1f::kCmdId == 417,
+ GLES2_VertexAttrib1f_kCmdId_mismatch);
+ COMPILE_ASSERT(VertexAttrib1fv::kCmdId == 418,
+ GLES2_VertexAttrib1fv_kCmdId_mismatch);
+ COMPILE_ASSERT(VertexAttrib1fvImmediate::kCmdId == 419,
+ GLES2_VertexAttrib1fvImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(VertexAttrib2f::kCmdId == 420,
+ GLES2_VertexAttrib2f_kCmdId_mismatch);
+ COMPILE_ASSERT(VertexAttrib2fv::kCmdId == 421,
+ GLES2_VertexAttrib2fv_kCmdId_mismatch);
+ COMPILE_ASSERT(VertexAttrib2fvImmediate::kCmdId == 422,
+ GLES2_VertexAttrib2fvImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(VertexAttrib3f::kCmdId == 423,
+ GLES2_VertexAttrib3f_kCmdId_mismatch);
+ COMPILE_ASSERT(VertexAttrib3fv::kCmdId == 424,
+ GLES2_VertexAttrib3fv_kCmdId_mismatch);
+ COMPILE_ASSERT(VertexAttrib3fvImmediate::kCmdId == 425,
+ GLES2_VertexAttrib3fvImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(VertexAttrib4f::kCmdId == 426,
+ GLES2_VertexAttrib4f_kCmdId_mismatch);
+ COMPILE_ASSERT(VertexAttrib4fv::kCmdId == 427,
+ GLES2_VertexAttrib4fv_kCmdId_mismatch);
+ COMPILE_ASSERT(VertexAttrib4fvImmediate::kCmdId == 428,
+ GLES2_VertexAttrib4fvImmediate_kCmdId_mismatch);
+ COMPILE_ASSERT(VertexAttribPointer::kCmdId == 429,
+ GLES2_VertexAttribPointer_kCmdId_mismatch);
+ COMPILE_ASSERT(Viewport::kCmdId == 430,
+ GLES2_Viewport_kCmdId_mismatch);
+ COMPILE_ASSERT(SwapBuffers::kCmdId == 431,
+ GLES2_SwapBuffers_kCmdId_mismatch);
+}
+
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 7ceef0e..f6db34d 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -13,6 +13,7 @@
#include "gpu/command_buffer/service/cmd_buffer_engine.h"
#include "gpu/command_buffer/service/gl_utils.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
+#include "gpu/command_buffer/service/gles2_cmd_validation.h"
namespace gpu {
namespace gles2 {
@@ -280,12 +281,6 @@ class GLES2DecoderImpl : public GLES2Decoder {
// Wrapper for glBindBuffer since we need to track the current targets.
void DoBindBuffer(GLenum target, GLuint buffer);
- // Wrapper for glDeleteProgram.
- void DoDeleteProgram(GLuint program);
-
- // Wrapper for glDeleteShader.
- void DoDeleteShader(GLuint shader);
-
// Swaps the buffers (copies/renders to the current window).
void DoSwapBuffers();
@@ -697,15 +692,6 @@ parse_error::ParseError GLES2DecoderImpl::DoCommand(
return result;
}
-} // namespace gles2
-} // namespace gpu
-
-// This is included so the compiler will make these inline.
-#include "gpu/command_buffer/service/gles2_cmd_decoder_validate.h"
-
-namespace gpu {
-namespace gles2 {
-
void GLES2DecoderImpl::CreateProgramHelper(GLuint client_id) {
// TODO(gman): verify client_id is unused.
GLuint service_id = glCreateProgram();
@@ -736,20 +722,30 @@ void GLES2DecoderImpl::DoBindBuffer(GLenum target, GLuint buffer) {
glBindBuffer(target, buffer);
}
-void GLES2DecoderImpl::DoDeleteProgram(GLuint program) {
+parse_error::ParseError GLES2DecoderImpl::HandleDeleteShader(
+ uint32 immediate_data_size, const gles2::DeleteShader& c) {
+ GLuint shader = c.shader;
GLuint service_id;
- if (id_map_.GetServiceId(program, &service_id)) {
- glDeleteProgram(service_id);
- id_map_.RemoveMapping(program, service_id);
+ if (!id_map_.GetServiceId(shader, &service_id)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
+ glDeleteProgram(service_id);
+ id_map_.RemoveMapping(shader, service_id);
+ return parse_error::kParseNoError;
}
-void GLES2DecoderImpl::DoDeleteShader(GLuint shader) {
+parse_error::ParseError GLES2DecoderImpl::HandleDeleteProgram(
+ uint32 immediate_data_size, const gles2::DeleteProgram& c) {
+ GLuint program = c.program;
GLuint service_id;
- if (id_map_.GetServiceId(shader, &service_id)) {
- glDeleteProgram(service_id);
- id_map_.RemoveMapping(shader, service_id);
+ if (!id_map_.GetServiceId(program, &service_id)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
+ glDeleteProgram(service_id);
+ id_map_.RemoveMapping(program, service_id);
+ return parse_error::kParseNoError;
}
// NOTE: If you need to know the results of SwapBuffers (like losing
@@ -795,8 +791,15 @@ parse_error::ParseError GLES2DecoderImpl::HandleDrawElements(
GLenum mode = c.mode;
GLsizei count = c.count;
GLenum type = c.type;
- const GLvoid* indices = reinterpret_cast<const GLvoid*>(c.index_offset);
- glDrawElements(mode, count, type, indices);
+ if (!ValidateGLenumDrawMode(mode) ||
+ !ValidateGLenumIndexType(type)) {
+ SetGLError(GL_INVALID_VALUE);
+ } else {
+ const GLvoid* indices = reinterpret_cast<const GLvoid*>(c.index_offset);
+ // TODO(gman): Validate indices
+ // TOOD(gman): Validate all attribs current program needs are setup.
+ glDrawElements(mode, count, type, indices);
+ }
} else {
SetGLError(GL_INVALID_VALUE);
}
@@ -845,13 +848,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleShaderSource(
uint32 data_size = c.data_size;
const char** data = GetSharedMemoryAs<const char**>(
c.data_shm_id, c.data_shm_offset, data_size);
- parse_error::ParseError result =
- // TODO(gman): Manually implement validation.
- ValidateShaderSource(
- this, immediate_data_size, shader, count, data,
- reinterpret_cast<const GLint*>(1));
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!data) {
+ return parse_error::kParseOutOfBounds;
}
return ShaderSourceHelper(
shader, count, reinterpret_cast<const char*>(data), data_size);
@@ -868,11 +866,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleShaderSourceImmediate(
uint32 data_size = c.data_size;
// TODO(gman): need to check that data_size is in range for arg_count.
const char** data = GetImmediateDataAs<const char**>(c);
- parse_error::ParseError result =
- ValidateShaderSourceImmediate(
- this, immediate_data_size, shader, count, data, NULL);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!data) {
+ return parse_error::kParseOutOfBounds;
}
return ShaderSourceHelper(
shader, count, reinterpret_cast<const char*>(data), data_size);
@@ -889,12 +884,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttribPointer(
GLuint offset = c.offset;
const void* ptr = reinterpret_cast<const void*>(c.offset);
// TODO(gman): Do manual validation.
- parse_error::ParseError result =
- ValidateVertexAttribPointer(
- this, immediate_data_size, indx, size, type, normalized, stride,
- reinterpret_cast<const void*>(1));
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ptr) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!ValidateGLenumVertexAttribType(type) ||
+ !ValidateGLenumVertexAttribSize(size)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
} else {
@@ -915,10 +911,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleReadPixels(
width, height, format, type, pack_alignment_);
void* pixels = GetSharedMemoryAs<void*>(
c.pixels_shm_id, c.pixels_shm_offset, pixels_size);
- parse_error::ParseError result = ValidateReadPixels(
- this, immediate_data_size, x, y, width, height, format, type, pixels);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!pixels) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!ValidateGLenumReadPixelFormat(format) ||
+ !ValidateGLenumPixelType(type)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glReadPixels(x, y, width, height, format, type, pixels);
return parse_error::kParseNoError;
@@ -928,10 +927,10 @@ parse_error::ParseError GLES2DecoderImpl::HandlePixelStorei(
uint32 immediate_data_size, const gles2::PixelStorei& c) {
GLenum pname = c.pname;
GLenum param = c.param;
- parse_error::ParseError result =
- ValidatePixelStorei(this, immediate_data_size, pname, param);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumPixelStore(pname) ||
+ !ValidateGLenumPixelStoreAlignment(param)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glPixelStorei(pname, param);
switch (pname) {
@@ -1041,14 +1040,16 @@ parse_error::ParseError GLES2DecoderImpl::HandleBufferData(
const void* data = NULL;
if (data_shm_id != 0 || data_shm_offset != 0) {
data = GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, size);
- parse_error::ParseError result =
- ValidateBufferData(this, immediate_data_size, target, size, data,
- usage);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!data) {
+ return parse_error::kParseOutOfBounds;
}
}
// TODO(gman): Validate case where data is NULL.
+ if (!ValidateGLenumBufferTarget(target) ||
+ !ValidateGLenumBufferUsage(usage)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
glBufferData(target, size, data, usage);
return parse_error::kParseNoError;
}
@@ -1059,14 +1060,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleBufferDataImmediate(
GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
const void* data = GetImmediateDataAs<const void*>(c);
GLenum usage = static_cast<GLenum>(c.usage);
- // Immediate version.
- // TODO(gman): Handle case where data is NULL.
- parse_error::ParseError result =
- ValidateBufferDataImmediate(this, immediate_data_size, target, size, data,
- usage);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumBufferTarget(target) ||
+ !ValidateGLenumBufferUsage(usage)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
+ // TODO(gman): Handle case where data is NULL.
glBufferData(target, size, data, usage);
return parse_error::kParseNoError;
}
@@ -1086,14 +1085,15 @@ parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexImage2D(
if (data_shm_id != 0 || data_shm_offset != 0) {
data = GetSharedMemoryAs<const void*>(
data_shm_id, data_shm_offset, image_size);
- parse_error::ParseError result =
- ValidateCompressedTexImage2D(
- this, immediate_data_size, target, level, internal_format, width,
- height, border, image_size, data);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!data) {
+ return parse_error::kParseOutOfBounds;
}
}
+ // TODO(gman): Validate internal_format
+ if (!ValidateGLenumTextureTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
// TODO(gman): Validate case where data is NULL.
glCompressedTexImage2D(
target, level, internal_format, width, height, border, image_size, data);
@@ -1112,12 +1112,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexImage2DImmediate(
const void* data = GetImmediateDataAs<const void*>(c);
// Immediate version.
// TODO(gman): Handle case where data is NULL.
- parse_error::ParseError result =
- ValidateCompressedTexImage2DImmediate(
- this, immediate_data_size, target, level, internal_format, width,
- height, border, image_size, data);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!data) {
+ return parse_error::kParseOutOfBounds;
+ }
+ // TODO(gman): Validate internal_format
+ if (!ValidateGLenumTextureTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glCompressedTexImage2D(
target, level, internal_format, width, height, border, image_size, data);
@@ -1142,14 +1143,17 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexImage2D(
if (pixels_shm_id != 0 || pixels_shm_offset != 0) {
pixels = GetSharedMemoryAs<const void*>(
pixels_shm_id, pixels_shm_offset, pixels_size);
- parse_error::ParseError result =
- ValidateTexImage2D(
- this, immediate_data_size, target, level, internal_format, width,
- height, border, format, type, pixels);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!pixels) {
+ return parse_error::kParseOutOfBounds;
}
}
+ if (!ValidateGLenumTextureTarget(target) ||
+ !ValidateGLenumTextureFormat(internal_format) ||
+ !ValidateGLenumTextureFormat(format) ||
+ !ValidateGLenumPixelType(type)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
// TODO(gman): Validate case where data is NULL.
glTexImage2D(
target, level, internal_format, width, height, border, format, type,
@@ -1161,7 +1165,7 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexImage2DImmediate(
uint32 immediate_data_size, const gles2::TexImage2DImmediate& c) {
GLenum target = static_cast<GLenum>(c.target);
GLint level = static_cast<GLint>(c.level);
- GLint internalformat = static_cast<GLint>(c.internalformat);
+ GLint internal_format = static_cast<GLint>(c.internalformat);
GLsizei width = static_cast<GLsizei>(c.width);
GLsizei height = static_cast<GLsizei>(c.height);
GLint border = static_cast<GLint>(c.border);
@@ -1170,15 +1174,18 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexImage2DImmediate(
const void* pixels = GetImmediateDataAs<const void*>(c);
// Immediate version.
// TODO(gman): Handle case where data is NULL.
- parse_error::ParseError result =
- ValidateTexImage2DImmediate(
- this, immediate_data_size, target, level, internalformat, width,
- height, border, format, type, pixels);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!pixels) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!ValidateGLenumTextureTarget(target) ||
+ !ValidateGLenumTextureFormat(internal_format) ||
+ !ValidateGLenumTextureFormat(format) ||
+ !ValidateGLenumPixelType(type)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glTexImage2D(
- target, level, internalformat, width, height, border, format, type,
+ target, level, internal_format, width, height, border, format, type,
pixels);
return parse_error::kParseNoError;
}
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
index 19c865c..957ccad 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
@@ -5,11 +5,6 @@
parse_error::ParseError GLES2DecoderImpl::HandleActiveTexture(
uint32 immediate_data_size, const gles2::ActiveTexture& c) {
GLenum texture = static_cast<GLenum>(c.texture);
- parse_error::ParseError result =
- ValidateActiveTexture(this, immediate_data_size, texture);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glActiveTexture(texture);
return parse_error::kParseNoError;
}
@@ -26,11 +21,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleAttachShader(
SetGLError(GL_INVALID_VALUE);
return parse_error::kParseNoError;
}
- parse_error::ParseError result =
- ValidateAttachShader(this, immediate_data_size, program, shader);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glAttachShader(program, shader);
return parse_error::kParseNoError;
}
@@ -46,11 +36,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocation(
uint32 name_size = c.data_size;
const char* name = GetSharedMemoryAs<const char*>(
c.name_shm_id, c.name_shm_offset, name_size);
- parse_error::ParseError result =
- ValidateBindAttribLocation(
- this, immediate_data_size, program, index, name);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (name == NULL) {
+ return parse_error::kParseOutOfBounds;
}
String name_str(name, name_size);
glBindAttribLocation(program, index, name_str.c_str());
@@ -69,11 +56,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocationImmediate(
const char* name = GetImmediateDataAs<const char*>(c);
// TODO(gman): Make sure validate checks
// immediate_data_size covers data_size.
- parse_error::ParseError result =
- ValidateBindAttribLocationImmediate(
- this, immediate_data_size, program, index, name);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (name == NULL) {
+ return parse_error::kParseOutOfBounds;
}
String name_str(name, name_size);
glBindAttribLocation(program, index, name_str.c_str());
@@ -88,10 +72,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindBuffer(
SetGLError(GL_INVALID_VALUE);
return parse_error::kParseNoError;
}
- parse_error::ParseError result =
- ValidateBindBuffer(this, immediate_data_size, target, buffer);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumBufferTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
DoBindBuffer(target, buffer);
return parse_error::kParseNoError;
@@ -105,10 +88,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindFramebuffer(
SetGLError(GL_INVALID_VALUE);
return parse_error::kParseNoError;
}
- parse_error::ParseError result =
- ValidateBindFramebuffer(this, immediate_data_size, target, framebuffer);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumFrameBufferTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glBindFramebufferEXT(target, framebuffer);
return parse_error::kParseNoError;
@@ -122,11 +104,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindRenderbuffer(
SetGLError(GL_INVALID_VALUE);
return parse_error::kParseNoError;
}
- parse_error::ParseError result =
- ValidateBindRenderbuffer(
- this, immediate_data_size, target, renderbuffer);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumRenderBufferTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glBindRenderbufferEXT(target, renderbuffer);
return parse_error::kParseNoError;
@@ -140,10 +120,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleBindTexture(
SetGLError(GL_INVALID_VALUE);
return parse_error::kParseNoError;
}
- parse_error::ParseError result =
- ValidateBindTexture(this, immediate_data_size, target, texture);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureBindTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glBindTexture(target, texture);
return parse_error::kParseNoError;
@@ -155,11 +134,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleBlendColor(
GLclampf green = static_cast<GLclampf>(c.green);
GLclampf blue = static_cast<GLclampf>(c.blue);
GLclampf alpha = static_cast<GLclampf>(c.alpha);
- parse_error::ParseError result =
- ValidateBlendColor(this, immediate_data_size, red, green, blue, alpha);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glBlendColor(red, green, blue, alpha);
return parse_error::kParseNoError;
}
@@ -167,10 +141,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleBlendColor(
parse_error::ParseError GLES2DecoderImpl::HandleBlendEquation(
uint32 immediate_data_size, const gles2::BlendEquation& c) {
GLenum mode = static_cast<GLenum>(c.mode);
- parse_error::ParseError result =
- ValidateBlendEquation(this, immediate_data_size, mode);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumEquation(mode)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glBlendEquation(mode);
return parse_error::kParseNoError;
@@ -180,11 +153,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleBlendEquationSeparate(
uint32 immediate_data_size, const gles2::BlendEquationSeparate& c) {
GLenum modeRGB = static_cast<GLenum>(c.modeRGB);
GLenum modeAlpha = static_cast<GLenum>(c.modeAlpha);
- parse_error::ParseError result =
- ValidateBlendEquationSeparate(
- this, immediate_data_size, modeRGB, modeAlpha);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumEquation(modeRGB)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumEquation(modeAlpha)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glBlendEquationSeparate(modeRGB, modeAlpha);
return parse_error::kParseNoError;
@@ -194,10 +169,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleBlendFunc(
uint32 immediate_data_size, const gles2::BlendFunc& c) {
GLenum sfactor = static_cast<GLenum>(c.sfactor);
GLenum dfactor = static_cast<GLenum>(c.dfactor);
- parse_error::ParseError result =
- ValidateBlendFunc(this, immediate_data_size, sfactor, dfactor);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumSrcBlendFactor(sfactor)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumDstBlendFactor(dfactor)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glBlendFunc(sfactor, dfactor);
return parse_error::kParseNoError;
@@ -209,11 +187,21 @@ parse_error::ParseError GLES2DecoderImpl::HandleBlendFuncSeparate(
GLenum dstRGB = static_cast<GLenum>(c.dstRGB);
GLenum srcAlpha = static_cast<GLenum>(c.srcAlpha);
GLenum dstAlpha = static_cast<GLenum>(c.dstAlpha);
- parse_error::ParseError result =
- ValidateBlendFuncSeparate(
- this, immediate_data_size, srcRGB, dstRGB, srcAlpha, dstAlpha);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumSrcBlendFactor(srcRGB)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumDstBlendFactor(dstRGB)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumSrcBlendFactor(srcAlpha)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumDstBlendFactor(dstAlpha)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
return parse_error::kParseNoError;
@@ -229,11 +217,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleBufferSubData(
uint32 data_size = size;
const void* data = GetSharedMemoryAs<const void*>(
data_shm_id, data_shm_offset, data_size);
- parse_error::ParseError result =
- ValidateBufferSubData(
- this, immediate_data_size, target, offset, size, data);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumBufferTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (data == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glBufferSubData(target, offset, size, data);
return parse_error::kParseNoError;
@@ -245,12 +234,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleBufferSubDataImmediate(
GLintptr offset = static_cast<GLintptr>(c.offset);
GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
const void* data = GetImmediateDataAs<const void*>(c);
+ if (!ValidateGLenumBufferTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (data == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateBufferSubDataImmediate(
- this, immediate_data_size, target, offset, size, data);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumBufferTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (data == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glBufferSubData(target, offset, size, data);
return parse_error::kParseNoError;
@@ -259,10 +256,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleBufferSubDataImmediate(
parse_error::ParseError GLES2DecoderImpl::HandleCheckFramebufferStatus(
uint32 immediate_data_size, const gles2::CheckFramebufferStatus& c) {
GLenum target = static_cast<GLenum>(c.target);
- parse_error::ParseError result =
- ValidateCheckFramebufferStatus(this, immediate_data_size, target);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumFrameBufferTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glCheckFramebufferStatusEXT(target);
return parse_error::kParseNoError;
@@ -271,11 +267,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleCheckFramebufferStatus(
parse_error::ParseError GLES2DecoderImpl::HandleClear(
uint32 immediate_data_size, const gles2::Clear& c) {
GLbitfield mask = static_cast<GLbitfield>(c.mask);
- parse_error::ParseError result =
- ValidateClear(this, immediate_data_size, mask);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glClear(mask);
return parse_error::kParseNoError;
}
@@ -286,11 +277,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleClearColor(
GLclampf green = static_cast<GLclampf>(c.green);
GLclampf blue = static_cast<GLclampf>(c.blue);
GLclampf alpha = static_cast<GLclampf>(c.alpha);
- parse_error::ParseError result =
- ValidateClearColor(this, immediate_data_size, red, green, blue, alpha);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glClearColor(red, green, blue, alpha);
return parse_error::kParseNoError;
}
@@ -298,11 +284,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleClearColor(
parse_error::ParseError GLES2DecoderImpl::HandleClearDepthf(
uint32 immediate_data_size, const gles2::ClearDepthf& c) {
GLclampf depth = static_cast<GLclampf>(c.depth);
- parse_error::ParseError result =
- ValidateClearDepthf(this, immediate_data_size, depth);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glClearDepth(depth);
return parse_error::kParseNoError;
}
@@ -310,11 +291,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleClearDepthf(
parse_error::ParseError GLES2DecoderImpl::HandleClearStencil(
uint32 immediate_data_size, const gles2::ClearStencil& c) {
GLint s = static_cast<GLint>(c.s);
- parse_error::ParseError result =
- ValidateClearStencil(this, immediate_data_size, s);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glClearStencil(s);
return parse_error::kParseNoError;
}
@@ -325,11 +301,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleColorMask(
GLboolean green = static_cast<GLboolean>(c.green);
GLboolean blue = static_cast<GLboolean>(c.blue);
GLboolean alpha = static_cast<GLboolean>(c.alpha);
- parse_error::ParseError result =
- ValidateColorMask(this, immediate_data_size, red, green, blue, alpha);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glColorMask(red, green, blue, alpha);
return parse_error::kParseNoError;
}
@@ -341,11 +312,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleCompileShader(
SetGLError(GL_INVALID_VALUE);
return parse_error::kParseNoError;
}
- parse_error::ParseError result =
- ValidateCompileShader(this, immediate_data_size, shader);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glCompileShader(shader);
return parse_error::kParseNoError;
}
@@ -365,12 +331,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2D(
uint32 data_size = imageSize;
const void* data = GetSharedMemoryAs<const void*>(
data_shm_id, data_shm_offset, data_size);
- parse_error::ParseError result =
- ValidateCompressedTexSubImage2D(
- this, immediate_data_size, target, level, xoffset, yoffset, width,
- height, format, imageSize, data);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (data == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glCompressedTexSubImage2D(
target, level, xoffset, yoffset, width, height, format, imageSize, data);
@@ -390,13 +356,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2DImmediate
GLenum format = static_cast<GLenum>(c.format);
GLsizei imageSize = static_cast<GLsizei>(c.imageSize);
const void* data = GetImmediateDataAs<const void*>(c);
+ if (!ValidateGLenumTextureTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (data == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateCompressedTexSubImage2DImmediate(
- this, immediate_data_size, target, level, xoffset, yoffset, width,
- height, format, imageSize, data);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (data == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glCompressedTexSubImage2D(
target, level, xoffset, yoffset, width, height, format, imageSize, data);
@@ -413,12 +386,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleCopyTexImage2D(
GLsizei width = static_cast<GLsizei>(c.width);
GLsizei height = static_cast<GLsizei>(c.height);
GLint border = static_cast<GLint>(c.border);
- parse_error::ParseError result =
- ValidateCopyTexImage2D(
- this, immediate_data_size, target, level, internalformat, x, y, width,
- height, border);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
return parse_error::kParseNoError;
@@ -434,12 +404,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleCopyTexSubImage2D(
GLint y = static_cast<GLint>(c.y);
GLsizei width = static_cast<GLsizei>(c.width);
GLsizei height = static_cast<GLsizei>(c.height);
- parse_error::ParseError result =
- ValidateCopyTexSubImage2D(
- this, immediate_data_size, target, level, xoffset, yoffset, x, y,
- width, height);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
return parse_error::kParseNoError;
@@ -448,11 +415,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleCopyTexSubImage2D(
parse_error::ParseError GLES2DecoderImpl::HandleCreateProgram(
uint32 immediate_data_size, const gles2::CreateProgram& c) {
uint32 client_id = c.client_id;
- parse_error::ParseError result =
- ValidateCreateProgram(this, immediate_data_size);
- if (result != parse_error::kParseNoError) {
- return result;
- }
CreateProgramHelper(client_id);
return parse_error::kParseNoError;
}
@@ -460,11 +422,14 @@ parse_error::ParseError GLES2DecoderImpl::HandleCreateProgram(
parse_error::ParseError GLES2DecoderImpl::HandleCreateShader(
uint32 immediate_data_size, const gles2::CreateShader& c) {
GLenum type = static_cast<GLenum>(c.type);
+ if (!ValidateGLenumShaderType(type)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
uint32 client_id = c.client_id;
- parse_error::ParseError result =
- ValidateCreateShader(this, immediate_data_size, type);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumShaderType(type)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
CreateShaderHelper(type, client_id);
return parse_error::kParseNoError;
@@ -473,10 +438,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleCreateShader(
parse_error::ParseError GLES2DecoderImpl::HandleCullFace(
uint32 immediate_data_size, const gles2::CullFace& c) {
GLenum mode = static_cast<GLenum>(c.mode);
- parse_error::ParseError result =
- ValidateCullFace(this, immediate_data_size, mode);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumFaceType(mode)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glCullFace(mode);
return parse_error::kParseNoError;
@@ -487,10 +451,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffers(
GLsizei n = static_cast<GLsizei>(c.n);
const GLuint* buffers = GetSharedMemoryAs<const GLuint*>(
c.buffers_shm_id, c.buffers_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateDeleteBuffers(this, immediate_data_size, n, buffers);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (buffers == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (buffers == NULL) {
+ return parse_error::kParseOutOfBounds;
}
DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers);
return parse_error::kParseNoError;
@@ -500,10 +465,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffersImmediate(
uint32 immediate_data_size, const gles2::DeleteBuffersImmediate& c) {
GLsizei n = static_cast<GLsizei>(c.n);
const GLuint* buffers = GetImmediateDataAs<const GLuint*>(c);
- parse_error::ParseError result =
- ValidateDeleteBuffersImmediate(this, immediate_data_size, n, buffers);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (buffers == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (buffers == NULL) {
+ return parse_error::kParseOutOfBounds;
}
DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers);
return parse_error::kParseNoError;
@@ -515,10 +481,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffers(
const GLuint* framebuffers = GetSharedMemoryAs<const GLuint*>(
c.framebuffers_shm_id, c.framebuffers_shm_offset, 0 /* TODO(
gman): size */);
- parse_error::ParseError result =
- ValidateDeleteFramebuffers(this, immediate_data_size, n, framebuffers);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (framebuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (framebuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
}
DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers);
return parse_error::kParseNoError;
@@ -528,29 +495,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffersImmediate(
uint32 immediate_data_size, const gles2::DeleteFramebuffersImmediate& c) {
GLsizei n = static_cast<GLsizei>(c.n);
const GLuint* framebuffers = GetImmediateDataAs<const GLuint*>(c);
- parse_error::ParseError result =
- ValidateDeleteFramebuffersImmediate(
- this, immediate_data_size, n, framebuffers);
- if (result != parse_error::kParseNoError) {
- return result;
- }
- DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers);
- return parse_error::kParseNoError;
-}
-
-parse_error::ParseError GLES2DecoderImpl::HandleDeleteProgram(
- uint32 immediate_data_size, const gles2::DeleteProgram& c) {
- GLuint program;
- if (!id_map_.GetServiceId(c.program, &program)) {
- SetGLError(GL_INVALID_VALUE);
- return parse_error::kParseNoError;
+ if (framebuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
}
- parse_error::ParseError result =
- ValidateDeleteProgram(this, immediate_data_size, program);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (framebuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
}
- DoDeleteProgram(program);
+ DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers);
return parse_error::kParseNoError;
}
@@ -560,10 +511,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffers(
const GLuint* renderbuffers = GetSharedMemoryAs<const GLuint*>(
c.renderbuffers_shm_id, c.renderbuffers_shm_offset, 0 /* TODO(
gman): size */);
- parse_error::ParseError result =
- ValidateDeleteRenderbuffers(this, immediate_data_size, n, renderbuffers);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (renderbuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (renderbuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
}
DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers);
return parse_error::kParseNoError;
@@ -573,29 +525,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffersImmediate(
uint32 immediate_data_size, const gles2::DeleteRenderbuffersImmediate& c) {
GLsizei n = static_cast<GLsizei>(c.n);
const GLuint* renderbuffers = GetImmediateDataAs<const GLuint*>(c);
- parse_error::ParseError result =
- ValidateDeleteRenderbuffersImmediate(
- this, immediate_data_size, n, renderbuffers);
- if (result != parse_error::kParseNoError) {
- return result;
- }
- DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers);
- return parse_error::kParseNoError;
-}
-
-parse_error::ParseError GLES2DecoderImpl::HandleDeleteShader(
- uint32 immediate_data_size, const gles2::DeleteShader& c) {
- GLuint shader;
- if (!id_map_.GetServiceId(c.shader, &shader)) {
- SetGLError(GL_INVALID_VALUE);
- return parse_error::kParseNoError;
+ if (renderbuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
}
- parse_error::ParseError result =
- ValidateDeleteShader(this, immediate_data_size, shader);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (renderbuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
}
- DoDeleteShader(shader);
+ DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers);
return parse_error::kParseNoError;
}
@@ -604,10 +540,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteTextures(
GLsizei n = static_cast<GLsizei>(c.n);
const GLuint* textures = GetSharedMemoryAs<const GLuint*>(
c.textures_shm_id, c.textures_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateDeleteTextures(this, immediate_data_size, n, textures);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (textures == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (textures == NULL) {
+ return parse_error::kParseOutOfBounds;
}
DeleteGLObjects<GLDeleteTexturesHelper>(n, textures);
return parse_error::kParseNoError;
@@ -617,10 +554,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteTexturesImmediate(
uint32 immediate_data_size, const gles2::DeleteTexturesImmediate& c) {
GLsizei n = static_cast<GLsizei>(c.n);
const GLuint* textures = GetImmediateDataAs<const GLuint*>(c);
- parse_error::ParseError result =
- ValidateDeleteTexturesImmediate(this, immediate_data_size, n, textures);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (textures == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (textures == NULL) {
+ return parse_error::kParseOutOfBounds;
}
DeleteGLObjects<GLDeleteTexturesHelper>(n, textures);
return parse_error::kParseNoError;
@@ -629,10 +567,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleDeleteTexturesImmediate(
parse_error::ParseError GLES2DecoderImpl::HandleDepthFunc(
uint32 immediate_data_size, const gles2::DepthFunc& c) {
GLenum func = static_cast<GLenum>(c.func);
- parse_error::ParseError result =
- ValidateDepthFunc(this, immediate_data_size, func);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumCmpFunction(func)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glDepthFunc(func);
return parse_error::kParseNoError;
@@ -641,11 +578,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleDepthFunc(
parse_error::ParseError GLES2DecoderImpl::HandleDepthMask(
uint32 immediate_data_size, const gles2::DepthMask& c) {
GLboolean flag = static_cast<GLboolean>(c.flag);
- parse_error::ParseError result =
- ValidateDepthMask(this, immediate_data_size, flag);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glDepthMask(flag);
return parse_error::kParseNoError;
}
@@ -654,11 +586,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleDepthRangef(
uint32 immediate_data_size, const gles2::DepthRangef& c) {
GLclampf zNear = static_cast<GLclampf>(c.zNear);
GLclampf zFar = static_cast<GLclampf>(c.zFar);
- parse_error::ParseError result =
- ValidateDepthRangef(this, immediate_data_size, zNear, zFar);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glDepthRange(zNear, zFar);
return parse_error::kParseNoError;
}
@@ -675,11 +602,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleDetachShader(
SetGLError(GL_INVALID_VALUE);
return parse_error::kParseNoError;
}
- parse_error::ParseError result =
- ValidateDetachShader(this, immediate_data_size, program, shader);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glDetachShader(program, shader);
return parse_error::kParseNoError;
}
@@ -687,10 +609,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleDetachShader(
parse_error::ParseError GLES2DecoderImpl::HandleDisable(
uint32 immediate_data_size, const gles2::Disable& c) {
GLenum cap = static_cast<GLenum>(c.cap);
- parse_error::ParseError result =
- ValidateDisable(this, immediate_data_size, cap);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumCapability(cap)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glDisable(cap);
return parse_error::kParseNoError;
@@ -699,11 +620,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleDisable(
parse_error::ParseError GLES2DecoderImpl::HandleDisableVertexAttribArray(
uint32 immediate_data_size, const gles2::DisableVertexAttribArray& c) {
GLuint index = static_cast<GLuint>(c.index);
- parse_error::ParseError result =
- ValidateDisableVertexAttribArray(this, immediate_data_size, index);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glDisableVertexAttribArray(index);
return parse_error::kParseNoError;
}
@@ -713,10 +629,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleDrawArrays(
GLenum mode = static_cast<GLenum>(c.mode);
GLint first = static_cast<GLint>(c.first);
GLsizei count = static_cast<GLsizei>(c.count);
- parse_error::ParseError result =
- ValidateDrawArrays(this, immediate_data_size, mode, first, count);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumDrawMode(mode)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glDrawArrays(mode, first, count);
return parse_error::kParseNoError;
@@ -725,10 +640,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleDrawArrays(
parse_error::ParseError GLES2DecoderImpl::HandleEnable(
uint32 immediate_data_size, const gles2::Enable& c) {
GLenum cap = static_cast<GLenum>(c.cap);
- parse_error::ParseError result =
- ValidateEnable(this, immediate_data_size, cap);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumCapability(cap)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glEnable(cap);
return parse_error::kParseNoError;
@@ -737,33 +651,18 @@ parse_error::ParseError GLES2DecoderImpl::HandleEnable(
parse_error::ParseError GLES2DecoderImpl::HandleEnableVertexAttribArray(
uint32 immediate_data_size, const gles2::EnableVertexAttribArray& c) {
GLuint index = static_cast<GLuint>(c.index);
- parse_error::ParseError result =
- ValidateEnableVertexAttribArray(this, immediate_data_size, index);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glEnableVertexAttribArray(index);
return parse_error::kParseNoError;
}
parse_error::ParseError GLES2DecoderImpl::HandleFinish(
uint32 immediate_data_size, const gles2::Finish& c) {
- parse_error::ParseError result =
- ValidateFinish(this, immediate_data_size);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glFinish();
return parse_error::kParseNoError;
}
parse_error::ParseError GLES2DecoderImpl::HandleFlush(
uint32 immediate_data_size, const gles2::Flush& c) {
- parse_error::ParseError result =
- ValidateFlush(this, immediate_data_size);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glFlush();
return parse_error::kParseNoError;
}
@@ -778,12 +677,17 @@ parse_error::ParseError GLES2DecoderImpl::HandleFramebufferRenderbuffer(
SetGLError(GL_INVALID_VALUE);
return parse_error::kParseNoError;
}
- parse_error::ParseError result =
- ValidateFramebufferRenderbuffer(
- this, immediate_data_size, target, attachment, renderbuffertarget,
- renderbuffer);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumFrameBufferTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumAttachment(attachment)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumRenderBufferTarget(renderbuffertarget)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glFramebufferRenderbufferEXT(
target, attachment, renderbuffertarget, renderbuffer);
@@ -801,12 +705,17 @@ parse_error::ParseError GLES2DecoderImpl::HandleFramebufferTexture2D(
return parse_error::kParseNoError;
}
GLint level = static_cast<GLint>(c.level);
- parse_error::ParseError result =
- ValidateFramebufferTexture2D(
- this, immediate_data_size, target, attachment, textarget, texture,
- level);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumFrameBufferTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumAttachment(attachment)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumTextureTarget(textarget)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glFramebufferTexture2DEXT(target, attachment, textarget, texture, level);
return parse_error::kParseNoError;
@@ -815,10 +724,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleFramebufferTexture2D(
parse_error::ParseError GLES2DecoderImpl::HandleFrontFace(
uint32 immediate_data_size, const gles2::FrontFace& c) {
GLenum mode = static_cast<GLenum>(c.mode);
- parse_error::ParseError result =
- ValidateFrontFace(this, immediate_data_size, mode);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumFaceMode(mode)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glFrontFace(mode);
return parse_error::kParseNoError;
@@ -829,10 +737,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenBuffers(
GLsizei n = static_cast<GLsizei>(c.n);
GLuint* buffers = GetSharedMemoryAs<GLuint*>(
c.buffers_shm_id, c.buffers_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateGenBuffers(this, immediate_data_size, n, buffers);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (buffers == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (buffers == NULL) {
+ return parse_error::kParseOutOfBounds;
}
GenGLObjects<GLGenBuffersHelper>(n, buffers);
return parse_error::kParseNoError;
@@ -842,10 +751,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenBuffersImmediate(
uint32 immediate_data_size, const gles2::GenBuffersImmediate& c) {
GLsizei n = static_cast<GLsizei>(c.n);
GLuint* buffers = GetImmediateDataAs<GLuint*>(c);
- parse_error::ParseError result =
- ValidateGenBuffersImmediate(this, immediate_data_size, n, buffers);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (buffers == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (buffers == NULL) {
+ return parse_error::kParseOutOfBounds;
}
GenGLObjects<GLGenBuffersHelper>(n, buffers);
return parse_error::kParseNoError;
@@ -854,10 +764,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenBuffersImmediate(
parse_error::ParseError GLES2DecoderImpl::HandleGenerateMipmap(
uint32 immediate_data_size, const gles2::GenerateMipmap& c) {
GLenum target = static_cast<GLenum>(c.target);
- parse_error::ParseError result =
- ValidateGenerateMipmap(this, immediate_data_size, target);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureBindTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glGenerateMipmapEXT(target);
return parse_error::kParseNoError;
@@ -869,10 +778,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffers(
GLuint* framebuffers = GetSharedMemoryAs<GLuint*>(
c.framebuffers_shm_id, c.framebuffers_shm_offset, 0 /* TODO(
gman): size */);
- parse_error::ParseError result =
- ValidateGenFramebuffers(this, immediate_data_size, n, framebuffers);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (framebuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (framebuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
}
GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers);
return parse_error::kParseNoError;
@@ -882,11 +792,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffersImmediate(
uint32 immediate_data_size, const gles2::GenFramebuffersImmediate& c) {
GLsizei n = static_cast<GLsizei>(c.n);
GLuint* framebuffers = GetImmediateDataAs<GLuint*>(c);
- parse_error::ParseError result =
- ValidateGenFramebuffersImmediate(
- this, immediate_data_size, n, framebuffers);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (framebuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (framebuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
}
GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers);
return parse_error::kParseNoError;
@@ -898,10 +808,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffers(
GLuint* renderbuffers = GetSharedMemoryAs<GLuint*>(
c.renderbuffers_shm_id, c.renderbuffers_shm_offset, 0 /* TODO(
gman): size */);
- parse_error::ParseError result =
- ValidateGenRenderbuffers(this, immediate_data_size, n, renderbuffers);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (renderbuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (renderbuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
}
GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers);
return parse_error::kParseNoError;
@@ -911,11 +822,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffersImmediate(
uint32 immediate_data_size, const gles2::GenRenderbuffersImmediate& c) {
GLsizei n = static_cast<GLsizei>(c.n);
GLuint* renderbuffers = GetImmediateDataAs<GLuint*>(c);
- parse_error::ParseError result =
- ValidateGenRenderbuffersImmediate(
- this, immediate_data_size, n, renderbuffers);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (renderbuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (renderbuffers == NULL) {
+ return parse_error::kParseOutOfBounds;
}
GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers);
return parse_error::kParseNoError;
@@ -926,10 +837,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenTextures(
GLsizei n = static_cast<GLsizei>(c.n);
GLuint* textures = GetSharedMemoryAs<GLuint*>(
c.textures_shm_id, c.textures_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateGenTextures(this, immediate_data_size, n, textures);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (textures == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (textures == NULL) {
+ return parse_error::kParseOutOfBounds;
}
GenGLObjects<GLGenTexturesHelper>(n, textures);
return parse_error::kParseNoError;
@@ -939,10 +851,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleGenTexturesImmediate(
uint32 immediate_data_size, const gles2::GenTexturesImmediate& c) {
GLsizei n = static_cast<GLsizei>(c.n);
GLuint* textures = GetImmediateDataAs<GLuint*>(c);
- parse_error::ParseError result =
- ValidateGenTexturesImmediate(this, immediate_data_size, n, textures);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (textures == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (textures == NULL) {
+ return parse_error::kParseOutOfBounds;
}
GenGLObjects<GLGenTexturesHelper>(n, textures);
return parse_error::kParseNoError;
@@ -956,10 +869,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetBooleanv(
uint32 params_size = num_values * sizeof(*params);
params = GetSharedMemoryAs<GLboolean*>(
c.params_shm_id, c.params_shm_offset, params_size);
- parse_error::ParseError result =
- ValidateGetBooleanv(this, immediate_data_size, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glGetBooleanv(pname, params);
return parse_error::kParseNoError;
@@ -974,11 +885,16 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetBufferParameteriv(
uint32 params_size = num_values * sizeof(*params);
params = GetSharedMemoryAs<GLint*>(
c.params_shm_id, c.params_shm_offset, params_size);
- parse_error::ParseError result =
- ValidateGetBufferParameteriv(
- this, immediate_data_size, target, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumBufferTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumBufferParameter(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glGetBufferParameteriv(target, pname, params);
return parse_error::kParseNoError;
@@ -988,11 +904,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetError(
uint32 immediate_data_size, const gles2::GetError& c) {
GLenum* result_dst = GetSharedMemoryAs<GLenum*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
- parse_error::ParseError result =
- ValidateGetError(this, immediate_data_size);
- if (result != parse_error::kParseNoError) {
- return result;
- }
*result_dst = GetGLError();
return parse_error::kParseNoError;
}
@@ -1005,10 +916,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetFloatv(
uint32 params_size = num_values * sizeof(*params);
params = GetSharedMemoryAs<GLfloat*>(
c.params_shm_id, c.params_shm_offset, params_size);
- parse_error::ParseError result =
- ValidateGetFloatv(this, immediate_data_size, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glGetFloatv(pname, params);
return parse_error::kParseNoError;
@@ -1026,11 +935,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetFramebufferAttachmentParamete
uint32 params_size = num_values * sizeof(*params);
params = GetSharedMemoryAs<GLint*>(
c.params_shm_id, c.params_shm_offset, params_size);
- parse_error::ParseError result =
- ValidateGetFramebufferAttachmentParameteriv(
- this, immediate_data_size, target, attachment, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumFrameBufferTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumAttachment(attachment)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumFrameBufferParameter(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params);
return parse_error::kParseNoError;
@@ -1044,10 +962,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetIntegerv(
uint32 params_size = num_values * sizeof(*params);
params = GetSharedMemoryAs<GLint*>(
c.params_shm_id, c.params_shm_offset, params_size);
- parse_error::ParseError result =
- ValidateGetIntegerv(this, immediate_data_size, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glGetIntegerv(pname, params);
return parse_error::kParseNoError;
@@ -1066,10 +982,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetProgramiv(
uint32 params_size = num_values * sizeof(*params);
params = GetSharedMemoryAs<GLint*>(
c.params_shm_id, c.params_shm_offset, params_size);
- parse_error::ParseError result =
- ValidateGetProgramiv(this, immediate_data_size, program, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumProgramParameter(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glGetProgramiv(program, pname, params);
return parse_error::kParseNoError;
@@ -1087,11 +1005,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetProgramInfoLog(
c.length_shm_id, c.length_shm_offset, 0 /* TODO(gman): size */);
char* infolog = GetSharedMemoryAs<char*>(
c.infolog_shm_id, c.infolog_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateGetProgramInfoLog(
- this, immediate_data_size, program, bufsize, length, infolog);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (length == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (infolog == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glGetProgramInfoLog(program, bufsize, length, infolog);
return parse_error::kParseNoError;
@@ -1106,11 +1024,16 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetRenderbufferParameteriv(
uint32 params_size = num_values * sizeof(*params);
params = GetSharedMemoryAs<GLint*>(
c.params_shm_id, c.params_shm_offset, params_size);
- parse_error::ParseError result =
- ValidateGetRenderbufferParameteriv(
- this, immediate_data_size, target, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumRenderBufferTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumRenderBufferParameter(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glGetRenderbufferParameterivEXT(target, pname, params);
return parse_error::kParseNoError;
@@ -1129,10 +1052,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetShaderiv(
uint32 params_size = num_values * sizeof(*params);
params = GetSharedMemoryAs<GLint*>(
c.params_shm_id, c.params_shm_offset, params_size);
- parse_error::ParseError result =
- ValidateGetShaderiv(this, immediate_data_size, shader, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumShaderParameter(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glGetShaderiv(shader, pname, params);
return parse_error::kParseNoError;
@@ -1150,11 +1075,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetShaderInfoLog(
c.length_shm_id, c.length_shm_offset, 0 /* TODO(gman): size */);
char* infolog = GetSharedMemoryAs<char*>(
c.infolog_shm_id, c.infolog_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateGetShaderInfoLog(
- this, immediate_data_size, shader, bufsize, length, infolog);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (length == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (infolog == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glGetShaderInfoLog(shader, bufsize, length, infolog);
return parse_error::kParseNoError;
@@ -1172,11 +1097,11 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetShaderSource(
c.length_shm_id, c.length_shm_offset, 0 /* TODO(gman): size */);
char* source = GetSharedMemoryAs<char*>(
c.source_shm_id, c.source_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateGetShaderSource(
- this, immediate_data_size, shader, bufsize, length, source);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (length == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (source == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glGetShaderSource(shader, bufsize, length, source);
return parse_error::kParseNoError;
@@ -1185,10 +1110,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetShaderSource(
parse_error::ParseError GLES2DecoderImpl::HandleGetString(
uint32 immediate_data_size, const gles2::GetString& c) {
GLenum name = static_cast<GLenum>(c.name);
- parse_error::ParseError result =
- ValidateGetString(this, immediate_data_size, name);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumStringType(name)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glGetString(name);
return parse_error::kParseNoError;
@@ -1203,11 +1127,16 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetTexParameterfv(
uint32 params_size = num_values * sizeof(*params);
params = GetSharedMemoryAs<GLfloat*>(
c.params_shm_id, c.params_shm_offset, params_size);
- parse_error::ParseError result =
- ValidateGetTexParameterfv(
- this, immediate_data_size, target, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumTextureParameter(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glGetTexParameterfv(target, pname, params);
return parse_error::kParseNoError;
@@ -1222,11 +1151,16 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetTexParameteriv(
uint32 params_size = num_values * sizeof(*params);
params = GetSharedMemoryAs<GLint*>(
c.params_shm_id, c.params_shm_offset, params_size);
- parse_error::ParseError result =
- ValidateGetTexParameteriv(
- this, immediate_data_size, target, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumTextureParameter(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glGetTexParameteriv(target, pname, params);
return parse_error::kParseNoError;
@@ -1241,11 +1175,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribfv(
uint32 params_size = num_values * sizeof(*params);
params = GetSharedMemoryAs<GLfloat*>(
c.params_shm_id, c.params_shm_offset, params_size);
- parse_error::ParseError result =
- ValidateGetVertexAttribfv(
- this, immediate_data_size, index, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumVertexAttribute(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glGetVertexAttribfv(index, pname, params);
return parse_error::kParseNoError;
@@ -1260,11 +1195,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribiv(
uint32 params_size = num_values * sizeof(*params);
params = GetSharedMemoryAs<GLint*>(
c.params_shm_id, c.params_shm_offset, params_size);
- parse_error::ParseError result =
- ValidateGetVertexAttribiv(
- this, immediate_data_size, index, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumVertexAttribute(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glGetVertexAttribiv(index, pname, params);
return parse_error::kParseNoError;
@@ -1274,10 +1210,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleHint(
uint32 immediate_data_size, const gles2::Hint& c) {
GLenum target = static_cast<GLenum>(c.target);
GLenum mode = static_cast<GLenum>(c.mode);
- parse_error::ParseError result =
- ValidateHint(this, immediate_data_size, target, mode);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumHintTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumHintMode(mode)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glHint(target, mode);
return parse_error::kParseNoError;
@@ -1292,11 +1231,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsBuffer(
}
GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
- parse_error::ParseError result =
- ValidateIsBuffer(this, immediate_data_size, buffer);
- if (result != parse_error::kParseNoError) {
- return result;
- }
*result_dst = glIsBuffer(buffer);
return parse_error::kParseNoError;
}
@@ -1306,10 +1240,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsEnabled(
GLenum cap = static_cast<GLenum>(c.cap);
GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
- parse_error::ParseError result =
- ValidateIsEnabled(this, immediate_data_size, cap);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumCapability(cap)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
*result_dst = glIsEnabled(cap);
return parse_error::kParseNoError;
@@ -1324,11 +1257,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsFramebuffer(
}
GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
- parse_error::ParseError result =
- ValidateIsFramebuffer(this, immediate_data_size, framebuffer);
- if (result != parse_error::kParseNoError) {
- return result;
- }
*result_dst = glIsFramebufferEXT(framebuffer);
return parse_error::kParseNoError;
}
@@ -1342,11 +1270,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsProgram(
}
GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
- parse_error::ParseError result =
- ValidateIsProgram(this, immediate_data_size, program);
- if (result != parse_error::kParseNoError) {
- return result;
- }
*result_dst = glIsProgram(program);
return parse_error::kParseNoError;
}
@@ -1360,11 +1283,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsRenderbuffer(
}
GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
- parse_error::ParseError result =
- ValidateIsRenderbuffer(this, immediate_data_size, renderbuffer);
- if (result != parse_error::kParseNoError) {
- return result;
- }
*result_dst = glIsRenderbufferEXT(renderbuffer);
return parse_error::kParseNoError;
}
@@ -1378,11 +1296,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsShader(
}
GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
- parse_error::ParseError result =
- ValidateIsShader(this, immediate_data_size, shader);
- if (result != parse_error::kParseNoError) {
- return result;
- }
*result_dst = glIsShader(shader);
return parse_error::kParseNoError;
}
@@ -1396,11 +1309,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsTexture(
}
GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
- parse_error::ParseError result =
- ValidateIsTexture(this, immediate_data_size, texture);
- if (result != parse_error::kParseNoError) {
- return result;
- }
*result_dst = glIsTexture(texture);
return parse_error::kParseNoError;
}
@@ -1408,11 +1316,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleIsTexture(
parse_error::ParseError GLES2DecoderImpl::HandleLineWidth(
uint32 immediate_data_size, const gles2::LineWidth& c) {
GLfloat width = static_cast<GLfloat>(c.width);
- parse_error::ParseError result =
- ValidateLineWidth(this, immediate_data_size, width);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glLineWidth(width);
return parse_error::kParseNoError;
}
@@ -1424,11 +1327,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleLinkProgram(
SetGLError(GL_INVALID_VALUE);
return parse_error::kParseNoError;
}
- parse_error::ParseError result =
- ValidateLinkProgram(this, immediate_data_size, program);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glLinkProgram(program);
return parse_error::kParseNoError;
}
@@ -1437,11 +1335,6 @@ parse_error::ParseError GLES2DecoderImpl::HandlePolygonOffset(
uint32 immediate_data_size, const gles2::PolygonOffset& c) {
GLfloat factor = static_cast<GLfloat>(c.factor);
GLfloat units = static_cast<GLfloat>(c.units);
- parse_error::ParseError result =
- ValidatePolygonOffset(this, immediate_data_size, factor, units);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glPolygonOffset(factor, units);
return parse_error::kParseNoError;
}
@@ -1452,11 +1345,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleRenderbufferStorage(
GLenum internalformat = static_cast<GLenum>(c.internalformat);
GLsizei width = static_cast<GLsizei>(c.width);
GLsizei height = static_cast<GLsizei>(c.height);
- parse_error::ParseError result =
- ValidateRenderbufferStorage(
- this, immediate_data_size, target, internalformat, width, height);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumRenderBufferTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumRenderBufferFormat(internalformat)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glRenderbufferStorageEXT(target, internalformat, width, height);
return parse_error::kParseNoError;
@@ -1466,11 +1361,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleSampleCoverage(
uint32 immediate_data_size, const gles2::SampleCoverage& c) {
GLclampf value = static_cast<GLclampf>(c.value);
GLboolean invert = static_cast<GLboolean>(c.invert);
- parse_error::ParseError result =
- ValidateSampleCoverage(this, immediate_data_size, value, invert);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glSampleCoverage(value, invert);
return parse_error::kParseNoError;
}
@@ -1481,11 +1371,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleScissor(
GLint y = static_cast<GLint>(c.y);
GLsizei width = static_cast<GLsizei>(c.width);
GLsizei height = static_cast<GLsizei>(c.height);
- parse_error::ParseError result =
- ValidateScissor(this, immediate_data_size, x, y, width, height);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glScissor(x, y, width, height);
return parse_error::kParseNoError;
}
@@ -1495,10 +1380,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleStencilFunc(
GLenum func = static_cast<GLenum>(c.func);
GLint ref = static_cast<GLint>(c.ref);
GLuint mask = static_cast<GLuint>(c.mask);
- parse_error::ParseError result =
- ValidateStencilFunc(this, immediate_data_size, func, ref, mask);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumCmpFunction(func)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glStencilFunc(func, ref, mask);
return parse_error::kParseNoError;
@@ -1510,11 +1394,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleStencilFuncSeparate(
GLenum func = static_cast<GLenum>(c.func);
GLint ref = static_cast<GLint>(c.ref);
GLuint mask = static_cast<GLuint>(c.mask);
- parse_error::ParseError result =
- ValidateStencilFuncSeparate(
- this, immediate_data_size, face, func, ref, mask);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumFaceType(face)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumCmpFunction(func)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glStencilFuncSeparate(face, func, ref, mask);
return parse_error::kParseNoError;
@@ -1523,11 +1409,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleStencilFuncSeparate(
parse_error::ParseError GLES2DecoderImpl::HandleStencilMask(
uint32 immediate_data_size, const gles2::StencilMask& c) {
GLuint mask = static_cast<GLuint>(c.mask);
- parse_error::ParseError result =
- ValidateStencilMask(this, immediate_data_size, mask);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glStencilMask(mask);
return parse_error::kParseNoError;
}
@@ -1536,10 +1417,9 @@ parse_error::ParseError GLES2DecoderImpl::HandleStencilMaskSeparate(
uint32 immediate_data_size, const gles2::StencilMaskSeparate& c) {
GLenum face = static_cast<GLenum>(c.face);
GLuint mask = static_cast<GLuint>(c.mask);
- parse_error::ParseError result =
- ValidateStencilMaskSeparate(this, immediate_data_size, face, mask);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumFaceType(face)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glStencilMaskSeparate(face, mask);
return parse_error::kParseNoError;
@@ -1550,10 +1430,17 @@ parse_error::ParseError GLES2DecoderImpl::HandleStencilOp(
GLenum fail = static_cast<GLenum>(c.fail);
GLenum zfail = static_cast<GLenum>(c.zfail);
GLenum zpass = static_cast<GLenum>(c.zpass);
- parse_error::ParseError result =
- ValidateStencilOp(this, immediate_data_size, fail, zfail, zpass);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumStencilOp(fail)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumStencilOp(zfail)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumStencilOp(zpass)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glStencilOp(fail, zfail, zpass);
return parse_error::kParseNoError;
@@ -1565,11 +1452,21 @@ parse_error::ParseError GLES2DecoderImpl::HandleStencilOpSeparate(
GLenum fail = static_cast<GLenum>(c.fail);
GLenum zfail = static_cast<GLenum>(c.zfail);
GLenum zpass = static_cast<GLenum>(c.zpass);
- parse_error::ParseError result =
- ValidateStencilOpSeparate(
- this, immediate_data_size, face, fail, zfail, zpass);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumFaceType(face)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumStencilOp(fail)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumStencilOp(zfail)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumStencilOp(zpass)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glStencilOpSeparate(face, fail, zfail, zpass);
return parse_error::kParseNoError;
@@ -1580,10 +1477,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexParameterf(
GLenum target = static_cast<GLenum>(c.target);
GLenum pname = static_cast<GLenum>(c.pname);
GLfloat param = static_cast<GLfloat>(c.param);
- parse_error::ParseError result =
- ValidateTexParameterf(this, immediate_data_size, target, pname, param);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureBindTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumTextureParameter(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glTexParameterf(target, pname, param);
return parse_error::kParseNoError;
@@ -1595,10 +1495,16 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfv(
GLenum pname = static_cast<GLenum>(c.pname);
const GLfloat* params = GetSharedMemoryAs<const GLfloat*>(
c.params_shm_id, c.params_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateTexParameterfv(this, immediate_data_size, target, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureBindTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumTextureParameter(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glTexParameterfv(target, pname, params);
return parse_error::kParseNoError;
@@ -1609,12 +1515,36 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfvImmediate(
GLenum target = static_cast<GLenum>(c.target);
GLenum pname = static_cast<GLenum>(c.pname);
const GLfloat* params = GetImmediateDataAs<const GLfloat*>(c);
+ if (!ValidateGLenumTextureBindTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumTextureParameter(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<TexParameterfvImmediate>(
+ immediate_data_size, 1, sizeof(GLfloat), 1)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateTexParameterfvImmediate(
- this, immediate_data_size, target, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureBindTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumTextureParameter(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<TexParameterfvImmediate>(
+ immediate_data_size, 1, sizeof(GLfloat), 1)) {
+ return parse_error::kParseOutOfBounds;
}
glTexParameterfv(target, pname, params);
return parse_error::kParseNoError;
@@ -1625,10 +1555,13 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexParameteri(
GLenum target = static_cast<GLenum>(c.target);
GLenum pname = static_cast<GLenum>(c.pname);
GLint param = static_cast<GLint>(c.param);
- parse_error::ParseError result =
- ValidateTexParameteri(this, immediate_data_size, target, pname, param);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureBindTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumTextureParameter(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
}
glTexParameteri(target, pname, param);
return parse_error::kParseNoError;
@@ -1640,10 +1573,16 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexParameteriv(
GLenum pname = static_cast<GLenum>(c.pname);
const GLint* params = GetSharedMemoryAs<const GLint*>(
c.params_shm_id, c.params_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateTexParameteriv(this, immediate_data_size, target, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureBindTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumTextureParameter(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glTexParameteriv(target, pname, params);
return parse_error::kParseNoError;
@@ -1654,12 +1593,36 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexParameterivImmediate(
GLenum target = static_cast<GLenum>(c.target);
GLenum pname = static_cast<GLenum>(c.pname);
const GLint* params = GetImmediateDataAs<const GLint*>(c);
+ if (!ValidateGLenumTextureBindTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumTextureParameter(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<TexParameterivImmediate>(
+ immediate_data_size, 1, sizeof(GLint), 1)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateTexParameterivImmediate(
- this, immediate_data_size, target, pname, params);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureBindTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumTextureParameter(pname)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (params == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<TexParameterivImmediate>(
+ immediate_data_size, 1, sizeof(GLint), 1)) {
+ return parse_error::kParseOutOfBounds;
}
glTexParameteriv(target, pname, params);
return parse_error::kParseNoError;
@@ -1681,12 +1644,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2D(
width, height, format, type, unpack_alignment_);
const void* pixels = GetSharedMemoryAs<const void*>(
pixels_shm_id, pixels_shm_offset, pixels_size);
- parse_error::ParseError result =
- ValidateTexSubImage2D(
- this, immediate_data_size, target, level, xoffset, yoffset, width,
- height, format, type, pixels);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumTextureFormat(format)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumPixelType(type)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (pixels == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glTexSubImage2D(
target, level, xoffset, yoffset, width, height, format, type, pixels);
@@ -1704,13 +1675,36 @@ parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2DImmediate(
GLenum format = static_cast<GLenum>(c.format);
GLenum type = static_cast<GLenum>(c.type);
const void* pixels = GetImmediateDataAs<const void*>(c);
+ if (!ValidateGLenumTextureTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumTextureFormat(format)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumPixelType(type)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (pixels == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateTexSubImage2DImmediate(
- this, immediate_data_size, target, level, xoffset, yoffset, width,
- height, format, type, pixels);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (!ValidateGLenumTextureTarget(target)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumTextureFormat(format)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (!ValidateGLenumPixelType(type)) {
+ SetGLError(GL_INVALID_VALUE);
+ return parse_error::kParseNoError;
+ }
+ if (pixels == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glTexSubImage2D(
target, level, xoffset, yoffset, width, height, format, type, pixels);
@@ -1721,11 +1715,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform1f(
uint32 immediate_data_size, const gles2::Uniform1f& c) {
GLint location = static_cast<GLint>(c.location);
GLfloat x = static_cast<GLfloat>(c.x);
- parse_error::ParseError result =
- ValidateUniform1f(this, immediate_data_size, location, x);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glUniform1f(location, x);
return parse_error::kParseNoError;
}
@@ -1736,10 +1725,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform1fv(
GLsizei count = static_cast<GLsizei>(c.count);
const GLfloat* v = GetSharedMemoryAs<const GLfloat*>(
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateUniform1fv(this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glUniform1fv(location, count, v);
return parse_error::kParseNoError;
@@ -1750,12 +1737,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform1fvImmediate(
GLint location = static_cast<GLint>(c.location);
GLsizei count = static_cast<GLsizei>(c.count);
const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c);
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform1fvImmediate>(
+ immediate_data_size, count, sizeof(GLfloat), 1)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateUniform1fvImmediate(
- this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform1fvImmediate>(
+ immediate_data_size, count, sizeof(GLfloat), 1)) {
+ return parse_error::kParseOutOfBounds;
}
glUniform1fv(location, count, v);
return parse_error::kParseNoError;
@@ -1765,11 +1760,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform1i(
uint32 immediate_data_size, const gles2::Uniform1i& c) {
GLint location = static_cast<GLint>(c.location);
GLint x = static_cast<GLint>(c.x);
- parse_error::ParseError result =
- ValidateUniform1i(this, immediate_data_size, location, x);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glUniform1i(location, x);
return parse_error::kParseNoError;
}
@@ -1780,10 +1770,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform1iv(
GLsizei count = static_cast<GLsizei>(c.count);
const GLint* v = GetSharedMemoryAs<const GLint*>(
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateUniform1iv(this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glUniform1iv(location, count, v);
return parse_error::kParseNoError;
@@ -1794,12 +1782,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform1ivImmediate(
GLint location = static_cast<GLint>(c.location);
GLsizei count = static_cast<GLsizei>(c.count);
const GLint* v = GetImmediateDataAs<const GLint*>(c);
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform1ivImmediate>(
+ immediate_data_size, count, sizeof(GLint), 1)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateUniform1ivImmediate(
- this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform1ivImmediate>(
+ immediate_data_size, count, sizeof(GLint), 1)) {
+ return parse_error::kParseOutOfBounds;
}
glUniform1iv(location, count, v);
return parse_error::kParseNoError;
@@ -1810,11 +1806,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform2f(
GLint location = static_cast<GLint>(c.location);
GLfloat x = static_cast<GLfloat>(c.x);
GLfloat y = static_cast<GLfloat>(c.y);
- parse_error::ParseError result =
- ValidateUniform2f(this, immediate_data_size, location, x, y);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glUniform2f(location, x, y);
return parse_error::kParseNoError;
}
@@ -1825,10 +1816,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform2fv(
GLsizei count = static_cast<GLsizei>(c.count);
const GLfloat* v = GetSharedMemoryAs<const GLfloat*>(
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateUniform2fv(this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glUniform2fv(location, count, v);
return parse_error::kParseNoError;
@@ -1839,12 +1828,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform2fvImmediate(
GLint location = static_cast<GLint>(c.location);
GLsizei count = static_cast<GLsizei>(c.count);
const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c);
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform2fvImmediate>(
+ immediate_data_size, count, sizeof(GLfloat), 2)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateUniform2fvImmediate(
- this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform2fvImmediate>(
+ immediate_data_size, count, sizeof(GLfloat), 2)) {
+ return parse_error::kParseOutOfBounds;
}
glUniform2fv(location, count, v);
return parse_error::kParseNoError;
@@ -1855,11 +1852,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform2i(
GLint location = static_cast<GLint>(c.location);
GLint x = static_cast<GLint>(c.x);
GLint y = static_cast<GLint>(c.y);
- parse_error::ParseError result =
- ValidateUniform2i(this, immediate_data_size, location, x, y);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glUniform2i(location, x, y);
return parse_error::kParseNoError;
}
@@ -1870,10 +1862,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform2iv(
GLsizei count = static_cast<GLsizei>(c.count);
const GLint* v = GetSharedMemoryAs<const GLint*>(
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateUniform2iv(this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glUniform2iv(location, count, v);
return parse_error::kParseNoError;
@@ -1884,12 +1874,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform2ivImmediate(
GLint location = static_cast<GLint>(c.location);
GLsizei count = static_cast<GLsizei>(c.count);
const GLint* v = GetImmediateDataAs<const GLint*>(c);
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform2ivImmediate>(
+ immediate_data_size, count, sizeof(GLint), 2)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateUniform2ivImmediate(
- this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform2ivImmediate>(
+ immediate_data_size, count, sizeof(GLint), 2)) {
+ return parse_error::kParseOutOfBounds;
}
glUniform2iv(location, count, v);
return parse_error::kParseNoError;
@@ -1901,11 +1899,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform3f(
GLfloat x = static_cast<GLfloat>(c.x);
GLfloat y = static_cast<GLfloat>(c.y);
GLfloat z = static_cast<GLfloat>(c.z);
- parse_error::ParseError result =
- ValidateUniform3f(this, immediate_data_size, location, x, y, z);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glUniform3f(location, x, y, z);
return parse_error::kParseNoError;
}
@@ -1916,10 +1909,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform3fv(
GLsizei count = static_cast<GLsizei>(c.count);
const GLfloat* v = GetSharedMemoryAs<const GLfloat*>(
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateUniform3fv(this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glUniform3fv(location, count, v);
return parse_error::kParseNoError;
@@ -1930,12 +1921,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform3fvImmediate(
GLint location = static_cast<GLint>(c.location);
GLsizei count = static_cast<GLsizei>(c.count);
const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c);
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform3fvImmediate>(
+ immediate_data_size, count, sizeof(GLfloat), 3)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateUniform3fvImmediate(
- this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform3fvImmediate>(
+ immediate_data_size, count, sizeof(GLfloat), 3)) {
+ return parse_error::kParseOutOfBounds;
}
glUniform3fv(location, count, v);
return parse_error::kParseNoError;
@@ -1947,11 +1946,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform3i(
GLint x = static_cast<GLint>(c.x);
GLint y = static_cast<GLint>(c.y);
GLint z = static_cast<GLint>(c.z);
- parse_error::ParseError result =
- ValidateUniform3i(this, immediate_data_size, location, x, y, z);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glUniform3i(location, x, y, z);
return parse_error::kParseNoError;
}
@@ -1962,10 +1956,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform3iv(
GLsizei count = static_cast<GLsizei>(c.count);
const GLint* v = GetSharedMemoryAs<const GLint*>(
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateUniform3iv(this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glUniform3iv(location, count, v);
return parse_error::kParseNoError;
@@ -1976,12 +1968,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform3ivImmediate(
GLint location = static_cast<GLint>(c.location);
GLsizei count = static_cast<GLsizei>(c.count);
const GLint* v = GetImmediateDataAs<const GLint*>(c);
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform3ivImmediate>(
+ immediate_data_size, count, sizeof(GLint), 3)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateUniform3ivImmediate(
- this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform3ivImmediate>(
+ immediate_data_size, count, sizeof(GLint), 3)) {
+ return parse_error::kParseOutOfBounds;
}
glUniform3iv(location, count, v);
return parse_error::kParseNoError;
@@ -1994,11 +1994,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform4f(
GLfloat y = static_cast<GLfloat>(c.y);
GLfloat z = static_cast<GLfloat>(c.z);
GLfloat w = static_cast<GLfloat>(c.w);
- parse_error::ParseError result =
- ValidateUniform4f(this, immediate_data_size, location, x, y, z, w);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glUniform4f(location, x, y, z, w);
return parse_error::kParseNoError;
}
@@ -2009,10 +2004,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform4fv(
GLsizei count = static_cast<GLsizei>(c.count);
const GLfloat* v = GetSharedMemoryAs<const GLfloat*>(
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateUniform4fv(this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glUniform4fv(location, count, v);
return parse_error::kParseNoError;
@@ -2023,12 +2016,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform4fvImmediate(
GLint location = static_cast<GLint>(c.location);
GLsizei count = static_cast<GLsizei>(c.count);
const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c);
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform4fvImmediate>(
+ immediate_data_size, count, sizeof(GLfloat), 4)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateUniform4fvImmediate(
- this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform4fvImmediate>(
+ immediate_data_size, count, sizeof(GLfloat), 4)) {
+ return parse_error::kParseOutOfBounds;
}
glUniform4fv(location, count, v);
return parse_error::kParseNoError;
@@ -2041,11 +2042,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform4i(
GLint y = static_cast<GLint>(c.y);
GLint z = static_cast<GLint>(c.z);
GLint w = static_cast<GLint>(c.w);
- parse_error::ParseError result =
- ValidateUniform4i(this, immediate_data_size, location, x, y, z, w);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glUniform4i(location, x, y, z, w);
return parse_error::kParseNoError;
}
@@ -2056,10 +2052,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform4iv(
GLsizei count = static_cast<GLsizei>(c.count);
const GLint* v = GetSharedMemoryAs<const GLint*>(
c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateUniform4iv(this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glUniform4iv(location, count, v);
return parse_error::kParseNoError;
@@ -2070,12 +2064,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniform4ivImmediate(
GLint location = static_cast<GLint>(c.location);
GLsizei count = static_cast<GLsizei>(c.count);
const GLint* v = GetImmediateDataAs<const GLint*>(c);
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform4ivImmediate>(
+ immediate_data_size, count, sizeof(GLint), 4)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateUniform4ivImmediate(
- this, immediate_data_size, location, count, v);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (v == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<Uniform4ivImmediate>(
+ immediate_data_size, count, sizeof(GLint), 4)) {
+ return parse_error::kParseOutOfBounds;
}
glUniform4iv(location, count, v);
return parse_error::kParseNoError;
@@ -2088,11 +2090,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fv(
GLboolean transpose = static_cast<GLboolean>(c.transpose);
const GLfloat* value = GetSharedMemoryAs<const GLfloat*>(
c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateUniformMatrix2fv(
- this, immediate_data_size, location, count, transpose, value);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (value == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glUniformMatrix2fv(location, count, transpose, value);
return parse_error::kParseNoError;
@@ -2104,12 +2103,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fvImmediate(
GLsizei count = static_cast<GLsizei>(c.count);
GLboolean transpose = static_cast<GLboolean>(c.transpose);
const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c);
+ if (value == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<UniformMatrix2fvImmediate>(
+ immediate_data_size, count, sizeof(GLfloat), 4)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateUniformMatrix2fvImmediate(
- this, immediate_data_size, location, count, transpose, value);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (value == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<UniformMatrix2fvImmediate>(
+ immediate_data_size, count, sizeof(GLfloat), 4)) {
+ return parse_error::kParseOutOfBounds;
}
glUniformMatrix2fv(location, count, transpose, value);
return parse_error::kParseNoError;
@@ -2122,11 +2129,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fv(
GLboolean transpose = static_cast<GLboolean>(c.transpose);
const GLfloat* value = GetSharedMemoryAs<const GLfloat*>(
c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateUniformMatrix3fv(
- this, immediate_data_size, location, count, transpose, value);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (value == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glUniformMatrix3fv(location, count, transpose, value);
return parse_error::kParseNoError;
@@ -2138,12 +2142,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fvImmediate(
GLsizei count = static_cast<GLsizei>(c.count);
GLboolean transpose = static_cast<GLboolean>(c.transpose);
const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c);
+ if (value == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<UniformMatrix3fvImmediate>(
+ immediate_data_size, count, sizeof(GLfloat), 9)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateUniformMatrix3fvImmediate(
- this, immediate_data_size, location, count, transpose, value);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (value == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<UniformMatrix3fvImmediate>(
+ immediate_data_size, count, sizeof(GLfloat), 9)) {
+ return parse_error::kParseOutOfBounds;
}
glUniformMatrix3fv(location, count, transpose, value);
return parse_error::kParseNoError;
@@ -2156,11 +2168,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fv(
GLboolean transpose = static_cast<GLboolean>(c.transpose);
const GLfloat* value = GetSharedMemoryAs<const GLfloat*>(
c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateUniformMatrix4fv(
- this, immediate_data_size, location, count, transpose, value);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (value == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glUniformMatrix4fv(location, count, transpose, value);
return parse_error::kParseNoError;
@@ -2172,12 +2181,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fvImmediate(
GLsizei count = static_cast<GLsizei>(c.count);
GLboolean transpose = static_cast<GLboolean>(c.transpose);
const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c);
+ if (value == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<UniformMatrix4fvImmediate>(
+ immediate_data_size, count, sizeof(GLfloat), 16)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateUniformMatrix4fvImmediate(
- this, immediate_data_size, location, count, transpose, value);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (value == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<UniformMatrix4fvImmediate>(
+ immediate_data_size, count, sizeof(GLfloat), 16)) {
+ return parse_error::kParseOutOfBounds;
}
glUniformMatrix4fv(location, count, transpose, value);
return parse_error::kParseNoError;
@@ -2190,11 +2207,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleUseProgram(
SetGLError(GL_INVALID_VALUE);
return parse_error::kParseNoError;
}
- parse_error::ParseError result =
- ValidateUseProgram(this, immediate_data_size, program);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glUseProgram(program);
return parse_error::kParseNoError;
}
@@ -2206,11 +2218,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleValidateProgram(
SetGLError(GL_INVALID_VALUE);
return parse_error::kParseNoError;
}
- parse_error::ParseError result =
- ValidateValidateProgram(this, immediate_data_size, program);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glValidateProgram(program);
return parse_error::kParseNoError;
}
@@ -2219,11 +2226,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1f(
uint32 immediate_data_size, const gles2::VertexAttrib1f& c) {
GLuint indx = static_cast<GLuint>(c.indx);
GLfloat x = static_cast<GLfloat>(c.x);
- parse_error::ParseError result =
- ValidateVertexAttrib1f(this, immediate_data_size, indx, x);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glVertexAttrib1f(indx, x);
return parse_error::kParseNoError;
}
@@ -2233,10 +2235,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fv(
GLuint indx = static_cast<GLuint>(c.indx);
const GLfloat* values = GetSharedMemoryAs<const GLfloat*>(
c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateVertexAttrib1fv(this, immediate_data_size, indx, values);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (values == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glVertexAttrib1fv(indx, values);
return parse_error::kParseNoError;
@@ -2246,12 +2246,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fvImmediate(
uint32 immediate_data_size, const gles2::VertexAttrib1fvImmediate& c) {
GLuint indx = static_cast<GLuint>(c.indx);
const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c);
+ if (values == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<VertexAttrib1fvImmediate>(
+ immediate_data_size, 1, sizeof(GLfloat), 1)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateVertexAttrib1fvImmediate(
- this, immediate_data_size, indx, values);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (values == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<VertexAttrib1fvImmediate>(
+ immediate_data_size, 1, sizeof(GLfloat), 1)) {
+ return parse_error::kParseOutOfBounds;
}
glVertexAttrib1fv(indx, values);
return parse_error::kParseNoError;
@@ -2262,11 +2270,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2f(
GLuint indx = static_cast<GLuint>(c.indx);
GLfloat x = static_cast<GLfloat>(c.x);
GLfloat y = static_cast<GLfloat>(c.y);
- parse_error::ParseError result =
- ValidateVertexAttrib2f(this, immediate_data_size, indx, x, y);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glVertexAttrib2f(indx, x, y);
return parse_error::kParseNoError;
}
@@ -2276,10 +2279,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fv(
GLuint indx = static_cast<GLuint>(c.indx);
const GLfloat* values = GetSharedMemoryAs<const GLfloat*>(
c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateVertexAttrib2fv(this, immediate_data_size, indx, values);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (values == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glVertexAttrib2fv(indx, values);
return parse_error::kParseNoError;
@@ -2289,12 +2290,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fvImmediate(
uint32 immediate_data_size, const gles2::VertexAttrib2fvImmediate& c) {
GLuint indx = static_cast<GLuint>(c.indx);
const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c);
+ if (values == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<VertexAttrib2fvImmediate>(
+ immediate_data_size, 1, sizeof(GLfloat), 2)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateVertexAttrib2fvImmediate(
- this, immediate_data_size, indx, values);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (values == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<VertexAttrib2fvImmediate>(
+ immediate_data_size, 1, sizeof(GLfloat), 2)) {
+ return parse_error::kParseOutOfBounds;
}
glVertexAttrib2fv(indx, values);
return parse_error::kParseNoError;
@@ -2306,11 +2315,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3f(
GLfloat x = static_cast<GLfloat>(c.x);
GLfloat y = static_cast<GLfloat>(c.y);
GLfloat z = static_cast<GLfloat>(c.z);
- parse_error::ParseError result =
- ValidateVertexAttrib3f(this, immediate_data_size, indx, x, y, z);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glVertexAttrib3f(indx, x, y, z);
return parse_error::kParseNoError;
}
@@ -2320,10 +2324,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fv(
GLuint indx = static_cast<GLuint>(c.indx);
const GLfloat* values = GetSharedMemoryAs<const GLfloat*>(
c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateVertexAttrib3fv(this, immediate_data_size, indx, values);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (values == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glVertexAttrib3fv(indx, values);
return parse_error::kParseNoError;
@@ -2333,12 +2335,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fvImmediate(
uint32 immediate_data_size, const gles2::VertexAttrib3fvImmediate& c) {
GLuint indx = static_cast<GLuint>(c.indx);
const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c);
+ if (values == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<VertexAttrib3fvImmediate>(
+ immediate_data_size, 1, sizeof(GLfloat), 3)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateVertexAttrib3fvImmediate(
- this, immediate_data_size, indx, values);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (values == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<VertexAttrib3fvImmediate>(
+ immediate_data_size, 1, sizeof(GLfloat), 3)) {
+ return parse_error::kParseOutOfBounds;
}
glVertexAttrib3fv(indx, values);
return parse_error::kParseNoError;
@@ -2351,11 +2361,6 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4f(
GLfloat y = static_cast<GLfloat>(c.y);
GLfloat z = static_cast<GLfloat>(c.z);
GLfloat w = static_cast<GLfloat>(c.w);
- parse_error::ParseError result =
- ValidateVertexAttrib4f(this, immediate_data_size, indx, x, y, z, w);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glVertexAttrib4f(indx, x, y, z, w);
return parse_error::kParseNoError;
}
@@ -2365,10 +2370,8 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fv(
GLuint indx = static_cast<GLuint>(c.indx);
const GLfloat* values = GetSharedMemoryAs<const GLfloat*>(
c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */);
- parse_error::ParseError result =
- ValidateVertexAttrib4fv(this, immediate_data_size, indx, values);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (values == NULL) {
+ return parse_error::kParseOutOfBounds;
}
glVertexAttrib4fv(indx, values);
return parse_error::kParseNoError;
@@ -2378,12 +2381,20 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fvImmediate(
uint32 immediate_data_size, const gles2::VertexAttrib4fvImmediate& c) {
GLuint indx = static_cast<GLuint>(c.indx);
const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c);
+ if (values == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<VertexAttrib4fvImmediate>(
+ immediate_data_size, 1, sizeof(GLfloat), 4)) {
+ return parse_error::kParseOutOfBounds;
+ }
// Immediate version.
- parse_error::ParseError result =
- ValidateVertexAttrib4fvImmediate(
- this, immediate_data_size, indx, values);
- if (result != parse_error::kParseNoError) {
- return result;
+ if (values == NULL) {
+ return parse_error::kParseOutOfBounds;
+ }
+ if (!CheckImmediateDataSize<VertexAttrib4fvImmediate>(
+ immediate_data_size, 1, sizeof(GLfloat), 4)) {
+ return parse_error::kParseOutOfBounds;
}
glVertexAttrib4fv(indx, values);
return parse_error::kParseNoError;
@@ -2395,22 +2406,12 @@ parse_error::ParseError GLES2DecoderImpl::HandleViewport(
GLint y = static_cast<GLint>(c.y);
GLsizei width = static_cast<GLsizei>(c.width);
GLsizei height = static_cast<GLsizei>(c.height);
- parse_error::ParseError result =
- ValidateViewport(this, immediate_data_size, x, y, width, height);
- if (result != parse_error::kParseNoError) {
- return result;
- }
glViewport(x, y, width, height);
return parse_error::kParseNoError;
}
parse_error::ParseError GLES2DecoderImpl::HandleSwapBuffers(
uint32 immediate_data_size, const gles2::SwapBuffers& c) {
- parse_error::ParseError result =
- ValidateSwapBuffers(this, immediate_data_size);
- if (result != parse_error::kParseNoError) {
- return result;
- }
DoSwapBuffers();
return parse_error::kParseNoError;
}
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_validate.h b/gpu/command_buffer/service/gles2_cmd_decoder_validate.h
deleted file mode 100644
index cfb5157..0000000
--- a/gpu/command_buffer/service/gles2_cmd_decoder_validate.h
+++ /dev/null
@@ -1,1262 +0,0 @@
-
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-
-namespace gpu {
-namespace gles2 {
-
-namespace {
-
-parse_error::ParseError ValidateActiveTexture(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum texture) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateAttachShader(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program,
- GLuint shader) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateBindAttribLocation(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program,
- GLuint index, const char* name) {
- if (name == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateBindAttribLocationImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program,
- GLuint index, const char* name) {
- if (name == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateBindBuffer(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLuint buffer) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateBindFramebuffer(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLuint framebuffer) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateBindRenderbuffer(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLuint renderbuffer) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateBindTexture(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLuint texture) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateBlendColor(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLclampf red,
- GLclampf green, GLclampf blue, GLclampf alpha) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateBlendEquation(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum mode) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateBlendEquationSeparate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum modeRGB,
- GLenum modeAlpha) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateBlendFunc(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum sfactor,
- GLenum dfactor) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateBlendFuncSeparate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum srcRGB,
- GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateBufferData(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLsizeiptr size, const void* data, GLenum usage) {
- if (data == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateBufferDataImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLsizeiptr size, const void* data, GLenum usage) {
- if (data == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateBufferSubData(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLintptr offset, GLsizeiptr size, const void* data) {
- if (data == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateBufferSubDataImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLintptr offset, GLsizeiptr size, const void* data) {
- if (data == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateCheckFramebufferStatus(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateClear(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLbitfield mask) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateClearColor(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLclampf red,
- GLclampf green, GLclampf blue, GLclampf alpha) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateClearDepthf(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLclampf depth) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateClearStencil(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint s) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateColorMask(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLboolean red,
- GLboolean green, GLboolean blue, GLboolean alpha) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateCompileShader(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateCompressedTexImage2D(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLint level, GLenum internalformat, GLsizei width, GLsizei height,
- GLint border, GLsizei imageSize, const void* data) {
- if (data == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateCompressedTexImage2DImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLint level, GLenum internalformat, GLsizei width, GLsizei height,
- GLint border, GLsizei imageSize, const void* data) {
- if (data == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateCompressedTexSubImage2D(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize, const void* data) {
- if (data == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateCompressedTexSubImage2DImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize, const void* data) {
- if (data == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateCopyTexImage2D(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width,
- GLsizei height, GLint border) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateCopyTexSubImage2D(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
- GLsizei height) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateCreateProgram(
- GLES2Decoder* decoder, uint32 immediate_data_size) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateCreateShader(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum type) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateCullFace(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum mode) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDeleteBuffers(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- const GLuint* buffers) {
- if (buffers == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDeleteBuffersImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- const GLuint* buffers) {
- if (buffers == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDeleteFramebuffers(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- const GLuint* framebuffers) {
- if (framebuffers == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDeleteFramebuffersImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- const GLuint* framebuffers) {
- if (framebuffers == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDeleteProgram(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDeleteRenderbuffers(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- const GLuint* renderbuffers) {
- if (renderbuffers == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDeleteRenderbuffersImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- const GLuint* renderbuffers) {
- if (renderbuffers == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDeleteShader(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDeleteTextures(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- const GLuint* textures) {
- if (textures == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDeleteTexturesImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- const GLuint* textures) {
- if (textures == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDepthFunc(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum func) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDepthMask(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLboolean flag) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDepthRangef(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLclampf zNear,
- GLclampf zFar) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDetachShader(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program,
- GLuint shader) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDisable(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum cap) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDisableVertexAttribArray(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint index) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDrawArrays(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum mode, GLint first,
- GLsizei count) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateDrawElements(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum mode,
- GLsizei count, GLenum type, const void* indices) {
- if (indices == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateEnable(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum cap) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateEnableVertexAttribArray(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint index) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateFinish(
- GLES2Decoder* decoder, uint32 immediate_data_size) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateFlush(
- GLES2Decoder* decoder, uint32 immediate_data_size) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateFramebufferRenderbuffer(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateFramebufferTexture2D(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateFrontFace(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum mode) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGenBuffers(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- GLuint* buffers) {
- if (buffers == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGenBuffersImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- GLuint* buffers) {
- if (buffers == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGenerateMipmap(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGenFramebuffers(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- GLuint* framebuffers) {
- if (framebuffers == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGenFramebuffersImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- GLuint* framebuffers) {
- if (framebuffers == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGenRenderbuffers(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- GLuint* renderbuffers) {
- if (renderbuffers == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGenRenderbuffersImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- GLuint* renderbuffers) {
- if (renderbuffers == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGenTextures(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- GLuint* textures) {
- if (textures == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGenTexturesImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLsizei n,
- GLuint* textures) {
- if (textures == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetActiveAttrib(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program,
- GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type,
- char* name) {
- if (length == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (size == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (type == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (name == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetActiveUniform(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program,
- GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type,
- char* name) {
- if (length == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (size == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (type == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (name == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetAttachedShaders(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program,
- GLsizei maxcount, GLsizei* count, GLuint* shaders) {
- if (count == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (shaders == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetAttribLocation(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program,
- const char* name) {
- if (name == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetAttribLocationImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program,
- const char* name) {
- if (name == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetBooleanv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum pname,
- GLboolean* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetBufferParameteriv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLenum pname, GLint* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetError(
- GLES2Decoder* decoder, uint32 immediate_data_size) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetFloatv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum pname,
- GLfloat* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetFramebufferAttachmentParameteriv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLenum attachment, GLenum pname, GLint* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetIntegerv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum pname,
- GLint* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetProgramiv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program,
- GLenum pname, GLint* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetProgramInfoLog(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program,
- GLsizei bufsize, GLsizei* length, char* infolog) {
- if (length == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (infolog == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetRenderbufferParameteriv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLenum pname, GLint* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetShaderiv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader,
- GLenum pname, GLint* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetShaderInfoLog(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader,
- GLsizei bufsize, GLsizei* length, char* infolog) {
- if (length == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (infolog == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetShaderPrecisionFormat(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum shadertype,
- GLenum precisiontype, GLint* range, GLint* precision) {
- if (range == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (precision == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetShaderSource(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader,
- GLsizei bufsize, GLsizei* length, char* source) {
- if (length == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (source == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetString(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum name) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetTexParameterfv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLenum pname, GLfloat* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetTexParameteriv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLenum pname, GLint* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetUniformfv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program,
- GLint location, GLfloat* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetUniformiv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program,
- GLint location, GLint* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetUniformLocation(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program,
- const char* name) {
- if (name == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetUniformLocationImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program,
- const char* name) {
- if (name == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetVertexAttribfv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint index,
- GLenum pname, GLfloat* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetVertexAttribiv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint index,
- GLenum pname, GLint* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateGetVertexAttribPointerv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint index,
- GLenum pname, void** pointer) {
- if (pointer == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateHint(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLenum mode) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateIsBuffer(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint buffer) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateIsEnabled(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum cap) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateIsFramebuffer(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint framebuffer) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateIsProgram(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateIsRenderbuffer(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint renderbuffer) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateIsShader(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateIsTexture(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint texture) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateLineWidth(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLfloat width) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateLinkProgram(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidatePixelStorei(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum pname,
- GLint param) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidatePolygonOffset(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLfloat factor,
- GLfloat units) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateReadPixels(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint x, GLint y,
- GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) {
- if (pixels == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateRenderbufferStorage(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLenum internalformat, GLsizei width, GLsizei height) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateSampleCoverage(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLclampf value,
- GLboolean invert) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateScissor(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint x, GLint y,
- GLsizei width, GLsizei height) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateShaderSource(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader,
- GLsizei count, const char** string, const GLint* length) {
- if (string == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (length == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateShaderSourceImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint shader,
- GLsizei count, const char** string, const GLint* length) {
- if (string == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (length == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateStencilFunc(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum func, GLint ref,
- GLuint mask) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateStencilFuncSeparate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum face, GLenum func,
- GLint ref, GLuint mask) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateStencilMask(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint mask) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateStencilMaskSeparate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum face,
- GLuint mask) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateStencilOp(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum fail,
- GLenum zfail, GLenum zpass) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateStencilOpSeparate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum face, GLenum fail,
- GLenum zfail, GLenum zpass) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateTexImage2D(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLint level, GLint internalformat, GLsizei width, GLsizei height,
- GLint border, GLenum format, GLenum type, const void* pixels) {
- if (pixels == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateTexImage2DImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLint level, GLint internalformat, GLsizei width, GLsizei height,
- GLint border, GLenum format, GLenum type, const void* pixels) {
- if (pixels == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateTexParameterf(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLenum pname, GLfloat param) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateTexParameterfv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLenum pname, const GLfloat* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateTexParameterfvImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLenum pname, const GLfloat* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<TexParameterfvImmediate>(
- immediate_data_size, 1, sizeof(GLfloat), 1)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateTexParameteri(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLenum pname, GLint param) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateTexParameteriv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLenum pname, const GLint* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateTexParameterivImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLenum pname, const GLint* params) {
- if (params == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<TexParameterivImmediate>(
- immediate_data_size, 1, sizeof(GLint), 1)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateTexSubImage2D(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLenum type, const void* pixels) {
- if (pixels == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateTexSubImage2DImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLenum target,
- GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLenum type, const void* pixels) {
- if (pixels == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform1f(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLfloat x) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform1fv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLfloat* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform1fvImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLfloat* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<Uniform1fvImmediate>(
- immediate_data_size, count, sizeof(GLfloat), 1)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform1i(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLint x) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform1iv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLint* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform1ivImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLint* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<Uniform1ivImmediate>(
- immediate_data_size, count, sizeof(GLint), 1)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform2f(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLfloat x, GLfloat y) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform2fv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLfloat* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform2fvImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLfloat* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<Uniform2fvImmediate>(
- immediate_data_size, count, sizeof(GLfloat), 2)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform2i(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLint x,
- GLint y) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform2iv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLint* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform2ivImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLint* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<Uniform2ivImmediate>(
- immediate_data_size, count, sizeof(GLint), 2)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform3f(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLfloat x, GLfloat y, GLfloat z) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform3fv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLfloat* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform3fvImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLfloat* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<Uniform3fvImmediate>(
- immediate_data_size, count, sizeof(GLfloat), 3)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform3i(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLint x,
- GLint y, GLint z) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform3iv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLint* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform3ivImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLint* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<Uniform3ivImmediate>(
- immediate_data_size, count, sizeof(GLint), 3)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform4f(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform4fv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLfloat* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform4fvImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLfloat* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<Uniform4fvImmediate>(
- immediate_data_size, count, sizeof(GLfloat), 4)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform4i(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location, GLint x,
- GLint y, GLint z, GLint w) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform4iv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLint* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniform4ivImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, const GLint* v) {
- if (v == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<Uniform4ivImmediate>(
- immediate_data_size, count, sizeof(GLint), 4)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniformMatrix2fv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, GLboolean transpose, const GLfloat* value) {
- if (value == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniformMatrix2fvImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, GLboolean transpose, const GLfloat* value) {
- if (value == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<UniformMatrix2fvImmediate>(
- immediate_data_size, count, sizeof(GLfloat), 4)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniformMatrix3fv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, GLboolean transpose, const GLfloat* value) {
- if (value == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniformMatrix3fvImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, GLboolean transpose, const GLfloat* value) {
- if (value == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<UniformMatrix3fvImmediate>(
- immediate_data_size, count, sizeof(GLfloat), 9)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniformMatrix4fv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, GLboolean transpose, const GLfloat* value) {
- if (value == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUniformMatrix4fvImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint location,
- GLsizei count, GLboolean transpose, const GLfloat* value) {
- if (value == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<UniformMatrix4fvImmediate>(
- immediate_data_size, count, sizeof(GLfloat), 16)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateUseProgram(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateValidateProgram(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint program) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateVertexAttrib1f(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx,
- GLfloat x) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateVertexAttrib1fv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx,
- const GLfloat* values) {
- if (values == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateVertexAttrib1fvImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx,
- const GLfloat* values) {
- if (values == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<VertexAttrib1fvImmediate>(
- immediate_data_size, 1, sizeof(GLfloat), 1)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateVertexAttrib2f(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, GLfloat x,
- GLfloat y) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateVertexAttrib2fv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx,
- const GLfloat* values) {
- if (values == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateVertexAttrib2fvImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx,
- const GLfloat* values) {
- if (values == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<VertexAttrib2fvImmediate>(
- immediate_data_size, 1, sizeof(GLfloat), 2)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateVertexAttrib3f(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, GLfloat x,
- GLfloat y, GLfloat z) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateVertexAttrib3fv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx,
- const GLfloat* values) {
- if (values == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateVertexAttrib3fvImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx,
- const GLfloat* values) {
- if (values == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<VertexAttrib3fvImmediate>(
- immediate_data_size, 1, sizeof(GLfloat), 3)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateVertexAttrib4f(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, GLfloat x,
- GLfloat y, GLfloat z, GLfloat w) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateVertexAttrib4fv(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx,
- const GLfloat* values) {
- if (values == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateVertexAttrib4fvImmediate(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx,
- const GLfloat* values) {
- if (values == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- if (!CheckImmediateDataSize<VertexAttrib4fvImmediate>(
- immediate_data_size, 1, sizeof(GLfloat), 4)) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateVertexAttribPointer(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLuint indx, GLint size,
- GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) {
- if (ptr == NULL) {
- return parse_error::kParseOutOfBounds;
- }
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateViewport(
- GLES2Decoder* decoder, uint32 immediate_data_size, GLint x, GLint y,
- GLsizei width, GLsizei height) {
- return parse_error::kParseNoError;
-}
-parse_error::ParseError ValidateSwapBuffers(
- GLES2Decoder* decoder, uint32 immediate_data_size) {
- return parse_error::kParseNoError;
-}
-} // anonymous namespace
-} // namespace gles2
-} // namespace gpu
-
diff --git a/gpu/command_buffer/service/gles2_cmd_validation.cc b/gpu/command_buffer/service/gles2_cmd_validation.cc
new file mode 100644
index 0000000..67d7fdc
--- /dev/null
+++ b/gpu/command_buffer/service/gles2_cmd_validation.cc
@@ -0,0 +1,22 @@
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Contains various validation functions for the GLES2 service.
+
+// NOTE: We explicitly do NOT include gles2_cmd_validation.h because the
+// gl2.h included in here must NOT be the native one. This is because
+// some of the GLenum definitions exist only in GLES2 and not in Desktop
+// GL.
+#include <GLES2/gl2types.h>
+
+namespace gpu {
+namespace gles2 {
+
+#include "gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h"
+
+} // namespace gles2
+} // namespace gpu
+
+
+
diff --git a/gpu/command_buffer/service/gles2_cmd_validation.h b/gpu/command_buffer/service/gles2_cmd_validation.h
new file mode 100644
index 0000000..aa44e9c
--- /dev/null
+++ b/gpu/command_buffer/service/gles2_cmd_validation.h
@@ -0,0 +1,21 @@
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Contains various validation functions for the GLES2 service.
+
+#ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_VALIDATION_H_
+#define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_VALIDATION_H_
+
+#include "gpu/command_buffer/common/gles2_cmd_format.h"
+
+namespace gpu {
+namespace gles2 {
+
+#include "gpu/command_buffer/service/gles2_cmd_validation_autogen.h"
+
+} // namespace gles2
+} // namespace gpu
+
+#endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_VALIDATION_H_
+
diff --git a/gpu/command_buffer/service/gles2_cmd_validation_autogen.h b/gpu/command_buffer/service/gles2_cmd_validation_autogen.h
new file mode 100644
index 0000000..ea7bdef
--- /dev/null
+++ b/gpu/command_buffer/service/gles2_cmd_validation_autogen.h
@@ -0,0 +1,42 @@
+// This file is auto-generated. DO NOT EDIT!
+
+
+bool ValidateGLenumBufferParameter(GLenum value);
+bool ValidateGLenumProgramParameter(GLenum value);
+bool ValidateGLenumFaceMode(GLenum value);
+bool ValidateGLenumShaderParameter(GLenum value);
+bool ValidateGLenumIndexType(GLenum value);
+bool ValidateGLenumVertexAttribute(GLenum value);
+bool ValidateGLenumPixelType(GLenum value);
+bool ValidateGLenumEquation(GLenum value);
+bool ValidateGLenumRenderBufferTarget(GLenum value);
+bool ValidateGLenumShaderPercision(GLenum value);
+bool ValidateGLenumReadPixelFormat(GLenum value);
+bool ValidateGLenumTextureBindTarget(GLenum value);
+bool ValidateGLenumCmpFunction(GLenum value);
+bool ValidateGLenumCapability(GLenum value);
+bool ValidateGLenumDstBlendFactor(GLenum value);
+bool ValidateGLenumAttachment(GLenum value);
+bool ValidateGLenumRenderBufferFormat(GLenum value);
+bool ValidateGLenumDrawMode(GLenum value);
+bool ValidateGLenumBufferUsage(GLenum value);
+bool ValidateGLenumHintTarget(GLenum value);
+bool ValidateGLenumHintMode(GLenum value);
+bool ValidateGLenumTextureFormat(GLenum value);
+bool ValidateGLenumStringType(GLenum value);
+bool ValidateGLenumFrameBufferTarget(GLenum value);
+bool ValidateGLenumPixelStoreAlignment(GLenum value);
+bool ValidateGLenumTextureParameter(GLenum value);
+bool ValidateGLenumTextureTarget(GLenum value);
+bool ValidateGLenumShaderType(GLenum value);
+bool ValidateGLenumFaceType(GLenum value);
+bool ValidateGLenumSrcBlendFactor(GLenum value);
+bool ValidateGLenumVertexAttribType(GLenum value);
+bool ValidateGLenumStencilOp(GLenum value);
+bool ValidateGLenumVertexAttribSize(GLenum value);
+bool ValidateGLenumBufferTarget(GLenum value);
+bool ValidateGLenumPixelStore(GLenum value);
+bool ValidateGLenumRenderBufferParameter(GLenum value);
+bool ValidateGLenumFrameBufferParameter(GLenum value);
+bool ValidateGLenumVertexPointer(GLenum value);
+
diff --git a/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h b/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h
new file mode 100644
index 0000000..ffaaba3
--- /dev/null
+++ b/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h
@@ -0,0 +1,487 @@
+// This file is auto-generated. DO NOT EDIT!
+
+
+bool ValidateGLenumBufferParameter(GLenum value) {
+ switch (value) {
+ case GL_BUFFER_SIZE:
+ case GL_BUFFER_USAGE:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumProgramParameter(GLenum value) {
+ switch (value) {
+ case GL_DELETE_STATUS:
+ case GL_LINK_STATUS:
+ case GL_VALIDATE_STATUS:
+ case GL_INFO_LOG_LENGTH:
+ case GL_ATTACHED_SHADERS:
+ case GL_ACTIVE_ATTRIBUTES:
+ case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
+ case GL_ACTIVE_UNIFORMS:
+ case GL_ACTIVE_UNIFORM_MAX_LENGTH:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumFaceMode(GLenum value) {
+ switch (value) {
+ case GL_CW:
+ case GL_CCW:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumShaderParameter(GLenum value) {
+ switch (value) {
+ case GL_SHADER_TYPE:
+ case GL_DELETE_STATUS:
+ case GL_COMPILE_STATUS:
+ case GL_INFO_LOG_LENGTH:
+ case GL_SHADER_SOURCE_LENGTH:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumIndexType(GLenum value) {
+ switch (value) {
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_SHORT:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumVertexAttribute(GLenum value) {
+ switch (value) {
+ case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+ case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
+ case GL_VERTEX_ATTRIB_ARRAY_SIZE:
+ case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
+ case GL_VERTEX_ATTRIB_ARRAY_TYPE:
+ case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
+ case GL_CURRENT_VERTEX_ATTRIB:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumPixelType(GLenum value) {
+ switch (value) {
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumEquation(GLenum value) {
+ switch (value) {
+ case GL_FUNC_ADD:
+ case GL_FUNC_SUBTRACT:
+ case GL_FUNC_REVERSE_SUBTRACT:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumRenderBufferTarget(GLenum value) {
+ switch (value) {
+ case GL_RENDERBUFFER:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumShaderPercision(GLenum value) {
+ switch (value) {
+ case GL_LOW_FLOAT:
+ case GL_MEDIUM_FLOAT:
+ case GL_HIGH_FLOAT:
+ case GL_LOW_INT:
+ case GL_MEDIUM_INT:
+ case GL_HIGH_INT:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumReadPixelFormat(GLenum value) {
+ switch (value) {
+ case GL_ALPHA:
+ case GL_RGB:
+ case GL_RGBA:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumTextureBindTarget(GLenum value) {
+ switch (value) {
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_CUBE_MAP:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumCmpFunction(GLenum value) {
+ switch (value) {
+ case GL_NEVER:
+ case GL_LESS:
+ case GL_EQUAL:
+ case GL_LEQUAL:
+ case GL_GREATER:
+ case GL_NOTEQUAL:
+ case GL_GEQUAL:
+ case GL_ALWAYS:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumCapability(GLenum value) {
+ switch (value) {
+ case GL_BLEND:
+ case GL_CULL_FACE:
+ case GL_DEPTH_TEST:
+ case GL_DITHER:
+ case GL_POLYGON_OFFSET_FILL:
+ case GL_SAMPLE_ALPHA_TO_COVERAGE:
+ case GL_SAMPLE_COVERAGE:
+ case GL_SCISSOR_TEST:
+ case GL_STENCIL_TEST:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumDstBlendFactor(GLenum value) {
+ switch (value) {
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumAttachment(GLenum value) {
+ switch (value) {
+ case GL_COLOR_ATTACHMENT0:
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumRenderBufferFormat(GLenum value) {
+ switch (value) {
+ case GL_RGBA4:
+ case GL_RGB565:
+ case GL_RGB5_A1:
+ case GL_DEPTH_COMPONENT16:
+ case GL_STENCIL_INDEX8:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumDrawMode(GLenum value) {
+ switch (value) {
+ case GL_POINTS:
+ case GL_LINE_STRIP:
+ case GL_LINE_LOOP:
+ case GL_LINES:
+ case GL_TRIANGLE_STRIP:
+ case GL_TRIANGLE_FAN:
+ case GL_TRIANGLES:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumBufferUsage(GLenum value) {
+ switch (value) {
+ case GL_STREAM_DRAW:
+ case GL_STATIC_DRAW:
+ case GL_DYNAMIC_DRAW:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumHintTarget(GLenum value) {
+ switch (value) {
+ case GL_GENERATE_MIPMAP_HINT:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumHintMode(GLenum value) {
+ switch (value) {
+ case GL_FASTEST:
+ case GL_NICEST:
+ case GL_DONT_CARE:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumTextureFormat(GLenum value) {
+ switch (value) {
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ case GL_RGB:
+ case GL_RGBA:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumStringType(GLenum value) {
+ switch (value) {
+ case GL_VENDOR:
+ case GL_RENDERER:
+ case GL_VERSION:
+ case GL_SHADING_LANGUAGE_VERSION:
+ case GL_EXTENSIONS:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumFrameBufferTarget(GLenum value) {
+ switch (value) {
+ case GL_FRAMEBUFFER:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumPixelStoreAlignment(GLenum value) {
+ switch (value) {
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumTextureParameter(GLenum value) {
+ switch (value) {
+ case GL_TEXTURE_MAG_FILTER:
+ case GL_TEXTURE_MIN_FILTER:
+ case GL_TEXTURE_WRAP_S:
+ case GL_TEXTURE_WRAP_T:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumTextureTarget(GLenum value) {
+ switch (value) {
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumShaderType(GLenum value) {
+ switch (value) {
+ case GL_VERTEX_SHADER:
+ case GL_FRAGMENT_SHADER:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumFaceType(GLenum value) {
+ switch (value) {
+ case GL_FRONT:
+ case GL_BACK:
+ case GL_FRONT_AND_BACK:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumSrcBlendFactor(GLenum value) {
+ switch (value) {
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ case GL_SRC_ALPHA_SATURATE:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumVertexAttribType(GLenum value) {
+ switch (value) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_FLOAT:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumStencilOp(GLenum value) {
+ switch (value) {
+ case GL_KEEP:
+ case GL_ZERO:
+ case GL_REPLACE:
+ case GL_INCR:
+ case GL_INCR_WRAP:
+ case GL_DECR:
+ case GL_DECR_WRAP:
+ case GL_INVERT:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumVertexAttribSize(GLenum value) {
+ switch (value) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumBufferTarget(GLenum value) {
+ switch (value) {
+ case GL_ARRAY_BUFFER:
+ case GL_ELEMENT_ARRAY_BUFFER:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumPixelStore(GLenum value) {
+ switch (value) {
+ case GL_PACK_ALIGNMENT:
+ case GL_UNPACK_ALIGNMENT:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumRenderBufferParameter(GLenum value) {
+ switch (value) {
+ case GL_RENDERBUFFER_WIDTH:
+ case GL_RENDERBUFFER_HEIGHT:
+ case GL_RENDERBUFFER_INTERNAL_FORMAT:
+ case GL_RENDERBUFFER_RED_SIZE:
+ case GL_RENDERBUFFER_GREEN_SIZE:
+ case GL_RENDERBUFFER_BLUE_SIZE:
+ case GL_RENDERBUFFER_ALPHA_SIZE:
+ case GL_RENDERBUFFER_DEPTH_SIZE:
+ case GL_RENDERBUFFER_STENCIL_SIZE:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumFrameBufferParameter(GLenum value) {
+ switch (value) {
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateGLenumVertexPointer(GLenum value) {
+ switch (value) {
+ case GL_VERTEX_ATTRIB_ARRAY_POINTER:
+ return true;
+ default:
+ return false;
+ }
+}
+