| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """code generator for GL command buffers.""" | 7 """code generator for GL command buffers.""" |
| 8 | 8 |
| 9 import os | 9 import os |
| 10 import os.path | 10 import os.path |
| 11 import sys | 11 import sys |
| 12 import re | 12 import re |
| 13 from optparse import OptionParser | 13 from optparse import OptionParser |
| 14 | 14 |
| 15 _SIZE_OF_UINT32 = 4 | 15 _SIZE_OF_UINT32 = 4 |
| 16 _SIZE_OF_COMMAND_HEADER = 4 | 16 _SIZE_OF_COMMAND_HEADER = 4 |
| 17 _FIRST_SPECIFIC_COMMAND_ID = 256 | 17 _FIRST_SPECIFIC_COMMAND_ID = 256 |
| 18 | 18 |
| 19 _LICENSE = """ | 19 _LICENSE = """ |
| 20 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 20 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 21 // Use of this source code is governed by a BSD-style license that can be | 21 // Use of this source code is governed by a BSD-style license that can be |
| 22 // found in the LICENSE file. | 22 // found in the LICENSE file. |
| 23 | 23 |
| 24 """ | 24 """ |
| 25 | 25 |
| 26 # This string is copied directly out of the gl2.h file from GLES2.0 | 26 # This string is copied directly out of the gl2.h file from GLES2.0 |
| 27 # the reasons it is copied out instead of parsed directly are | |
| 28 # | |
| 29 # 1) Because order is important. The command IDs need to stay constant forever | |
| 30 # so if you add a new command it needs to be added to the bottom of the list. | |
| 31 # | |
| 32 # 2) So we can add more commands easily that are unrelated to GLES2.0 but still | |
| 33 # needed for GLES2.0 command buffers. | |
| 34 # | 27 # |
| 35 # Edits: | 28 # Edits: |
| 36 # | 29 # |
| 37 # *) Any argument that is a resourceID has been changed to GLresourceID. | 30 # *) Any argument that is a resourceID has been changed to GLresourceID. |
| 38 # (not pointer arguments) | 31 # (not pointer arguments) |
| 39 # | 32 # |
| 33 # *) All GLenums have been changed to GLenumTypeOfEnum |
| 34 # |
| 40 _GL_FUNCTIONS = """ | 35 _GL_FUNCTIONS = """ |
| 41 GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); | 36 GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); |
| 42 GL_APICALL void GL_APIENTRY glAttachShader (GLResourceId program, GLReso
urceId shader); | 37 GL_APICALL void GL_APIENTRY glAttachShader (GLResourceId program, GLReso
urceId shader); |
| 43 GL_APICALL void GL_APIENTRY glBindAttribLocation (GLResourceId program,
GLuint index, const char* name); | 38 GL_APICALL void GL_APIENTRY glBindAttribLocation (GLResourceId program,
GLuint index, const char* name); |
| 44 GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLResourceId bu
ffer); | 39 GL_APICALL void GL_APIENTRY glBindBuffer (GLenumBufferTarget target, GLR
esourceId buffer); |
| 45 GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLResource
Id framebuffer); | 40 GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenumFrameBufferTarget t
arget, GLResourceId framebuffer); |
| 46 GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLResourc
eId renderbuffer); | 41 GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenumRenderBufferTarget
target, GLResourceId renderbuffer); |
| 47 GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLResourceId t
exture); | 42 GL_APICALL void GL_APIENTRY glBindTexture (GLenumTextureBindTarget targe
t, GLResourceId texture); |
| 48 GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green,
GLclampf blue, GLclampf alpha); | 43 GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green,
GLclampf blue, GLclampf alpha); |
| 49 GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode ); | 44 GL_APICALL void GL_APIENTRY glBlendEquation ( GLenumEquation mode ); |
| 50 GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLe
num modeAlpha); | 45 GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenumEquation mode
RGB, GLenumEquation modeAlpha); |
| 51 GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor)
; | 46 GL_APICALL void GL_APIENTRY glBlendFunc (GLenumSrcBlendFactor sfactor, G
LenumDstBlendFactor dfactor); |
| 52 GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum d
stRGB, GLenum srcAlpha, GLenum dstAlpha); | 47 GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenumSrcBlendFactor sr
cRGB, GLenumDstBlendFactor dstRGB, GLenumSrcBlendFactor srcAlpha, GLenumDstBlend
Factor dstAlpha); |
| 53 GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size
, const void* data, GLenum usage); | 48 GL_APICALL void GL_APIENTRY glBufferData (GLenumBufferTarget target, GLs
izeiptr size, const void* data, GLenumBufferUsage usage); |
| 54 GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr off
set, GLsizeiptr size, const void* data); | 49 GL_APICALL void GL_APIENTRY glBufferSubData (GLenumBufferTarget target,
GLintptr offset, GLsizeiptr size, const void* data); |
| 55 GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); | 50 GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenumFrameBufferT
arget target); |
| 56 GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); | 51 GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); |
| 57 GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green,
GLclampf blue, GLclampf alpha); | 52 GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green,
GLclampf blue, GLclampf alpha); |
| 58 GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth); | 53 GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth); |
| 59 GL_APICALL void GL_APIENTRY glClearStencil (GLint s); | 54 GL_APICALL void GL_APIENTRY glClearStencil (GLint s); |
| 60 GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green,
GLboolean blue, GLboolean alpha); | 55 GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green,
GLboolean blue, GLboolean alpha); |
| 61 GL_APICALL void GL_APIENTRY glCompileShader (GLResourceId shader); | 56 GL_APICALL void GL_APIENTRY glCompileShader (GLResourceId shader); |
| 62 GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint
level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsi
zei imageSize, const void* data); | 57 GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenumTextureTarget
target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint
border, GLsizei imageSize, const void* data); |
| 63 GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GL
int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum f
ormat, GLsizei imageSize, const void* data); | 58 GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenumTextureTarg
et target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei hei
ght, GLenum format, GLsizei imageSize, const void* data); |
| 64 GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level
, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint
border); | 59 GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenumTextureTarget target
, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei h
eight, GLint border); |
| 65 GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint le
vel, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei heig
ht); | 60 GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenumTextureTarget tar
get, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
GLsizei height); |
| 66 GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); | 61 GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); |
| 67 GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); | 62 GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenumShaderType type); |
| 68 GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); | 63 GL_APICALL void GL_APIENTRY glCullFace (GLenumFaceType mode); |
| 69 GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* bu
ffers); | 64 GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* bu
ffers); |
| 70 GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuin
t* framebuffers); | 65 GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuin
t* framebuffers); |
| 71 GL_APICALL void GL_APIENTRY glDeleteProgram (GLResourceId program); | 66 GL_APICALL void GL_APIENTRY glDeleteProgram (GLResourceId program); |
| 72 GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLui
nt* renderbuffers); | 67 GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLui
nt* renderbuffers); |
| 73 GL_APICALL void GL_APIENTRY glDeleteShader (GLResourceId shader); | 68 GL_APICALL void GL_APIENTRY glDeleteShader (GLResourceId shader); |
| 74 GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* t
extures); | 69 GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* t
extures); |
| 75 GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); | 70 GL_APICALL void GL_APIENTRY glDepthFunc (GLenumCmpFunction func); |
| 76 GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); | 71 GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); |
| 77 GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar
); | 72 GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar
); |
| 78 GL_APICALL void GL_APIENTRY glDetachShader (GLResourceId program, GLReso
urceId shader); | 73 GL_APICALL void GL_APIENTRY glDetachShader (GLResourceId program, GLReso
urceId shader); |
| 79 GL_APICALL void GL_APIENTRY glDisable (GLenum cap); | 74 GL_APICALL void GL_APIENTRY glDisable (GLenumCapability cap); |
| 80 GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); | 75 GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); |
| 81 GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsi
zei count); | 76 GL_APICALL void GL_APIENTRY glDrawArrays (GLenumDrawMode mode, GLint fir
st, GLsizei count); |
| 82 GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count,
GLenum type, const void* indices); | 77 GL_APICALL void GL_APIENTRY glDrawElements (GLenumDrawMode mode, GLsizei
count, GLenumIndexType type, const void* indices); |
| 83 GL_APICALL void GL_APIENTRY glEnable (GLenum cap); | 78 GL_APICALL void GL_APIENTRY glEnable (GLenumCapability cap); |
| 84 GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); | 79 GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); |
| 85 GL_APICALL void GL_APIENTRY glFinish (void); | 80 GL_APICALL void GL_APIENTRY glFinish (void); |
| 86 GL_APICALL void GL_APIENTRY glFlush (void); | 81 GL_APICALL void GL_APIENTRY glFlush (void); |
| 87 GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GL
enum attachment, GLenum renderbuffertarget, GLResourceId renderbuffer); | 82 GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenumFrameBuffer
Target target, GLenumAttachment attachment, GLenumRenderBufferTarget renderbuffe
rtarget, GLResourceId renderbuffer); |
| 88 GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenu
m attachment, GLenum textarget, GLResourceId texture, GLint level); | 83 GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenumFrameBufferTar
get target, GLenumAttachment attachment, GLenumTextureTarget textarget, GLResour
ceId texture, GLint level); |
| 89 GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); | 84 GL_APICALL void GL_APIENTRY glFrontFace (GLenumFaceMode mode); |
| 90 GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); | 85 GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); |
| 91 GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); | 86 GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenumTextureBindTarget ta
rget); |
| 92 GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* frameb
uffers); | 87 GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* frameb
uffers); |
| 93 GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* rende
rbuffers); | 88 GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* rende
rbuffers); |
| 94 GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); | 89 GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); |
| 95 GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLResourceId program, GLu
int index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* na
me); | 90 GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLResourceId program, GLu
int index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* na
me); |
| 96 GL_APICALL void GL_APIENTRY glGetActiveUniform (GLResourceId program, GL
uint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* n
ame); | 91 GL_APICALL void GL_APIENTRY glGetActiveUniform (GLResourceId program, GL
uint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* n
ame); |
| 97 GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLResourceId program,
GLsizei maxcount, GLsizei* count, GLuint* shaders); | 92 GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLResourceId program,
GLsizei maxcount, GLsizei* count, GLuint* shaders); |
| 98 GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLResourceId program, c
onst char* name); | 93 GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLResourceId program, c
onst char* name); |
| 99 GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* para
ms); | 94 GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* para
ms); |
| 100 GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenu
m pname, GLint* params); | 95 GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenumBufferTarget t
arget, GLenumBufferParameter pname, GLint* params); |
| 101 GL_APICALL GLenum GL_APIENTRY glGetError (void); | 96 GL_APICALL GLenum GL_APIENTRY glGetError (void); |
| 102 GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); | 97 GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); |
| 103 GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenu
m target, GLenum attachment, GLenum pname, GLint* params); | 98 GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenu
mFrameBufferTarget target, GLenumAttachment attachment, GLenumFrameBufferParamet
er pname, GLint* params); |
| 104 GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); | 99 GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); |
| 105 GL_APICALL void GL_APIENTRY glGetProgramiv (GLResourceId program, GLenum
pname, GLint* params); | 100 GL_APICALL void GL_APIENTRY glGetProgramiv (GLResourceId program, GLenum
ProgramParameter pname, GLint* params); |
| 106 GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLResourceId program, G
Lsizei bufsize, GLsizei* length, char* infolog); | 101 GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLResourceId program, G
Lsizei bufsize, GLsizei* length, char* infolog); |
| 107 GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target,
GLenum pname, GLint* params); | 102 GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenumRenderBu
fferTarget target, GLenumRenderBufferParameter pname, GLint* params); |
| 108 GL_APICALL void GL_APIENTRY glGetShaderiv (GLResourceId shader, GLenum p
name, GLint* params); | 103 GL_APICALL void GL_APIENTRY glGetShaderiv (GLResourceId shader, GLenumSh
aderParameter pname, GLint* params); |
| 109 GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLResourceId shader, GLs
izei bufsize, GLsizei* length, char* infolog); | 104 GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLResourceId shader, GLs
izei bufsize, GLsizei* length, char* infolog); |
| 110 GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertyp
e, GLenum precisiontype, GLint* range, GLint* precision); | 105 GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenumShaderType
shadertype, GLenumShaderPercision precisiontype, GLint* range, GLint* precision
); |
| 111 GL_APICALL void GL_APIENTRY glGetShaderSource (GLResourceId shader, GLsi
zei bufsize, GLsizei* length, char* source); | 106 GL_APICALL void GL_APIENTRY glGetShaderSource (GLResourceId shader, GLsi
zei bufsize, GLsizei* length, char* source); |
| 112 GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name); | 107 GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenumStringType name); |
| 113 GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum p
name, GLfloat* params); | 108 GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenumTextureTarget tar
get, GLenumTextureParameter pname, GLfloat* params); |
| 114 GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum p
name, GLint* params); | 109 GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenumTextureTarget tar
get, GLenumTextureParameter pname, GLint* params); |
| 115 GL_APICALL void GL_APIENTRY glGetUniformfv (GLResourceId program, GLint
location, GLfloat* params); | 110 GL_APICALL void GL_APIENTRY glGetUniformfv (GLResourceId program, GLint
location, GLfloat* params); |
| 116 GL_APICALL void GL_APIENTRY glGetUniformiv (GLResourceId program, GLint
location, GLint* params); | 111 GL_APICALL void GL_APIENTRY glGetUniformiv (GLResourceId program, GLint
location, GLint* params); |
| 117 GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLResourceId program,
const char* name); | 112 GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLResourceId program,
const char* name); |
| 118 GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pn
ame, GLfloat* params); | 113 GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenumVer
texAttribute pname, GLfloat* params); |
| 119 GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pn
ame, GLint* params); | 114 GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenumVer
texAttribute pname, GLint* params); |
| 120 GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLe
num pname, void** pointer); | 115 GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLe
numVertexPointer pname, void** pointer); |
| 121 GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); | 116 GL_APICALL void GL_APIENTRY glHint (GLenumHintTarget target, GLenumHintM
ode mode); |
| 122 GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLResourceId buffer); | 117 GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLResourceId buffer); |
| 123 GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); | 118 GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenumCapability cap); |
| 124 GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLResourceId framebuffer); | 119 GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLResourceId framebuffer); |
| 125 GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLResourceId program); | 120 GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLResourceId program); |
| 126 GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLResourceId renderbuffer)
; | 121 GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLResourceId renderbuffer)
; |
| 127 GL_APICALL GLboolean GL_APIENTRY glIsShader (GLResourceId shader); | 122 GL_APICALL GLboolean GL_APIENTRY glIsShader (GLResourceId shader); |
| 128 GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLResourceId texture); | 123 GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLResourceId texture); |
| 129 GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); | 124 GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); |
| 130 GL_APICALL void GL_APIENTRY glLinkProgram (GLResourceId program); | 125 GL_APICALL void GL_APIENTRY glLinkProgram (GLResourceId program); |
| 131 GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); | 126 GL_APICALL void GL_APIENTRY glPixelStorei (GLenumPixelStore pname, GLint
PixelStoreAlignment param); |
| 132 GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat uni
ts); | 127 GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat uni
ts); |
| 133 GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei widt
h, GLsizei height, GLenum format, GLenum type, void* pixels); | 128 GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei widt
h, GLsizei height, GLenumReadPixelFormat format, GLenumPixelType type, void* pix
els); |
| 134 GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); | 129 GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); |
| 135 GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum
internalformat, GLsizei width, GLsizei height); | 130 GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenumRenderBufferTar
get target, GLenumRenderBufferFormat internalformat, GLsizei width, GLsizei heig
ht); |
| 136 GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean
invert); | 131 GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean
invert); |
| 137 GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width,
GLsizei height); | 132 GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width,
GLsizei height); |
| 138 GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLResourceI
d* shaders, GLenum binaryformat, const void* binary, GLsizei length); | 133 GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLResourceI
d* shaders, GLenum binaryformat, const void* binary, GLsizei length); |
| 139 GL_APICALL void GL_APIENTRY glShaderSource (GLResourceId shader, GLsizei
count, const char** string, const GLint* length); | 134 GL_APICALL void GL_APIENTRY glShaderSource (GLResourceId shader, GLsizei
count, const char** string, const GLint* length); |
| 140 GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuin
t mask); | 135 GL_APICALL void GL_APIENTRY glStencilFunc (GLenumCmpFunction func, GLint
ref, GLuint mask); |
| 141 GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum f
unc, GLint ref, GLuint mask); | 136 GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenumFaceType face,
GLenumCmpFunction func, GLint ref, GLuint mask); |
| 142 GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); | 137 GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); |
| 143 GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint m
ask); | 138 GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenumFaceType face,
GLuint mask); |
| 144 GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLen
um zpass); | 139 GL_APICALL void GL_APIENTRY glStencilOp (GLenumStencilOp fail, GLenumSte
ncilOp zfail, GLenumStencilOp zpass); |
| 145 GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fai
l, GLenum zfail, GLenum zpass); | 140 GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenumFaceType face, GL
enumStencilOp fail, GLenumStencilOp zfail, GLenumStencilOp zpass); |
| 146 GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GL
int internalformat, GLsizei width, GLsizei height, GLint border, GLenum format,
GLenum type, const void* pixels); | 141 GL_APICALL void GL_APIENTRY glTexImage2D (GLenumTextureTarget target, GL
int level, GLintTextureFormat internalformat, GLsizei width, GLsizei height, GLi
nt border, GLenumTextureFormat format, GLenumPixelType type, const void* pixels)
; |
| 147 GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname
, GLfloat param); | 142 GL_APICALL void GL_APIENTRY glTexParameterf (GLenumTextureBindTarget tar
get, GLenumTextureParameter pname, GLfloat param); |
| 148 GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pnam
e, const GLfloat* params); | 143 GL_APICALL void GL_APIENTRY glTexParameterfv (GLenumTextureBindTarget ta
rget, GLenumTextureParameter pname, const GLfloat* params); |
| 149 GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname
, GLint param); | 144 GL_APICALL void GL_APIENTRY glTexParameteri (GLenumTextureBindTarget tar
get, GLenumTextureParameter pname, GLint param); |
| 150 GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pnam
e, const GLint* params); | 145 GL_APICALL void GL_APIENTRY glTexParameteriv (GLenumTextureBindTarget ta
rget, GLenumTextureParameter pname, const GLint* params); |
| 151 GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLe
num type, const void* pixels); | 146 GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenumTextureTarget target,
GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenu
mTextureFormat format, GLenumPixelType type, const void* pixels); |
| 152 GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x); | 147 GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x); |
| 153 GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count,
const GLfloat* v); | 148 GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count,
const GLfloat* v); |
| 154 GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x); | 149 GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x); |
| 155 GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count,
const GLint* v); | 150 GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count,
const GLint* v); |
| 156 GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfl
oat y); | 151 GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfl
oat y); |
| 157 GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count,
const GLfloat* v); | 152 GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count,
const GLfloat* v); |
| 158 GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint
y); | 153 GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint
y); |
| 159 GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count,
const GLint* v); | 154 GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count,
const GLint* v); |
| 160 GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfl
oat y, GLfloat z); | 155 GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfl
oat y, GLfloat z); |
| 161 GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count,
const GLfloat* v); | 156 GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count,
const GLfloat* v); |
| 162 GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint
y, GLint z); | 157 GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint
y, GLint z); |
| 163 GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count,
const GLint* v); | 158 GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count,
const GLint* v); |
| 164 GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfl
oat y, GLfloat z, GLfloat w); | 159 GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfl
oat y, GLfloat z, GLfloat w); |
| 165 GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count,
const GLfloat* v); | 160 GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count,
const GLfloat* v); |
| 166 GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint
y, GLint z, GLint w); | 161 GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint
y, GLint z, GLint w); |
| 167 GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count,
const GLint* v); | 162 GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count,
const GLint* v); |
| 168 GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei
count, GLboolean transpose, const GLfloat* value); | 163 GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei
count, GLboolean transpose, const GLfloat* value); |
| 169 GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei
count, GLboolean transpose, const GLfloat* value); | 164 GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei
count, GLboolean transpose, const GLfloat* value); |
| 170 GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei
count, GLboolean transpose, const GLfloat* value); | 165 GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei
count, GLboolean transpose, const GLfloat* value); |
| 171 GL_APICALL void GL_APIENTRY glUseProgram (GLResourceId program); | 166 GL_APICALL void GL_APIENTRY glUseProgram (GLResourceId program); |
| 172 GL_APICALL void GL_APIENTRY glValidateProgram (GLResourceId program); | 167 GL_APICALL void GL_APIENTRY glValidateProgram (GLResourceId program); |
| 173 GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); | 168 GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); |
| 174 GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloa
t* values); | 169 GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloa
t* values); |
| 175 GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GL
float y); | 170 GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GL
float y); |
| 176 GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloa
t* values); | 171 GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloa
t* values); |
| 177 GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GL
float y, GLfloat z); | 172 GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GL
float y, GLfloat z); |
| 178 GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloa
t* values); | 173 GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloa
t* values); |
| 179 GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GL
float y, GLfloat z, GLfloat w); | 174 GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GL
float y, GLfloat z, GLfloat w); |
| 180 GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloa
t* values); | 175 GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloa
t* values); |
| 181 GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint si
ze, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr); | 176 GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLintVer
texAttribSize size, GLenumVertexAttribType type, GLboolean normalized, GLsizei s
tride, const void* ptr); |
| 182 GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width,
GLsizei height); | 177 GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width,
GLsizei height); |
| 183 // Non-GL commands. | 178 // Non-GL commands. |
| 184 GL_APICALL void GL_APIENTRY glSwapBuffers (void); | 179 GL_APICALL void GL_APIENTRY glSwapBuffers (void); |
| 185 """ | 180 """ |
| 186 | 181 |
| 182 # This is the list of all commmands that will be generated and their Id. |
| 183 # If a command is not listed in this table it is an error. |
| 184 # This lets us make sure that command ids do not change as the generator |
| 185 # generates new variations of commands. |
| 186 |
| 187 _CMD_ID_TABLE = { |
| 188 'ActiveTexture': 256, |
| 189 'AttachShader': 257, |
| 190 'BindAttribLocation': 258, |
| 191 'BindAttribLocationImmediate': 259, |
| 192 'BindBuffer': 260, |
| 193 'BindFramebuffer': 261, |
| 194 'BindRenderbuffer': 262, |
| 195 'BindTexture': 263, |
| 196 'BlendColor': 264, |
| 197 'BlendEquation': 265, |
| 198 'BlendEquationSeparate': 266, |
| 199 'BlendFunc': 267, |
| 200 'BlendFuncSeparate': 268, |
| 201 'BufferData': 269, |
| 202 'BufferDataImmediate': 270, |
| 203 'BufferSubData': 271, |
| 204 'BufferSubDataImmediate': 272, |
| 205 'CheckFramebufferStatus': 273, |
| 206 'Clear': 274, |
| 207 'ClearColor': 275, |
| 208 'ClearDepthf': 276, |
| 209 'ClearStencil': 277, |
| 210 'ColorMask': 278, |
| 211 'CompileShader': 279, |
| 212 'CompressedTexImage2D': 280, |
| 213 'CompressedTexImage2DImmediate': 281, |
| 214 'CompressedTexSubImage2D': 282, |
| 215 'CompressedTexSubImage2DImmediate': 283, |
| 216 'CopyTexImage2D': 284, |
| 217 'CopyTexSubImage2D': 285, |
| 218 'CreateProgram': 286, |
| 219 'CreateShader': 287, |
| 220 'CullFace': 288, |
| 221 'DeleteBuffers': 289, |
| 222 'DeleteBuffersImmediate': 290, |
| 223 'DeleteFramebuffers': 291, |
| 224 'DeleteFramebuffersImmediate': 292, |
| 225 'DeleteProgram': 293, |
| 226 'DeleteRenderbuffers': 294, |
| 227 'DeleteRenderbuffersImmediate': 295, |
| 228 'DeleteShader': 296, |
| 229 'DeleteTextures': 297, |
| 230 'DeleteTexturesImmediate': 298, |
| 231 'DepthFunc': 299, |
| 232 'DepthMask': 300, |
| 233 'DepthRangef': 301, |
| 234 'DetachShader': 302, |
| 235 'Disable': 303, |
| 236 'DisableVertexAttribArray': 304, |
| 237 'DrawArrays': 305, |
| 238 'DrawElements': 306, |
| 239 'Enable': 307, |
| 240 'EnableVertexAttribArray': 308, |
| 241 'Finish': 309, |
| 242 'Flush': 310, |
| 243 'FramebufferRenderbuffer': 311, |
| 244 'FramebufferTexture2D': 312, |
| 245 'FrontFace': 313, |
| 246 'GenBuffers': 314, |
| 247 'GenBuffersImmediate': 315, |
| 248 'GenerateMipmap': 316, |
| 249 'GenFramebuffers': 317, |
| 250 'GenFramebuffersImmediate': 318, |
| 251 'GenRenderbuffers': 319, |
| 252 'GenRenderbuffersImmediate': 320, |
| 253 'GenTextures': 321, |
| 254 'GenTexturesImmediate': 322, |
| 255 'GetActiveAttrib': 323, |
| 256 'GetActiveUniform': 324, |
| 257 'GetAttachedShaders': 325, |
| 258 'GetAttribLocation': 326, |
| 259 'GetAttribLocationImmediate': 327, |
| 260 'GetBooleanv': 328, |
| 261 'GetBufferParameteriv': 329, |
| 262 'GetError': 330, |
| 263 'GetFloatv': 331, |
| 264 'GetFramebufferAttachmentParameteriv': 332, |
| 265 'GetIntegerv': 333, |
| 266 'GetProgramiv': 334, |
| 267 'GetProgramInfoLog': 335, |
| 268 'GetRenderbufferParameteriv': 336, |
| 269 'GetShaderiv': 337, |
| 270 'GetShaderInfoLog': 338, |
| 271 'GetShaderPrecisionFormat': 339, |
| 272 'GetShaderSource': 340, |
| 273 'GetString': 341, |
| 274 'GetTexParameterfv': 342, |
| 275 'GetTexParameteriv': 343, |
| 276 'GetUniformfv': 344, |
| 277 'GetUniformiv': 345, |
| 278 'GetUniformLocation': 346, |
| 279 'GetUniformLocationImmediate': 347, |
| 280 'GetVertexAttribfv': 348, |
| 281 'GetVertexAttribiv': 349, |
| 282 'GetVertexAttribPointerv': 350, |
| 283 'Hint': 351, |
| 284 'IsBuffer': 352, |
| 285 'IsEnabled': 353, |
| 286 'IsFramebuffer': 354, |
| 287 'IsProgram': 355, |
| 288 'IsRenderbuffer': 356, |
| 289 'IsShader': 357, |
| 290 'IsTexture': 358, |
| 291 'LineWidth': 359, |
| 292 'LinkProgram': 360, |
| 293 'PixelStorei': 361, |
| 294 'PolygonOffset': 362, |
| 295 'ReadPixels': 363, |
| 296 'RenderbufferStorage': 364, |
| 297 'SampleCoverage': 365, |
| 298 'Scissor': 366, |
| 299 'ShaderSource': 367, |
| 300 'ShaderSourceImmediate': 368, |
| 301 'StencilFunc': 369, |
| 302 'StencilFuncSeparate': 370, |
| 303 'StencilMask': 371, |
| 304 'StencilMaskSeparate': 372, |
| 305 'StencilOp': 373, |
| 306 'StencilOpSeparate': 374, |
| 307 'TexImage2D': 375, |
| 308 'TexImage2DImmediate': 376, |
| 309 'TexParameterf': 377, |
| 310 'TexParameterfv': 378, |
| 311 'TexParameterfvImmediate': 379, |
| 312 'TexParameteri': 380, |
| 313 'TexParameteriv': 381, |
| 314 'TexParameterivImmediate': 382, |
| 315 'TexSubImage2D': 383, |
| 316 'TexSubImage2DImmediate': 384, |
| 317 'Uniform1f': 385, |
| 318 'Uniform1fv': 386, |
| 319 'Uniform1fvImmediate': 387, |
| 320 'Uniform1i': 388, |
| 321 'Uniform1iv': 389, |
| 322 'Uniform1ivImmediate': 390, |
| 323 'Uniform2f': 391, |
| 324 'Uniform2fv': 392, |
| 325 'Uniform2fvImmediate': 393, |
| 326 'Uniform2i': 394, |
| 327 'Uniform2iv': 395, |
| 328 'Uniform2ivImmediate': 396, |
| 329 'Uniform3f': 397, |
| 330 'Uniform3fv': 398, |
| 331 'Uniform3fvImmediate': 399, |
| 332 'Uniform3i': 400, |
| 333 'Uniform3iv': 401, |
| 334 'Uniform3ivImmediate': 402, |
| 335 'Uniform4f': 403, |
| 336 'Uniform4fv': 404, |
| 337 'Uniform4fvImmediate': 405, |
| 338 'Uniform4i': 406, |
| 339 'Uniform4iv': 407, |
| 340 'Uniform4ivImmediate': 408, |
| 341 'UniformMatrix2fv': 409, |
| 342 'UniformMatrix2fvImmediate': 410, |
| 343 'UniformMatrix3fv': 411, |
| 344 'UniformMatrix3fvImmediate': 412, |
| 345 'UniformMatrix4fv': 413, |
| 346 'UniformMatrix4fvImmediate': 414, |
| 347 'UseProgram': 415, |
| 348 'ValidateProgram': 416, |
| 349 'VertexAttrib1f': 417, |
| 350 'VertexAttrib1fv': 418, |
| 351 'VertexAttrib1fvImmediate': 419, |
| 352 'VertexAttrib2f': 420, |
| 353 'VertexAttrib2fv': 421, |
| 354 'VertexAttrib2fvImmediate': 422, |
| 355 'VertexAttrib3f': 423, |
| 356 'VertexAttrib3fv': 424, |
| 357 'VertexAttrib3fvImmediate': 425, |
| 358 'VertexAttrib4f': 426, |
| 359 'VertexAttrib4fv': 427, |
| 360 'VertexAttrib4fvImmediate': 428, |
| 361 'VertexAttribPointer': 429, |
| 362 'Viewport': 430, |
| 363 'SwapBuffers': 431, |
| 364 } |
| 365 |
| 366 # This is a list of enum names and their valid values. It is used to map |
| 367 # GLenum arguments to a specific set of valid values. |
| 368 _ENUM_LISTS = { |
| 369 'FrameBufferTarget': [ |
| 370 'GL_FRAMEBUFFER', |
| 371 ], |
| 372 'RenderBufferTarget': [ |
| 373 'GL_RENDERBUFFER', |
| 374 ], |
| 375 'BufferTarget': [ |
| 376 'GL_ARRAY_BUFFER', |
| 377 'GL_ELEMENT_ARRAY_BUFFER', |
| 378 ], |
| 379 'BufferUsage': [ |
| 380 'GL_STREAM_DRAW', |
| 381 'GL_STATIC_DRAW', |
| 382 'GL_DYNAMIC_DRAW', |
| 383 ], |
| 384 'TextureTarget': [ |
| 385 'GL_TEXTURE_2D', |
| 386 'GL_TEXTURE_CUBE_MAP_POSITIVE_X', |
| 387 'GL_TEXTURE_CUBE_MAP_NEGATIVE_X', |
| 388 'GL_TEXTURE_CUBE_MAP_POSITIVE_Y', |
| 389 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Y', |
| 390 'GL_TEXTURE_CUBE_MAP_POSITIVE_Z', |
| 391 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Z', |
| 392 ], |
| 393 'TextureBindTarget': [ |
| 394 'GL_TEXTURE_2D', |
| 395 'GL_TEXTURE_CUBE_MAP', |
| 396 ], |
| 397 'ShaderType': [ |
| 398 'GL_VERTEX_SHADER', |
| 399 'GL_FRAGMENT_SHADER', |
| 400 ], |
| 401 'FaceType': [ |
| 402 'GL_FRONT', |
| 403 'GL_BACK', |
| 404 'GL_FRONT_AND_BACK', |
| 405 ], |
| 406 'FaceMode': [ |
| 407 'GL_CW', |
| 408 'GL_CCW', |
| 409 ], |
| 410 'CmpFunction': [ |
| 411 'GL_NEVER', |
| 412 'GL_LESS', |
| 413 'GL_EQUAL', |
| 414 'GL_LEQUAL', |
| 415 'GL_GREATER', |
| 416 'GL_NOTEQUAL', |
| 417 'GL_GEQUAL', |
| 418 'GL_ALWAYS', |
| 419 ], |
| 420 'Equation': [ |
| 421 'GL_FUNC_ADD', |
| 422 'GL_FUNC_SUBTRACT', |
| 423 'GL_FUNC_REVERSE_SUBTRACT', |
| 424 ], |
| 425 'SrcBlendFactor': [ |
| 426 'GL_ZERO', |
| 427 'GL_ONE', |
| 428 'GL_SRC_COLOR', |
| 429 'GL_ONE_MINUS_SRC_COLOR', |
| 430 'GL_DST_COLOR', |
| 431 'GL_ONE_MINUS_DST_COLOR', |
| 432 'GL_SRC_ALPHA', |
| 433 'GL_ONE_MINUS_SRC_ALPHA', |
| 434 'GL_DST_ALPHA', |
| 435 'GL_ONE_MINUS_DST_ALPHA', |
| 436 'GL_CONSTANT_COLOR', |
| 437 'GL_ONE_MINUS_CONSTANT_COLOR', |
| 438 'GL_CONSTANT_ALPHA', |
| 439 'GL_ONE_MINUS_CONSTANT_ALPHA', |
| 440 'GL_SRC_ALPHA_SATURATE', |
| 441 ], |
| 442 'DstBlendFactor': [ |
| 443 'GL_ZERO', |
| 444 'GL_ONE', |
| 445 'GL_SRC_COLOR', |
| 446 'GL_ONE_MINUS_SRC_COLOR', |
| 447 'GL_DST_COLOR', |
| 448 'GL_ONE_MINUS_DST_COLOR', |
| 449 'GL_SRC_ALPHA', |
| 450 'GL_ONE_MINUS_SRC_ALPHA', |
| 451 'GL_DST_ALPHA', |
| 452 'GL_ONE_MINUS_DST_ALPHA', |
| 453 'GL_CONSTANT_COLOR', |
| 454 'GL_ONE_MINUS_CONSTANT_COLOR', |
| 455 'GL_CONSTANT_ALPHA', |
| 456 'GL_ONE_MINUS_CONSTANT_ALPHA', |
| 457 ], |
| 458 'Capability': [ |
| 459 'GL_BLEND', |
| 460 'GL_CULL_FACE', |
| 461 'GL_DEPTH_TEST', |
| 462 'GL_DITHER', |
| 463 'GL_POLYGON_OFFSET_FILL', |
| 464 'GL_SAMPLE_ALPHA_TO_COVERAGE', |
| 465 'GL_SAMPLE_COVERAGE', |
| 466 'GL_SCISSOR_TEST', |
| 467 'GL_STENCIL_TEST', |
| 468 ], |
| 469 'DrawMode': [ |
| 470 'GL_POINTS', |
| 471 'GL_LINE_STRIP', |
| 472 'GL_LINE_LOOP', |
| 473 'GL_LINES', |
| 474 'GL_TRIANGLE_STRIP', |
| 475 'GL_TRIANGLE_FAN', |
| 476 'GL_TRIANGLES', |
| 477 ], |
| 478 'IndexType': [ |
| 479 'GL_UNSIGNED_BYTE', |
| 480 'GL_UNSIGNED_SHORT', |
| 481 ], |
| 482 'Attachment': [ |
| 483 'GL_COLOR_ATTACHMENT0', |
| 484 'GL_DEPTH_ATTACHMENT', |
| 485 'GL_STENCIL_ATTACHMENT', |
| 486 ], |
| 487 'BufferParameter': [ |
| 488 'GL_BUFFER_SIZE', |
| 489 'GL_BUFFER_USAGE', |
| 490 ], |
| 491 'FrameBufferParameter': [ |
| 492 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE', |
| 493 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME', |
| 494 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL', |
| 495 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE', |
| 496 ], |
| 497 'ProgramParameter': [ |
| 498 'GL_DELETE_STATUS', |
| 499 'GL_LINK_STATUS', |
| 500 'GL_VALIDATE_STATUS', |
| 501 'GL_INFO_LOG_LENGTH', |
| 502 'GL_ATTACHED_SHADERS', |
| 503 'GL_ACTIVE_ATTRIBUTES', |
| 504 'GL_ACTIVE_ATTRIBUTE_MAX_LENGTH', |
| 505 'GL_ACTIVE_UNIFORMS', |
| 506 'GL_ACTIVE_UNIFORM_MAX_LENGTH', |
| 507 ], |
| 508 'RenderBufferParameter': [ |
| 509 'GL_RENDERBUFFER_WIDTH', |
| 510 'GL_RENDERBUFFER_HEIGHT', |
| 511 'GL_RENDERBUFFER_INTERNAL_FORMAT', |
| 512 'GL_RENDERBUFFER_RED_SIZE', |
| 513 'GL_RENDERBUFFER_GREEN_SIZE', |
| 514 'GL_RENDERBUFFER_BLUE_SIZE', |
| 515 'GL_RENDERBUFFER_ALPHA_SIZE', |
| 516 'GL_RENDERBUFFER_DEPTH_SIZE', |
| 517 'GL_RENDERBUFFER_STENCIL_SIZE', |
| 518 ], |
| 519 'ShaderParameter': [ |
| 520 'GL_SHADER_TYPE', |
| 521 'GL_DELETE_STATUS', |
| 522 'GL_COMPILE_STATUS', |
| 523 'GL_INFO_LOG_LENGTH', |
| 524 'GL_SHADER_SOURCE_LENGTH', |
| 525 ], |
| 526 'ShaderPercision': [ |
| 527 'GL_LOW_FLOAT', |
| 528 'GL_MEDIUM_FLOAT', |
| 529 'GL_HIGH_FLOAT', |
| 530 'GL_LOW_INT', |
| 531 'GL_MEDIUM_INT', |
| 532 'GL_HIGH_INT', |
| 533 ], |
| 534 'StringType': [ |
| 535 'GL_VENDOR', |
| 536 'GL_RENDERER', |
| 537 'GL_VERSION', |
| 538 'GL_SHADING_LANGUAGE_VERSION', |
| 539 'GL_EXTENSIONS', |
| 540 ], |
| 541 'TextureParameter': [ |
| 542 'GL_TEXTURE_MAG_FILTER', |
| 543 'GL_TEXTURE_MIN_FILTER', |
| 544 'GL_TEXTURE_WRAP_S', |
| 545 'GL_TEXTURE_WRAP_T', |
| 546 ], |
| 547 'VertexAttribute': [ |
| 548 'GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING', |
| 549 'GL_VERTEX_ATTRIB_ARRAY_ENABLED', |
| 550 'GL_VERTEX_ATTRIB_ARRAY_SIZE', |
| 551 'GL_VERTEX_ATTRIB_ARRAY_STRIDE', |
| 552 'GL_VERTEX_ATTRIB_ARRAY_TYPE', |
| 553 'GL_VERTEX_ATTRIB_ARRAY_NORMALIZED', |
| 554 'GL_CURRENT_VERTEX_ATTRIB', |
| 555 ], |
| 556 'VertexPointer': [ |
| 557 'GL_VERTEX_ATTRIB_ARRAY_POINTER', |
| 558 ], |
| 559 'HintTarget': [ |
| 560 'GL_GENERATE_MIPMAP_HINT', |
| 561 ], |
| 562 'HintMode': [ |
| 563 'GL_FASTEST', |
| 564 'GL_NICEST', |
| 565 'GL_DONT_CARE', |
| 566 ], |
| 567 'PixelStore': [ |
| 568 'GL_PACK_ALIGNMENT', |
| 569 'GL_UNPACK_ALIGNMENT', |
| 570 ], |
| 571 'PixelStoreAlignment': [ |
| 572 '1', |
| 573 '2', |
| 574 '4', |
| 575 '8', |
| 576 ], |
| 577 'ReadPixelFormat': [ |
| 578 'GL_ALPHA', |
| 579 'GL_RGB', |
| 580 'GL_RGBA', |
| 581 ], |
| 582 'PixelType': [ |
| 583 'GL_UNSIGNED_BYTE', |
| 584 'GL_UNSIGNED_SHORT_5_6_5', |
| 585 'GL_UNSIGNED_SHORT_4_4_4_4', |
| 586 'GL_UNSIGNED_SHORT_5_5_5_1', |
| 587 ], |
| 588 'RenderBufferFormat': [ |
| 589 'GL_RGBA4', |
| 590 'GL_RGB565', |
| 591 'GL_RGB5_A1', |
| 592 'GL_DEPTH_COMPONENT16', |
| 593 'GL_STENCIL_INDEX8', |
| 594 ], |
| 595 'StencilOp': [ |
| 596 'GL_KEEP', |
| 597 'GL_ZERO', |
| 598 'GL_REPLACE', |
| 599 'GL_INCR', |
| 600 'GL_INCR_WRAP', |
| 601 'GL_DECR', |
| 602 'GL_DECR_WRAP', |
| 603 'GL_INVERT', |
| 604 ], |
| 605 'TextureFormat': [ |
| 606 'GL_ALPHA', |
| 607 'GL_LUMINANCE', |
| 608 'GL_LUMINANCE_ALPHA', |
| 609 'GL_RGB', |
| 610 'GL_RGBA', |
| 611 ], |
| 612 'VertexAttribType': [ |
| 613 'GL_BYTE', |
| 614 'GL_UNSIGNED_BYTE', |
| 615 'GL_SHORT', |
| 616 'GL_UNSIGNED_SHORT', |
| 617 #'GL_FIXED', // This is not available on Desktop GL. |
| 618 'GL_FLOAT', |
| 619 ], |
| 620 'VertexAttribSize': [ |
| 621 '1', |
| 622 '2', |
| 623 '3', |
| 624 '4', |
| 625 ], |
| 626 } |
| 627 |
| 187 # This table specifies types and other special data for the commands that | 628 # This table specifies types and other special data for the commands that |
| 188 # will be generated. | 629 # will be generated. |
| 189 # | 630 # |
| 190 # type: defines which handler will be used to generate code. | 631 # type: defines which handler will be used to generate code. |
| 191 # DecoderFunc: defines which function to call in the decoder to execute the | 632 # DecoderFunc: defines which function to call in the decoder to execute the |
| 192 # corresponding GL command. If not specified the GL command will | 633 # corresponding GL command. If not specified the GL command will |
| 193 # be called directly. | 634 # be called directly. |
| 194 # cmd_args: The arguments to use for the command. This overrides generating | 635 # cmd_args: The arguments to use for the command. This overrides generating |
| 195 # them based on the GL function arguments. | 636 # them based on the GL function arguments. |
| 196 # a NonImmediate type is a type that stays a pointer even in | 637 # a NonImmediate type is a type that stays a pointer even in |
| 197 # and immediate version of acommand. | 638 # and immediate version of acommand. |
| 198 # immediate: Whether or not to generate an immediate command for the GL | 639 # immediate: Whether or not to generate an immediate command for the GL |
| 199 # function. The default is if there is exactly 1 pointer argument | 640 # function. The default is if there is exactly 1 pointer argument |
| 200 # in the GL function an immediate command is generated. | 641 # in the GL function an immediate command is generated. |
| 201 # needs_size: If true a data_size field is added to the command. | 642 # needs_size: If true a data_size field is added to the command. |
| 202 # data_type: The type of data the command uses. For PUTn or PUT types. | 643 # data_type: The type of data the command uses. For PUTn or PUT types. |
| 203 # count: The number of units per element. For PUTn or PUT types. | 644 # count: The number of units per element. For PUTn or PUT types. |
| 204 | 645 |
| 205 _FUNCTION_INFO = { | 646 _FUNCTION_INFO = { |
| 206 'BindAttribLocation': {'type': 'GLchar'}, | 647 'BindAttribLocation': {'type': 'GLchar'}, |
| 207 'BindBuffer': {'DecoderFunc': 'DoBindBuffer'}, | 648 'BindBuffer': {'DecoderFunc': 'DoBindBuffer'}, |
| 208 'BindFramebuffer': {'DecoderFunc': 'glBindFramebufferEXT'}, | 649 'BindFramebuffer': {'DecoderFunc': 'glBindFramebufferEXT'}, |
| 209 'BindRenderbuffer': {'DecoderFunc': 'glBindRenderbufferEXT'}, | 650 'BindRenderbuffer': {'DecoderFunc': 'glBindRenderbufferEXT'}, |
| 210 'BufferData': {'type': 'Manual', 'immediate': True,}, | 651 'BufferData': {'type': 'Manual', 'immediate': True}, |
| 211 'BufferSubData': {'type': 'Data'}, | 652 'BufferSubData': {'type': 'Data'}, |
| 212 'CheckFramebufferStatus': {'DecoderFunc': 'glCheckFramebufferStatusEXT'}, | 653 'CheckFramebufferStatus': {'DecoderFunc': 'glCheckFramebufferStatusEXT'}, |
| 213 'ClearDepthf': {'DecoderFunc': 'glClearDepth'}, | 654 'ClearDepthf': {'DecoderFunc': 'glClearDepth'}, |
| 214 'CompressedTexImage2D': {'type': 'Manual', 'immediate': True,}, | 655 'CompressedTexImage2D': {'type': 'Manual','immediate': True}, |
| 215 'CompressedTexSubImage2D': {'type': 'Data'}, | 656 'CompressedTexSubImage2D': {'type': 'Data'}, |
| 216 'CreateProgram': {'type': 'Create'}, | 657 'CreateProgram': {'type': 'Create'}, |
| 217 'CreateShader': {'type': 'Create'}, | 658 'CreateShader': {'type': 'Create'}, |
| 218 'DeleteBuffers': {'type': 'DELn'}, | 659 'DeleteBuffers': {'type': 'DELn'}, |
| 219 'DeleteFramebuffers': {'type': 'DELn'}, | 660 'DeleteFramebuffers': {'type': 'DELn'}, |
| 220 'DeleteProgram': {'DecoderFunc': 'DoDeleteProgram'}, | 661 'DeleteProgram': {'type': 'Custom', 'DecoderFunc': 'DoDeleteProgram'}, |
| 221 'DeleteRenderbuffers': {'type': 'DELn'}, | 662 'DeleteRenderbuffers': {'type': 'DELn'}, |
| 222 'DeleteShader': {'DecoderFunc': 'DoDeleteShader'}, | 663 'DeleteShader': {'type': 'Custom', 'DecoderFunc': 'DoDeleteShader'}, |
| 223 'DeleteTextures': {'type': 'DELn'}, | 664 'DeleteTextures': {'type': 'DELn'}, |
| 224 'DepthRangef': {'DecoderFunc': 'glDepthRange'}, | 665 'DepthRangef': {'DecoderFunc': 'glDepthRange'}, |
| 225 'DrawElements': { | 666 'DrawElements': { |
| 226 'type': 'Manual', | 667 'type': 'Manual', |
| 227 'cmd_args': 'GLenum mode, GLsizei count, GLenum type, GLuint index_offset', | 668 'cmd_args': 'GLenum mode, GLsizei count, GLenum type, GLuint index_offset', |
| 228 }, | 669 }, |
| 229 'FramebufferRenderbuffer': {'DecoderFunc': 'glFramebufferRenderbufferEXT'}, | 670 'FramebufferRenderbuffer': {'DecoderFunc': 'glFramebufferRenderbufferEXT'}, |
| 230 'FramebufferTexture2D': {'DecoderFunc': 'glFramebufferTexture2DEXT'}, | 671 'FramebufferTexture2D': {'DecoderFunc': 'glFramebufferTexture2DEXT'}, |
| 231 'GenerateMipmap': {'DecoderFunc': 'glGenerateMipmapEXT'}, | 672 'GenerateMipmap': {'DecoderFunc': 'glGenerateMipmapEXT'}, |
| 232 'GenBuffers': {'type': 'GENn'}, | 673 'GenBuffers': {'type': 'GENn'}, |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 for arg in args: | 875 for arg in args: |
| 435 file.Write("COMPILE_ASSERT(offsetof(%s, %s) == %d,\n" % | 876 file.Write("COMPILE_ASSERT(offsetof(%s, %s) == %d,\n" % |
| 436 (func.name, arg.name, offset)) | 877 (func.name, arg.name, offset)) |
| 437 file.Write(" OffsetOf_%s_%s_not_%d);\n" % | 878 file.Write(" OffsetOf_%s_%s_not_%d);\n" % |
| 438 (func.name, arg.name, offset)) | 879 (func.name, arg.name, offset)) |
| 439 offset += _SIZE_OF_UINT32 | 880 offset += _SIZE_OF_UINT32 |
| 440 file.Write("\n") | 881 file.Write("\n") |
| 441 | 882 |
| 442 def WriteHandlerImplementation(self, func, file): | 883 def WriteHandlerImplementation(self, func, file): |
| 443 """Writes the handler implementation for this command.""" | 884 """Writes the handler implementation for this command.""" |
| 444 file.Write(" parse_error::ParseError result =\n") | |
| 445 file.Write(" Validate%s(this, immediate_data_size%s);\n" % | |
| 446 (func.name, func.MakeOriginalArgString("", True))) | |
| 447 file.Write(" if (result != parse_error::kParseNoError) {\n") | |
| 448 file.Write(" return result;\n") | |
| 449 file.Write(" }\n") | |
| 450 file.Write(" %s(%s);\n" % | 885 file.Write(" %s(%s);\n" % |
| 451 (func.GetGLFunctionName(), func.MakeOriginalArgString(""))) | 886 (func.GetGLFunctionName(), func.MakeOriginalArgString(""))) |
| 452 | 887 |
| 453 def WriteCmdSizeTest(self, func, file): | 888 def WriteCmdSizeTest(self, func, file): |
| 454 """Writes the size test for a command.""" | 889 """Writes the size test for a command.""" |
| 455 file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT\n") | 890 file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT\n") |
| 456 | 891 |
| 457 def WriteFormatTest(self, func, file): | 892 def WriteFormatTest(self, func, file): |
| 458 """Writes a format test for a command.""" | 893 """Writes a format test for a command.""" |
| 459 file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) | 894 file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 file.Write("\n") | 942 file.Write("\n") |
| 508 | 943 |
| 509 def WriteImmediateCmdSizeTest(self, func, file): | 944 def WriteImmediateCmdSizeTest(self, func, file): |
| 510 """Writes a size test for an immediate version of a command.""" | 945 """Writes a size test for an immediate version of a command.""" |
| 511 file.Write(" // TODO(gman): Compute correct size.\n") | 946 file.Write(" // TODO(gman): Compute correct size.\n") |
| 512 file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);\n") | 947 file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);\n") |
| 513 | 948 |
| 514 def WriteImmediateHandlerImplementation (self, func, file): | 949 def WriteImmediateHandlerImplementation (self, func, file): |
| 515 """Writes the handler impl for the immediate version of a command.""" | 950 """Writes the handler impl for the immediate version of a command.""" |
| 516 file.Write(" // Immediate version.\n") | 951 file.Write(" // Immediate version.\n") |
| 517 file.Write(" parse_error::ParseError result =\n") | 952 func.WriteHandlerValidation(file) |
| 518 file.Write(" Validate%s(this, immediate_data_size%s);\n" % | |
| 519 (func.name, func.MakeOriginalArgString("", True))) | |
| 520 file.Write(" if (result != parse_error::kParseNoError) {\n") | |
| 521 file.Write(" return result;\n") | |
| 522 file.Write(" }\n") | |
| 523 file.Write(" %s(%s);\n" % | 953 file.Write(" %s(%s);\n" % |
| 524 (func.GetGLFunctionName(), func.MakeOriginalArgString(""))) | 954 (func.GetGLFunctionName(), func.MakeOriginalArgString(""))) |
| 525 | 955 |
| 526 def WriteServiceImplementation(self, func, file): | 956 def WriteServiceImplementation(self, func, file): |
| 527 """Writes the service implementation for a command.""" | 957 """Writes the service implementation for a command.""" |
| 528 file.Write( | 958 file.Write( |
| 529 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) | 959 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) |
| 530 file.Write( | 960 file.Write( |
| 531 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) | 961 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) |
| 532 for arg in func.GetOriginalArgs(): | 962 for arg in func.GetOriginalArgs(): |
| 533 arg.WriteGetCode(file) | 963 arg.WriteGetCode(file) |
| 964 func.WriteHandlerValidation(file) |
| 534 func.WriteHandlerImplementation(file) | 965 func.WriteHandlerImplementation(file) |
| 535 file.Write(" return parse_error::kParseNoError;\n") | 966 file.Write(" return parse_error::kParseNoError;\n") |
| 536 file.Write("}\n") | 967 file.Write("}\n") |
| 537 file.Write("\n") | 968 file.Write("\n") |
| 538 | 969 |
| 539 def WriteImmediateServiceImplementation(self, func, file): | 970 def WriteImmediateServiceImplementation(self, func, file): |
| 540 """Writes the service implementation for an immediate version of command.""" | 971 """Writes the service implementation for an immediate version of command.""" |
| 541 file.Write( | 972 file.Write( |
| 542 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) | 973 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) |
| 543 file.Write( | 974 file.Write( |
| 544 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) | 975 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) |
| 545 for arg in func.GetOriginalArgs(): | 976 for arg in func.GetOriginalArgs(): |
| 546 arg.WriteGetCode(file) | 977 arg.WriteGetCode(file) |
| 978 func.WriteHandlerValidation(file) |
| 547 func.WriteHandlerImplementation(file) | 979 func.WriteHandlerImplementation(file) |
| 548 file.Write(" return parse_error::kParseNoError;\n") | 980 file.Write(" return parse_error::kParseNoError;\n") |
| 549 file.Write("}\n") | 981 file.Write("}\n") |
| 550 file.Write("\n") | 982 file.Write("\n") |
| 551 | 983 |
| 552 def WriteImmediateValidationCode(self, func, file): | 984 def WriteImmediateValidationCode(self, func, file): |
| 553 """Writes the validation code for an immediate version of a command.""" | 985 """Writes the validation code for an immediate version of a command.""" |
| 554 pass | 986 pass |
| 555 | 987 |
| 556 def WriteGLES2ImplementationHeader(self, func, file): | 988 def WriteGLES2ImplementationHeader(self, func, file): |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 file.Write(" uint32 pixels_size = GLES2Util::ComputeImageDataSize(\n") | 1227 file.Write(" uint32 pixels_size = GLES2Util::ComputeImageDataSize(\n") |
| 796 file.Write(" width, height, format, type, unpack_alignment_);\n") | 1228 file.Write(" width, height, format, type, unpack_alignment_);\n") |
| 797 elif func.name == 'TexSubImage2D': | 1229 elif func.name == 'TexSubImage2D': |
| 798 file.Write(" uint32 pixels_size = GLES2Util::ComputeImageDataSize(\n") | 1230 file.Write(" uint32 pixels_size = GLES2Util::ComputeImageDataSize(\n") |
| 799 file.Write(" width, height, format, type, unpack_alignment_);\n") | 1231 file.Write(" width, height, format, type, unpack_alignment_);\n") |
| 800 else: | 1232 else: |
| 801 file.Write(" uint32 data_size = 0; // TODO(gman): get correct size!\n") | 1233 file.Write(" uint32 data_size = 0; // TODO(gman): get correct size!\n") |
| 802 | 1234 |
| 803 for arg in func.GetOriginalArgs(): | 1235 for arg in func.GetOriginalArgs(): |
| 804 arg.WriteGetAddress(file) | 1236 arg.WriteGetAddress(file) |
| 1237 func.WriteHandlerValidation(file) |
| 805 func.WriteHandlerImplementation(file) | 1238 func.WriteHandlerImplementation(file) |
| 806 file.Write(" return parse_error::kParseNoError;\n") | 1239 file.Write(" return parse_error::kParseNoError;\n") |
| 807 file.Write("}\n") | 1240 file.Write("}\n") |
| 808 file.Write("\n") | 1241 file.Write("\n") |
| 809 | 1242 |
| 810 def WriteImmediateCmdGetTotalSize(self, func, file): | 1243 def WriteImmediateCmdGetTotalSize(self, func, file): |
| 811 """Overrriden from TypeHandler.""" | 1244 """Overrriden from TypeHandler.""" |
| 812 # TODO(gman): Move this data to _FUNCTION_INFO? | 1245 # TODO(gman): Move this data to _FUNCTION_INFO? |
| 813 if func.name == 'BufferDataImmediate': | 1246 if func.name == 'BufferDataImmediate': |
| 814 file.Write(" uint32 total_size = ComputeSize(_size);\n") | 1247 file.Write(" uint32 total_size = ComputeSize(_size);\n") |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 | 1293 |
| 861 def __init__(self): | 1294 def __init__(self): |
| 862 TypeHandler.__init__(self) | 1295 TypeHandler.__init__(self) |
| 863 | 1296 |
| 864 def InitFunction(self, func): | 1297 def InitFunction(self, func): |
| 865 """Overrriden from TypeHandler.""" | 1298 """Overrriden from TypeHandler.""" |
| 866 pass | 1299 pass |
| 867 | 1300 |
| 868 def WriteHandlerImplementation (self, func, file): | 1301 def WriteHandlerImplementation (self, func, file): |
| 869 """Overrriden from TypeHandler.""" | 1302 """Overrriden from TypeHandler.""" |
| 870 file.Write(" parse_error::ParseError result =\n") | 1303 func.WriteHandlerValidation(file) |
| 871 file.Write(" Validate%s(this, immediate_data_size%s);\n" % | |
| 872 (func.name, func.MakeOriginalArgString("", True))) | |
| 873 file.Write(" if (result != parse_error::kParseNoError) {\n") | |
| 874 file.Write(" return result;\n") | |
| 875 file.Write(" }\n") | |
| 876 file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" % | 1304 file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" % |
| 877 (func.name, func.GetLastOriginalArg().name)) | 1305 (func.name, func.GetLastOriginalArg().name)) |
| 878 | 1306 |
| 879 def WriteImmediateHandlerImplementation(self, func, file): | 1307 def WriteImmediateHandlerImplementation(self, func, file): |
| 880 """Overrriden from TypeHandler.""" | 1308 """Overrriden from TypeHandler.""" |
| 881 file.Write(" parse_error::ParseError result =\n") | 1309 func.WriteHandlerValidation(file) |
| 882 file.Write(" Validate%s(this, immediate_data_size%s);\n" % | |
| 883 (func.name, func.MakeOriginalArgString("", True))) | |
| 884 file.Write(" if (result != parse_error::kParseNoError) {\n") | |
| 885 file.Write(" return result;\n") | |
| 886 file.Write(" }\n") | |
| 887 file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" % | 1310 file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" % |
| 888 (func.original_name, func.GetLastOriginalArg().name)) | 1311 (func.original_name, func.GetLastOriginalArg().name)) |
| 889 | 1312 |
| 890 def WriteGLES2ImplementationHeader(self, func, file): | 1313 def WriteGLES2ImplementationHeader(self, func, file): |
| 891 """Overrriden from TypeHandler.""" | 1314 """Overrriden from TypeHandler.""" |
| 892 file.Write("%s %s(%s) {\n" % | 1315 file.Write("%s %s(%s) {\n" % |
| 893 (func.return_type, func.original_name, | 1316 (func.return_type, func.original_name, |
| 894 func.MakeTypedOriginalArgString(""))) | 1317 func.MakeTypedOriginalArgString(""))) |
| 895 file.Write(" MakeIds(%s);\n" % func.MakeOriginalArgString("")) | 1318 file.Write(" MakeIds(%s);\n" % func.MakeOriginalArgString("")) |
| 896 file.Write(" helper_->%sImmediate(%s);\n" % | 1319 file.Write(" helper_->%sImmediate(%s);\n" % |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 def __init__(self): | 1428 def __init__(self): |
| 1006 TypeHandler.__init__(self) | 1429 TypeHandler.__init__(self) |
| 1007 | 1430 |
| 1008 def InitFunction(self, func): | 1431 def InitFunction(self, func): |
| 1009 """Overrriden from TypeHandler.""" | 1432 """Overrriden from TypeHandler.""" |
| 1010 func.AddCmdArg(Argument("client_id", 'uint32')) | 1433 func.AddCmdArg(Argument("client_id", 'uint32')) |
| 1011 | 1434 |
| 1012 def WriteHandlerImplementation (self, func, file): | 1435 def WriteHandlerImplementation (self, func, file): |
| 1013 """Overrriden from TypeHandler.""" | 1436 """Overrriden from TypeHandler.""" |
| 1014 file.Write(" uint32 client_id = c.client_id;\n") | 1437 file.Write(" uint32 client_id = c.client_id;\n") |
| 1015 file.Write(" parse_error::ParseError result =\n") | 1438 func.WriteHandlerValidation(file) |
| 1016 file.Write(" Validate%s(this, immediate_data_size%s);\n" % | |
| 1017 (func.name, func.MakeOriginalArgString("", True))) | |
| 1018 file.Write(" if (result != parse_error::kParseNoError) {\n") | |
| 1019 file.Write(" return result;\n") | |
| 1020 file.Write(" }\n") | |
| 1021 file.Write(" %sHelper(%s);\n" % | 1439 file.Write(" %sHelper(%s);\n" % |
| 1022 (func.name, func.MakeCmdArgString(""))) | 1440 (func.name, func.MakeCmdArgString(""))) |
| 1023 | 1441 |
| 1024 def WriteGLES2ImplementationHeader(self, func, file): | 1442 def WriteGLES2ImplementationHeader(self, func, file): |
| 1025 """Overrriden from TypeHandler.""" | 1443 """Overrriden from TypeHandler.""" |
| 1026 file.Write("%s %s(%s) {\n" % | 1444 file.Write("%s %s(%s) {\n" % |
| 1027 (func.return_type, func.original_name, | 1445 (func.return_type, func.original_name, |
| 1028 func.MakeTypedOriginalArgString(""))) | 1446 func.MakeTypedOriginalArgString(""))) |
| 1029 file.Write(" GLuint client_id;\n") | 1447 file.Write(" GLuint client_id;\n") |
| 1030 file.Write(" MakeIds(1, &client_id);\n") | 1448 file.Write(" MakeIds(1, &client_id);\n") |
| 1031 file.Write(" helper_->%s(%s);\n" % | 1449 file.Write(" helper_->%s(%s);\n" % |
| 1032 (func.name, func.MakeCmdArgString(""))) | 1450 (func.name, func.MakeCmdArgString(""))) |
| 1033 file.Write(" return client_id;\n") | 1451 file.Write(" return client_id;\n") |
| 1034 file.Write("}\n") | 1452 file.Write("}\n") |
| 1035 file.Write("\n") | 1453 file.Write("\n") |
| 1036 | 1454 |
| 1037 def WriteGLES2ImplementationImpl(self, func, file): | 1455 def WriteGLES2ImplementationImpl(self, func, file): |
| 1038 """Overrriden from TypeHandler.""" | 1456 """Overrriden from TypeHandler.""" |
| 1039 pass | 1457 pass |
| 1040 | 1458 |
| 1041 | 1459 |
| 1042 class DELnHandler(TypeHandler): | 1460 class DELnHandler(TypeHandler): |
| 1043 """Handler for glDelete___ type functions.""" | 1461 """Handler for glDelete___ type functions.""" |
| 1044 | 1462 |
| 1045 def __init__(self): | 1463 def __init__(self): |
| 1046 TypeHandler.__init__(self) | 1464 TypeHandler.__init__(self) |
| 1047 | 1465 |
| 1048 def WriteHandlerImplementation (self, func, file): | 1466 def WriteHandlerImplementation (self, func, file): |
| 1049 """Overrriden from TypeHandler.""" | 1467 """Overrriden from TypeHandler.""" |
| 1050 file.Write(" parse_error::ParseError result =\n") | 1468 func.WriteHandlerValidation(file) |
| 1051 file.Write(" Validate%s(this, immediate_data_size%s);\n" % | |
| 1052 (func.name, func.MakeOriginalArgString("", True))) | |
| 1053 file.Write(" if (result != parse_error::kParseNoError) {\n") | |
| 1054 file.Write(" return result;\n") | |
| 1055 file.Write(" }\n") | |
| 1056 file.Write(" DeleteGLObjects<GL%sHelper>(n, %s);\n" % | 1469 file.Write(" DeleteGLObjects<GL%sHelper>(n, %s);\n" % |
| 1057 (func.name, func.GetLastOriginalArg().name)) | 1470 (func.name, func.GetLastOriginalArg().name)) |
| 1058 | 1471 |
| 1059 def WriteImmediateHandlerImplementation (self, func, file): | 1472 def WriteImmediateHandlerImplementation (self, func, file): |
| 1060 """Overrriden from TypeHandler.""" | 1473 """Overrriden from TypeHandler.""" |
| 1061 file.Write(" parse_error::ParseError result =\n") | 1474 func.WriteHandlerValidation(file) |
| 1062 file.Write(" Validate%s(this, immediate_data_size%s);\n" % | |
| 1063 (func.name, func.MakeOriginalArgString("", True))) | |
| 1064 file.Write(" if (result != parse_error::kParseNoError) {\n") | |
| 1065 file.Write(" return result;\n") | |
| 1066 file.Write(" }\n") | |
| 1067 file.Write(" DeleteGLObjects<GL%sHelper>(n, %s);\n" % | 1475 file.Write(" DeleteGLObjects<GL%sHelper>(n, %s);\n" % |
| 1068 (func.original_name, func.GetLastOriginalArg().name)) | 1476 (func.original_name, func.GetLastOriginalArg().name)) |
| 1069 | 1477 |
| 1070 def WriteGLES2ImplementationHeader(self, func, file): | 1478 def WriteGLES2ImplementationHeader(self, func, file): |
| 1071 """Overrriden from TypeHandler.""" | 1479 """Overrriden from TypeHandler.""" |
| 1072 file.Write("%s %s(%s) {\n" % | 1480 file.Write("%s %s(%s) {\n" % |
| 1073 (func.return_type, func.original_name, | 1481 (func.return_type, func.original_name, |
| 1074 func.MakeTypedOriginalArgString(""))) | 1482 func.MakeTypedOriginalArgString(""))) |
| 1075 file.Write(" FreeIds(%s);\n" % func.MakeOriginalArgString("")) | 1483 file.Write(" FreeIds(%s);\n" % func.MakeOriginalArgString("")) |
| 1076 file.Write(" helper_->%sImmediate(%s);\n" % | 1484 file.Write(" helper_->%sImmediate(%s);\n" % |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 | 1607 |
| 1200 all_but_last_args = func.GetOriginalArgs()[:-1] | 1608 all_but_last_args = func.GetOriginalArgs()[:-1] |
| 1201 for arg in all_but_last_args: | 1609 for arg in all_but_last_args: |
| 1202 arg.WriteGetCode(file) | 1610 arg.WriteGetCode(file) |
| 1203 | 1611 |
| 1204 file.Write(" %s params;\n" % last_arg.type) | 1612 file.Write(" %s params;\n" % last_arg.type) |
| 1205 file.Write(" GLsizei num_values = util_.GLGetNumValuesReturned(pname);\n") | 1613 file.Write(" GLsizei num_values = util_.GLGetNumValuesReturned(pname);\n") |
| 1206 file.Write(" uint32 params_size = num_values * sizeof(*params);\n") | 1614 file.Write(" uint32 params_size = num_values * sizeof(*params);\n") |
| 1207 file.Write(" params = GetSharedMemoryAs<%s>(\n" % last_arg.type) | 1615 file.Write(" params = GetSharedMemoryAs<%s>(\n" % last_arg.type) |
| 1208 file.Write(" c.params_shm_id, c.params_shm_offset, params_size);\n") | 1616 file.Write(" c.params_shm_id, c.params_shm_offset, params_size);\n") |
| 1617 func.WriteHandlerValidation(file) |
| 1209 func.WriteHandlerImplementation(file) | 1618 func.WriteHandlerImplementation(file) |
| 1210 file.Write(" return parse_error::kParseNoError;\n") | 1619 file.Write(" return parse_error::kParseNoError;\n") |
| 1211 file.Write("}\n") | 1620 file.Write("}\n") |
| 1212 file.Write("\n") | 1621 file.Write("\n") |
| 1213 | 1622 |
| 1214 def WriteGLES2ImplementationHeader(self, func, file): | 1623 def WriteGLES2ImplementationHeader(self, func, file): |
| 1215 """Overrriden from TypeHandler.""" | 1624 """Overrriden from TypeHandler.""" |
| 1216 file.Write("%s %s(%s) {\n" % | 1625 file.Write("%s %s(%s) {\n" % |
| 1217 (func.return_type, func.original_name, | 1626 (func.return_type, func.original_name, |
| 1218 func.MakeTypedOriginalArgString(""))) | 1627 func.MakeTypedOriginalArgString(""))) |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1521 | 1930 |
| 1522 all_but_last_arg = func.GetOriginalArgs()[:-1] | 1931 all_but_last_arg = func.GetOriginalArgs()[:-1] |
| 1523 for arg in all_but_last_arg: | 1932 for arg in all_but_last_arg: |
| 1524 arg.WriteGetCode(file) | 1933 arg.WriteGetCode(file) |
| 1525 | 1934 |
| 1526 file.Write(" uint32 name_size = c.data_size;\n") | 1935 file.Write(" uint32 name_size = c.data_size;\n") |
| 1527 file.Write(" const char* name = GetSharedMemoryAs<%s>(\n" % | 1936 file.Write(" const char* name = GetSharedMemoryAs<%s>(\n" % |
| 1528 last_arg.type) | 1937 last_arg.type) |
| 1529 file.Write(" c.%s_shm_id, c.%s_shm_offset, name_size);\n" % | 1938 file.Write(" c.%s_shm_id, c.%s_shm_offset, name_size);\n" % |
| 1530 (last_arg.name, last_arg.name)) | 1939 (last_arg.name, last_arg.name)) |
| 1531 file.Write(" parse_error::ParseError result =\n") | 1940 func.WriteHandlerValidation(file) |
| 1532 file.Write(" Validate%s(this, immediate_data_size%s);\n" % | |
| 1533 (func.name, func.MakeOriginalArgString("", True))) | |
| 1534 file.Write(" if (result != parse_error::kParseNoError) {\n") | |
| 1535 file.Write(" return result;\n") | |
| 1536 file.Write(" }\n") | |
| 1537 arg_string = ", ".join(["%s" % arg.name for arg in all_but_last_arg]) | 1941 arg_string = ", ".join(["%s" % arg.name for arg in all_but_last_arg]) |
| 1538 file.Write(" String name_str(name, name_size);\n") | 1942 file.Write(" String name_str(name, name_size);\n") |
| 1539 file.Write(" %s(%s, name_str.c_str());\n" % | 1943 file.Write(" %s(%s, name_str.c_str());\n" % |
| 1540 (func.GetGLFunctionName(), arg_string)) | 1944 (func.GetGLFunctionName(), arg_string)) |
| 1541 file.Write(" return parse_error::kParseNoError;\n") | 1945 file.Write(" return parse_error::kParseNoError;\n") |
| 1542 file.Write("}\n") | 1946 file.Write("}\n") |
| 1543 file.Write("\n") | 1947 file.Write("\n") |
| 1544 | 1948 |
| 1545 def WriteImmediateServiceImplementation(self, func, file): | 1949 def WriteImmediateServiceImplementation(self, func, file): |
| 1546 """Overrriden from TypeHandler.""" | 1950 """Overrriden from TypeHandler.""" |
| 1547 file.Write( | 1951 file.Write( |
| 1548 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) | 1952 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) |
| 1549 file.Write( | 1953 file.Write( |
| 1550 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) | 1954 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) |
| 1551 last_arg = func.GetLastOriginalArg() | 1955 last_arg = func.GetLastOriginalArg() |
| 1552 | 1956 |
| 1553 all_but_last_arg = func.GetOriginalArgs()[:-1] | 1957 all_but_last_arg = func.GetOriginalArgs()[:-1] |
| 1554 for arg in all_but_last_arg: | 1958 for arg in all_but_last_arg: |
| 1555 arg.WriteGetCode(file) | 1959 arg.WriteGetCode(file) |
| 1556 | 1960 |
| 1557 file.Write(" uint32 name_size = c.data_size;\n") | 1961 file.Write(" uint32 name_size = c.data_size;\n") |
| 1558 file.Write( | 1962 file.Write( |
| 1559 " const char* name = GetImmediateDataAs<const char*>(c);\n") | 1963 " const char* name = GetImmediateDataAs<const char*>(c);\n") |
| 1560 file.Write(" // TODO(gman): Make sure validate checks\n") | 1964 file.Write(" // TODO(gman): Make sure validate checks\n") |
| 1561 file.Write(" // immediate_data_size covers data_size.\n") | 1965 file.Write(" // immediate_data_size covers data_size.\n") |
| 1562 file.Write(" parse_error::ParseError result =\n") | 1966 func.WriteHandlerValidation(file) |
| 1563 file.Write(" Validate%s(this, immediate_data_size%s);\n" % | |
| 1564 (func.name, func.MakeOriginalArgString("", True))) | |
| 1565 file.Write(" if (result != parse_error::kParseNoError) {\n") | |
| 1566 file.Write(" return result;\n") | |
| 1567 file.Write(" }\n") | |
| 1568 arg_string = ", ".join(["%s" % arg.name for arg in all_but_last_arg]) | 1967 arg_string = ", ".join(["%s" % arg.name for arg in all_but_last_arg]) |
| 1569 file.Write(" String name_str(name, name_size);\n") | 1968 file.Write(" String name_str(name, name_size);\n") |
| 1570 file.Write(" %s(%s, name_str.c_str());\n" % | 1969 file.Write(" %s(%s, name_str.c_str());\n" % |
| 1571 (func.GetGLFunctionName(), arg_string)) | 1970 (func.GetGLFunctionName(), arg_string)) |
| 1572 file.Write(" return parse_error::kParseNoError;\n") | 1971 file.Write(" return parse_error::kParseNoError;\n") |
| 1573 file.Write("}\n") | 1972 file.Write("}\n") |
| 1574 file.Write("\n") | 1973 file.Write("\n") |
| 1575 | 1974 |
| 1576 def WriteGLES2ImplementationHeader(self, func, file): | 1975 def WriteGLES2ImplementationHeader(self, func, file): |
| 1577 """Overrriden from TypeHandler.""" | 1976 """Overrriden from TypeHandler.""" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 | 2099 |
| 1701 file.Write(" uint32 name_size = c.data_size;\n") | 2100 file.Write(" uint32 name_size = c.data_size;\n") |
| 1702 file.Write(" const char* name = GetSharedMemoryAs<%s>(\n" % | 2101 file.Write(" const char* name = GetSharedMemoryAs<%s>(\n" % |
| 1703 last_arg.type) | 2102 last_arg.type) |
| 1704 file.Write(" c.%s_shm_id, c.%s_shm_offset, name_size);\n" % | 2103 file.Write(" c.%s_shm_id, c.%s_shm_offset, name_size);\n" % |
| 1705 (last_arg.name, last_arg.name)) | 2104 (last_arg.name, last_arg.name)) |
| 1706 file.Write(" GLint* location = GetSharedMemoryAs<GLint*>(\n") | 2105 file.Write(" GLint* location = GetSharedMemoryAs<GLint*>(\n") |
| 1707 file.Write( | 2106 file.Write( |
| 1708 " c.location_shm_id, c.location_shm_offset, sizeof(*location));\n") | 2107 " c.location_shm_id, c.location_shm_offset, sizeof(*location));\n") |
| 1709 file.Write(" // TODO(gman): Validate location.\n") | 2108 file.Write(" // TODO(gman): Validate location.\n") |
| 1710 file.Write(" parse_error::ParseError result =\n") | 2109 func.WriteHandlerValidation(file) |
| 1711 file.Write(" Validate%s(this, immediate_data_size%s);\n" % | |
| 1712 (func.name, func.MakeOriginalArgString("", True))) | |
| 1713 file.Write(" if (result != parse_error::kParseNoError) {\n") | |
| 1714 file.Write(" return result;\n") | |
| 1715 file.Write(" }\n") | |
| 1716 arg_string = ", ".join(["%s" % arg.name for arg in all_but_last_arg]) | 2110 arg_string = ", ".join(["%s" % arg.name for arg in all_but_last_arg]) |
| 1717 file.Write(" String name_str(name, name_size);\n") | 2111 file.Write(" String name_str(name, name_size);\n") |
| 1718 file.Write(" *location = %s(%s, name_str.c_str());\n" % | 2112 file.Write(" *location = %s(%s, name_str.c_str());\n" % |
| 1719 (func.GetGLFunctionName(), arg_string)) | 2113 (func.GetGLFunctionName(), arg_string)) |
| 1720 file.Write(" return parse_error::kParseNoError;\n") | 2114 file.Write(" return parse_error::kParseNoError;\n") |
| 1721 file.Write("}\n") | 2115 file.Write("}\n") |
| 1722 file.Write("\n") | 2116 file.Write("\n") |
| 1723 | 2117 |
| 1724 def WriteImmediateServiceImplementation(self, func, file): | 2118 def WriteImmediateServiceImplementation(self, func, file): |
| 1725 """Overrriden from TypeHandler.""" | 2119 """Overrriden from TypeHandler.""" |
| 1726 file.Write( | 2120 file.Write( |
| 1727 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) | 2121 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) |
| 1728 file.Write( | 2122 file.Write( |
| 1729 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) | 2123 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) |
| 1730 last_arg = func.GetLastOriginalArg() | 2124 last_arg = func.GetLastOriginalArg() |
| 1731 | 2125 |
| 1732 all_but_last_arg = func.GetOriginalArgs()[:-1] | 2126 all_but_last_arg = func.GetOriginalArgs()[:-1] |
| 1733 for arg in all_but_last_arg: | 2127 for arg in all_but_last_arg: |
| 1734 arg.WriteGetCode(file) | 2128 arg.WriteGetCode(file) |
| 1735 | 2129 |
| 1736 file.Write(" uint32 name_size = c.data_size;\n") | 2130 file.Write(" uint32 name_size = c.data_size;\n") |
| 1737 file.Write( | 2131 file.Write( |
| 1738 " const char* name = GetImmediateDataAs<const char*>(c);\n") | 2132 " const char* name = GetImmediateDataAs<const char*>(c);\n") |
| 1739 file.Write(" // TODO(gman): Make sure validate checks\n") | 2133 file.Write(" // TODO(gman): Make sure validate checks\n") |
| 1740 file.Write(" // immediate_data_size covers data_size.\n") | 2134 file.Write(" // immediate_data_size covers data_size.\n") |
| 1741 file.Write(" GLint* location = GetSharedMemoryAs<GLint*>(\n") | 2135 file.Write(" GLint* location = GetSharedMemoryAs<GLint*>(\n") |
| 1742 file.Write( | 2136 file.Write( |
| 1743 " c.location_shm_id, c.location_shm_offset, sizeof(*location));\n") | 2137 " c.location_shm_id, c.location_shm_offset, sizeof(*location));\n") |
| 1744 file.Write(" // TODO(gman): Validate location.\n") | 2138 file.Write(" // TODO(gman): Validate location.\n") |
| 1745 file.Write(" parse_error::ParseError result =\n") | 2139 func.WriteHandlerValidation(file) |
| 1746 file.Write(" Validate%s(this, immediate_data_size%s);\n" % | |
| 1747 (func.name, func.MakeOriginalArgString("", True))) | |
| 1748 file.Write(" if (result != parse_error::kParseNoError) {\n") | |
| 1749 file.Write(" return result;\n") | |
| 1750 file.Write(" }\n") | |
| 1751 arg_string = ", ".join(["%s" % arg.name for arg in all_but_last_arg]) | 2140 arg_string = ", ".join(["%s" % arg.name for arg in all_but_last_arg]) |
| 1752 file.Write(" String name_str(name, name_size);\n") | 2141 file.Write(" String name_str(name, name_size);\n") |
| 1753 file.Write(" *location = %s(%s, name_str.c_str());\n" % | 2142 file.Write(" *location = %s(%s, name_str.c_str());\n" % |
| 1754 (func.GetGLFunctionName(), arg_string)) | 2143 (func.GetGLFunctionName(), arg_string)) |
| 1755 file.Write(" return parse_error::kParseNoError;\n") | 2144 file.Write(" return parse_error::kParseNoError;\n") |
| 1756 file.Write("}\n") | 2145 file.Write("}\n") |
| 1757 file.Write("\n") | 2146 file.Write("\n") |
| 1758 | 2147 |
| 1759 def WriteGLES2ImplementationHeader(self, func, file): | 2148 def WriteGLES2ImplementationHeader(self, func, file): |
| 1760 """Overrriden from TypeHandler.""" | 2149 """Overrriden from TypeHandler.""" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1880 file.Write( | 2269 file.Write( |
| 1881 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) | 2270 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) |
| 1882 args = func.GetOriginalArgs() | 2271 args = func.GetOriginalArgs() |
| 1883 for arg in args: | 2272 for arg in args: |
| 1884 arg.WriteGetCode(file) | 2273 arg.WriteGetCode(file) |
| 1885 | 2274 |
| 1886 file.Write(" %s* result_dst = GetSharedMemoryAs<%s*>(\n" % | 2275 file.Write(" %s* result_dst = GetSharedMemoryAs<%s*>(\n" % |
| 1887 (func.return_type, func.return_type)) | 2276 (func.return_type, func.return_type)) |
| 1888 file.Write( | 2277 file.Write( |
| 1889 " c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));\n") | 2278 " c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));\n") |
| 1890 file.Write(" parse_error::ParseError result =\n") | 2279 func.WriteHandlerValidation(file) |
| 1891 file.Write(" Validate%s(this, immediate_data_size%s);\n" % | |
| 1892 (func.name, func.MakeOriginalArgString("", True))) | |
| 1893 file.Write(" if (result != parse_error::kParseNoError) {\n") | |
| 1894 file.Write(" return result;\n") | |
| 1895 file.Write(" }\n") | |
| 1896 file.Write(" *result_dst = %s(%s);\n" % | 2280 file.Write(" *result_dst = %s(%s);\n" % |
| 1897 (func.GetGLFunctionName(), func.MakeOriginalArgString(""))) | 2281 (func.GetGLFunctionName(), func.MakeOriginalArgString(""))) |
| 1898 file.Write(" return parse_error::kParseNoError;\n") | 2282 file.Write(" return parse_error::kParseNoError;\n") |
| 1899 file.Write("}\n") | 2283 file.Write("}\n") |
| 1900 file.Write("\n") | 2284 file.Write("\n") |
| 1901 | 2285 |
| 1902 def WriteGLES2ImplementationHeader(self, func, file): | 2286 def WriteGLES2ImplementationHeader(self, func, file): |
| 1903 """Overrriden from TypeHandler.""" | 2287 """Overrriden from TypeHandler.""" |
| 1904 file.Write("%s %s(%s) {\n" % | 2288 file.Write("%s %s(%s) {\n" % |
| 1905 (func.return_type, func.original_name, | 2289 (func.return_type, func.original_name, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1986 | 2370 |
| 1987 def WriteGetAddress(self, file): | 2371 def WriteGetAddress(self, file): |
| 1988 """Writes the code to get the address this argument refers to.""" | 2372 """Writes the code to get the address this argument refers to.""" |
| 1989 pass | 2373 pass |
| 1990 | 2374 |
| 1991 def GetImmediateVersion(self): | 2375 def GetImmediateVersion(self): |
| 1992 """Gets the immediate version of this argument.""" | 2376 """Gets the immediate version of this argument.""" |
| 1993 return self | 2377 return self |
| 1994 | 2378 |
| 1995 | 2379 |
| 2380 class EnumArgument(Argument): |
| 2381 """A class that represents a GLenum argument""" |
| 2382 |
| 2383 def __init__(self, name, type): |
| 2384 Argument.__init__(self, name, "GLenum") |
| 2385 |
| 2386 self.enum_type = type |
| 2387 |
| 2388 def WriteValidationCode(self, file): |
| 2389 file.Write(" if (!Validate%s(%s)) {\n" % (self.enum_type, self.name)) |
| 2390 file.Write(" SetGLError(GL_INVALID_VALUE);\n") |
| 2391 file.Write(" return parse_error::kParseNoError;\n") |
| 2392 file.Write(" }\n") |
| 2393 |
| 2394 |
| 2395 class IntArgument(Argument): |
| 2396 """A class for a GLint argument that can only except specific values. |
| 2397 |
| 2398 For example glTexImage2D takes a GLint for its internalformat |
| 2399 argument instead of a GLenum. |
| 2400 """ |
| 2401 |
| 2402 def __init__(self, name, type): |
| 2403 Argument.__init__(self, name, "GLint") |
| 2404 |
| 2405 self.int_type = type |
| 2406 |
| 2407 def WriteValidationCode(self, file): |
| 2408 file.Write(" if (!Validate%s(%s)) {\n" % (self.int_type, self.name)) |
| 2409 file.Write(" SetGLError(GL_INVALID_VALUE);\n") |
| 2410 file.Write(" return parse_error::kParseNoError;\n") |
| 2411 file.Write(" }\n") |
| 2412 |
| 2413 |
| 1996 class ImmediatePointerArgument(Argument): | 2414 class ImmediatePointerArgument(Argument): |
| 1997 """A class that represents an immediate argument to a function. | 2415 """A class that represents an immediate argument to a function. |
| 1998 | 2416 |
| 1999 An immediate argument is one where the data follows the command. | 2417 An immediate argument is one where the data follows the command. |
| 2000 """ | 2418 """ |
| 2001 | 2419 |
| 2002 def __init__(self, name, type): | 2420 def __init__(self, name, type): |
| 2003 Argument.__init__(self, name, type) | 2421 Argument.__init__(self, name, type) |
| 2004 | 2422 |
| 2005 def AddCmdArgs(self, args): | 2423 def AddCmdArgs(self, args): |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2195 ["%s %s%s" % (arg.type, prefix, arg.name) for arg in args]) | 2613 ["%s %s%s" % (arg.type, prefix, arg.name) for arg in args]) |
| 2196 return self.__GetArgList(arg_string, add_comma) | 2614 return self.__GetArgList(arg_string, add_comma) |
| 2197 | 2615 |
| 2198 def MakeInitString(self, prefix, add_comma = False): | 2616 def MakeInitString(self, prefix, add_comma = False): |
| 2199 """Gets the list of arguments as they need to be for cmd Init/Set.""" | 2617 """Gets the list of arguments as they need to be for cmd Init/Set.""" |
| 2200 args = self.GetInitArgs() | 2618 args = self.GetInitArgs() |
| 2201 arg_string = ", ".join( | 2619 arg_string = ", ".join( |
| 2202 ["%s%s" % (prefix, arg.name) for arg in args]) | 2620 ["%s%s" % (prefix, arg.name) for arg in args]) |
| 2203 return self.__GetArgList(arg_string, add_comma) | 2621 return self.__GetArgList(arg_string, add_comma) |
| 2204 | 2622 |
| 2623 def WriteHandlerValidation(self, file): |
| 2624 """Writes validation code for the function.""" |
| 2625 for arg in self.GetOriginalArgs(): |
| 2626 arg.WriteValidationCode(file) |
| 2627 self.WriteValidationCode(file) |
| 2628 |
| 2205 def WriteHandlerImplementation(self, file): | 2629 def WriteHandlerImplementation(self, file): |
| 2206 """Writes the handler implementation for this command.""" | 2630 """Writes the handler implementation for this command.""" |
| 2207 self.type_handler.WriteHandlerImplementation(self, file) | 2631 self.type_handler.WriteHandlerImplementation(self, file) |
| 2208 | 2632 |
| 2209 def WriteValidationCode(self, file): | 2633 def WriteValidationCode(self, file): |
| 2210 """Writes the validation code for a command.""" | 2634 """Writes the validation code for a command.""" |
| 2211 pass | 2635 pass |
| 2212 | 2636 |
| 2213 def WriteCmdArgFlag(self, file): | 2637 def WriteCmdArgFlag(self, file): |
| 2214 """Writes the cmd kArgFlags constant.""" | 2638 """Writes the cmd kArgFlags constant.""" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2361 " ".join(arg_parts[1:-1])) | 2785 " ".join(arg_parts[1:-1])) |
| 2362 else: | 2786 else: |
| 2363 return PointerArgument( | 2787 return PointerArgument( |
| 2364 arg_parts[-1], | 2788 arg_parts[-1], |
| 2365 " ".join(arg_parts[0:-1])) | 2789 " ".join(arg_parts[0:-1])) |
| 2366 # Is this a resource argument? Must come after pointer check. | 2790 # Is this a resource argument? Must come after pointer check. |
| 2367 elif arg_parts[0] == 'GLResourceId': | 2791 elif arg_parts[0] == 'GLResourceId': |
| 2368 return ResourceIdArgument( | 2792 return ResourceIdArgument( |
| 2369 arg_parts[-1], | 2793 arg_parts[-1], |
| 2370 " ".join(arg_parts[0:-1])) | 2794 " ".join(arg_parts[0:-1])) |
| 2795 elif arg_parts[0].startswith('GLenum') and len(arg_parts[0]) > 6: |
| 2796 return EnumArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) |
| 2797 elif (arg_parts[0].startswith('GLint') and len(arg_parts[0]) > 5 and |
| 2798 arg_parts[0] != "GLintptr"): |
| 2799 return IntArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) |
| 2371 else: | 2800 else: |
| 2372 return Argument( | 2801 return Argument(arg_parts[-1], " ".join(arg_parts[0:-1])) |
| 2373 arg_parts[-1], | |
| 2374 " ".join(arg_parts[0:-1])) | |
| 2375 | 2802 |
| 2376 | 2803 |
| 2377 class GLGenerator(object): | 2804 class GLGenerator(object): |
| 2378 """A class to generate GL command buffers.""" | 2805 """A class to generate GL command buffers.""" |
| 2379 | 2806 |
| 2380 _function_re = re.compile(r'GL_APICALL(.*?)GL_APIENTRY (.*?) \((.*?)\);') | 2807 _function_re = re.compile(r'GL_APICALL(.*?)GL_APIENTRY (.*?) \((.*?)\);') |
| 2381 _non_alnum_re = re.compile(r'[^a-zA-Z0-9]') | 2808 _non_alnum_re = re.compile(r'[^a-zA-Z0-9]') |
| 2382 | 2809 |
| 2383 def __init__(self, verbose): | 2810 def __init__(self, verbose): |
| 2384 self.original_functions = [] | 2811 self.original_functions = [] |
| 2385 self.functions = [] | 2812 self.functions = [] |
| 2386 self.verbose = verbose | 2813 self.verbose = verbose |
| 2814 self.errors = 0 |
| 2387 self._function_info = {} | 2815 self._function_info = {} |
| 2388 self._empty_type_handler = TypeHandler() | 2816 self._empty_type_handler = TypeHandler() |
| 2389 self._empty_function_info = FunctionInfo({}, self._empty_type_handler) | 2817 self._empty_function_info = FunctionInfo({}, self._empty_type_handler) |
| 2390 | 2818 |
| 2391 self._type_handlers = { | 2819 self._type_handlers = { |
| 2392 'Create': CreateHandler(), | 2820 'Create': CreateHandler(), |
| 2393 'Custom': CustomHandler(), | 2821 'Custom': CustomHandler(), |
| 2394 'Data': DataHandler(), | 2822 'Data': DataHandler(), |
| 2395 'DELn': DELnHandler(), | 2823 'DELn': DELnHandler(), |
| 2396 'GENn': GENnHandler(), | 2824 'GENn': GENnHandler(), |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2428 """Gets a type info for the given function name.""" | 2856 """Gets a type info for the given function name.""" |
| 2429 if name in self._function_info: | 2857 if name in self._function_info: |
| 2430 return self._function_info[name] | 2858 return self._function_info[name] |
| 2431 return self._empty_function_info | 2859 return self._empty_function_info |
| 2432 | 2860 |
| 2433 def Log(self, msg): | 2861 def Log(self, msg): |
| 2434 """Prints something if verbose is true.""" | 2862 """Prints something if verbose is true.""" |
| 2435 if self.verbose: | 2863 if self.verbose: |
| 2436 print msg | 2864 print msg |
| 2437 | 2865 |
| 2866 def Error(self, msg): |
| 2867 """Prints an error.""" |
| 2868 print "Error: %s" % msg |
| 2869 self.errors += 1 |
| 2870 |
| 2438 def WriteHeader(self, file): | 2871 def WriteHeader(self, file): |
| 2439 """Writes header to file""" | 2872 """Writes header to file""" |
| 2440 file.Write( | 2873 file.Write( |
| 2441 "// This file is auto-generated. DO NOT EDIT!\n" | 2874 "// This file is auto-generated. DO NOT EDIT!\n" |
| 2442 "\n") | 2875 "\n") |
| 2443 | 2876 |
| 2444 def WriteLicense(self, file): | 2877 def WriteLicense(self, file): |
| 2445 """Writes the license.""" | 2878 """Writes the license.""" |
| 2446 file.Write(_LICENSE) | 2879 file.Write(_LICENSE) |
| 2447 | 2880 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2462 base = os.path.dirname(os.path.dirname(os.path.dirname( | 2895 base = os.path.dirname(os.path.dirname(os.path.dirname( |
| 2463 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))) | 2896 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))) |
| 2464 hpath = os.path.abspath(filename)[len(base) + 1:] | 2897 hpath = os.path.abspath(filename)[len(base) + 1:] |
| 2465 return self._non_alnum_re.sub('_', hpath).upper() | 2898 return self._non_alnum_re.sub('_', hpath).upper() |
| 2466 | 2899 |
| 2467 def ParseArgs(self, arg_string): | 2900 def ParseArgs(self, arg_string): |
| 2468 """Parses a function arg string.""" | 2901 """Parses a function arg string.""" |
| 2469 args = [] | 2902 args = [] |
| 2470 num_pointer_args = 0 | 2903 num_pointer_args = 0 |
| 2471 parts = arg_string.split(',') | 2904 parts = arg_string.split(',') |
| 2905 is_gl_enum = False |
| 2472 for arg_string in parts: | 2906 for arg_string in parts: |
| 2907 if arg_string.startswith('GLenum '): |
| 2908 is_gl_enum = True |
| 2473 arg = CreateArg(arg_string) | 2909 arg = CreateArg(arg_string) |
| 2474 if arg: | 2910 if arg: |
| 2475 args.append(arg) | 2911 args.append(arg) |
| 2476 if arg.IsPointer(): | 2912 if arg.IsPointer(): |
| 2477 num_pointer_args += 1 | 2913 num_pointer_args += 1 |
| 2478 return (args, num_pointer_args) | 2914 return (args, num_pointer_args, is_gl_enum) |
| 2479 | 2915 |
| 2480 def ParseGLH(self, filename): | 2916 def ParseGLH(self, filename): |
| 2481 """Parses the GL2.h file and extracts the functions""" | 2917 """Parses the GL2.h file and extracts the functions""" |
| 2482 for line in _GL_FUNCTIONS.splitlines(): | 2918 for line in _GL_FUNCTIONS.splitlines(): |
| 2483 match = self._function_re.match(line) | 2919 match = self._function_re.match(line) |
| 2484 if match: | 2920 if match: |
| 2485 func_name = match.group(2)[2:] | 2921 func_name = match.group(2)[2:] |
| 2486 func_info = self.GetFunctionInfo(func_name) | 2922 func_info = self.GetFunctionInfo(func_name) |
| 2487 if func_info.type != 'Noop': | 2923 if func_info.type != 'Noop': |
| 2488 return_type = match.group(1).strip() | 2924 return_type = match.group(1).strip() |
| 2489 arg_string = match.group(3) | 2925 arg_string = match.group(3) |
| 2490 (args, num_pointer_args) = self.ParseArgs(arg_string) | 2926 (args, num_pointer_args, is_gl_enum) = self.ParseArgs(arg_string) |
| 2927 if is_gl_enum: |
| 2928 self.Log("%s uses bare GLenum" % func_name) |
| 2491 args_for_cmds = args | 2929 args_for_cmds = args |
| 2492 if hasattr(func_info, 'cmd_args'): | 2930 if hasattr(func_info, 'cmd_args'): |
| 2493 (args_for_cmds, num_pointer_args) = ( | 2931 (args_for_cmds, num_pointer_args, is_gl_enum) = ( |
| 2494 self.ParseArgs(getattr(func_info, 'cmd_args'))) | 2932 self.ParseArgs(getattr(func_info, 'cmd_args'))) |
| 2495 cmd_args = [] | 2933 cmd_args = [] |
| 2496 for arg in args_for_cmds: | 2934 for arg in args_for_cmds: |
| 2497 arg.AddCmdArgs(cmd_args) | 2935 arg.AddCmdArgs(cmd_args) |
| 2498 init_args = [] | 2936 init_args = [] |
| 2499 for arg in args_for_cmds: | 2937 for arg in args_for_cmds: |
| 2500 arg.AddInitArgs(init_args) | 2938 arg.AddInitArgs(init_args) |
| 2501 return_arg = CreateArg(return_type + " result") | 2939 return_arg = CreateArg(return_type + " result") |
| 2502 if return_arg: | 2940 if return_arg: |
| 2503 init_args.append(return_arg) | 2941 init_args.append(return_arg) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2517 self.Log("Non Auto Generated Functions: %d" % len(funcs)) | 2955 self.Log("Non Auto Generated Functions: %d" % len(funcs)) |
| 2518 | 2956 |
| 2519 for f in funcs: | 2957 for f in funcs: |
| 2520 self.Log(" %-10s %-20s gl%s" % (f.info.type, f.return_type, f.name)) | 2958 self.Log(" %-10s %-20s gl%s" % (f.info.type, f.return_type, f.name)) |
| 2521 | 2959 |
| 2522 def WriteCommandIds(self, filename): | 2960 def WriteCommandIds(self, filename): |
| 2523 """Writes the command buffer format""" | 2961 """Writes the command buffer format""" |
| 2524 file = CWriter(filename) | 2962 file = CWriter(filename) |
| 2525 self.WriteHeader(file) | 2963 self.WriteHeader(file) |
| 2526 file.Write("#define GLES2_COMMAND_LIST(OP) \\\n") | 2964 file.Write("#define GLES2_COMMAND_LIST(OP) \\\n") |
| 2527 command_id = _FIRST_SPECIFIC_COMMAND_ID | |
| 2528 for func in self.functions: | 2965 for func in self.functions: |
| 2529 file.Write(" %-60s /* %d */ \\\n" % ("OP(%s)" % func.name, command_id)) | 2966 if not func.name in _CMD_ID_TABLE: |
| 2530 command_id += 1 | 2967 self.Error("Command %s not in _CMD_ID_TABLE" % func.name) |
| 2968 file.Write(" %-60s /* %d */ \\\n" % |
| 2969 ("OP(%s)" % func.name, _CMD_ID_TABLE[func.name])) |
| 2531 file.Write("\n") | 2970 file.Write("\n") |
| 2532 | 2971 |
| 2533 file.Write("enum CommandId {\n") | 2972 file.Write("enum CommandId {\n") |
| 2534 file.Write(" kStartPoint = cmd::kLastCommonId, " | 2973 file.Write(" kStartPoint = cmd::kLastCommonId, " |
| 2535 "// All GLES2 commands start after this.\n") | 2974 "// All GLES2 commands start after this.\n") |
| 2536 file.Write("#define GLES2_CMD_OP(name) k ## name,\n") | 2975 file.Write("#define GLES2_CMD_OP(name) k ## name,\n") |
| 2537 file.Write(" GLES2_COMMAND_LIST(GLES2_CMD_OP)\n") | 2976 file.Write(" GLES2_COMMAND_LIST(GLES2_CMD_OP)\n") |
| 2538 file.Write("#undef GLES2_CMD_OP\n") | 2977 file.Write("#undef GLES2_CMD_OP\n") |
| 2539 file.Write(" kNumCommands\n") | 2978 file.Write(" kNumCommands\n") |
| 2540 file.Write("};\n") | 2979 file.Write("};\n") |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2564 file.Write("\n") | 3003 file.Write("\n") |
| 2565 | 3004 |
| 2566 for func in self.functions: | 3005 for func in self.functions: |
| 2567 func.WriteFormatTest(file) | 3006 func.WriteFormatTest(file) |
| 2568 | 3007 |
| 2569 file.Close() | 3008 file.Close() |
| 2570 | 3009 |
| 2571 def WriteCommandIdTest(self, filename): | 3010 def WriteCommandIdTest(self, filename): |
| 2572 """Writes the command id test.""" | 3011 """Writes the command id test.""" |
| 2573 file = CWriter(filename) | 3012 file = CWriter(filename) |
| 2574 self.WriteLicense(file) | |
| 2575 file.Write("// This file contains unit tests for gles2 commmand ids\n") | 3013 file.Write("// This file contains unit tests for gles2 commmand ids\n") |
| 2576 file.Write("\n") | 3014 file.Write("\n") |
| 2577 file.Write("#include \"tests/common/win/testing_common.h\"\n") | |
| 2578 file.Write("#include \"gpu/command_buffer/common/gles2_cmd_format.h\"\n") | |
| 2579 file.Write("\n") | |
| 2580 | |
| 2581 self.WriteNamespaceOpen(file) | |
| 2582 | 3015 |
| 2583 file.Write("// *** These IDs MUST NOT CHANGE!!! ***\n") | 3016 file.Write("// *** These IDs MUST NOT CHANGE!!! ***\n") |
| 2584 file.Write("// Changing them will break all client programs.\n") | 3017 file.Write("// Changing them will break all client programs.\n") |
| 2585 file.Write("TEST(GLES2CommandIdTest, CommandIdsMatch) {\n") | 3018 file.Write("TEST(GLES2CommandIdTest, CommandIdsMatch) {\n") |
| 2586 command_id = _FIRST_SPECIFIC_COMMAND_ID | |
| 2587 for func in self.functions: | 3019 for func in self.functions: |
| 3020 if not func.name in _CMD_ID_TABLE: |
| 3021 self.Error("Command %s not in _CMD_ID_TABLE" % func.name) |
| 2588 file.Write(" COMPILE_ASSERT(%s::kCmdId == %d,\n" % | 3022 file.Write(" COMPILE_ASSERT(%s::kCmdId == %d,\n" % |
| 2589 (func.name, command_id)) | 3023 (func.name, _CMD_ID_TABLE[func.name])) |
| 2590 file.Write(" GLES2_%s_kCmdId_mismatch);\n" % func.name) | 3024 file.Write(" GLES2_%s_kCmdId_mismatch);\n" % func.name) |
| 2591 command_id += 1 | |
| 2592 | 3025 |
| 2593 file.Write("}\n") | 3026 file.Write("}\n") |
| 2594 | 3027 file.Write("\n") |
| 2595 self.WriteNamespaceClose(file) | |
| 2596 | |
| 2597 file.Close() | 3028 file.Close() |
| 2598 | 3029 |
| 2599 def WriteCmdHelperHeader(self, filename): | 3030 def WriteCmdHelperHeader(self, filename): |
| 2600 """Writes the gles2 command helper.""" | 3031 """Writes the gles2 command helper.""" |
| 2601 file = CWriter(filename) | 3032 file = CWriter(filename) |
| 2602 | 3033 |
| 2603 for func in self.functions: | 3034 for func in self.functions: |
| 2604 func.WriteCmdHelper(file) | 3035 func.WriteCmdHelper(file) |
| 2605 | 3036 |
| 2606 file.Close() | 3037 file.Close() |
| 2607 | 3038 |
| 2608 def WriteServiceImplementation(self, filename): | 3039 def WriteServiceImplementation(self, filename): |
| 2609 """Writes the service decorder implementation.""" | 3040 """Writes the service decorder implementation.""" |
| 2610 file = CWriter(filename) | 3041 file = CWriter(filename) |
| 2611 self.WriteHeader(file) | 3042 self.WriteHeader(file) |
| 2612 file.Write("// It is included by gles2_cmd_decoder.cc\n") | 3043 file.Write("// It is included by gles2_cmd_decoder.cc\n") |
| 2613 file.Write("\n") | 3044 file.Write("\n") |
| 2614 | 3045 |
| 2615 for func in self.functions: | 3046 for func in self.functions: |
| 2616 func.WriteServiceImplementation(file) | 3047 func.WriteServiceImplementation(file) |
| 2617 | 3048 |
| 2618 file.Close() | 3049 file.Close() |
| 2619 | 3050 |
| 2620 def WriteServiceValidation(self, filename): | |
| 2621 file = CWriter(filename) | |
| 2622 self.WriteLicense(file) | |
| 2623 file.Write("\n") | |
| 2624 self.WriteNamespaceOpen(file) | |
| 2625 file.Write("namespace {\n") | |
| 2626 file.Write("\n") | |
| 2627 for func in self.functions: | |
| 2628 file.Write("parse_error::ParseError Validate%s(\n" % func.name) | |
| 2629 file.Write( | |
| 2630 " GLES2Decoder* decoder, uint32 immediate_data_size%s) {\n" % | |
| 2631 func.MakeTypedOriginalArgString("", True)) | |
| 2632 for arg in func.GetOriginalArgs(): | |
| 2633 arg.WriteValidationCode(file) | |
| 2634 func.WriteValidationCode(file) | |
| 2635 file.Write(" return parse_error::kParseNoError;\n") | |
| 2636 file.Write("}\n") | |
| 2637 file.Write("} // anonymous namespace\n") | |
| 2638 self.WriteNamespaceClose(file) | |
| 2639 file.Close() | |
| 2640 | |
| 2641 def WriteGLES2CLibImplementation(self, filename): | 3051 def WriteGLES2CLibImplementation(self, filename): |
| 2642 """Writes the GLES2 c lib implementation.""" | 3052 """Writes the GLES2 c lib implementation.""" |
| 2643 file = CWriter(filename) | 3053 file = CWriter(filename) |
| 2644 self.WriteHeader(file) | 3054 self.WriteHeader(file) |
| 2645 file.Write("\n") | 3055 file.Write("\n") |
| 2646 file.Write("// These functions emluate GLES2 over command buffers.\n") | 3056 file.Write("// These functions emluate GLES2 over command buffers.\n") |
| 2647 file.Write("\n") | 3057 file.Write("\n") |
| 2648 file.Write("\n") | 3058 file.Write("\n") |
| 2649 | 3059 |
| 2650 for func in self.original_functions: | 3060 for func in self.original_functions: |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2685 "#include \"gpu/command_buffer/client/gles2_implementation.h\"\n") | 3095 "#include \"gpu/command_buffer/client/gles2_implementation.h\"\n") |
| 2686 file.Write("\n") | 3096 file.Write("\n") |
| 2687 self.WriteNamespaceOpen(file) | 3097 self.WriteNamespaceOpen(file) |
| 2688 for func in self.original_functions: | 3098 for func in self.original_functions: |
| 2689 func.WriteGLES2ImplementationImpl(file) | 3099 func.WriteGLES2ImplementationImpl(file) |
| 2690 file.Write("\n") | 3100 file.Write("\n") |
| 2691 | 3101 |
| 2692 self.WriteNamespaceClose(file) | 3102 self.WriteNamespaceClose(file) |
| 2693 file.Close() | 3103 file.Close() |
| 2694 | 3104 |
| 3105 def WriteServiceUtilsHeader(self, filename): |
| 3106 """Writes the gles2 auto generated utility header.""" |
| 3107 file = CWriter(filename) |
| 3108 self.WriteHeader(file) |
| 3109 file.Write("\n") |
| 3110 for enum in _ENUM_LISTS: |
| 3111 file.Write("bool ValidateGLenum%s(GLenum value);\n" % enum) |
| 3112 file.Write("\n") |
| 3113 file.Close() |
| 3114 |
| 3115 def WriteServiceUtilsImplementation(self, filename): |
| 3116 """Writes the gles2 auto generated utility implementation.""" |
| 3117 file = CWriter(filename) |
| 3118 self.WriteHeader(file) |
| 3119 file.Write("\n") |
| 3120 for enum in _ENUM_LISTS: |
| 3121 file.Write("bool ValidateGLenum%s(GLenum value) {\n" % enum) |
| 3122 file.Write(" switch (value) {\n") |
| 3123 for value in _ENUM_LISTS[enum]: |
| 3124 file.Write(" case %s:\n" % value) |
| 3125 file.Write(" return true;\n") |
| 3126 file.Write(" default:\n") |
| 3127 file.Write(" return false;\n") |
| 3128 file.Write(" }\n") |
| 3129 file.Write("}\n") |
| 3130 file.Write("\n") |
| 3131 file.Close() |
| 3132 |
| 2695 | 3133 |
| 2696 def main(argv): | 3134 def main(argv): |
| 2697 """This is the main function.""" | 3135 """This is the main function.""" |
| 2698 parser = OptionParser() | 3136 parser = OptionParser() |
| 2699 parser.add_option( | 3137 parser.add_option( |
| 2700 "-g", "--generate-implementation-templates", action="store_true", | 3138 "-g", "--generate-implementation-templates", action="store_true", |
| 2701 help="generates files that are generally hand edited..") | 3139 help="generates files that are generally hand edited..") |
| 2702 parser.add_option( | 3140 parser.add_option( |
| 2703 "--generate-command-id-tests", action="store_true", | 3141 "--generate-command-id-tests", action="store_true", |
| 2704 help="generate tests for commands ids. Commands MUST not change ID!") | 3142 help="generate tests for commands ids. Commands MUST not change ID!") |
| 2705 parser.add_option( | 3143 parser.add_option( |
| 2706 "-v", "--verbose", action="store_true", | 3144 "-v", "--verbose", action="store_true", |
| 2707 help="prints more output.") | 3145 help="prints more output.") |
| 2708 | 3146 |
| 2709 (options, args) = parser.parse_args(args=argv) | 3147 (options, args) = parser.parse_args(args=argv) |
| 2710 | 3148 |
| 2711 gen = GLGenerator(options.verbose) | 3149 gen = GLGenerator(options.verbose) |
| 2712 gen.ParseGLH("common/GLES2/gl2.h") | 3150 gen.ParseGLH("common/GLES2/gl2.h") |
| 2713 gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") | 3151 gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") |
| 2714 gen.WriteFormat("common/gles2_cmd_format_autogen.h") | 3152 gen.WriteFormat("common/gles2_cmd_format_autogen.h") |
| 2715 gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") | 3153 gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") |
| 2716 gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") | 3154 gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") |
| 2717 gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") | 3155 gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") |
| 2718 gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") | 3156 gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") |
| 2719 gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") | 3157 gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") |
| 3158 gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") |
| 3159 gen.WriteServiceUtilsImplementation( |
| 3160 "service/gles2_cmd_validation_implementation_autogen.h") |
| 2720 | 3161 |
| 2721 if options.generate_implementation_templates: | 3162 if options.generate_implementation_templates: |
| 2722 gen.WriteGLES2ImplementationImpl("client/gles2_implementation_gen.h") | 3163 gen.WriteGLES2ImplementationImpl("client/gles2_implementation_gen.h") |
| 2723 gen.WriteServiceValidation("service/gles2_cmd_decoder_validate.h") | |
| 2724 | 3164 |
| 2725 if options.generate_command_id_tests: | 3165 if options.generate_command_id_tests: |
| 2726 gen.WriteCommandIdTest("common/gles2_cmd_id_test.cc") | 3166 gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") |
| 2727 | 3167 |
| 3168 if gen.errors > 0: |
| 3169 print "%d errors" % gen.errors |
| 3170 sys.exit(1) |
| 2728 | 3171 |
| 2729 if __name__ == '__main__': | 3172 if __name__ == '__main__': |
| 2730 main(sys.argv[1:]) | 3173 main(sys.argv[1:]) |
| OLD | NEW |