Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: gpu/command_buffer/build_gles2_cmd_buffer.py

Issue 521018: A bunch of unit tests for GLES2 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | gpu/command_buffer/client/gles2_c_lib_autogen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 = """// 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 20 // Use of this source code is governed by a BSD-style license that can be
22 // found in the LICENSE file. 21 // found in the LICENSE file.
23 22
24 """ 23 """
25 24
26 # This string is copied directly out of the gl2.h file from GLES2.0 25 # This string is copied directly out of the gl2.h file from GLES2.0
27 # 26 #
28 # Edits: 27 # Edits:
29 # 28 #
30 # *) Any argument that is a resourceID has been changed to GLresourceID. 29 # *) Any argument that is a resourceID has been changed to GLid<Type>.
31 # (not pointer arguments) 30 # (not pointer arguments)
32 # 31 #
33 # *) All GLenums have been changed to GLenumTypeOfEnum 32 # *) All GLenums have been changed to GLenumTypeOfEnum
34 # 33 #
35 _GL_FUNCTIONS = """ 34 _GL_FUNCTIONS = """
36 GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); 35 GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
37 GL_APICALL void GL_APIENTRY glAttachShader (GLResourceId program, GLReso urceId shader); 36 GL_APICALL void GL_APIENTRY glAttachShader (GLidProgram program, GLidSha der shader);
38 GL_APICALL void GL_APIENTRY glBindAttribLocation (GLResourceId program, GLuint index, const char* name); 37 GL_APICALL void GL_APIENTRY glBindAttribLocation (GLidProgram program, G Luint index, const char* name);
39 GL_APICALL void GL_APIENTRY glBindBuffer (GLenumBufferTarget target, GLR esourceId buffer); 38 GL_APICALL void GL_APIENTRY glBindBuffer (GLenumBufferTarget target, GLi dBuffer buffer);
40 GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenumFrameBufferTarget t arget, GLResourceId framebuffer); 39 GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenumFrameBufferTarget t arget, GLidFramebuffer framebuffer);
41 GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenumRenderBufferTarget target, GLResourceId renderbuffer); 40 GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenumRenderBufferTarget target, GLidRenderbuffer renderbuffer);
42 GL_APICALL void GL_APIENTRY glBindTexture (GLenumTextureBindTarget targe t, GLResourceId texture); 41 GL_APICALL void GL_APIENTRY glBindTexture (GLenumTextureBindTarget targe t, GLidTexture texture);
43 GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); 42 GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
44 GL_APICALL void GL_APIENTRY glBlendEquation ( GLenumEquation mode ); 43 GL_APICALL void GL_APIENTRY glBlendEquation ( GLenumEquation mode );
45 GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenumEquation mode RGB, GLenumEquation modeAlpha); 44 GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenumEquation mode RGB, GLenumEquation modeAlpha);
46 GL_APICALL void GL_APIENTRY glBlendFunc (GLenumSrcBlendFactor sfactor, G LenumDstBlendFactor dfactor); 45 GL_APICALL void GL_APIENTRY glBlendFunc (GLenumSrcBlendFactor sfactor, G LenumDstBlendFactor dfactor);
47 GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenumSrcBlendFactor sr cRGB, GLenumDstBlendFactor dstRGB, GLenumSrcBlendFactor srcAlpha, GLenumDstBlend Factor dstAlpha); 46 GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenumSrcBlendFactor sr cRGB, GLenumDstBlendFactor dstRGB, GLenumSrcBlendFactor srcAlpha, GLenumDstBlend Factor dstAlpha);
48 GL_APICALL void GL_APIENTRY glBufferData (GLenumBufferTarget target, GLs izeiptr size, const void* data, GLenumBufferUsage usage); 47 GL_APICALL void GL_APIENTRY glBufferData (GLenumBufferTarget target, GLs izeiptr size, const void* data, GLenumBufferUsage usage);
49 GL_APICALL void GL_APIENTRY glBufferSubData (GLenumBufferTarget target, GLintptr offset, GLsizeiptr size, const void* data); 48 GL_APICALL void GL_APIENTRY glBufferSubData (GLenumBufferTarget target, GLintptr offset, GLsizeiptr size, const void* data);
50 GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenumFrameBufferT arget target); 49 GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenumFrameBufferT arget target);
51 GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); 50 GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
52 GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); 51 GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
53 GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth); 52 GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth);
54 GL_APICALL void GL_APIENTRY glClearStencil (GLint s); 53 GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
55 GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); 54 GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
56 GL_APICALL void GL_APIENTRY glCompileShader (GLResourceId shader); 55 GL_APICALL void GL_APIENTRY glCompileShader (GLidShader shader);
57 GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenumTextureTarget target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data); 56 GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenumTextureTarget target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, 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); 57 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);
59 GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenumTextureTarget target , GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei h eight, GLint border); 58 GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenumTextureTarget target , GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei h eight, GLint border);
60 GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenumTextureTarget tar get, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); 59 GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenumTextureTarget tar get, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
61 GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); 60 GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
62 GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenumShaderType type); 61 GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenumShaderType type);
63 GL_APICALL void GL_APIENTRY glCullFace (GLenumFaceType mode); 62 GL_APICALL void GL_APIENTRY glCullFace (GLenumFaceType mode);
64 GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* bu ffers); 63 GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* bu ffers);
65 GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuin t* framebuffers); 64 GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuin t* framebuffers);
66 GL_APICALL void GL_APIENTRY glDeleteProgram (GLResourceId program); 65 GL_APICALL void GL_APIENTRY glDeleteProgram (GLidProgram program);
67 GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLui nt* renderbuffers); 66 GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLui nt* renderbuffers);
68 GL_APICALL void GL_APIENTRY glDeleteShader (GLResourceId shader); 67 GL_APICALL void GL_APIENTRY glDeleteShader (GLidShader shader);
69 GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* t extures); 68 GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* t extures);
70 GL_APICALL void GL_APIENTRY glDepthFunc (GLenumCmpFunction func); 69 GL_APICALL void GL_APIENTRY glDepthFunc (GLenumCmpFunction func);
71 GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); 70 GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
72 GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar ); 71 GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar );
73 GL_APICALL void GL_APIENTRY glDetachShader (GLResourceId program, GLReso urceId shader); 72 GL_APICALL void GL_APIENTRY glDetachShader (GLidProgram program, GLidSha der shader);
74 GL_APICALL void GL_APIENTRY glDisable (GLenumCapability cap); 73 GL_APICALL void GL_APIENTRY glDisable (GLenumCapability cap);
75 GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); 74 GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
76 GL_APICALL void GL_APIENTRY glDrawArrays (GLenumDrawMode mode, GLint fir st, GLsizei count); 75 GL_APICALL void GL_APIENTRY glDrawArrays (GLenumDrawMode mode, GLint fir st, GLsizei count);
77 GL_APICALL void GL_APIENTRY glDrawElements (GLenumDrawMode mode, GLsizei count, GLenumIndexType type, const void* indices); 76 GL_APICALL void GL_APIENTRY glDrawElements (GLenumDrawMode mode, GLsizei count, GLenumIndexType type, const void* indices);
78 GL_APICALL void GL_APIENTRY glEnable (GLenumCapability cap); 77 GL_APICALL void GL_APIENTRY glEnable (GLenumCapability cap);
79 GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); 78 GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
80 GL_APICALL void GL_APIENTRY glFinish (void); 79 GL_APICALL void GL_APIENTRY glFinish (void);
81 GL_APICALL void GL_APIENTRY glFlush (void); 80 GL_APICALL void GL_APIENTRY glFlush (void);
82 GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenumFrameBuffer Target target, GLenumAttachment attachment, GLenumRenderBufferTarget renderbuffe rtarget, GLResourceId renderbuffer); 81 GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenumFrameBuffer Target target, GLenumAttachment attachment, GLenumRenderBufferTarget renderbuffe rtarget, GLidRenderbuffer renderbuffer);
83 GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenumFrameBufferTar get target, GLenumAttachment attachment, GLenumTextureTarget textarget, GLResour ceId texture, GLint level); 82 GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenumFrameBufferTar get target, GLenumAttachment attachment, GLenumTextureTarget textarget, GLidText ure texture, GLint level);
84 GL_APICALL void GL_APIENTRY glFrontFace (GLenumFaceMode mode); 83 GL_APICALL void GL_APIENTRY glFrontFace (GLenumFaceMode mode);
85 GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); 84 GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
86 GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenumTextureBindTarget ta rget); 85 GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenumTextureBindTarget ta rget);
87 GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* frameb uffers); 86 GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* frameb uffers);
88 GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* rende rbuffers); 87 GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* rende rbuffers);
89 GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); 88 GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
90 GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLResourceId program, GLu int index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* na me); 89 GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLidProgram program, GLui nt index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* nam e);
91 GL_APICALL void GL_APIENTRY glGetActiveUniform (GLResourceId program, GL uint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* n ame); 90 GL_APICALL void GL_APIENTRY glGetActiveUniform (GLidProgram program, GLu int index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* na me);
92 GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLResourceId program, GLsizei maxcount, GLsizei* count, GLuint* shaders); 91 GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLidProgram program, G Lsizei maxcount, GLsizei* count, GLuint* shaders);
93 GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLResourceId program, c onst char* name); 92 GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLidProgram program, co nst char* name);
94 GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* para ms); 93 GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* para ms);
95 GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenumBufferTarget t arget, GLenumBufferParameter pname, GLint* params); 94 GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenumBufferTarget t arget, GLenumBufferParameter pname, GLint* params);
96 GL_APICALL GLenum GL_APIENTRY glGetError (void); 95 GL_APICALL GLenum GL_APIENTRY glGetError (void);
97 GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); 96 GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
98 GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenu mFrameBufferTarget target, GLenumAttachment attachment, GLenumFrameBufferParamet er pname, GLint* params); 97 GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenu mFrameBufferTarget target, GLenumAttachment attachment, GLenumFrameBufferParamet er pname, GLint* params);
99 GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); 98 GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
100 GL_APICALL void GL_APIENTRY glGetProgramiv (GLResourceId program, GLenum ProgramParameter pname, GLint* params); 99 GL_APICALL void GL_APIENTRY glGetProgramiv (GLidProgram program, GLenumP rogramParameter pname, GLint* params);
101 GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLResourceId program, G Lsizei bufsize, GLsizei* length, char* infolog); 100 GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLidProgram program, GL sizei bufsize, GLsizei* length, char* infolog);
102 GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenumRenderBu fferTarget target, GLenumRenderBufferParameter pname, GLint* params); 101 GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenumRenderBu fferTarget target, GLenumRenderBufferParameter pname, GLint* params);
103 GL_APICALL void GL_APIENTRY glGetShaderiv (GLResourceId shader, GLenumSh aderParameter pname, GLint* params); 102 GL_APICALL void GL_APIENTRY glGetShaderiv (GLidShader shader, GLenumShad erParameter pname, GLint* params);
104 GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLResourceId shader, GLs izei bufsize, GLsizei* length, char* infolog); 103 GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLidShader shader, GLsiz ei bufsize, GLsizei* length, char* infolog);
105 GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenumShaderType shadertype, GLenumShaderPercision precisiontype, GLint* range, GLint* precision ); 104 GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenumShaderType shadertype, GLenumShaderPercision precisiontype, GLint* range, GLint* precision );
106 GL_APICALL void GL_APIENTRY glGetShaderSource (GLResourceId shader, GLsi zei bufsize, GLsizei* length, char* source); 105 GL_APICALL void GL_APIENTRY glGetShaderSource (GLidShader shader, GLsize i bufsize, GLsizei* length, char* source);
107 GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenumStringType name); 106 GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenumStringType name);
108 GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenumTextureTarget tar get, GLenumTextureParameter pname, GLfloat* params); 107 GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenumTextureTarget tar get, GLenumTextureParameter pname, GLfloat* params);
109 GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenumTextureTarget tar get, GLenumTextureParameter pname, GLint* params); 108 GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenumTextureTarget tar get, GLenumTextureParameter pname, GLint* params);
110 GL_APICALL void GL_APIENTRY glGetUniformfv (GLResourceId program, GLint location, GLfloat* params); 109 GL_APICALL void GL_APIENTRY glGetUniformfv (GLidProgram program, GLint l ocation, GLfloat* params);
111 GL_APICALL void GL_APIENTRY glGetUniformiv (GLResourceId program, GLint location, GLint* params); 110 GL_APICALL void GL_APIENTRY glGetUniformiv (GLidProgram program, GLint l ocation, GLint* params);
112 GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLResourceId program, const char* name); 111 GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLidProgram program, c onst char* name);
113 GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenumVer texAttribute pname, GLfloat* params); 112 GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenumVer texAttribute pname, GLfloat* params);
114 GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenumVer texAttribute pname, GLint* params); 113 GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenumVer texAttribute pname, GLint* params);
115 GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLe numVertexPointer pname, void** pointer); 114 GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLe numVertexPointer pname, void** pointer);
116 GL_APICALL void GL_APIENTRY glHint (GLenumHintTarget target, GLenumHintM ode mode); 115 GL_APICALL void GL_APIENTRY glHint (GLenumHintTarget target, GLenumHintM ode mode);
117 GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLResourceId buffer); 116 GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLidBuffer buffer);
118 GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenumCapability cap); 117 GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenumCapability cap);
119 GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLResourceId framebuffer); 118 GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLidFramebuffer framebuffer );
120 GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLResourceId program); 119 GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLidProgram program);
121 GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLResourceId renderbuffer) ; 120 GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLidRenderbuffer renderbuf fer);
122 GL_APICALL GLboolean GL_APIENTRY glIsShader (GLResourceId shader); 121 GL_APICALL GLboolean GL_APIENTRY glIsShader (GLidShader shader);
123 GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLResourceId texture); 122 GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLidTexture texture);
124 GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); 123 GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
125 GL_APICALL void GL_APIENTRY glLinkProgram (GLResourceId program); 124 GL_APICALL void GL_APIENTRY glLinkProgram (GLidProgram program);
126 GL_APICALL void GL_APIENTRY glPixelStorei (GLenumPixelStore pname, GLint PixelStoreAlignment param); 125 GL_APICALL void GL_APIENTRY glPixelStorei (GLenumPixelStore pname, GLint PixelStoreAlignment param);
127 GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat uni ts); 126 GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat uni ts);
128 GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei widt h, GLsizei height, GLenumReadPixelFormat format, GLenumPixelType type, void* pix els); 127 GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei widt h, GLsizei height, GLenumReadPixelFormat format, GLenumPixelType type, void* pix els);
129 GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); 128 GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
130 GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenumRenderBufferTar get target, GLenumRenderBufferFormat internalformat, GLsizei width, GLsizei heig ht); 129 GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenumRenderBufferTar get target, GLenumRenderBufferFormat internalformat, GLsizei width, GLsizei heig ht);
131 GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); 130 GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
132 GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); 131 GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
133 GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLResourceI d* shaders, GLenum binaryformat, const void* binary, GLsizei length); 132 GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLidShader* shaders, GLenum binaryformat, const void* binary, GLsizei length);
134 GL_APICALL void GL_APIENTRY glShaderSource (GLResourceId shader, GLsizei count, const char** string, const GLint* length); 133 GL_APICALL void GL_APIENTRY glShaderSource (GLidShader shader, GLsizei c ount, const char** str, const GLint* length);
135 GL_APICALL void GL_APIENTRY glStencilFunc (GLenumCmpFunction func, GLint ref, GLuint mask); 134 GL_APICALL void GL_APIENTRY glStencilFunc (GLenumCmpFunction func, GLint ref, GLuint mask);
136 GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenumFaceType face, GLenumCmpFunction func, GLint ref, GLuint mask); 135 GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenumFaceType face, GLenumCmpFunction func, GLint ref, GLuint mask);
137 GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); 136 GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
138 GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenumFaceType face, GLuint mask); 137 GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenumFaceType face, GLuint mask);
139 GL_APICALL void GL_APIENTRY glStencilOp (GLenumStencilOp fail, GLenumSte ncilOp zfail, GLenumStencilOp zpass); 138 GL_APICALL void GL_APIENTRY glStencilOp (GLenumStencilOp fail, GLenumSte ncilOp zfail, GLenumStencilOp zpass);
140 GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenumFaceType face, GL enumStencilOp fail, GLenumStencilOp zfail, GLenumStencilOp zpass); 139 GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenumFaceType face, GL enumStencilOp fail, GLenumStencilOp zfail, GLenumStencilOp zpass);
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) ; 140 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) ;
142 GL_APICALL void GL_APIENTRY glTexParameterf (GLenumTextureBindTarget tar get, GLenumTextureParameter pname, GLfloat param); 141 GL_APICALL void GL_APIENTRY glTexParameterf (GLenumTextureBindTarget tar get, GLenumTextureParameter pname, GLfloat param);
143 GL_APICALL void GL_APIENTRY glTexParameterfv (GLenumTextureBindTarget ta rget, GLenumTextureParameter pname, const GLfloat* params); 142 GL_APICALL void GL_APIENTRY glTexParameterfv (GLenumTextureBindTarget ta rget, GLenumTextureParameter pname, const GLfloat* params);
144 GL_APICALL void GL_APIENTRY glTexParameteri (GLenumTextureBindTarget tar get, GLenumTextureParameter pname, GLint param); 143 GL_APICALL void GL_APIENTRY glTexParameteri (GLenumTextureBindTarget tar get, GLenumTextureParameter pname, GLint param);
145 GL_APICALL void GL_APIENTRY glTexParameteriv (GLenumTextureBindTarget ta rget, GLenumTextureParameter pname, const GLint* params); 144 GL_APICALL void GL_APIENTRY glTexParameteriv (GLenumTextureBindTarget ta rget, GLenumTextureParameter pname, const GLint* params);
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); 145 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);
147 GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x); 146 GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
148 GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v); 147 GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
149 GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x); 148 GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
150 GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v); 149 GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
151 GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfl oat y); 150 GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfl oat y);
152 GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v); 151 GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
153 GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y); 152 GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
154 GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v); 153 GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
155 GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfl oat y, GLfloat z); 154 GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfl oat y, GLfloat z);
156 GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v); 155 GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
157 GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z); 156 GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
158 GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v); 157 GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
159 GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfl oat y, GLfloat z, GLfloat w); 158 GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfl oat y, GLfloat z, GLfloat w);
160 GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v); 159 GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
161 GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w); 160 GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
162 GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v); 161 GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
163 GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); 162 GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLbooleanFalse transpose, const GLfloat* value);
164 GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); 163 GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLbooleanFalse transpose, const GLfloat* value);
165 GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); 164 GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLbooleanFalse transpose, const GLfloat* value);
166 GL_APICALL void GL_APIENTRY glUseProgram (GLResourceId program); 165 GL_APICALL void GL_APIENTRY glUseProgram (GLidProgram program);
167 GL_APICALL void GL_APIENTRY glValidateProgram (GLResourceId program); 166 GL_APICALL void GL_APIENTRY glValidateProgram (GLidProgram program);
168 GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); 167 GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
169 GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloa t* values); 168 GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloa t* values);
170 GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GL float y); 169 GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GL float y);
171 GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloa t* values); 170 GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloa t* values);
172 GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GL float y, GLfloat z); 171 GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GL float y, GLfloat z);
173 GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloa t* values); 172 GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloa t* values);
174 GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GL float y, GLfloat z, GLfloat w); 173 GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GL float y, GLfloat z, GLfloat w);
175 GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloa t* values); 174 GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloa t* values);
176 GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLintVer texAttribSize size, GLenumVertexAttribType type, GLboolean normalized, GLsizei s tride, const void* ptr); 175 GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLintVer texAttribSize size, GLenumVertexAttribType type, GLboolean normalized, GLsizei s tride, const void* ptr);
177 GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); 176 GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 'VertexAttrib4fv': 427, 358 'VertexAttrib4fv': 427,
360 'VertexAttrib4fvImmediate': 428, 359 'VertexAttrib4fvImmediate': 428,
361 'VertexAttribPointer': 429, 360 'VertexAttribPointer': 429,
362 'Viewport': 430, 361 'Viewport': 430,
363 'SwapBuffers': 431, 362 'SwapBuffers': 431,
364 } 363 }
365 364
366 # This is a list of enum names and their valid values. It is used to map 365 # 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. 366 # GLenum arguments to a specific set of valid values.
368 _ENUM_LISTS = { 367 _ENUM_LISTS = {
369 'FrameBufferTarget': [ 368 'FrameBufferTarget': {
370 'GL_FRAMEBUFFER', 369 'type': 'GLenum',
371 ], 370 'valid': [
372 'RenderBufferTarget': [ 371 'GL_FRAMEBUFFER',
373 'GL_RENDERBUFFER', 372 ],
374 ], 373 },
375 'BufferTarget': [ 374 'RenderBufferTarget': {
376 'GL_ARRAY_BUFFER', 375 'type': 'GLenum',
377 'GL_ELEMENT_ARRAY_BUFFER', 376 'valid': [
378 ], 377 'GL_RENDERBUFFER',
379 'BufferUsage': [ 378 ],
380 'GL_STREAM_DRAW', 379 },
381 'GL_STATIC_DRAW', 380 'BufferTarget': {
382 'GL_DYNAMIC_DRAW', 381 'type': 'GLenum',
383 ], 382 'valid': [
384 'TextureTarget': [ 383 'GL_ARRAY_BUFFER',
385 'GL_TEXTURE_2D', 384 'GL_ELEMENT_ARRAY_BUFFER',
386 'GL_TEXTURE_CUBE_MAP_POSITIVE_X', 385 ],
387 'GL_TEXTURE_CUBE_MAP_NEGATIVE_X', 386 'invalid': [
388 'GL_TEXTURE_CUBE_MAP_POSITIVE_Y', 387 'GL_RENDERBUFFER',
389 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Y', 388 ],
390 'GL_TEXTURE_CUBE_MAP_POSITIVE_Z', 389 },
391 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Z', 390 'BufferUsage': {
392 ], 391 'type': 'GLenum',
393 'TextureBindTarget': [ 392 'valid': [
394 'GL_TEXTURE_2D', 393 'GL_STREAM_DRAW',
395 'GL_TEXTURE_CUBE_MAP', 394 'GL_STATIC_DRAW',
396 ], 395 'GL_DYNAMIC_DRAW',
397 'ShaderType': [ 396 ],
398 'GL_VERTEX_SHADER', 397 'invalid': [
399 'GL_FRAGMENT_SHADER', 398 'GL_STATIC_READ',
400 ], 399 ],
401 'FaceType': [ 400 },
402 'GL_FRONT', 401 'TextureTarget': {
403 'GL_BACK', 402 'type': 'GLenum',
404 'GL_FRONT_AND_BACK', 403 'valid': [
405 ], 404 'GL_TEXTURE_2D',
406 'FaceMode': [ 405 'GL_TEXTURE_CUBE_MAP_POSITIVE_X',
407 'GL_CW', 406 'GL_TEXTURE_CUBE_MAP_NEGATIVE_X',
408 'GL_CCW', 407 'GL_TEXTURE_CUBE_MAP_POSITIVE_Y',
409 ], 408 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Y',
410 'CmpFunction': [ 409 'GL_TEXTURE_CUBE_MAP_POSITIVE_Z',
411 'GL_NEVER', 410 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Z',
412 'GL_LESS', 411 ],
413 'GL_EQUAL', 412 'invalid': [
414 'GL_LEQUAL', 413 'GL_PROXY_TEXTURE_CUBE_MAP',
415 'GL_GREATER', 414 ]
416 'GL_NOTEQUAL', 415 },
417 'GL_GEQUAL', 416 'TextureBindTarget': {
418 'GL_ALWAYS', 417 'type': 'GLenum',
419 ], 418 'valid': [
420 'Equation': [ 419 'GL_TEXTURE_2D',
421 'GL_FUNC_ADD', 420 'GL_TEXTURE_CUBE_MAP',
422 'GL_FUNC_SUBTRACT', 421 ],
423 'GL_FUNC_REVERSE_SUBTRACT', 422 'invalid': [
424 ], 423 'GL_TEXTURE_1D',
425 'SrcBlendFactor': [ 424 'GL_TEXTURE_3D',
426 'GL_ZERO', 425 ],
427 'GL_ONE', 426 },
428 'GL_SRC_COLOR', 427 'ShaderType': {
429 'GL_ONE_MINUS_SRC_COLOR', 428 'type': 'GLenum',
430 'GL_DST_COLOR', 429 'valid': [
431 'GL_ONE_MINUS_DST_COLOR', 430 'GL_VERTEX_SHADER',
432 'GL_SRC_ALPHA', 431 'GL_FRAGMENT_SHADER',
433 'GL_ONE_MINUS_SRC_ALPHA', 432 ],
434 'GL_DST_ALPHA', 433 },
435 'GL_ONE_MINUS_DST_ALPHA', 434 'FaceType': {
436 'GL_CONSTANT_COLOR', 435 'type': 'GLenum',
437 'GL_ONE_MINUS_CONSTANT_COLOR', 436 'valid': [
438 'GL_CONSTANT_ALPHA', 437 'GL_FRONT',
439 'GL_ONE_MINUS_CONSTANT_ALPHA', 438 'GL_BACK',
440 'GL_SRC_ALPHA_SATURATE', 439 'GL_FRONT_AND_BACK',
441 ], 440 ],
442 'DstBlendFactor': [ 441 },
443 'GL_ZERO', 442 'FaceMode': {
444 'GL_ONE', 443 'type': 'GLenum',
445 'GL_SRC_COLOR', 444 'valid': [
446 'GL_ONE_MINUS_SRC_COLOR', 445 'GL_CW',
447 'GL_DST_COLOR', 446 'GL_CCW',
448 'GL_ONE_MINUS_DST_COLOR', 447 ],
449 'GL_SRC_ALPHA', 448 },
450 'GL_ONE_MINUS_SRC_ALPHA', 449 'CmpFunction': {
451 'GL_DST_ALPHA', 450 'type': 'GLenum',
452 'GL_ONE_MINUS_DST_ALPHA', 451 'valid': [
453 'GL_CONSTANT_COLOR', 452 'GL_NEVER',
454 'GL_ONE_MINUS_CONSTANT_COLOR', 453 'GL_LESS',
455 'GL_CONSTANT_ALPHA', 454 'GL_EQUAL',
456 'GL_ONE_MINUS_CONSTANT_ALPHA', 455 'GL_LEQUAL',
457 ], 456 'GL_GREATER',
458 'Capability': [ 457 'GL_NOTEQUAL',
459 'GL_BLEND', 458 'GL_GEQUAL',
460 'GL_CULL_FACE', 459 'GL_ALWAYS',
461 'GL_DEPTH_TEST', 460 ],
462 'GL_DITHER', 461 },
463 'GL_POLYGON_OFFSET_FILL', 462 'Equation': {
464 'GL_SAMPLE_ALPHA_TO_COVERAGE', 463 'type': 'GLenum',
465 'GL_SAMPLE_COVERAGE', 464 'valid': [
466 'GL_SCISSOR_TEST', 465 'GL_FUNC_ADD',
467 'GL_STENCIL_TEST', 466 'GL_FUNC_SUBTRACT',
468 ], 467 'GL_FUNC_REVERSE_SUBTRACT',
469 'DrawMode': [ 468 ],
470 'GL_POINTS', 469 'invalid': [
471 'GL_LINE_STRIP', 470 'GL_MIN',
472 'GL_LINE_LOOP', 471 'GL_MAX',
473 'GL_LINES', 472 ],
474 'GL_TRIANGLE_STRIP', 473 },
475 'GL_TRIANGLE_FAN', 474 'SrcBlendFactor': {
476 'GL_TRIANGLES', 475 'type': 'GLenum',
477 ], 476 'valid': [
478 'IndexType': [ 477 'GL_ZERO',
479 'GL_UNSIGNED_BYTE', 478 'GL_ONE',
480 'GL_UNSIGNED_SHORT', 479 'GL_SRC_COLOR',
481 ], 480 'GL_ONE_MINUS_SRC_COLOR',
482 'Attachment': [ 481 'GL_DST_COLOR',
483 'GL_COLOR_ATTACHMENT0', 482 'GL_ONE_MINUS_DST_COLOR',
484 'GL_DEPTH_ATTACHMENT', 483 'GL_SRC_ALPHA',
485 'GL_STENCIL_ATTACHMENT', 484 'GL_ONE_MINUS_SRC_ALPHA',
486 ], 485 'GL_DST_ALPHA',
487 'BufferParameter': [ 486 'GL_ONE_MINUS_DST_ALPHA',
488 'GL_BUFFER_SIZE', 487 'GL_CONSTANT_COLOR',
489 'GL_BUFFER_USAGE', 488 'GL_ONE_MINUS_CONSTANT_COLOR',
490 ], 489 'GL_CONSTANT_ALPHA',
491 'FrameBufferParameter': [ 490 'GL_ONE_MINUS_CONSTANT_ALPHA',
492 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE', 491 'GL_SRC_ALPHA_SATURATE',
493 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME', 492 ],
494 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL', 493 },
495 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE', 494 'DstBlendFactor': {
496 ], 495 'type': 'GLenum',
497 'ProgramParameter': [ 496 'valid': [
498 'GL_DELETE_STATUS', 497 'GL_ZERO',
499 'GL_LINK_STATUS', 498 'GL_ONE',
500 'GL_VALIDATE_STATUS', 499 'GL_SRC_COLOR',
501 'GL_INFO_LOG_LENGTH', 500 'GL_ONE_MINUS_SRC_COLOR',
502 'GL_ATTACHED_SHADERS', 501 'GL_DST_COLOR',
503 'GL_ACTIVE_ATTRIBUTES', 502 'GL_ONE_MINUS_DST_COLOR',
504 'GL_ACTIVE_ATTRIBUTE_MAX_LENGTH', 503 'GL_SRC_ALPHA',
505 'GL_ACTIVE_UNIFORMS', 504 'GL_ONE_MINUS_SRC_ALPHA',
506 'GL_ACTIVE_UNIFORM_MAX_LENGTH', 505 'GL_DST_ALPHA',
507 ], 506 'GL_ONE_MINUS_DST_ALPHA',
508 'RenderBufferParameter': [ 507 'GL_CONSTANT_COLOR',
509 'GL_RENDERBUFFER_WIDTH', 508 'GL_ONE_MINUS_CONSTANT_COLOR',
510 'GL_RENDERBUFFER_HEIGHT', 509 'GL_CONSTANT_ALPHA',
511 'GL_RENDERBUFFER_INTERNAL_FORMAT', 510 'GL_ONE_MINUS_CONSTANT_ALPHA',
512 'GL_RENDERBUFFER_RED_SIZE', 511 ],
513 'GL_RENDERBUFFER_GREEN_SIZE', 512 },
514 'GL_RENDERBUFFER_BLUE_SIZE', 513 'Capability': {
515 'GL_RENDERBUFFER_ALPHA_SIZE', 514 'type': 'GLenum',
516 'GL_RENDERBUFFER_DEPTH_SIZE', 515 'valid': [
517 'GL_RENDERBUFFER_STENCIL_SIZE', 516 'GL_BLEND',
518 ], 517 'GL_CULL_FACE',
519 'ShaderParameter': [ 518 'GL_DEPTH_TEST',
520 'GL_SHADER_TYPE', 519 'GL_DITHER',
521 'GL_DELETE_STATUS', 520 'GL_POLYGON_OFFSET_FILL',
522 'GL_COMPILE_STATUS', 521 'GL_SAMPLE_ALPHA_TO_COVERAGE',
523 'GL_INFO_LOG_LENGTH', 522 'GL_SAMPLE_COVERAGE',
524 'GL_SHADER_SOURCE_LENGTH', 523 'GL_SCISSOR_TEST',
525 ], 524 'GL_STENCIL_TEST',
526 'ShaderPercision': [ 525 ],
527 'GL_LOW_FLOAT', 526 'invalid': [
528 'GL_MEDIUM_FLOAT', 527 'GL_CLIP_PLANE0',
529 'GL_HIGH_FLOAT', 528 'GL_POINT_SPRITE',
530 'GL_LOW_INT', 529 ],
531 'GL_MEDIUM_INT', 530 },
532 'GL_HIGH_INT', 531 'DrawMode': {
533 ], 532 'type': 'GLenum',
534 'StringType': [ 533 'valid': [
535 'GL_VENDOR', 534 'GL_POINTS',
536 'GL_RENDERER', 535 'GL_LINE_STRIP',
537 'GL_VERSION', 536 'GL_LINE_LOOP',
538 'GL_SHADING_LANGUAGE_VERSION', 537 'GL_LINES',
539 'GL_EXTENSIONS', 538 'GL_TRIANGLE_STRIP',
540 ], 539 'GL_TRIANGLE_FAN',
541 'TextureParameter': [ 540 'GL_TRIANGLES',
542 'GL_TEXTURE_MAG_FILTER', 541 ],
543 'GL_TEXTURE_MIN_FILTER', 542 'invalid': [
544 'GL_TEXTURE_WRAP_S', 543 'GL_QUADS',
545 'GL_TEXTURE_WRAP_T', 544 'GL_POLYGON',
546 ], 545 ],
547 'VertexAttribute': [ 546 },
548 'GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING', 547 'IndexType': {
549 'GL_VERTEX_ATTRIB_ARRAY_ENABLED', 548 'type': 'GLenum',
550 'GL_VERTEX_ATTRIB_ARRAY_SIZE', 549 'valid': [
551 'GL_VERTEX_ATTRIB_ARRAY_STRIDE', 550 'GL_UNSIGNED_BYTE',
552 'GL_VERTEX_ATTRIB_ARRAY_TYPE', 551 'GL_UNSIGNED_SHORT',
553 'GL_VERTEX_ATTRIB_ARRAY_NORMALIZED', 552 ],
554 'GL_CURRENT_VERTEX_ATTRIB', 553 'invalid': [
555 ], 554 'GL_UNSIGNED_INT',
556 'VertexPointer': [ 555 'GL_INT',
557 'GL_VERTEX_ATTRIB_ARRAY_POINTER', 556 ],
558 ], 557 },
559 'HintTarget': [ 558 'Attachment': {
560 'GL_GENERATE_MIPMAP_HINT', 559 'type': 'GLenum',
561 ], 560 'valid': [
562 'HintMode': [ 561 'GL_COLOR_ATTACHMENT0',
563 'GL_FASTEST', 562 'GL_DEPTH_ATTACHMENT',
564 'GL_NICEST', 563 'GL_STENCIL_ATTACHMENT',
565 'GL_DONT_CARE', 564 ],
566 ], 565 },
567 'PixelStore': [ 566 'BufferParameter': {
568 'GL_PACK_ALIGNMENT', 567 'type': 'GLenum',
569 'GL_UNPACK_ALIGNMENT', 568 'valid': [
570 ], 569 'GL_BUFFER_SIZE',
571 'PixelStoreAlignment': [ 570 'GL_BUFFER_USAGE',
572 '1', 571 ],
573 '2', 572 'invalid': [
574 '4', 573 'GL_PIXEL_PACK_BUFFER',
575 '8', 574 ],
576 ], 575 },
577 'ReadPixelFormat': [ 576 'FrameBufferParameter': {
578 'GL_ALPHA', 577 'type': 'GLenum',
579 'GL_RGB', 578 'valid': [
580 'GL_RGBA', 579 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE',
581 ], 580 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME',
582 'PixelType': [ 581 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL',
583 'GL_UNSIGNED_BYTE', 582 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE',
584 'GL_UNSIGNED_SHORT_5_6_5', 583 ],
585 'GL_UNSIGNED_SHORT_4_4_4_4', 584 },
586 'GL_UNSIGNED_SHORT_5_5_5_1', 585 'ProgramParameter': {
587 ], 586 'type': 'GLenum',
588 'RenderBufferFormat': [ 587 'valid': [
589 'GL_RGBA4', 588 'GL_DELETE_STATUS',
590 'GL_RGB565', 589 'GL_LINK_STATUS',
591 'GL_RGB5_A1', 590 'GL_VALIDATE_STATUS',
592 'GL_DEPTH_COMPONENT16', 591 'GL_INFO_LOG_LENGTH',
593 'GL_STENCIL_INDEX8', 592 'GL_ATTACHED_SHADERS',
594 ], 593 'GL_ACTIVE_ATTRIBUTES',
595 'StencilOp': [ 594 'GL_ACTIVE_ATTRIBUTE_MAX_LENGTH',
596 'GL_KEEP', 595 'GL_ACTIVE_UNIFORMS',
597 'GL_ZERO', 596 'GL_ACTIVE_UNIFORM_MAX_LENGTH',
598 'GL_REPLACE', 597 ],
599 'GL_INCR', 598 },
600 'GL_INCR_WRAP', 599 'RenderBufferParameter': {
601 'GL_DECR', 600 'type': 'GLenum',
602 'GL_DECR_WRAP', 601 'valid': [
603 'GL_INVERT', 602 'GL_RENDERBUFFER_WIDTH',
604 ], 603 'GL_RENDERBUFFER_HEIGHT',
605 'TextureFormat': [ 604 'GL_RENDERBUFFER_INTERNAL_FORMAT',
606 'GL_ALPHA', 605 'GL_RENDERBUFFER_RED_SIZE',
607 'GL_LUMINANCE', 606 'GL_RENDERBUFFER_GREEN_SIZE',
608 'GL_LUMINANCE_ALPHA', 607 'GL_RENDERBUFFER_BLUE_SIZE',
609 'GL_RGB', 608 'GL_RENDERBUFFER_ALPHA_SIZE',
610 'GL_RGBA', 609 'GL_RENDERBUFFER_DEPTH_SIZE',
611 ], 610 'GL_RENDERBUFFER_STENCIL_SIZE',
612 'VertexAttribType': [ 611 ],
613 'GL_BYTE', 612 },
614 'GL_UNSIGNED_BYTE', 613 'ShaderParameter': {
615 'GL_SHORT', 614 'type': 'GLenum',
616 'GL_UNSIGNED_SHORT', 615 'valid': [
617 #'GL_FIXED', // This is not available on Desktop GL. 616 'GL_SHADER_TYPE',
618 'GL_FLOAT', 617 'GL_DELETE_STATUS',
619 ], 618 'GL_COMPILE_STATUS',
620 'VertexAttribSize': [ 619 'GL_INFO_LOG_LENGTH',
621 '1', 620 'GL_SHADER_SOURCE_LENGTH',
622 '2', 621 ],
623 '3', 622 },
624 '4', 623 'ShaderPercision': {
625 ], 624 'type': 'GLenum',
625 'valid': [
626 'GL_LOW_FLOAT',
627 'GL_MEDIUM_FLOAT',
628 'GL_HIGH_FLOAT',
629 'GL_LOW_INT',
630 'GL_MEDIUM_INT',
631 'GL_HIGH_INT',
632 ],
633 },
634 'StringType': {
635 'type': 'GLenum',
636 'valid': [
637 'GL_VENDOR',
638 'GL_RENDERER',
639 'GL_VERSION',
640 'GL_SHADING_LANGUAGE_VERSION',
641 'GL_EXTENSIONS',
642 ],
643 },
644 'TextureParameter': {
645 'type': 'GLenum',
646 'valid': [
647 'GL_TEXTURE_MAG_FILTER',
648 'GL_TEXTURE_MIN_FILTER',
649 'GL_TEXTURE_WRAP_S',
650 'GL_TEXTURE_WRAP_T',
651 ],
652 'invalid': [
653 'GL_GENERATE_MIPMAP',
654 ],
655 },
656 'VertexAttribute': {
657 'type': 'GLenum',
658 'valid': [
659 'GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING',
660 'GL_VERTEX_ATTRIB_ARRAY_ENABLED',
661 'GL_VERTEX_ATTRIB_ARRAY_SIZE',
662 'GL_VERTEX_ATTRIB_ARRAY_STRIDE',
663 'GL_VERTEX_ATTRIB_ARRAY_TYPE',
664 'GL_VERTEX_ATTRIB_ARRAY_NORMALIZED',
665 'GL_CURRENT_VERTEX_ATTRIB',
666 ],
667 },
668 'VertexPointer': {
669 'type': 'GLenum',
670 'valid': [
671 'GL_VERTEX_ATTRIB_ARRAY_POINTER',
672 ],
673 },
674 'HintTarget': {
675 'type': 'GLenum',
676 'valid': [
677 'GL_GENERATE_MIPMAP_HINT',
678 ],
679 'invalid': [
680 'GL_PERSPECTIVE_CORRECTION_HINT',
681 ],
682 },
683 'HintMode': {
684 'type': 'GLenum',
685 'valid': [
686 'GL_FASTEST',
687 'GL_NICEST',
688 'GL_DONT_CARE',
689 ],
690 },
691 'PixelStore': {
692 'type': 'GLenum',
693 'valid': [
694 'GL_PACK_ALIGNMENT',
695 'GL_UNPACK_ALIGNMENT',
696 ],
697 'invalid': [
698 'GL_PACK_SWAP_BYTES',
699 'GL_UNPACK_SWAP_BYTES',
700 ],
701 },
702 'PixelStoreAlignment': {
703 'type': 'GLint',
704 'valid': [
705 '1',
706 '2',
707 '4',
708 '8',
709 ],
710 'invalid': [
711 '3',
712 '9',
713 ],
714 },
715 'ReadPixelFormat': {
716 'type': 'GLenum',
717 'valid': [
718 'GL_ALPHA',
719 'GL_RGB',
720 'GL_RGBA',
721 ],
722 },
723 'PixelType': {
724 'type': 'GLenum',
725 'valid': [
726 'GL_UNSIGNED_BYTE',
727 'GL_UNSIGNED_SHORT_5_6_5',
728 'GL_UNSIGNED_SHORT_4_4_4_4',
729 'GL_UNSIGNED_SHORT_5_5_5_1',
730 ],
731 'invalid': [
732 'GL_SHORT',
733 'GL_INT',
734 ],
735 },
736 'RenderBufferFormat': {
737 'type': 'GLenum',
738 'valid': [
739 'GL_RGBA4',
740 'GL_RGB565',
741 'GL_RGB5_A1',
742 'GL_DEPTH_COMPONENT16',
743 'GL_STENCIL_INDEX8',
744 ],
745 },
746 'StencilOp': {
747 'type': 'GLenum',
748 'valid': [
749 'GL_KEEP',
750 'GL_ZERO',
751 'GL_REPLACE',
752 'GL_INCR',
753 'GL_INCR_WRAP',
754 'GL_DECR',
755 'GL_DECR_WRAP',
756 'GL_INVERT',
757 ],
758 },
759 'TextureFormat': {
760 'type': 'GLenum',
761 'valid': [
762 'GL_ALPHA',
763 'GL_LUMINANCE',
764 'GL_LUMINANCE_ALPHA',
765 'GL_RGB',
766 'GL_RGBA',
767 ],
768 'invalid': [
769 'GL_BGRA',
770 'GL_BGR',
771 ],
772 },
773 'VertexAttribType': {
774 'type': 'GLenum',
775 'valid': [
776 'GL_BYTE',
777 'GL_UNSIGNED_BYTE',
778 'GL_SHORT',
779 'GL_UNSIGNED_SHORT',
780 # 'GL_FIXED', // This is not available on Desktop GL.
781 'GL_FLOAT',
782 ],
783 'invalid': [
784 'GL_DOUBLE',
785 ],
786 },
787 'VertexAttribSize': {
788 'type': 'GLint',
789 'valid': [
790 '1',
791 '2',
792 '3',
793 '4',
794 ],
795 'invalid': [
796 '0',
797 '5',
798 ],
799 },
800 'False': {
801 'type': 'GLboolean',
802 'valid': [
803 'false',
804 ],
805 'invalid': [
806 'true',
807 ],
808 },
626 } 809 }
627 810
628 # This table specifies types and other special data for the commands that 811 # This table specifies types and other special data for the commands that
629 # will be generated. 812 # will be generated.
630 # 813 #
631 # type: defines which handler will be used to generate code. 814 # type: defines which handler will be used to generate code.
632 # DecoderFunc: defines which function to call in the decoder to execute the 815 # DecoderFunc: defines which function to call in the decoder to execute the
633 # corresponding GL command. If not specified the GL command will 816 # corresponding GL command. If not specified the GL command will
634 # be called directly. 817 # be called directly.
635 # cmd_args: The arguments to use for the command. This overrides generating 818 # cmd_args: The arguments to use for the command. This overrides generating
(...skipping 13 matching lines...) Expand all
649 'BindFramebuffer': {'DecoderFunc': 'glBindFramebufferEXT'}, 832 'BindFramebuffer': {'DecoderFunc': 'glBindFramebufferEXT'},
650 'BindRenderbuffer': {'DecoderFunc': 'glBindRenderbufferEXT'}, 833 'BindRenderbuffer': {'DecoderFunc': 'glBindRenderbufferEXT'},
651 'BufferData': {'type': 'Manual', 'immediate': True}, 834 'BufferData': {'type': 'Manual', 'immediate': True},
652 'BufferSubData': {'type': 'Data'}, 835 'BufferSubData': {'type': 'Data'},
653 'CheckFramebufferStatus': {'DecoderFunc': 'glCheckFramebufferStatusEXT'}, 836 'CheckFramebufferStatus': {'DecoderFunc': 'glCheckFramebufferStatusEXT'},
654 'ClearDepthf': {'DecoderFunc': 'glClearDepth'}, 837 'ClearDepthf': {'DecoderFunc': 'glClearDepth'},
655 'CompressedTexImage2D': {'type': 'Manual','immediate': True}, 838 'CompressedTexImage2D': {'type': 'Manual','immediate': True},
656 'CompressedTexSubImage2D': {'type': 'Data'}, 839 'CompressedTexSubImage2D': {'type': 'Data'},
657 'CreateProgram': {'type': 'Create'}, 840 'CreateProgram': {'type': 'Create'},
658 'CreateShader': {'type': 'Create'}, 841 'CreateShader': {'type': 'Create'},
659 'DeleteBuffers': {'type': 'DELn'}, 842 'DeleteBuffers': {'type': 'DELn', 'gl_test_func': 'glDeleteBuffersARB'},
660 'DeleteFramebuffers': {'type': 'DELn'}, 843 'DeleteFramebuffers': {
844 'type': 'DELn',
845 'gl_test_func': 'glDeleteFramebuffersEXT',
846 },
661 'DeleteProgram': {'type': 'Custom', 'DecoderFunc': 'DoDeleteProgram'}, 847 'DeleteProgram': {'type': 'Custom', 'DecoderFunc': 'DoDeleteProgram'},
662 'DeleteRenderbuffers': {'type': 'DELn'}, 848 'DeleteRenderbuffers': {
849 'type': 'DELn',
850 'gl_test_func': 'glDeleteRenderbuffersEXT',
851 },
663 'DeleteShader': {'type': 'Custom', 'DecoderFunc': 'DoDeleteShader'}, 852 'DeleteShader': {'type': 'Custom', 'DecoderFunc': 'DoDeleteShader'},
664 'DeleteTextures': {'type': 'DELn'}, 853 'DeleteTextures': {'type': 'DELn'},
665 'DepthRangef': {'DecoderFunc': 'glDepthRange'}, 854 'DepthRangef': {'DecoderFunc': 'glDepthRange'},
666 'DisableVertexAttribArray': {'DecoderFunc': 'DoDisableVertexAttribArray'}, 855 'DisableVertexAttribArray': {'DecoderFunc': 'DoDisableVertexAttribArray'},
667 'DrawArrays': { 'DecoderFunc': 'DoDrawArrays'}, 856 'DrawArrays': { 'DecoderFunc': 'DoDrawArrays', 'unit_test': False},
668 'DrawElements': { 857 'DrawElements': {
669 'type': 'Manual', 858 'type': 'Manual',
670 'cmd_args': 'GLenum mode, GLsizei count, GLenum type, GLuint index_offset', 859 'cmd_args': 'GLenum mode, GLsizei count, GLenum type, GLuint index_offset',
671 }, 860 },
672 'EnableVertexAttribArray': {'DecoderFunc': 'DoEnableVertexAttribArray'}, 861 'EnableVertexAttribArray': {'DecoderFunc': 'DoEnableVertexAttribArray'},
673 'FramebufferRenderbuffer': {'DecoderFunc': 'glFramebufferRenderbufferEXT'}, 862 'FramebufferRenderbuffer': {'DecoderFunc': 'glFramebufferRenderbufferEXT'},
674 'FramebufferTexture2D': {'DecoderFunc': 'glFramebufferTexture2DEXT'}, 863 'FramebufferTexture2D': {'DecoderFunc': 'glFramebufferTexture2DEXT'},
675 'GenerateMipmap': {'DecoderFunc': 'glGenerateMipmapEXT'}, 864 'GenerateMipmap': {'DecoderFunc': 'glGenerateMipmapEXT'},
676 'GenBuffers': {'type': 'GENn'}, 865 'GenBuffers': {'type': 'GENn', 'gl_test_func': 'glGenBuffersARB'},
677 'GenFramebuffers': {'type': 'GENn'}, 866 'GenFramebuffers': {'type': 'GENn', 'gl_test_func': 'glGenFramebuffersEXT'},
678 'GenRenderbuffers': {'type': 'GENn'}, 867 'GenRenderbuffers': {'type': 'GENn', 'gl_test_func': 'glGenRenderbuffersEXT'},
679 'GenTextures': {'type': 'GENn'}, 868 'GenTextures': {'type': 'GENn', 'gl_test_func': 'glGenTextures'},
680 'GetActiveAttrib': {'type': 'Custom'}, 869 'GetActiveAttrib': {'type': 'Custom'},
681 'GetActiveUniform': {'type': 'Custom'}, 870 'GetActiveUniform': {'type': 'Custom'},
682 'GetAttachedShaders': {'type': 'Custom'}, 871 'GetAttachedShaders': {'type': 'Custom'},
683 'GetAttribLocation': { 872 'GetAttribLocation': {
684 'type': 'HandWritten', 873 'type': 'HandWritten',
685 'immediate': True, 874 'immediate': True,
686 'needs_size': True, 875 'needs_size': True,
687 'cmd_args': 876 'cmd_args':
688 'GLResourceId program, const char* name, NonImmediate GLint* location', 877 'GLidProgram program, const char* name, NonImmediate GLint* location',
689 }, 878 },
690 'GetBooleanv': {'type': 'GETn'}, 879 'GetBooleanv': {'type': 'GETn'},
691 'GetBufferParameteriv': {'type': 'GETn'}, 880 'GetBufferParameteriv': {'type': 'GETn'},
692 'GetError': {'type': 'Is', 'DecoderFunc': 'GetGLError'}, 881 'GetError': {'type': 'Is', 'DecoderFunc': 'GetGLError'},
693 'GetFloatv': {'type': 'GETn'}, 882 'GetFloatv': {'type': 'GETn'},
694 'GetFramebufferAttachmentParameteriv': { 883 'GetFramebufferAttachmentParameteriv': {
695 'type': 'GETn', 884 'type': 'GETn',
696 'DecoderFunc': 'glGetFramebufferAttachmentParameterivEXT', 885 'DecoderFunc': 'glGetFramebufferAttachmentParameterivEXT',
697 }, 886 },
698 'GetIntegerv': {'type': 'GETn'}, 887 'GetIntegerv': {'type': 'GETn'},
699 'GetProgramiv': {'type': 'GETn'}, 888 'GetProgramiv': {'type': 'GETn'},
700 'GetProgramInfoLog': {'type': 'STRn'}, 889 'GetProgramInfoLog': {'type': 'STRn'},
701 'GetRenderbufferParameteriv': { 890 'GetRenderbufferParameteriv': {
702 'type': 'GETn', 891 'type': 'GETn',
703 'DecoderFunc': 'glGetRenderbufferParameterivEXT', 892 'DecoderFunc': 'glGetRenderbufferParameterivEXT',
704 }, 893 },
705 'GetShaderiv': {'type': 'GETn'}, 894 'GetShaderiv': {'type': 'GETn'},
706 'GetShaderInfoLog': {'type': 'STRn'}, 895 'GetShaderInfoLog': {'type': 'STRn'},
707 'GetShaderPrecisionFormat': {'type': 'Custom'}, 896 'GetShaderPrecisionFormat': {'type': 'Custom'},
708 'GetShaderSource': {'type': 'STRn'}, 897 'GetShaderSource': {'type': 'STRn'},
709 'GetTexParameterfv': {'type': 'GETn'}, 898 'GetTexParameterfv': {'type': 'GETn'},
710 'GetTexParameteriv': {'type': 'GETn'}, 899 'GetTexParameteriv': {'type': 'GETn'},
711 'GetUniformfv': {'type': 'Custom', 'immediate': False}, 900 'GetUniformfv': {'type': 'Custom', 'immediate': False},
712 'GetUniformiv': {'type': 'Custom', 'immediate': False}, 901 'GetUniformiv': {'type': 'Custom', 'immediate': False},
713 'GetUniformLocation': { 902 'GetUniformLocation': {
714 'type': 'HandWritten', 903 'type': 'HandWritten',
715 'immediate': True, 904 'immediate': True,
716 'needs_size': True, 905 'needs_size': True,
717 'cmd_args': 906 'cmd_args':
718 'GLResourceId program, const char* name, NonImmediate GLint* location', 907 'GLidProgram program, const char* name, NonImmediate GLint* location',
719 }, 908 },
720 'GetVertexAttribfv': {'type': 'GETn'}, 909 'GetVertexAttribfv': {'type': 'GETn'},
721 'GetVertexAttribiv': {'type': 'GETn'}, 910 'GetVertexAttribiv': {'type': 'GETn'},
722 'GetVertexAttribPointerv': {'type': 'Custom', 'immediate': False}, 911 'GetVertexAttribPointerv': {'type': 'Custom', 'immediate': False},
723 'IsBuffer': {'type': 'Is'}, 912 'IsBuffer': {'type': 'Is'},
724 'IsEnabled': {'type': 'Is'}, 913 'IsEnabled': {'type': 'Is'},
725 'IsFramebuffer': {'type': 'Is', 'DecoderFunc': 'glIsFramebufferEXT'}, 914 'IsFramebuffer': {'type': 'Is', 'DecoderFunc': 'glIsFramebufferEXT'},
726 'IsProgram': {'type': 'Is'}, 915 'IsProgram': {'type': 'Is'},
727 'IsRenderbuffer': {'type': 'Is', 'DecoderFunc': 'glIsRenderbufferEXT'}, 916 'IsRenderbuffer': {'type': 'Is', 'DecoderFunc': 'glIsRenderbufferEXT'},
728 'IsShader': {'type': 'Is'}, 917 'IsShader': {'type': 'Is'},
(...skipping 19 matching lines...) Expand all
748 'Uniform1iv': {'type': 'PUTn', 'data_type': 'GLint', 'count': 1}, 937 'Uniform1iv': {'type': 'PUTn', 'data_type': 'GLint', 'count': 1},
749 'Uniform2fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 2}, 938 'Uniform2fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 2},
750 'Uniform2iv': {'type': 'PUTn', 'data_type': 'GLint', 'count': 2}, 939 'Uniform2iv': {'type': 'PUTn', 'data_type': 'GLint', 'count': 2},
751 'Uniform3fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 3}, 940 'Uniform3fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 3},
752 'Uniform3iv': {'type': 'PUTn', 'data_type': 'GLint', 'count': 3}, 941 'Uniform3iv': {'type': 'PUTn', 'data_type': 'GLint', 'count': 3},
753 'Uniform4fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 4}, 942 'Uniform4fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 4},
754 'Uniform4iv': {'type': 'PUTn', 'data_type': 'GLint', 'count': 4}, 943 'Uniform4iv': {'type': 'PUTn', 'data_type': 'GLint', 'count': 4},
755 'UniformMatrix2fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 4}, 944 'UniformMatrix2fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 4},
756 'UniformMatrix3fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 9}, 945 'UniformMatrix3fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 9},
757 'UniformMatrix4fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 16}, 946 'UniformMatrix4fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 16},
758 'UseProgram': {'DecoderFunc': 'DoUseProgram'}, 947 'UseProgram': {'DecoderFunc': 'DoUseProgram', 'unit_test': False},
759 'VertexAttrib1fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 1}, 948 'VertexAttrib1fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 1},
760 'VertexAttrib2fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 2}, 949 'VertexAttrib2fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 2},
761 'VertexAttrib3fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 3}, 950 'VertexAttrib3fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 3},
762 'VertexAttrib4fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 4}, 951 'VertexAttrib4fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 4},
763 'VertexAttribPointer': { 952 'VertexAttribPointer': {
764 'type': 'Manual', 953 'type': 'Manual',
765 'cmd_args': 'GLuint indx, GLint size, GLenum type, GLboolean normalized, ' 954 'cmd_args': 'GLuint indx, GLint size, GLenum type, GLboolean normalized, '
766 'GLsizei stride, GLuint offset', 955 'GLsizei stride, GLuint offset',
767 }, 956 },
768 'SwapBuffers': {'DecoderFunc': 'DoSwapBuffers'}, 957 'SwapBuffers': {'DecoderFunc': 'DoSwapBuffers', 'unit_test': False},
769 } 958 }
770 959
771 960
772 class CWriter(object): 961 class CWriter(object):
773 """Writes to a file formatting it for Google's style guidelines.""" 962 """Writes to a file formatting it for Google's style guidelines."""
774 963
775 def __init__(self, filename): 964 def __init__(self, filename):
776 self.filename = filename 965 self.filename = filename
777 self.file = open(filename, "w") 966 self.file = open(filename, "w")
778 967
779 def Write(self, string): 968 def Write(self, string):
780 """Writes a string to a file spliting if it's > 80 characters.""" 969 """Writes a string to a file spliting if it's > 80 characters."""
781 lines = string.splitlines() 970 lines = string.splitlines()
782 num_lines = len(lines) 971 num_lines = len(lines)
783 for ii in range(0, num_lines): 972 for ii in range(0, num_lines):
784 self.__WriteLine(lines[ii], ii < (num_lines - 1) or string[-1] == '\n') 973 self.__WriteLine(lines[ii], ii < (num_lines - 1) or string[-1] == '\n')
785 974
786 def __FindSplit(self, string): 975 def __FindSplit(self, string):
787 """Finds a place to split a string.""" 976 """Finds a place to split a string."""
788 splitter = string.find('=') 977 splitter = string.find('=')
789 if splitter >= 0 and not string[splitter + 1] == '=': 978 if splitter >= 0 and not string[splitter + 1] == '=' and splitter < 80:
790 return splitter 979 return splitter
791 parts = string.split('(') 980 parts = string.split('(')
792 if len(parts) > 1: 981 if len(parts) > 1:
793 splitter = len(parts[0]) 982 splitter = len(parts[0])
794 for ii in range(1, len(parts)): 983 for ii in range(1, len(parts)):
795 if not parts[ii - 1][-3:] == "if ": 984 if (not parts[ii - 1][-3:] == "if " and
985 (len(parts[ii]) > 0 and not parts[ii][0] == ")")
986 and splitter < 80):
796 return splitter 987 return splitter
797 splitter += len(parts[ii]) + 1 988 splitter += len(parts[ii]) + 1
798 done = False 989 done = False
799 end = len(string) 990 end = len(string)
800 last_splitter = -1 991 last_splitter = -1
801 while not done: 992 while not done:
802 splitter = string[0:end].rfind(',') 993 splitter = string[0:end].rfind(',')
803 if splitter < 0: 994 if splitter < 0:
804 return last_splitter 995 return last_splitter
805 elif splitter >= 80: 996 elif splitter >= 80:
(...skipping 19 matching lines...) Expand all
825 return 1016 return
826 self.file.write(line) 1017 self.file.write(line)
827 if ends_with_eol: 1018 if ends_with_eol:
828 self.file.write('\n') 1019 self.file.write('\n')
829 1020
830 def Close(self): 1021 def Close(self):
831 """Close the file.""" 1022 """Close the file."""
832 self.file.close() 1023 self.file.close()
833 1024
834 1025
1026 class CHeaderWriter(CWriter):
1027 """Writes a C Header file."""
1028
1029 _non_alnum_re = re.compile(r'[^a-zA-Z0-9]')
1030
1031 def __init__(self, filename, file_comment = None):
1032 CWriter.__init__(self, filename)
1033
1034 base = os.path.dirname(
1035 os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
1036 hpath = os.path.abspath(filename)[len(base) + 1:]
1037 self.guard = self._non_alnum_re.sub('_', hpath).upper() + '_'
1038
1039 self.Write(_LICENSE)
1040 self.Write(
1041 "// This file is auto-generated. DO NOT EDIT!\n"
1042 "\n")
1043 if not file_comment == None:
1044 self.Write(file_comment)
1045 self.Write("#ifndef %s\n" % self.guard)
1046 self.Write("#define %s\n\n" % self.guard)
1047
1048 def Close(self):
1049 self.Write("#endif // %s\n\n" % self.guard)
1050 CWriter.Close(self)
1051
835 class TypeHandler(object): 1052 class TypeHandler(object):
836 """This class emits code for a particular type of function.""" 1053 """This class emits code for a particular type of function."""
837 1054
838 def __init__(self): 1055 def __init__(self):
839 pass 1056 pass
840 1057
841 def InitFunction(self, func): 1058 def InitFunction(self, func):
842 """Add or adjust anything type specific for this function.""" 1059 """Add or adjust anything type specific for this function."""
843 if func.GetInfo('needs_size'): 1060 if func.GetInfo('needs_size'):
844 func.AddCmdArg(Argument('data_size', 'uint32')) 1061 func.AddCmdArg(Argument('data_size', 'uint32'))
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 offset += _SIZE_OF_UINT32 1102 offset += _SIZE_OF_UINT32
886 file.Write("\n") 1103 file.Write("\n")
887 1104
888 def WriteHandlerImplementation(self, func, file): 1105 def WriteHandlerImplementation(self, func, file):
889 """Writes the handler implementation for this command.""" 1106 """Writes the handler implementation for this command."""
890 file.Write(" %s(%s);\n" % 1107 file.Write(" %s(%s);\n" %
891 (func.GetGLFunctionName(), func.MakeOriginalArgString(""))) 1108 (func.GetGLFunctionName(), func.MakeOriginalArgString("")))
892 1109
893 def WriteCmdSizeTest(self, func, file): 1110 def WriteCmdSizeTest(self, func, file):
894 """Writes the size test for a command.""" 1111 """Writes the size test for a command."""
895 file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT\n") 1112 file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);\n")
896 1113
897 def WriteFormatTest(self, func, file): 1114 def WriteFormatTest(self, func, file):
898 """Writes a format test for a command.""" 1115 """Writes a format test for a command."""
899 file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) 1116 file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name)
900 file.Write(" %s cmd = {{0}};\n" % func.name) 1117 file.Write(" %s cmd = { { 0 } };\n" % func.name)
901 file.Write(" void* next_cmd = cmd.Set(\n") 1118 file.Write(" void* next_cmd = cmd.Set(\n")
902 file.Write(" &cmd") 1119 file.Write(" &cmd")
903 args = func.GetCmdArgs() 1120 args = func.GetCmdArgs()
904 value = 11 1121 value = 11
905 for arg in args: 1122 for arg in args:
906 file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) 1123 file.Write(",\n static_cast<%s>(%d)" % (arg.type, value))
907 value += 1 1124 value += 1
908 file.Write(");\n") 1125 file.Write(");\n")
909 value = 11 1126 value = 11
910 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) 1127 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 for arg in all_but_last_arg: 1207 for arg in all_but_last_arg:
991 arg.WriteGetCode(file) 1208 arg.WriteGetCode(file)
992 self.WriteGetDataSizeCode(func, file) 1209 self.WriteGetDataSizeCode(func, file)
993 last_arg.WriteGetCode(file) 1210 last_arg.WriteGetCode(file)
994 func.WriteHandlerValidation(file) 1211 func.WriteHandlerValidation(file)
995 func.WriteHandlerImplementation(file) 1212 func.WriteHandlerImplementation(file)
996 file.Write(" return parse_error::kParseNoError;\n") 1213 file.Write(" return parse_error::kParseNoError;\n")
997 file.Write("}\n") 1214 file.Write("}\n")
998 file.Write("\n") 1215 file.Write("\n")
999 1216
1217 def WriteValidUnitTest(self, func, file, test, extra = {}):
1218 """Writes a valid unit test."""
1219 name = func.name
1220 arg_strings = []
1221 count = 0
1222 for arg in func.GetOriginalArgs():
1223 arg_strings.append(arg.GetValidArg(count, 0))
1224 count += 1
1225 gl_arg_strings = []
1226 count = 0
1227 for arg in func.GetOriginalArgs():
1228 gl_arg_strings.append(arg.GetValidGLArg(count, 0))
1229 count += 1
1230 gl_func_name = func.GetGLTestFunctionName()
1231 vars = {
1232 'name':name,
1233 'gl_func_name': gl_func_name,
1234 'args': ", ".join(arg_strings),
1235 'gl_args': ", ".join(gl_arg_strings),
1236 }
1237 vars.update(extra)
1238 file.Write(test % vars)
1239
1240 def WriteInvalidUnitTest(self, func, file, test, extra = {}):
1241 """Writes a invalid unit test."""
1242 arg_index = 0
1243 for arg in func.GetOriginalArgs():
1244 num_invalid_values = arg.GetNumInvalidValues()
1245 for value_index in range(0, num_invalid_values):
1246 arg_strings = []
1247 parse_result = "kParseNoError"
1248 count = 0
1249 for arg in func.GetOriginalArgs():
1250 if count == arg_index:
1251 (arg_string, parse_result) = arg.GetInvalidArg(count, value_index)
1252 else:
1253 arg_string = arg.GetValidArg(count, 0)
1254 arg_strings.append(arg_string)
1255 count += 1
1256 gl_arg_strings = []
1257 count = 0
1258 for arg in func.GetOriginalArgs():
1259 gl_arg_strings.append("_")
1260 count += 1
1261 gl_func_name = func.GetGLFunctionName()
1262 if gl_func_name.startswith("gl"):
1263 gl_func_name = gl_func_name[2:]
1264 else:
1265 gl_func_name = func.name
1266
1267 vars = {
1268 'name': func.name,
1269 'arg_index': arg_index,
1270 'value_index': value_index,
1271 'gl_func_name': gl_func_name,
1272 'args': ", ".join(arg_strings),
1273 'all_but_last_args': ", ".join(arg_strings[:-1]),
1274 'gl_args': ", ".join(gl_arg_strings),
1275 'parse_result': parse_result,
1276 }
1277 vars.update(extra)
1278 file.Write(test % vars)
1279 arg_index += 1
1280
1281 def WriteServiceUnitTest(self, func, file):
1282 """Writes the service unit test for a command."""
1283 if func.GetInfo('unit_test') == False:
1284 file.Write("// TODO(gman): %s\n" % func.name)
1285 return
1286 valid_test = """
1287 TEST_F(GLES2DecoderTest, %(name)sValidArgs) {
1288 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s));
1289 SpecializedSetup<%(name)s, 0>();
1290 %(name)s cmd;
1291 cmd.Init(%(args)s);
1292 EXPECT_EQ(parse_error::kParseNoError, ExecuteCmd(cmd));
1293 }
1294 """
1295 self.WriteValidUnitTest(func, file, valid_test)
1296
1297 invalid_test = """
1298 TEST_F(GLES2DecoderTest, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
1299 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)).Times(0);
1300 SpecializedSetup<%(name)s, 0>();
1301 %(name)s cmd;
1302 cmd.Init(%(args)s);
1303 EXPECT_EQ(parse_error::%(parse_result)s, ExecuteCmd(cmd));
1304 }
1305 """
1306 self.WriteInvalidUnitTest(func, file, invalid_test)
1307
1308 def WriteImmediateServiceUnitTest(self, func, file):
1309 """Writes the service unit test for an immediate command."""
1310 file.Write("// TODO(gman): %s\n" % func.name)
1311
1000 def WriteImmediateValidationCode(self, func, file): 1312 def WriteImmediateValidationCode(self, func, file):
1001 """Writes the validation code for an immediate version of a command.""" 1313 """Writes the validation code for an immediate version of a command."""
1002 pass 1314 pass
1003 1315
1004 def WriteGLES2ImplementationHeader(self, func, file): 1316 def WriteGLES2ImplementationHeader(self, func, file):
1005 """Writes the GLES2 Implemention declaration.""" 1317 """Writes the GLES2 Implemention declaration."""
1006 if func.can_auto_generate: 1318 if func.can_auto_generate:
1007 file.Write("%s %s(%s) {\n" % 1319 file.Write("%s %s(%s) {\n" %
1008 (func.return_type, func.original_name, 1320 (func.return_type, func.original_name,
1009 func.MakeTypedOriginalArgString(""))) 1321 func.MakeTypedOriginalArgString("")))
(...skipping 29 matching lines...) Expand all
1039 1351
1040 def WriteImmediateCmdSetHeader(self, func, file): 1352 def WriteImmediateCmdSetHeader(self, func, file):
1041 """Writes the SetHeader function for the immediate version of a cmd.""" 1353 """Writes the SetHeader function for the immediate version of a cmd."""
1042 file.Write(" void SetHeader(uint32 size_in_bytes) {\n") 1354 file.Write(" void SetHeader(uint32 size_in_bytes) {\n")
1043 file.Write(" header.SetCmdByTotalSize<ValueType>(size_in_bytes);\n") 1355 file.Write(" header.SetCmdByTotalSize<ValueType>(size_in_bytes);\n")
1044 file.Write(" }\n") 1356 file.Write(" }\n")
1045 file.Write("\n") 1357 file.Write("\n")
1046 1358
1047 def WriteImmediateCmdInit(self, func, file): 1359 def WriteImmediateCmdInit(self, func, file):
1048 """Writes the Init function for the immediate version of a command.""" 1360 """Writes the Init function for the immediate version of a command."""
1049 file.Write(" void Init(%s) {\n" % func.MakeTypedCmdArgString("_")) 1361 raise Error
1050 file.Write(" SetHeader(0); // TODO(gman): pass in correct size\n")
1051 args = func.GetCmdArgs()
1052 for arg in args:
1053 file.Write(" %s = _%s;\n" % (arg.name, arg.name))
1054 file.Write(" }\n")
1055 file.Write("\n")
1056 1362
1057 def WriteImmediateCmdSet(self, func, file): 1363 def WriteImmediateCmdSet(self, func, file):
1058 """Writes the Set function for the immediate version of a command.""" 1364 """Writes the Set function for the immediate version of a command."""
1059 copy_args = func.MakeCmdArgString("_", False) 1365 raise Error
1060 file.Write(" void* Set(void* cmd%s) {\n" %
1061 func.MakeTypedCmdArgString("_", True))
1062 file.Write(" // TODO(gman): compute correct size.\n")
1063 file.Write(" const uint32 size = ComputeSize(0);\n")
1064 file.Write(" static_cast<ValueType*>(cmd)->Init(%s);\n" % copy_args)
1065 file.Write(" return NextImmediateCmdAddressTotalSize<ValueType>("
1066 "cmd, size);\n")
1067 file.Write(" }\n")
1068 file.Write("\n")
1069 1366
1070 def WriteCmdHelper(self, func, file): 1367 def WriteCmdHelper(self, func, file):
1071 """Writes the cmd helper definition for a cmd.""" 1368 """Writes the cmd helper definition for a cmd."""
1072 args = func.MakeCmdArgString("") 1369 args = func.MakeCmdArgString("")
1073 file.Write(" void %s(%s) {\n" % 1370 file.Write(" void %s(%s) {\n" %
1074 (func.name, func.MakeTypedCmdArgString(""))) 1371 (func.name, func.MakeTypedCmdArgString("")))
1075 file.Write(" gles2::%s& c = GetCmdSpace<gles2::%s>();\n" % 1372 file.Write(" gles2::%s& c = GetCmdSpace<gles2::%s>();\n" %
1076 (func.name, func.name)) 1373 (func.name, func.name))
1077 file.Write(" c.Init(%s);\n" % args) 1374 file.Write(" c.Init(%s);\n" % args)
1078 file.Write(" }\n\n") 1375 file.Write(" }\n\n")
(...skipping 14 matching lines...) Expand all
1093 class CustomHandler(TypeHandler): 1390 class CustomHandler(TypeHandler):
1094 """Handler for commands that are auto-generated but require minor tweaks.""" 1391 """Handler for commands that are auto-generated but require minor tweaks."""
1095 1392
1096 def __init__(self): 1393 def __init__(self):
1097 TypeHandler.__init__(self) 1394 TypeHandler.__init__(self)
1098 1395
1099 def WriteServiceImplementation(self, func, file): 1396 def WriteServiceImplementation(self, func, file):
1100 """Overrriden from TypeHandler.""" 1397 """Overrriden from TypeHandler."""
1101 pass 1398 pass
1102 1399
1400 def WriteServiceUnitTest(self, func, file):
1401 """Overrriden from TypeHandler."""
1402 file.Write("// TODO(gman): %s\n\n" % func.name)
1403
1404 def WriteImmediateServiceUnitTest(self, func, file):
1405 """Overrriden from TypeHandler."""
1406 file.Write("// TODO(gman): %s\n\n" % func.name)
1407
1103 def WriteImmediateCmdGetTotalSize(self, func, file): 1408 def WriteImmediateCmdGetTotalSize(self, func, file):
1104 """Overrriden from TypeHandler.""" 1409 """Overrriden from TypeHandler."""
1105 file.Write(" uint32 total_size = 0; // TODO(gman): get correct size.\n") 1410 file.Write(" uint32 total_size = 0; // TODO(gman): get correct size.\n")
1106 1411
1107 def WriteImmediateCmdInit(self, func, file): 1412 def WriteImmediateCmdInit(self, func, file):
1108 """Overrriden from TypeHandler.""" 1413 """Overrriden from TypeHandler."""
1109 file.Write(" void Init(%s) {\n" % func.MakeTypedCmdArgString("_")) 1414 file.Write(" void Init(%s) {\n" % func.MakeTypedCmdArgString("_"))
1110 self.WriteImmediateCmdGetTotalSize(func, file) 1415 self.WriteImmediateCmdGetTotalSize(func, file)
1111 file.Write(" SetHeader(total_size);\n") 1416 file.Write(" SetHeader(total_size);\n")
1112 args = func.GetCmdArgs() 1417 args = func.GetCmdArgs()
(...skipping 28 matching lines...) Expand all
1141 1446
1142 def InitFunction(self, func): 1447 def InitFunction(self, func):
1143 """Add or adjust anything type specific for this function.""" 1448 """Add or adjust anything type specific for this function."""
1144 CustomHandler.InitFunction(self, func) 1449 CustomHandler.InitFunction(self, func)
1145 func.can_auto_generate = False 1450 func.can_auto_generate = False
1146 1451
1147 def WriteStruct(self, func, file): 1452 def WriteStruct(self, func, file):
1148 """Overrriden from TypeHandler.""" 1453 """Overrriden from TypeHandler."""
1149 pass 1454 pass
1150 1455
1456 def WriteServiceUnitTest(self, func, file):
1457 """Overrriden from TypeHandler."""
1458 file.Write("// TODO(gman): %s\n\n" % func.name)
1459
1460 def WriteImmediateServiceUnitTest(self, func, file):
1461 """Overrriden from TypeHandler."""
1462 file.Write("// TODO(gman): %s\n\n" % func.name)
1463
1151 def WriteServiceImplementation(self, func, file): 1464 def WriteServiceImplementation(self, func, file):
1152 """Overrriden from TypeHandler.""" 1465 """Overrriden from TypeHandler."""
1153 pass 1466 pass
1154 1467
1155 def WriteImmediateServiceImplementation(self, func, file): 1468 def WriteImmediateServiceImplementation(self, func, file):
1156 """Overrriden from TypeHandler.""" 1469 """Overrriden from TypeHandler."""
1157 pass 1470 pass
1158 1471
1159 def WriteGLES2ImplementationImpl(self, func, file): 1472 def WriteGLES2ImplementationImpl(self, func, file):
1160 """Overrriden from TypeHandler.""" 1473 """Overrriden from TypeHandler."""
(...skipping 19 matching lines...) Expand all
1180 class ManualHandler(CustomHandler): 1493 class ManualHandler(CustomHandler):
1181 """Handler for commands who's handlers must be written by hand.""" 1494 """Handler for commands who's handlers must be written by hand."""
1182 1495
1183 def __init__(self): 1496 def __init__(self):
1184 CustomHandler.__init__(self) 1497 CustomHandler.__init__(self)
1185 1498
1186 def WriteServiceImplementation(self, func, file): 1499 def WriteServiceImplementation(self, func, file):
1187 """Overrriden from TypeHandler.""" 1500 """Overrriden from TypeHandler."""
1188 pass 1501 pass
1189 1502
1503 def WriteServiceUnitTest(self, func, file):
1504 """Overrriden from TypeHandler."""
1505 file.Write("// TODO(gman): %s\n\n" % func.name)
1506
1507 def WriteImmediateServiceUnitTest(self, func, file):
1508 """Overrriden from TypeHandler."""
1509 file.Write("// TODO(gman): %s\n\n" % func.name)
1510
1190 def WriteImmediateServiceImplementation(self, func, file): 1511 def WriteImmediateServiceImplementation(self, func, file):
1191 """Overrriden from TypeHandler.""" 1512 """Overrriden from TypeHandler."""
1192 pass 1513 pass
1193 1514
1194 def WriteImmediateFormatTest(self, func, file): 1515 def WriteImmediateFormatTest(self, func, file):
1195 """Overrriden from TypeHandler.""" 1516 """Overrriden from TypeHandler."""
1196 file.Write("// TODO(gman): Implement test for %s\n" % func.name) 1517 file.Write("// TODO(gman): Implement test for %s\n" % func.name)
1197 1518
1198 def WriteGLES2ImplementationHeader(self, func, file): 1519 def WriteGLES2ImplementationHeader(self, func, file):
1199 """Overrriden from TypeHandler.""" 1520 """Overrriden from TypeHandler."""
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 def WriteImmediateFormatTest(self, func, file): 1628 def WriteImmediateFormatTest(self, func, file):
1308 """Overrriden from TypeHandler.""" 1629 """Overrriden from TypeHandler."""
1309 # TODO(gman): Remove this exception. 1630 # TODO(gman): Remove this exception.
1310 file.Write("// TODO(gman): Implement test for %s\n" % func.name) 1631 file.Write("// TODO(gman): Implement test for %s\n" % func.name)
1311 return 1632 return
1312 1633
1313 def WriteGLES2ImplementationImpl(self, func, file): 1634 def WriteGLES2ImplementationImpl(self, func, file):
1314 """Overrriden from TypeHandler.""" 1635 """Overrriden from TypeHandler."""
1315 pass 1636 pass
1316 1637
1638 def WriteServiceUnitTest(self, func, file):
1639 """Overrriden from TypeHandler."""
1640 file.Write("// TODO(gman): %s\n\n" % func.name)
1641
1642 def WriteImmediateServiceUnitTest(self, func, file):
1643 """Overrriden from TypeHandler."""
1644 file.Write("// TODO(gman): %s\n\n" % func.name)
1645
1317 1646
1318 class GENnHandler(TypeHandler): 1647 class GENnHandler(TypeHandler):
1319 """Handler for glGen___ type functions.""" 1648 """Handler for glGen___ type functions."""
1320 1649
1321 def __init__(self): 1650 def __init__(self):
1322 TypeHandler.__init__(self) 1651 TypeHandler.__init__(self)
1323 1652
1324 def InitFunction(self, func): 1653 def InitFunction(self, func):
1325 """Overrriden from TypeHandler.""" 1654 """Overrriden from TypeHandler."""
1326 pass 1655 pass
1327 1656
1328 def WriteGetDataSizeCode(self, func, file): 1657 def WriteGetDataSizeCode(self, func, file):
1329 """Overrriden from TypeHandler.""" 1658 """Overrriden from TypeHandler."""
1330 file.Write(" uint32 data_size = n * sizeof(GLuint);\n") 1659 file.Write(" uint32 data_size = n * sizeof(GLuint);\n")
1331 1660
1332 def WriteHandlerImplementation (self, func, file): 1661 def WriteHandlerImplementation (self, func, file):
1333 """Overrriden from TypeHandler.""" 1662 """Overrriden from TypeHandler."""
1334 file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" % 1663 file.Write(" if (!GenGLObjects<GL%sHelper>(n, %s)) {\n"
1664 " return parse_error::kParseInvalidArguments;\n"
1665 " }\n" %
1335 (func.name, func.GetLastOriginalArg().name)) 1666 (func.name, func.GetLastOriginalArg().name))
1336 1667
1337 def WriteImmediateHandlerImplementation(self, func, file): 1668 def WriteImmediateHandlerImplementation(self, func, file):
1338 """Overrriden from TypeHandler.""" 1669 """Overrriden from TypeHandler."""
1339 file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" % 1670 file.Write(" if (!GenGLObjects<GL%sHelper>(n, %s)) {\n"
1671 " return parse_error::kParseInvalidArguments;\n"
1672 " }\n" %
1340 (func.original_name, func.GetLastOriginalArg().name)) 1673 (func.original_name, func.GetLastOriginalArg().name))
1341 1674
1342 def WriteGLES2ImplementationHeader(self, func, file): 1675 def WriteGLES2ImplementationHeader(self, func, file):
1343 """Overrriden from TypeHandler.""" 1676 """Overrriden from TypeHandler."""
1344 file.Write("%s %s(%s) {\n" % 1677 file.Write("%s %s(%s) {\n" %
1345 (func.return_type, func.original_name, 1678 (func.return_type, func.original_name,
1346 func.MakeTypedOriginalArgString(""))) 1679 func.MakeTypedOriginalArgString("")))
1347 file.Write(" MakeIds(%s);\n" % func.MakeOriginalArgString("")) 1680 file.Write(" MakeIds(%s);\n" % func.MakeOriginalArgString(""))
1348 file.Write(" helper_->%sImmediate(%s);\n" % 1681 file.Write(" helper_->%sImmediate(%s);\n" %
1349 (func.name, func.MakeOriginalArgString(""))) 1682 (func.name, func.MakeOriginalArgString("")))
1350 file.Write("}\n") 1683 file.Write("}\n")
1351 file.Write("\n") 1684 file.Write("\n")
1352 1685
1353 def WriteGLES2ImplementationImpl(self, func, file): 1686 def WriteGLES2ImplementationImpl(self, func, file):
1354 """Overrriden from TypeHandler.""" 1687 """Overrriden from TypeHandler."""
1355 pass 1688 pass
1356 1689
1690 def WriteServiceUnitTest(self, func, file):
1691 """Overrriden from TypeHandler."""
1692 valid_test = """
1693 TEST_F(GLES2DecoderTest, %(name)sValidArgs) {
1694 EXPECT_CALL(*gl_, %(gl_func_name)s(1, _))
1695 .WillOnce(SetArgumentPointee<1>(kNewServiceId));
1696 GetSharedMemoryAs<GLuint*>()[0] = kNewClientId;
1697 SpecializedSetup<%(name)s, 0>();
1698 %(name)s cmd;
1699 cmd.Init(%(args)s);
1700 EXPECT_EQ(parse_error::kParseNoError, ExecuteCmd(cmd));
1701 EXPECT_EQ(GetServiceId(kNewClientId), kNewServiceId);
1702 }
1703 """
1704 self.WriteValidUnitTest(func, file, valid_test)
1705 invalid_test = """
1706 TEST_F(GLES2DecoderTest, %(name)sInvalidArgs) {
1707 EXPECT_CALL(*gl_, %(gl_func_name)s(_, _)).Times(0);
1708 GetSharedMemoryAs<GLuint*>()[0] = client_%(resource_name)s_id_;
1709 SpecializedSetup<%(name)s, 0>();
1710 %(name)s cmd;
1711 cmd.Init(%(args)s);
1712 EXPECT_EQ(parse_error::kParseInvalidArguments, ExecuteCmd(cmd));
1713 }
1714 """
1715 self.WriteValidUnitTest(func, file, invalid_test, {
1716 'resource_name': func.GetOriginalArgs()[1].name[0:-1]
1717 })
1718
1719 def WriteImmediateServiceUnitTest(self, func, file):
1720 """Overrriden from TypeHandler."""
1721 valid_test = """
1722 TEST_F(GLES2DecoderTest, %(name)sValidArgs) {
1723 EXPECT_CALL(*gl_, %(gl_func_name)s(1, _))
1724 .WillOnce(SetArgumentPointee<1>(kNewServiceId));
1725 %(name)s& cmd = *GetImmediateAs<%(name)s>();
1726 GLuint temp = kNewClientId;
1727 SpecializedSetup<%(name)s, 0>();
1728 cmd.Init(1, &temp);
1729 EXPECT_EQ(parse_error::kParseNoError,
1730 ExecuteImmediateCmd(cmd, sizeof(temp)));
1731 EXPECT_EQ(GetServiceId(kNewClientId), kNewServiceId);
1732 }
1733 """
1734 self.WriteValidUnitTest(func, file, valid_test)
1735 invalid_test = """
1736 TEST_F(GLES2DecoderTest, %(name)sInvalidArgs) {
1737 EXPECT_CALL(*gl_, %(gl_func_name)s(_, _)).Times(0);
1738 %(name)s& cmd = *GetImmediateAs<%(name)s>();
1739 SpecializedSetup<%(name)s, 0>();
1740 cmd.Init(1, &client_%(resource_name)s_id_);
1741 EXPECT_EQ(parse_error::kParseInvalidArguments,
1742 ExecuteImmediateCmd(cmd, sizeof(&client_%(resource_name)s_id_)));
1743 }
1744 """
1745 self.WriteValidUnitTest(func, file, invalid_test, {
1746 'resource_name': func.GetOriginalArgs()[1].name[0:-1]
1747 })
1748
1357 def WriteImmediateCmdComputeSize(self, func, file): 1749 def WriteImmediateCmdComputeSize(self, func, file):
1358 """Overrriden from TypeHandler.""" 1750 """Overrriden from TypeHandler."""
1359 file.Write(" static uint32 ComputeDataSize(GLsizei n) {\n") 1751 file.Write(" static uint32 ComputeDataSize(GLsizei n) {\n")
1360 file.Write( 1752 file.Write(
1361 " return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT\n") 1753 " return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT\n")
1362 file.Write(" }\n") 1754 file.Write(" }\n")
1363 file.Write("\n") 1755 file.Write("\n")
1364 file.Write(" static uint32 ComputeSize(GLsizei n) {\n") 1756 file.Write(" static uint32 ComputeSize(GLsizei n) {\n")
1365 file.Write(" return static_cast<uint32>(\n") 1757 file.Write(" return static_cast<uint32>(\n")
1366 file.Write(" sizeof(ValueType) + ComputeDataSize(n)); // NOLINT\n") 1758 file.Write(" sizeof(ValueType) + ComputeDataSize(n)); // NOLINT\n")
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 for arg in args: 1823 for arg in args:
1432 file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) 1824 file.Write(",\n static_cast<%s>(%d)" % (arg.type, value))
1433 value += 1 1825 value += 1
1434 file.Write(",\n ids);\n") 1826 file.Write(",\n ids);\n")
1435 args = func.GetCmdArgs() 1827 args = func.GetCmdArgs()
1436 value = 11 1828 value = 11
1437 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) 1829 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name)
1438 file.Write(" cmd.header.command);\n") 1830 file.Write(" cmd.header.command);\n")
1439 file.Write(" EXPECT_EQ(sizeof(cmd) +\n") 1831 file.Write(" EXPECT_EQ(sizeof(cmd) +\n")
1440 file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u),\n") 1832 file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u),\n")
1441 file.Write(" cmd.header.size * 4u); // NOLINT\n") 1833 file.Write(" cmd.header.size * 4u);\n")
1442 file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") 1834 file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n")
1443 file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n"); 1835 file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n");
1444 file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u));\n"); 1836 file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u));\n");
1445 for arg in args: 1837 for arg in args:
1446 file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % 1838 file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" %
1447 (arg.type, value, arg.name)) 1839 (arg.type, value, arg.name))
1448 value += 1 1840 value += 1
1449 file.Write(" // TODO(gman): Check that ids were inserted;\n") 1841 file.Write(" // TODO(gman): Check that ids were inserted;\n")
1450 file.Write("}\n") 1842 file.Write("}\n")
1451 file.Write("\n") 1843 file.Write("\n")
1452 1844
1453 1845
1454 class CreateHandler(TypeHandler): 1846 class CreateHandler(TypeHandler):
1455 """Handler for glCreate___ type functions.""" 1847 """Handler for glCreate___ type functions."""
1456 1848
1457 def __init__(self): 1849 def __init__(self):
1458 TypeHandler.__init__(self) 1850 TypeHandler.__init__(self)
1459 1851
1460 def InitFunction(self, func): 1852 def InitFunction(self, func):
1461 """Overrriden from TypeHandler.""" 1853 """Overrriden from TypeHandler."""
1462 func.AddCmdArg(Argument("client_id", 'uint32')) 1854 func.AddCmdArg(Argument("client_id", 'uint32'))
1463 1855
1856 def WriteServiceUnitTest(self, func, file):
1857 """Overrriden from TypeHandler."""
1858 valid_test = """
1859 TEST_F(GLES2DecoderTest, %(name)sValidArgs) {
1860 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s))
1861 .WillOnce(Return(kNewServiceId));
1862 SpecializedSetup<%(name)s, 0>();
1863 %(name)s cmd;
1864 cmd.Init(%(args)s%(comma)skNewClientId);
1865 EXPECT_EQ(parse_error::kParseNoError, ExecuteCmd(cmd));
1866 EXPECT_EQ(GetServiceId(kNewClientId), kNewServiceId);
1867 }
1868 """
1869 comma = ""
1870 if len(func.GetOriginalArgs()):
1871 comma =", "
1872 self.WriteValidUnitTest(func, file, valid_test, {
1873 'comma': comma,
1874 })
1875 invalid_test = """
1876 TEST_F(GLES2DecoderTest, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
1877 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)).Times(0);
1878 SpecializedSetup<%(name)s, 0>();
1879 %(name)s cmd;
1880 cmd.Init(%(args)s%(comma)skNewClientId);
1881 EXPECT_EQ(parse_error::kParseNoError, ExecuteCmd(cmd));
1882 }
1883 """
1884 self.WriteInvalidUnitTest(func, file, invalid_test, {
1885 'comma': comma,
1886 })
1887
1464 def WriteHandlerImplementation (self, func, file): 1888 def WriteHandlerImplementation (self, func, file):
1465 """Overrriden from TypeHandler.""" 1889 """Overrriden from TypeHandler."""
1466 file.Write(" uint32 client_id = c.client_id;\n") 1890 file.Write(" uint32 client_id = c.client_id;\n")
1467 file.Write(" %sHelper(%s);\n" % 1891 file.Write(" %sHelper(%s);\n" %
1468 (func.name, func.MakeCmdArgString(""))) 1892 (func.name, func.MakeCmdArgString("")))
1469 1893
1470 def WriteGLES2ImplementationHeader(self, func, file): 1894 def WriteGLES2ImplementationHeader(self, func, file):
1471 """Overrriden from TypeHandler.""" 1895 """Overrriden from TypeHandler."""
1472 file.Write("%s %s(%s) {\n" % 1896 file.Write("%s %s(%s) {\n" %
1473 (func.return_type, func.original_name, 1897 (func.return_type, func.original_name,
(...skipping 14 matching lines...) Expand all
1488 class DELnHandler(TypeHandler): 1912 class DELnHandler(TypeHandler):
1489 """Handler for glDelete___ type functions.""" 1913 """Handler for glDelete___ type functions."""
1490 1914
1491 def __init__(self): 1915 def __init__(self):
1492 TypeHandler.__init__(self) 1916 TypeHandler.__init__(self)
1493 1917
1494 def WriteGetDataSizeCode(self, func, file): 1918 def WriteGetDataSizeCode(self, func, file):
1495 """Overrriden from TypeHandler.""" 1919 """Overrriden from TypeHandler."""
1496 file.Write(" uint32 data_size = n * sizeof(GLuint);\n") 1920 file.Write(" uint32 data_size = n * sizeof(GLuint);\n")
1497 1921
1922 def WriteServiceUnitTest(self, func, file):
1923 """Overrriden from TypeHandler."""
1924 valid_test = """
1925 TEST_F(GLES2DecoderTest, %(name)sValidArgs) {
1926 EXPECT_CALL(
1927 *gl_,
1928 %(gl_func_name)s(1, Pointee(kService%(upper_resource_name)sId)))
1929 .Times(1);
1930 GetSharedMemoryAs<GLuint*>()[0] = client_%(resource_name)s_id_;
1931 SpecializedSetup<%(name)s, 0>();
1932 %(name)s cmd;
1933 cmd.Init(%(args)s);
1934 EXPECT_EQ(parse_error::kParseNoError, ExecuteCmd(cmd));
1935 EXPECT_EQ(GetServiceId(kNewClientId), 0u);
1936 }
1937 """
1938 self.WriteValidUnitTest(func, file, valid_test, {
1939 'resource_name': func.GetOriginalArgs()[1].name[0:-1],
1940 'upper_resource_name':
1941 func.GetOriginalArgs()[1].name[0:-1].capitalize(),
1942 })
1943 invalid_test = """
1944 TEST_F(GLES2DecoderTest, %(name)sInvalidArgs) {
1945 EXPECT_CALL(*gl_, %(gl_func_name)s(1, Pointee(0)))
1946 .Times(1);
1947 GetSharedMemoryAs<GLuint*>()[0] = kInvalidClientId;
1948 SpecializedSetup<%(name)s, 0>();
1949 %(name)s cmd;
1950 cmd.Init(%(args)s);
1951 EXPECT_EQ(parse_error::kParseNoError, ExecuteCmd(cmd));
1952 }
1953 """
1954 self.WriteValidUnitTest(func, file, invalid_test)
1955
1956 def WriteImmediateServiceUnitTest(self, func, file):
1957 """Overrriden from TypeHandler."""
1958 valid_test = """
1959 TEST_F(GLES2DecoderTest, %(name)sValidArgs) {
1960 EXPECT_CALL(
1961 *gl_,
1962 %(gl_func_name)s(1, Pointee(kService%(upper_resource_name)sId)))
1963 .Times(1);
1964 %(name)s& cmd = *GetImmediateAs<%(name)s>();
1965 SpecializedSetup<%(name)s, 0>();
1966 cmd.Init(1, &client_%(resource_name)s_id_);
1967 EXPECT_EQ(parse_error::kParseNoError,
1968 ExecuteImmediateCmd(cmd, sizeof(client_%(resource_name)s_id_)));
1969 EXPECT_EQ(GetServiceId(kNewClientId), 0u);
1970 }
1971 """
1972 self.WriteValidUnitTest(func, file, valid_test, {
1973 'resource_name': func.GetOriginalArgs()[1].name[0:-1],
1974 'upper_resource_name':
1975 func.GetOriginalArgs()[1].name[0:-1].capitalize(),
1976 })
1977 invalid_test = """
1978 TEST_F(GLES2DecoderTest, %(name)sInvalidArgs) {
1979 EXPECT_CALL(*gl_, %(gl_func_name)s(1, Pointee(0)))
1980 .Times(1);
1981 %(name)s& cmd = *GetImmediateAs<%(name)s>();
1982 SpecializedSetup<%(name)s, 0>();
1983 GLuint temp = kInvalidClientId;
1984 cmd.Init(1, &temp);
1985 EXPECT_EQ(parse_error::kParseNoError,
1986 ExecuteImmediateCmd(cmd, sizeof(temp)));
1987 }
1988 """
1989 self.WriteValidUnitTest(func, file, invalid_test)
1990
1498 def WriteHandlerImplementation (self, func, file): 1991 def WriteHandlerImplementation (self, func, file):
1499 """Overrriden from TypeHandler.""" 1992 """Overrriden from TypeHandler."""
1500 file.Write(" DeleteGLObjects<GL%sHelper>(n, %s);\n" % 1993 file.Write(" DeleteGLObjects<GL%sHelper>(n, %s);\n" %
1501 (func.name, func.GetLastOriginalArg().name)) 1994 (func.name, func.GetLastOriginalArg().name))
1502 1995
1503 def WriteImmediateHandlerImplementation (self, func, file): 1996 def WriteImmediateHandlerImplementation (self, func, file):
1504 """Overrriden from TypeHandler.""" 1997 """Overrriden from TypeHandler."""
1505 file.Write(" DeleteGLObjects<GL%sHelper>(n, %s);\n" % 1998 file.Write(" DeleteGLObjects<GL%sHelper>(n, %s);\n" %
1506 (func.original_name, func.GetLastOriginalArg().name)) 1999 (func.original_name, func.GetLastOriginalArg().name))
1507 2000
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 for arg in args: 2090 for arg in args:
1598 file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) 2091 file.Write(",\n static_cast<%s>(%d)" % (arg.type, value))
1599 value += 1 2092 value += 1
1600 file.Write(",\n ids);\n") 2093 file.Write(",\n ids);\n")
1601 args = func.GetCmdArgs() 2094 args = func.GetCmdArgs()
1602 value = 11 2095 value = 11
1603 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) 2096 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name)
1604 file.Write(" cmd.header.command);\n") 2097 file.Write(" cmd.header.command);\n")
1605 file.Write(" EXPECT_EQ(sizeof(cmd) +\n") 2098 file.Write(" EXPECT_EQ(sizeof(cmd) +\n")
1606 file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u),\n") 2099 file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u),\n")
1607 file.Write(" cmd.header.size * 4u); // NOLINT\n") 2100 file.Write(" cmd.header.size * 4u);\n")
1608 file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") 2101 file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n")
1609 file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n"); 2102 file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n");
1610 file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u));\n"); 2103 file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u));\n");
1611 for arg in args: 2104 for arg in args:
1612 file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % 2105 file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" %
1613 (arg.type, value, arg.name)) 2106 (arg.type, value, arg.name))
1614 value += 1 2107 value += 1
1615 file.Write(" // TODO(gman): Check that ids were inserted;\n") 2108 file.Write(" // TODO(gman): Check that ids were inserted;\n")
1616 file.Write("}\n") 2109 file.Write("}\n")
1617 file.Write("\n") 2110 file.Write("\n")
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 """Overrriden from TypeHandler.""" 2166 """Overrriden from TypeHandler."""
1674 pass 2167 pass
1675 2168
1676 2169
1677 class PUTHandler(TypeHandler): 2170 class PUTHandler(TypeHandler):
1678 """Handler for glTexParameter_v, glVertexAttrib_v functions.""" 2171 """Handler for glTexParameter_v, glVertexAttrib_v functions."""
1679 2172
1680 def __init__(self): 2173 def __init__(self):
1681 TypeHandler.__init__(self) 2174 TypeHandler.__init__(self)
1682 2175
2176 def WriteImmediateServiceUnitTest(self, func, file):
2177 """Writes the service unit test for a command."""
2178 valid_test = """
2179 TEST_F(GLES2DecoderTest, %(name)sValidArgs) {
2180 %(name)s& cmd = *GetImmediateAs<%(name)s>();
2181 EXPECT_CALL(
2182 *gl_,
2183 %(gl_func_name)s(%(gl_args)s,
2184 reinterpret_cast<%(data_type)s*>(ImmediateDataAddress(&cmd))));
2185 SpecializedSetup<%(name)s, 0>();
2186 %(data_type)s temp[%(data_count)s] = { 0, };
2187 cmd.Init(%(gl_args)s, &temp[0]);
2188 EXPECT_EQ(parse_error::kParseNoError,
2189 ExecuteImmediateCmd(cmd, sizeof(temp)));
2190 }
2191 """
2192 gl_arg_strings = []
2193 gl_any_strings = []
2194 count = 0
2195 for arg in func.GetOriginalArgs()[0:-1]:
2196 gl_arg_strings.append(arg.GetValidGLArg(count, 0))
2197 gl_any_strings.append("_")
2198 count += 1
2199 extra = {
2200 'data_type': func.GetInfo('data_type'),
2201 'data_count': func.GetInfo('count'),
2202 'gl_args': ", ".join(gl_arg_strings),
2203 'gl_any_args': ", ".join(gl_any_strings),
2204 }
2205 self.WriteValidUnitTest(func, file, valid_test, extra)
2206
2207 invalid_test = """
2208 TEST_F(GLES2DecoderTest, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
2209 %(name)s& cmd = *GetImmediateAs<%(name)s>();
2210 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_any_args)s, _)).Times(0);
2211 SpecializedSetup<%(name)s, 0>();
2212 %(data_type)s temp[%(data_count)s] = { 0, };
2213 cmd.Init(%(all_but_last_args)s, &temp[0]);
2214 EXPECT_EQ(parse_error::%(parse_result)s,
2215 ExecuteImmediateCmd(cmd, sizeof(temp)));
2216 }
2217 """
2218 self.WriteInvalidUnitTest(func, file, invalid_test, extra)
2219
1683 def WriteGetDataSizeCode(self, func, file): 2220 def WriteGetDataSizeCode(self, func, file):
1684 """Overrriden from TypeHandler.""" 2221 """Overrriden from TypeHandler."""
1685 file.Write(" uint32 data_size = ComputeImmediateDataSize(" 2222 file.Write(" uint32 data_size = ComputeImmediateDataSize("
1686 "immediate_data_size, 1, sizeof(%s), %d);\n" % 2223 "immediate_data_size, 1, sizeof(%s), %d);\n" %
1687 (func.info.data_type, func.info.count)) 2224 (func.info.data_type, func.info.count))
1688 2225
1689 def WriteGLES2ImplementationHeader(self, func, file): 2226 def WriteGLES2ImplementationHeader(self, func, file):
1690 """Overrriden from TypeHandler.""" 2227 """Overrriden from TypeHandler."""
1691 file.Write("%s %s(%s) {\n" % 2228 file.Write("%s %s(%s) {\n" %
1692 (func.return_type, func.original_name, 2229 (func.return_type, func.original_name,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 for arg in args: 2322 for arg in args:
1786 file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) 2323 file.Write(",\n static_cast<%s>(%d)" % (arg.type, value))
1787 value += 1 2324 value += 1
1788 file.Write(",\n data);\n") 2325 file.Write(",\n data);\n")
1789 args = func.GetCmdArgs() 2326 args = func.GetCmdArgs()
1790 value = 11 2327 value = 11
1791 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) 2328 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name)
1792 file.Write(" cmd.header.command);\n") 2329 file.Write(" cmd.header.command);\n")
1793 file.Write(" EXPECT_EQ(sizeof(cmd) +\n") 2330 file.Write(" EXPECT_EQ(sizeof(cmd) +\n")
1794 file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)),\n") 2331 file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)),\n")
1795 file.Write(" cmd.header.size * 4u); // NOLINT\n") 2332 file.Write(" cmd.header.size * 4u);\n")
1796 file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") 2333 file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n")
1797 file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n") 2334 file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n")
1798 file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)));\n") 2335 file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)));\n")
1799 for arg in args: 2336 for arg in args:
1800 file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % 2337 file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" %
1801 (arg.type, value, arg.name)) 2338 (arg.type, value, arg.name))
1802 value += 1 2339 value += 1
1803 file.Write(" // TODO(gman): Check that data was inserted;\n") 2340 file.Write(" // TODO(gman): Check that data was inserted;\n")
1804 file.Write("}\n") 2341 file.Write("}\n")
1805 file.Write("\n") 2342 file.Write("\n")
1806 2343
1807 2344
1808 class PUTnHandler(TypeHandler): 2345 class PUTnHandler(TypeHandler):
1809 """Handler for PUTn 'glUniform__v' type functions.""" 2346 """Handler for PUTn 'glUniform__v' type functions."""
1810 2347
1811 def __init__(self): 2348 def __init__(self):
1812 TypeHandler.__init__(self) 2349 TypeHandler.__init__(self)
1813 2350
2351 def WriteImmediateServiceUnitTest(self, func, file):
2352 """Writes the service unit test for a command."""
2353 valid_test = """
2354 TEST_F(GLES2DecoderTest, %(name)sValidArgs) {
2355 %(name)s& cmd = *GetImmediateAs<%(name)s>();
2356 EXPECT_CALL(
2357 *gl_,
2358 %(gl_func_name)s(%(gl_args)s,
2359 reinterpret_cast<%(data_type)s*>(ImmediateDataAddress(&cmd))));
2360 SpecializedSetup<%(name)s, 0>();
2361 %(data_type)s temp[%(data_count)s * 2] = { 0, };
2362 cmd.Init(%(gl_args)s, &temp[0]);
2363 EXPECT_EQ(parse_error::kParseNoError,
2364 ExecuteImmediateCmd(cmd, sizeof(temp)));
2365 }
2366 """
2367 gl_arg_strings = []
2368 gl_any_strings = []
2369 count = 0
2370 for arg in func.GetOriginalArgs()[0:-1]:
2371 gl_arg_strings.append(arg.GetValidGLArg(count, 0))
2372 gl_any_strings.append("_")
2373 count += 1
2374 extra = {
2375 'data_type': func.GetInfo('data_type'),
2376 'data_count': func.GetInfo('count'),
2377 'gl_args': ", ".join(gl_arg_strings),
2378 'gl_any_args': ", ".join(gl_any_strings),
2379 }
2380 self.WriteValidUnitTest(func, file, valid_test, extra)
2381
2382 invalid_test = """
2383 TEST_F(GLES2DecoderTest, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
2384 %(name)s& cmd = *GetImmediateAs<%(name)s>();
2385 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_any_args)s, _)).Times(0);
2386 SpecializedSetup<%(name)s, 0>();
2387 %(data_type)s temp[%(data_count)s * 2] = { 0, };
2388 cmd.Init(%(all_but_last_args)s, &temp[0]);
2389 EXPECT_EQ(parse_error::%(parse_result)s,
2390 ExecuteImmediateCmd(cmd, sizeof(temp)));
2391 }
2392 """
2393 self.WriteInvalidUnitTest(func, file, invalid_test, extra)
2394
1814 def WriteGetDataSizeCode(self, func, file): 2395 def WriteGetDataSizeCode(self, func, file):
1815 """Overrriden from TypeHandler.""" 2396 """Overrriden from TypeHandler."""
1816 file.Write(" uint32 data_size = ComputeImmediateDataSize(" 2397 file.Write(" uint32 data_size = ComputeImmediateDataSize("
1817 "immediate_data_size, 1, sizeof(%s), %d);\n" % 2398 "immediate_data_size, 1, sizeof(%s), %d);\n" %
1818 (func.info.data_type, func.info.count)) 2399 (func.info.data_type, func.info.count))
1819 2400
1820 def WriteGLES2ImplementationHeader(self, func, file): 2401 def WriteGLES2ImplementationHeader(self, func, file):
1821 """Overrriden from TypeHandler.""" 2402 """Overrriden from TypeHandler."""
1822 file.Write("%s %s(%s) {\n" % 2403 file.Write("%s %s(%s) {\n" %
1823 (func.return_type, func.original_name, 2404 (func.return_type, func.original_name,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 for arg in args: 2497 for arg in args:
1917 file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) 2498 file.Write(",\n static_cast<%s>(%d)" % (arg.type, value))
1918 value += 1 2499 value += 1
1919 file.Write(",\n data);\n") 2500 file.Write(",\n data);\n")
1920 args = func.GetCmdArgs() 2501 args = func.GetCmdArgs()
1921 value = 1 2502 value = 1
1922 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) 2503 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name)
1923 file.Write(" cmd.header.command);\n") 2504 file.Write(" cmd.header.command);\n")
1924 file.Write(" EXPECT_EQ(sizeof(cmd) +\n") 2505 file.Write(" EXPECT_EQ(sizeof(cmd) +\n")
1925 file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)),\n") 2506 file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)),\n")
1926 file.Write(" cmd.header.size * 4u); // NOLINT\n") 2507 file.Write(" cmd.header.size * 4u);\n")
1927 file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") 2508 file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n")
1928 file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n") 2509 file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n")
1929 file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)));\n") 2510 file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)));\n")
1930 for arg in args: 2511 for arg in args:
1931 file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % 2512 file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" %
1932 (arg.type, value, arg.name)) 2513 (arg.type, value, arg.name))
1933 value += 1 2514 value += 1
1934 file.Write(" // TODO(gman): Check that data was inserted;\n") 2515 file.Write(" // TODO(gman): Check that data was inserted;\n")
1935 file.Write("}\n") 2516 file.Write("}\n")
1936 file.Write("\n") 2517 file.Write("\n")
1937 2518
1938 2519
1939 class GLcharHandler(TypeHandler): 2520 class GLcharHandler(TypeHandler):
1940 """Handler for functions that pass a single string .""" 2521 """Handler for functions that pass a single string ."""
1941 2522
1942 def __init__(self): 2523 def __init__(self):
1943 TypeHandler.__init__(self) 2524 TypeHandler.__init__(self)
1944 2525
1945 def InitFunction(self, func): 2526 def InitFunction(self, func):
1946 """Overrriden from TypeHandler.""" 2527 """Overrriden from TypeHandler."""
1947 func.AddCmdArg(Argument('data_size', 'uint32')) 2528 func.AddCmdArg(Argument('data_size', 'uint32'))
1948 2529
2530 def WriteServiceUnitTest(self, func, file):
2531 """Overrriden from TypeHandler."""
2532 file.Write("// TODO(gman): %s\n\n" % func.name)
2533
2534 def WriteImmediateServiceUnitTest(self, func, file):
2535 """Overrriden from TypeHandler."""
2536 file.Write("// TODO(gman): %s\n\n" % func.name)
2537
1949 def WriteServiceImplementation(self, func, file): 2538 def WriteServiceImplementation(self, func, file):
1950 """Overrriden from TypeHandler.""" 2539 """Overrriden from TypeHandler."""
1951 file.Write( 2540 file.Write(
1952 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) 2541 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name)
1953 file.Write( 2542 file.Write(
1954 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) 2543 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name)
1955 last_arg = func.GetLastOriginalArg() 2544 last_arg = func.GetLastOriginalArg()
1956 2545
1957 all_but_last_arg = func.GetOriginalArgs()[:-1] 2546 all_but_last_arg = func.GetOriginalArgs()[:-1]
1958 for arg in all_but_last_arg: 2547 for arg in all_but_last_arg:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2007 (func.name, func.MakeOriginalArgString(""))) 2596 (func.name, func.MakeOriginalArgString("")))
2008 file.Write("}\n") 2597 file.Write("}\n")
2009 file.Write("\n") 2598 file.Write("\n")
2010 2599
2011 def WriteGLES2ImplementationImpl(self, func, file): 2600 def WriteGLES2ImplementationImpl(self, func, file):
2012 """Overrriden from TypeHandler.""" 2601 """Overrriden from TypeHandler."""
2013 pass 2602 pass
2014 2603
2015 def WriteImmediateCmdComputeSize(self, func, file): 2604 def WriteImmediateCmdComputeSize(self, func, file):
2016 """Overrriden from TypeHandler.""" 2605 """Overrriden from TypeHandler."""
2017 file.Write(" static uint32 ComputeDataSize(const char* s) {\n") 2606 file.Write(" static uint32 ComputeSize(uint32 data_size) {\n")
2018 file.Write(" return strlen(s);\n") 2607 file.Write(" return static_cast<uint32>(\n")
2608 file.Write(" sizeof(ValueType) + data_size); // NOLINT\n")
2019 file.Write(" }\n") 2609 file.Write(" }\n")
2020 file.Write("\n")
2021 file.Write(" static uint32 ComputeSize(const char* s) {\n")
2022 file.Write(" return static_cast<uint32>(\n")
2023 file.Write(" sizeof(ValueType) + ComputeDataSize(s)); // NOLINT\n")
2024 file.Write(" }\n")
2025 file.Write("\n")
2026 2610
2027 def WriteImmediateCmdSetHeader(self, func, file): 2611 def WriteImmediateCmdSetHeader(self, func, file):
2028 """Overrriden from TypeHandler.""" 2612 """Overrriden from TypeHandler."""
2029 file.Write(" void SetHeader(const char* s) {\n") 2613 code = """
2030 file.Write(" header.SetCmdByTotalSize<ValueType>(ComputeSize(s));\n") 2614 void SetHeader(uint32 data_size) {
2031 file.Write(" }\n") 2615 header.SetCmdBySize<ValueType>(data_size);
2032 file.Write("\n") 2616 }
2617 """
2618 file.Write(code)
2033 2619
2034 def WriteImmediateCmdInit(self, func, file): 2620 def WriteImmediateCmdInit(self, func, file):
2035 """Overrriden from TypeHandler.""" 2621 """Overrriden from TypeHandler."""
2036 last_arg = func.GetLastOriginalArg() 2622 last_arg = func.GetLastOriginalArg()
2037 file.Write(" void Init(%s) {\n" % func.MakeTypedOriginalArgString("_")) 2623 args = func.GetCmdArgs()
2038 file.Write(" SetHeader(_%s);\n" % last_arg.name) 2624 set_code = []
2039 args = func.GetCmdArgs()[:-1]
2040 for arg in args: 2625 for arg in args:
2041 file.Write(" %s = _%s;\n" % (arg.name, arg.name)) 2626 set_code.append(" %s = _%s;" % (arg.name, arg.name))
2042 file.Write(" data_size = strlen(_%s);\n" % last_arg.name) 2627 code = """
2043 file.Write(" memcpy(ImmediateDataAddress(this), _%s, data_size);\n" % 2628 void Init(%(typed_args)s, uint32 _data_size) {
2044 last_arg.name) 2629 SetHeader(_data_size);
2045 file.Write(" }\n") 2630 %(set_code)s
2046 file.Write("\n") 2631 memcpy(ImmediateDataAddress(this), _%(last_arg)s, _data_size);
2632 }
2633
2634 """
2635 file.Write(code % {
2636 "typed_args": func.MakeTypedOriginalArgString("_"),
2637 "set_code": "\n".join(set_code),
2638 "last_arg": last_arg.name
2639 })
2047 2640
2048 def WriteImmediateCmdSet(self, func, file): 2641 def WriteImmediateCmdSet(self, func, file):
2049 """Overrriden from TypeHandler.""" 2642 """Overrriden from TypeHandler."""
2050 last_arg = func.GetLastOriginalArg() 2643 last_arg = func.GetLastOriginalArg()
2051 file.Write(" void* Set(void* cmd%s) {\n" % 2644 file.Write(" void* Set(void* cmd%s, uint32 _data_size) {\n" %
2052 func.MakeTypedOriginalArgString("_", True)) 2645 func.MakeTypedOriginalArgString("_", True))
2053 file.Write(" static_cast<ValueType*>(cmd)->Init(%s);\n" % 2646 file.Write(" static_cast<ValueType*>(cmd)->Init(%s, _data_size);\n" %
2054 func.MakeOriginalArgString("_")) 2647 func.MakeOriginalArgString("_"))
2055 file.Write(" const uint32 size = ComputeSize(_%s);\n" % last_arg.name) 2648 file.Write(" return NextImmediateCmdAddress<ValueType>("
2056 file.Write(" return NextImmediateCmdAddressTotalSize<ValueType>(" 2649 "cmd, _data_size);\n")
2057 "cmd, size);\n")
2058 file.Write(" }\n") 2650 file.Write(" }\n")
2059 file.Write("\n") 2651 file.Write("\n")
2060 2652
2061 def WriteImmediateCmdHelper(self, func, file): 2653 def WriteImmediateCmdHelper(self, func, file):
2062 """Overrriden from TypeHandler.""" 2654 """Overrriden from TypeHandler."""
2063 args = func.MakeOriginalArgString("") 2655 args = func.MakeOriginalArgString("")
2064 last_arg = func.GetLastOriginalArg() 2656 last_arg = func.GetLastOriginalArg()
2065 file.Write(" void %s(%s) {\n" % 2657 file.Write(" void %s(%s) {\n" %
2066 (func.name, func.MakeTypedOriginalArgString(""))) 2658 (func.name, func.MakeTypedOriginalArgString("")))
2067 file.Write(" const uint32 size = gles2::%s::ComputeSize(%s);\n" % 2659 file.Write(" const uint32 data_size = strlen(name);\n")
2068 (func.name, last_arg.name)) 2660 file.Write(" gles2::%s& c = GetImmediateCmdSpace<gles2::%s>("
2069 file.Write(" gles2::%s& c = GetImmediateCmdSpaceTotalSize<gles2::%s>(" 2661 "data_size);\n" %
2070 "size);\n" %
2071 (func.name, func.name)) 2662 (func.name, func.name))
2072 file.Write(" c.Init(%s);\n" % args) 2663 file.Write(" c.Init(%s, data_size);\n" % args)
2073 file.Write(" }\n\n") 2664 file.Write(" }\n\n")
2074 2665
2075 def WriteImmediateFormatTest(self, func, file): 2666 def WriteImmediateFormatTest(self, func, file):
2076 """Overrriden from TypeHandler.""" 2667 """Overrriden from TypeHandler."""
2077 file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) 2668 init_code = []
2078 file.Write(" int8 buf[256] = { 0, };\n") 2669 check_code = []
2079 file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" %
2080 (func.name, func.name))
2081 file.Write(" static const char* const test_str = \"test string\";\n")
2082 file.Write(" void* next_cmd = cmd.Set(\n")
2083 file.Write(" &cmd")
2084 all_but_last_arg = func.GetCmdArgs()[:-1] 2670 all_but_last_arg = func.GetCmdArgs()[:-1]
2085 value = 11 2671 value = 11
2086 for arg in all_but_last_arg: 2672 for arg in all_but_last_arg:
2087 file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) 2673 init_code.append(" static_cast<%s>(%d)," % (arg.type, value))
2088 value += 1 2674 value += 1
2089 file.Write(",\n test_str);\n")
2090 value = 11 2675 value = 11
2091 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name)
2092 file.Write(" cmd.header.command);\n")
2093 file.Write(" EXPECT_EQ(sizeof(cmd) + // NOLINT\n")
2094 file.Write(" RoundSizeToMultipleOfEntries(strlen(test_str)),\n")
2095 file.Write(" cmd.header.size * 4u);\n")
2096 file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n")
2097 file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n")
2098 file.Write(" strlen(test_str) + 1);\n")
2099 for arg in all_but_last_arg: 2676 for arg in all_but_last_arg:
2100 file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % 2677 check_code.append(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);" %
2101 (arg.type, value, arg.name)) 2678 (arg.type, value, arg.name))
2102 value += 1 2679 value += 1
2103 file.Write(" // TODO(gman): check that string got copied.\n") 2680 code = """
2104 file.Write("}\n") 2681 TEST(GLES2FormatTest, %(func_name)s) {
2105 file.Write("\n") 2682 int8 buf[256] = { 0, };
2683 %(func_name)s& cmd = *static_cast<%(func_name)s*>(static_cast<void*>(&buf));
2684 static const char* const test_str = \"test string\";
2685 void* next_cmd = cmd.Set(
2686 &cmd,
2687 %(init_code)s
2688 test_str,
2689 strlen(test_str));
2690 EXPECT_EQ(static_cast<uint32>(%(func_name)s::kCmdId),
2691 cmd.header.command);
2692 EXPECT_EQ(sizeof(cmd) +
2693 RoundSizeToMultipleOfEntries(strlen(test_str)),
2694 cmd.header.size * 4u);
2695 EXPECT_EQ(static_cast<char*>(next_cmd),
2696 reinterpret_cast<char*>(&cmd) + sizeof(cmd) +
2697 RoundSizeToMultipleOfEntries(strlen(test_str)));
2698 %(check_code)s
2699 EXPECT_EQ(static_cast<uint32>(strlen(test_str)), cmd.data_size);
2700 EXPECT_EQ(0, memcmp(test_str, ImmediateDataAddress(&cmd), strlen(test_str)));
2701 }
2702 """
2703 file.Write(code % {
2704 'func_name': func.name,
2705 'init_code': "\n".join(init_code),
2706 'check_code': "\n".join(check_code),
2707 })
2106 2708
2107 class GetGLcharHandler(GLcharHandler): 2709 class GetGLcharHandler(GLcharHandler):
2108 """Handler for glGetAttibLoc, glGetUniformLoc.""" 2710 """Handler for glGetAttibLoc, glGetUniformLoc."""
2109 2711
2110 def __init__(self): 2712 def __init__(self):
2111 GLcharHandler.__init__(self) 2713 GLcharHandler.__init__(self)
2112 2714
2715 def WriteServiceUnitTest(self, func, file):
2716 """Overrriden from TypeHandler."""
2717 file.Write("// TODO(gman): %s\n\n" % func.name)
2718
2719 def WriteImmediateServiceUnitTest(self, func, file):
2720 """Overrriden from TypeHandler."""
2721 file.Write("// TODO(gman): %s\n\n" % func.name)
2722
2113 def WriteServiceImplementation(self, func, file): 2723 def WriteServiceImplementation(self, func, file):
2114 """Overrriden from TypeHandler.""" 2724 """Overrriden from TypeHandler."""
2115 file.Write( 2725 file.Write(
2116 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) 2726 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name)
2117 file.Write( 2727 file.Write(
2118 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) 2728 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name)
2119 last_arg = func.GetLastOriginalArg() 2729 last_arg = func.GetLastOriginalArg()
2120 2730
2121 all_but_last_arg = func.GetOriginalArgs() 2731 all_but_last_arg = func.GetOriginalArgs()
2122 for arg in all_but_last_arg: 2732 for arg in all_but_last_arg:
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
2254 file.Write(" void* next_cmd = cmd.Set(\n") 2864 file.Write(" void* next_cmd = cmd.Set(\n")
2255 file.Write(" &cmd") 2865 file.Write(" &cmd")
2256 all_but_last_arg = func.GetCmdArgs()[:-1] 2866 all_but_last_arg = func.GetCmdArgs()[:-1]
2257 value = 11 2867 value = 11
2258 for arg in all_but_last_arg: 2868 for arg in all_but_last_arg:
2259 file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) 2869 file.Write(",\n static_cast<%s>(%d)" % (arg.type, value))
2260 value += 1 2870 value += 1
2261 file.Write(",\n test_str);\n") 2871 file.Write(",\n test_str);\n")
2262 value = 11 2872 value = 11
2263 file.Write(" EXPECT_EQ(%s::kCmdId ^ cmd.header.command);\n" % func.name) 2873 file.Write(" EXPECT_EQ(%s::kCmdId ^ cmd.header.command);\n" % func.name)
2264 file.Write(" EXPECT_EQ(sizeof(cmd) + // NOLINT\n") 2874 file.Write(" EXPECT_EQ(sizeof(cmd)\n")
2265 file.Write(" RoundSizeToMultipleOfEntries(strlen(test_str)),\n") 2875 file.Write(" RoundSizeToMultipleOfEntries(strlen(test_str)),\n")
2266 file.Write(" cmd.header.size * 4u);\n") 2876 file.Write(" cmd.header.size * 4u);\n")
2267 file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") 2877 file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n")
2268 file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd));\n"); 2878 file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd));\n");
2269 for arg in all_but_last_arg: 2879 for arg in all_but_last_arg:
2270 file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % 2880 file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" %
2271 (arg.type, value, arg.name)) 2881 (arg.type, value, arg.name))
2272 value += 1 2882 value += 1
2273 file.Write(" // TODO(gman): check that string got copied.\n") 2883 file.Write(" // TODO(gman): check that string got copied.\n")
2274 file.Write("}\n") 2884 file.Write("}\n")
2275 file.Write("\n") 2885 file.Write("\n")
2276 2886
2277 2887
2278 class IsHandler(TypeHandler): 2888 class IsHandler(TypeHandler):
2279 """Handler for glIs____ type and glGetError functions.""" 2889 """Handler for glIs____ type and glGetError functions."""
2280 2890
2281 def __init__(self): 2891 def __init__(self):
2282 TypeHandler.__init__(self) 2892 TypeHandler.__init__(self)
2283 2893
2284 def InitFunction(self, func): 2894 def InitFunction(self, func):
2285 """Overrriden from TypeHandler.""" 2895 """Overrriden from TypeHandler."""
2286 func.AddCmdArg(Argument("result_shm_id", 'uint32')) 2896 func.AddCmdArg(Argument("result_shm_id", 'uint32'))
2287 func.AddCmdArg(Argument("result_shm_offset", 'uint32')) 2897 func.AddCmdArg(Argument("result_shm_offset", 'uint32'))
2288 2898
2899 def WriteServiceUnitTest(self, func, file):
2900 """Overrriden from TypeHandler."""
2901 valid_test = """
2902 TEST_F(GLES2DecoderTest, %(name)sValidArgs) {
2903 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s));
2904 SpecializedSetup<%(name)s, 0>();
2905 %(name)s cmd;
2906 cmd.Init(%(args)s%(comma)sshared_memory_id_, shared_memory_offset_);
2907 EXPECT_EQ(parse_error::kParseNoError, ExecuteCmd(cmd));
2908 }
2909 """
2910 comma = ""
2911 if len(func.GetOriginalArgs()):
2912 comma =", "
2913 self.WriteValidUnitTest(func, file, valid_test, {
2914 'comma': comma,
2915 })
2916
2917 invalid_test = """
2918 TEST_F(GLES2DecoderTest, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
2919 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)).Times(0);
2920 SpecializedSetup<%(name)s, 0>();
2921 %(name)s cmd;
2922 cmd.Init(%(args)s%(comma)sshared_memory_id_, shared_memory_offset_);
2923 EXPECT_EQ(parse_error::%(parse_result)s, ExecuteCmd(cmd));
2924 }
2925 """
2926 self.WriteInvalidUnitTest(func, file, invalid_test, {
2927 'comma': comma,
2928 })
2929
2289 def WriteServiceImplementation(self, func, file): 2930 def WriteServiceImplementation(self, func, file):
2290 """Overrriden from TypeHandler.""" 2931 """Overrriden from TypeHandler."""
2291 file.Write( 2932 file.Write(
2292 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) 2933 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name)
2293 file.Write( 2934 file.Write(
2294 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) 2935 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name)
2295 args = func.GetOriginalArgs() 2936 args = func.GetOriginalArgs()
2296 for arg in args: 2937 for arg in args:
2297 arg.WriteGetCode(file) 2938 arg.WriteGetCode(file)
2298 2939
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2333 """Handler for GetProgramInfoLog, GetShaderInfoLog and GetShaderSource.""" 2974 """Handler for GetProgramInfoLog, GetShaderInfoLog and GetShaderSource."""
2334 2975
2335 def __init__(self): 2976 def __init__(self):
2336 TypeHandler.__init__(self) 2977 TypeHandler.__init__(self)
2337 2978
2338 def WriteGLES2ImplementationHeader(self, func, file): 2979 def WriteGLES2ImplementationHeader(self, func, file):
2339 """Overrriden from TypeHandler.""" 2980 """Overrriden from TypeHandler."""
2340 file.Write("// TODO(gman): Implement this\n") 2981 file.Write("// TODO(gman): Implement this\n")
2341 TypeHandler.WriteGLES2ImplementationHeader(self, func, file) 2982 TypeHandler.WriteGLES2ImplementationHeader(self, func, file)
2342 2983
2984 def WriteServiceUnitTest(self, func, file):
2985 """Overrriden from TypeHandler."""
2986 file.Write("// TODO(gman): %s\n\n" % func.name)
2987
2988 def WriteImmediateServiceUnitTest(self, func, file):
2989 """Overrriden from TypeHandler."""
2990 file.Write("// TODO(gman): %s\n\n" % func.name)
2991
2343 def WriteServiceImplementation(self, func, file): 2992 def WriteServiceImplementation(self, func, file):
2344 """Overrriden from TypeHandler.""" 2993 """Overrriden from TypeHandler."""
2345 file.Write( 2994 file.Write(
2346 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name) 2995 "parse_error::ParseError GLES2DecoderImpl::Handle%s(\n" % func.name)
2347 file.Write( 2996 file.Write(
2348 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) 2997 " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name)
2349 args = func.GetOriginalArgs() 2998 args = func.GetOriginalArgs()
2350 all_but_last_2_args = args[:-2] 2999 all_but_last_2_args = args[:-2]
2351 for arg in all_but_last_2_args: 3000 for arg in all_but_last_2_args:
2352 arg.WriteGetCode(file) 3001 arg.WriteGetCode(file)
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2414 return False 3063 return False
2415 3064
2416 def AddCmdArgs(self, args): 3065 def AddCmdArgs(self, args):
2417 """Adds command arguments for this argument to the given list.""" 3066 """Adds command arguments for this argument to the given list."""
2418 return args.append(self) 3067 return args.append(self)
2419 3068
2420 def AddInitArgs(self, args): 3069 def AddInitArgs(self, args):
2421 """Adds init arguments for this argument to the given list.""" 3070 """Adds init arguments for this argument to the given list."""
2422 return args.append(self) 3071 return args.append(self)
2423 3072
3073 def GetValidArg(self, offset, index):
3074 return str(offset + 1)
3075
3076 def GetValidGLArg(self, offset, index):
3077 return str(offset + 1)
3078
3079 def GetNumInvalidValues(self):
3080 """returns the number of invalid values to be tested."""
3081 return 0
3082
3083 def GetInvalidArg(self, offset, index):
3084 """returns an invalid value and expected parse result by index."""
3085 return ("---ERROR0---", "---ERROR2---")
3086
2424 def WriteGetCode(self, file): 3087 def WriteGetCode(self, file):
2425 """Writes the code to get an argument from a command structure.""" 3088 """Writes the code to get an argument from a command structure."""
2426 file.Write(" %s %s = static_cast<%s>(c.%s);\n" % 3089 file.Write(" %s %s = static_cast<%s>(c.%s);\n" %
2427 (self.type, self.name, self.type, self.name)) 3090 (self.type, self.name, self.type, self.name))
2428 3091
2429 def WriteValidationCode(self, file): 3092 def WriteValidationCode(self, file):
2430 """Writes the validation code for an argument.""" 3093 """Writes the validation code for an argument."""
2431 pass 3094 pass
2432 3095
2433 def WriteGetAddress(self, file): 3096 def WriteGetAddress(self, file):
2434 """Writes the code to get the address this argument refers to.""" 3097 """Writes the code to get the address this argument refers to."""
2435 pass 3098 pass
2436 3099
2437 def GetImmediateVersion(self): 3100 def GetImmediateVersion(self):
2438 """Gets the immediate version of this argument.""" 3101 """Gets the immediate version of this argument."""
2439 return self 3102 return self
2440 3103
3104 class EnumBaseArgument(Argument):
3105 """Base calss for EnumArgument, IntArgument and BoolArgument"""
2441 3106
2442 class EnumArgument(Argument): 3107 def __init__(self, name, gl_type, type, gl_error):
3108 Argument.__init__(self, name, gl_type)
3109
3110 self.local_type = type
3111 self.gl_error = gl_error
3112 name = type[len(gl_type):]
3113 self.enum_info = _ENUM_LISTS[name]
3114
3115 def WriteValidationCode(self, file):
3116 file.Write(" if (!Validate%s(%s)) {\n" % (self.local_type, self.name))
3117 file.Write(" SetGLError(%s);\n" % self.gl_error)
3118 file.Write(" return parse_error::kParseNoError;\n")
3119 file.Write(" }\n")
3120
3121 def GetValidArg(self, offset, index):
3122 if 'valid' in self.enum_info:
3123 valid = self.enum_info['valid']
3124 num_valid = len(valid)
3125 if index >= num_valid:
3126 index = num_valid - 1
3127 return valid[index]
3128 return str(offset + 1)
3129
3130 def GetValidGLArg(self, offset, index):
3131 return self.GetValidArg(offset, index)
3132
3133 def GetNumInvalidValues(self):
3134 """returns the number of invalid values to be tested."""
3135 if 'invalid' in self.enum_info:
3136 invalid = self.enum_info['invalid']
3137 return len(invalid)
3138 return 0
3139
3140 def GetInvalidArg(self, offset, index):
3141 """returns an invalid value by index."""
3142 if 'invalid' in self.enum_info:
3143 invalid = self.enum_info['invalid']
3144 num_invalid = len(invalid)
3145 if index >= num_invalid:
3146 index = num_invalid - 1
3147 return (invalid[index], "kParseNoError")
3148 return ("---ERROR1---", "kParseNoError")
3149
3150
3151 class EnumArgument(EnumBaseArgument):
2443 """A class that represents a GLenum argument""" 3152 """A class that represents a GLenum argument"""
2444 3153
2445 def __init__(self, name, type): 3154 def __init__(self, name, type):
2446 Argument.__init__(self, name, "GLenum") 3155 EnumBaseArgument.__init__(self, name, "GLenum", type, "GL_INVALID_ENUM")
2447
2448 self.enum_type = type
2449
2450 def WriteValidationCode(self, file):
2451 file.Write(" if (!Validate%s(%s)) {\n" % (self.enum_type, self.name))
2452 file.Write(" SetGLError(GL_INVALID_ENUM);\n")
2453 file.Write(" return parse_error::kParseNoError;\n")
2454 file.Write(" }\n")
2455 3156
2456 3157
2457 class IntArgument(Argument): 3158 class IntArgument(EnumBaseArgument):
2458 """A class for a GLint argument that can only except specific values. 3159 """A class for a GLint argument that can only except specific values.
2459 3160
2460 For example glTexImage2D takes a GLint for its internalformat 3161 For example glTexImage2D takes a GLint for its internalformat
2461 argument instead of a GLenum. 3162 argument instead of a GLenum.
2462 """ 3163 """
2463 3164
2464 def __init__(self, name, type): 3165 def __init__(self, name, type):
2465 Argument.__init__(self, name, "GLint") 3166 EnumBaseArgument.__init__(self, name, "GLint", type, "GL_INVALID_VALUE")
2466 3167
2467 self.int_type = type
2468 3168
2469 def WriteValidationCode(self, file): 3169 class BoolArgument(EnumBaseArgument):
2470 file.Write(" if (!Validate%s(%s)) {\n" % (self.int_type, self.name)) 3170 """A class for a GLboolean argument that can only except specific values.
2471 file.Write(" SetGLError(GL_INVALID_VALUE);\n") 3171
2472 file.Write(" return parse_error::kParseNoError;\n") 3172 For example glUniformMatrix takes a GLboolean for it's transpose but it
2473 file.Write(" }\n") 3173 must be false.
3174 """
3175
3176 def __init__(self, name, type):
3177 EnumBaseArgument.__init__(self, name, "GLboolean", type, "GL_INVALID_VALUE")
2474 3178
2475 3179
2476 class ImmediatePointerArgument(Argument): 3180 class ImmediatePointerArgument(Argument):
2477 """A class that represents an immediate argument to a function. 3181 """A class that represents an immediate argument to a function.
2478 3182
2479 An immediate argument is one where the data follows the command. 3183 An immediate argument is one where the data follows the command.
2480 """ 3184 """
2481 3185
2482 def __init__(self, name, type): 3186 def __init__(self, name, type):
2483 Argument.__init__(self, name, type) 3187 Argument.__init__(self, name, type)
(...skipping 23 matching lines...) Expand all
2507 class PointerArgument(Argument): 3211 class PointerArgument(Argument):
2508 """A class that represents a pointer argument to a function.""" 3212 """A class that represents a pointer argument to a function."""
2509 3213
2510 def __init__(self, name, type): 3214 def __init__(self, name, type):
2511 Argument.__init__(self, name, type) 3215 Argument.__init__(self, name, type)
2512 3216
2513 def IsPointer(self): 3217 def IsPointer(self):
2514 """Returns true if argument is a pointer.""" 3218 """Returns true if argument is a pointer."""
2515 return True 3219 return True
2516 3220
3221 def GetValidArg(self, offset, index):
3222 """Overridden from Argument."""
3223 return "shared_memory_id_, shared_memory_offset_"
3224
3225 def GetValidGLArg(self, offset, index):
3226 """Overridden from Argument."""
3227 return "reinterpret_cast<%s>(shared_memory_address_)" % self.type
3228
3229 def GetNumInvalidValues(self):
3230 """Overridden from Argument."""
3231 return 2
3232
3233 def GetInvalidArg(self, offset, index):
3234 """Overridden from Argument."""
3235 if index == 0:
3236 return ("kInvalidSharedMemoryId, 0", "kParseOutOfBounds")
3237 else:
3238 return ("shared_memory_id_, kInvalidSharedMemoryOffset",
3239 "kParseOutOfBounds")
3240
2517 def AddCmdArgs(self, args): 3241 def AddCmdArgs(self, args):
2518 """Overridden from Argument.""" 3242 """Overridden from Argument."""
2519 args.append(Argument("%s_shm_id" % self.name, 'uint32')) 3243 args.append(Argument("%s_shm_id" % self.name, 'uint32'))
2520 args.append(Argument("%s_shm_offset" % self.name, 'uint32')) 3244 args.append(Argument("%s_shm_offset" % self.name, 'uint32'))
2521 3245
2522 def WriteGetCode(self, file): 3246 def WriteGetCode(self, file):
2523 """Overridden from Argument.""" 3247 """Overridden from Argument."""
2524 file.Write( 3248 file.Write(
2525 " %s %s = GetSharedMemoryAs<%s>(\n" % 3249 " %s %s = GetSharedMemoryAs<%s>(\n" %
2526 (self.type, self.name, self.type)) 3250 (self.type, self.name, self.type))
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2560 3284
2561 def GetImmediateVersion(self): 3285 def GetImmediateVersion(self):
2562 """Overridden from Argument.""" 3286 """Overridden from Argument."""
2563 return self 3287 return self
2564 3288
2565 3289
2566 class ResourceIdArgument(Argument): 3290 class ResourceIdArgument(Argument):
2567 """A class that represents a resource id argument to a function.""" 3291 """A class that represents a resource id argument to a function."""
2568 3292
2569 def __init__(self, name, type): 3293 def __init__(self, name, type):
2570 type = type.replace("GLResourceId", "GLuint") 3294 match = re.match("(GLid\w+)", type)
3295 self.resource_type = match.group(1)[4:]
3296 type = type.replace(match.group(1), "GLuint")
2571 Argument.__init__(self, name, type) 3297 Argument.__init__(self, name, type)
2572 3298
2573 def WriteGetCode(self, file): 3299 def WriteGetCode(self, file):
2574 """Overridden from Argument.""" 3300 """Overridden from Argument."""
2575 file.Write(" %s %s;\n" % (self.type, self.name)) 3301 file.Write(" %s %s;\n" % (self.type, self.name))
2576 file.Write(" if (!id_map_.GetServiceId(c.%s, &%s)) {\n" % 3302 file.Write(" if (!id_map_.GetServiceId(c.%s, &%s)) {\n" %
2577 (self.name, self.name)) 3303 (self.name, self.name))
2578 file.Write(" SetGLError(GL_INVALID_VALUE);\n") 3304 file.Write(" SetGLError(GL_INVALID_VALUE);\n")
2579 file.Write(" return parse_error::kParseNoError;\n") 3305 file.Write(" return parse_error::kParseNoError;\n")
2580 file.Write(" }\n") 3306 file.Write(" }\n")
2581 3307
3308 def GetValidArg(self, offset, index):
3309 return "client_%s_id_" % self.resource_type.lower()
3310
3311 def GetValidGLArg(self, offset, index):
3312 return "kService%sId" % self.resource_type
2582 3313
2583 class Function(object): 3314 class Function(object):
2584 """A class that represents a function.""" 3315 """A class that represents a function."""
2585 3316
2586 def __init__(self, name, info, return_type, original_args, args_for_cmds, 3317 def __init__(self, name, info, return_type, original_args, args_for_cmds,
2587 cmd_args, init_args, num_pointer_args): 3318 cmd_args, init_args, num_pointer_args):
2588 self.name = name 3319 self.name = name
2589 self.original_name = name 3320 self.original_name = name
2590 self.info = info 3321 self.info = info
2591 self.type_handler = info.type_handler 3322 self.type_handler = info.type_handler
(...skipping 15 matching lines...) Expand all
2607 if hasattr(self.info, name): 3338 if hasattr(self.info, name):
2608 return getattr(self.info, name) 3339 return getattr(self.info, name)
2609 return None 3340 return None
2610 3341
2611 def GetGLFunctionName(self): 3342 def GetGLFunctionName(self):
2612 """Gets the function to call to execute GL for this command.""" 3343 """Gets the function to call to execute GL for this command."""
2613 if self.GetInfo('DecoderFunc'): 3344 if self.GetInfo('DecoderFunc'):
2614 return self.GetInfo('DecoderFunc') 3345 return self.GetInfo('DecoderFunc')
2615 return "gl%s" % self.original_name 3346 return "gl%s" % self.original_name
2616 3347
3348 def GetGLTestFunctionName(self):
3349 gl_func_name = self.GetInfo('gl_test_func')
3350 if gl_func_name == None:
3351 gl_func_name = self.GetGLFunctionName()
3352 if gl_func_name.startswith("gl"):
3353 gl_func_name = gl_func_name[2:]
3354 else:
3355 gl_func_name = self.name
3356 return gl_func_name
3357
2617 def AddCmdArg(self, arg): 3358 def AddCmdArg(self, arg):
2618 """Adds a cmd argument to this function.""" 3359 """Adds a cmd argument to this function."""
2619 self.cmd_args.append(arg) 3360 self.cmd_args.append(arg)
2620 3361
2621 def GetCmdArgs(self): 3362 def GetCmdArgs(self):
2622 """Gets the command args for this function.""" 3363 """Gets the command args for this function."""
2623 return self.cmd_args 3364 return self.cmd_args
2624 3365
2625 def GetInitArgs(self): 3366 def GetInitArgs(self):
2626 """Gets the init args for this function.""" 3367 """Gets the init args for this function."""
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2740 self.type_handler.WriteStruct(self, file) 3481 self.type_handler.WriteStruct(self, file)
2741 3482
2742 def WriteCmdHelper(self, file): 3483 def WriteCmdHelper(self, file):
2743 """Writes the cmd's helper.""" 3484 """Writes the cmd's helper."""
2744 self.type_handler.WriteCmdHelper(self, file) 3485 self.type_handler.WriteCmdHelper(self, file)
2745 3486
2746 def WriteServiceImplementation(self, file): 3487 def WriteServiceImplementation(self, file):
2747 """Writes the service implementation for a command.""" 3488 """Writes the service implementation for a command."""
2748 self.type_handler.WriteServiceImplementation(self, file) 3489 self.type_handler.WriteServiceImplementation(self, file)
2749 3490
3491 def WriteServiceUnitTest(self, file):
3492 """Writes the service implementation for a command."""
3493 self.type_handler.WriteServiceUnitTest(self, file)
3494
2750 def WriteGLES2ImplementationHeader(self, file): 3495 def WriteGLES2ImplementationHeader(self, file):
2751 """Writes the GLES2 Implemention declaration.""" 3496 """Writes the GLES2 Implemention declaration."""
2752 self.type_handler.WriteGLES2ImplementationHeader(self, file) 3497 self.type_handler.WriteGLES2ImplementationHeader(self, file)
2753 3498
2754 def WriteGLES2ImplementationImpl(self, file): 3499 def WriteGLES2ImplementationImpl(self, file):
2755 """Writes the GLES2 Implemention definition.""" 3500 """Writes the GLES2 Implemention definition."""
2756 self.type_handler.WriteGLES2ImplementationImpl(self, file) 3501 self.type_handler.WriteGLES2ImplementationImpl(self, file)
2757 3502
2758 def WriteFormatTest(self, file): 3503 def WriteFormatTest(self, file):
2759 """Writes the cmd's format test.""" 3504 """Writes the cmd's format test."""
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2795 self.original_name = func.name 3540 self.original_name = func.name
2796 3541
2797 def WriteServiceImplementation(self, file): 3542 def WriteServiceImplementation(self, file):
2798 """Overridden from Function""" 3543 """Overridden from Function"""
2799 self.type_handler.WriteImmediateServiceImplementation(self, file) 3544 self.type_handler.WriteImmediateServiceImplementation(self, file)
2800 3545
2801 def WriteHandlerImplementation(self, file): 3546 def WriteHandlerImplementation(self, file):
2802 """Overridden from Function""" 3547 """Overridden from Function"""
2803 self.type_handler.WriteImmediateHandlerImplementation(self, file) 3548 self.type_handler.WriteImmediateHandlerImplementation(self, file)
2804 3549
3550 def WriteServiceUnitTest(self, file):
3551 """Writes the service implementation for a command."""
3552 self.type_handler.WriteImmediateServiceUnitTest(self, file)
3553
2805 def WriteValidationCode(self, file): 3554 def WriteValidationCode(self, file):
2806 """Overridden from Function""" 3555 """Overridden from Function"""
2807 self.type_handler.WriteImmediateValidationCode(self, file) 3556 self.type_handler.WriteImmediateValidationCode(self, file)
2808 3557
2809 def WriteCmdArgFlag(self, file): 3558 def WriteCmdArgFlag(self, file):
2810 """Overridden from Function""" 3559 """Overridden from Function"""
2811 file.Write(" static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN;\n") 3560 file.Write(" static const cmd::ArgFlags kArgFlags = cmd::kAtLeastN;\n")
2812 3561
2813 def WriteCmdComputeSize(self, file): 3562 def WriteCmdComputeSize(self, file):
2814 """Overridden from Function""" 3563 """Overridden from Function"""
(...skipping 29 matching lines...) Expand all
2844 elif arg_string.find('*') >= 0: 3593 elif arg_string.find('*') >= 0:
2845 if arg_parts[0] == 'NonImmediate': 3594 if arg_parts[0] == 'NonImmediate':
2846 return NonImmediatePointerArgument( 3595 return NonImmediatePointerArgument(
2847 arg_parts[-1], 3596 arg_parts[-1],
2848 " ".join(arg_parts[1:-1])) 3597 " ".join(arg_parts[1:-1]))
2849 else: 3598 else:
2850 return PointerArgument( 3599 return PointerArgument(
2851 arg_parts[-1], 3600 arg_parts[-1],
2852 " ".join(arg_parts[0:-1])) 3601 " ".join(arg_parts[0:-1]))
2853 # Is this a resource argument? Must come after pointer check. 3602 # Is this a resource argument? Must come after pointer check.
2854 elif arg_parts[0] == 'GLResourceId': 3603 elif arg_parts[0].startswith('GLid'):
2855 return ResourceIdArgument( 3604 return ResourceIdArgument(arg_parts[-1], " ".join(arg_parts[0:-1]))
2856 arg_parts[-1],
2857 " ".join(arg_parts[0:-1]))
2858 elif arg_parts[0].startswith('GLenum') and len(arg_parts[0]) > 6: 3605 elif arg_parts[0].startswith('GLenum') and len(arg_parts[0]) > 6:
2859 return EnumArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) 3606 return EnumArgument(arg_parts[-1], " ".join(arg_parts[0:-1]))
3607 elif arg_parts[0].startswith('GLboolean') and len(arg_parts[0]) > 9:
3608 return BoolArgument(arg_parts[-1], " ".join(arg_parts[0:-1]))
2860 elif (arg_parts[0].startswith('GLint') and len(arg_parts[0]) > 5 and 3609 elif (arg_parts[0].startswith('GLint') and len(arg_parts[0]) > 5 and
2861 arg_parts[0] != "GLintptr"): 3610 arg_parts[0] != "GLintptr"):
2862 return IntArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) 3611 return IntArgument(arg_parts[-1], " ".join(arg_parts[0:-1]))
2863 else: 3612 else:
2864 return Argument(arg_parts[-1], " ".join(arg_parts[0:-1])) 3613 return Argument(arg_parts[-1], " ".join(arg_parts[0:-1]))
2865 3614
2866 3615
2867 class GLGenerator(object): 3616 class GLGenerator(object):
2868 """A class to generate GL command buffers.""" 3617 """A class to generate GL command buffers."""
2869 3618
2870 _function_re = re.compile(r'GL_APICALL(.*?)GL_APIENTRY (.*?) \((.*?)\);') 3619 _function_re = re.compile(r'GL_APICALL(.*?)GL_APIENTRY (.*?) \((.*?)\);')
2871 _non_alnum_re = re.compile(r'[^a-zA-Z0-9]')
2872 3620
2873 def __init__(self, verbose): 3621 def __init__(self, verbose):
2874 self.original_functions = [] 3622 self.original_functions = []
2875 self.functions = [] 3623 self.functions = []
2876 self.verbose = verbose 3624 self.verbose = verbose
2877 self.errors = 0 3625 self.errors = 0
2878 self._function_info = {} 3626 self._function_info = {}
2879 self._empty_type_handler = TypeHandler() 3627 self._empty_type_handler = TypeHandler()
2880 self._empty_function_info = FunctionInfo({}, self._empty_type_handler) 3628 self._empty_function_info = FunctionInfo({}, self._empty_type_handler)
2881 3629
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2924 def Log(self, msg): 3672 def Log(self, msg):
2925 """Prints something if verbose is true.""" 3673 """Prints something if verbose is true."""
2926 if self.verbose: 3674 if self.verbose:
2927 print msg 3675 print msg
2928 3676
2929 def Error(self, msg): 3677 def Error(self, msg):
2930 """Prints an error.""" 3678 """Prints an error."""
2931 print "Error: %s" % msg 3679 print "Error: %s" % msg
2932 self.errors += 1 3680 self.errors += 1
2933 3681
2934 def WriteHeader(self, file):
2935 """Writes header to file"""
2936 file.Write(
2937 "// This file is auto-generated. DO NOT EDIT!\n"
2938 "\n")
2939
2940 def WriteLicense(self, file): 3682 def WriteLicense(self, file):
2941 """Writes the license.""" 3683 """Writes the license."""
2942 file.Write(_LICENSE) 3684 file.Write(_LICENSE)
2943 3685
2944 def WriteNamespaceOpen(self, file): 3686 def WriteNamespaceOpen(self, file):
2945 """Writes the code for the namespace.""" 3687 """Writes the code for the namespace."""
2946 file.Write("namespace gpu {\n") 3688 file.Write("namespace gpu {\n")
2947 file.Write("namespace gles2 {\n") 3689 file.Write("namespace gles2 {\n")
2948 file.Write("\n") 3690 file.Write("\n")
2949 3691
2950 def WriteNamespaceClose(self, file): 3692 def WriteNamespaceClose(self, file):
2951 """Writes the code to close the namespace.""" 3693 """Writes the code to close the namespace."""
2952 file.Write("} // namespace gles2\n") 3694 file.Write("} // namespace gles2\n")
2953 file.Write("} // namespace gpu\n") 3695 file.Write("} // namespace gpu\n")
2954 file.Write("\n") 3696 file.Write("\n")
2955 3697
2956 def MakeGuard(self, filename):
2957 """Creates a header guard id."""
2958 base = os.path.dirname(os.path.dirname(os.path.dirname(
2959 os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
2960 hpath = os.path.abspath(filename)[len(base) + 1:]
2961 return self._non_alnum_re.sub('_', hpath).upper()
2962
2963 def ParseArgs(self, arg_string): 3698 def ParseArgs(self, arg_string):
2964 """Parses a function arg string.""" 3699 """Parses a function arg string."""
2965 args = [] 3700 args = []
2966 num_pointer_args = 0 3701 num_pointer_args = 0
2967 parts = arg_string.split(',') 3702 parts = arg_string.split(',')
2968 is_gl_enum = False 3703 is_gl_enum = False
2969 for arg_string in parts: 3704 for arg_string in parts:
2970 if arg_string.startswith('GLenum '): 3705 if arg_string.startswith('GLenum '):
2971 is_gl_enum = True 3706 is_gl_enum = True
2972 arg = CreateArg(arg_string) 3707 arg = CreateArg(arg_string)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3015 3750
3016 funcs = [f for f in self.functions if not f.can_auto_generate and 3751 funcs = [f for f in self.functions if not f.can_auto_generate and
3017 (f.IsType('') or f.IsType('Custom') or f.IsType('Todo'))] 3752 (f.IsType('') or f.IsType('Custom') or f.IsType('Todo'))]
3018 self.Log("Non Auto Generated Functions: %d" % len(funcs)) 3753 self.Log("Non Auto Generated Functions: %d" % len(funcs))
3019 3754
3020 for f in funcs: 3755 for f in funcs:
3021 self.Log(" %-10s %-20s gl%s" % (f.info.type, f.return_type, f.name)) 3756 self.Log(" %-10s %-20s gl%s" % (f.info.type, f.return_type, f.name))
3022 3757
3023 def WriteCommandIds(self, filename): 3758 def WriteCommandIds(self, filename):
3024 """Writes the command buffer format""" 3759 """Writes the command buffer format"""
3025 file = CWriter(filename) 3760 file = CHeaderWriter(filename)
3026 self.WriteHeader(file)
3027 file.Write("#define GLES2_COMMAND_LIST(OP) \\\n") 3761 file.Write("#define GLES2_COMMAND_LIST(OP) \\\n")
3028 for func in self.functions: 3762 for func in self.functions:
3029 if not func.name in _CMD_ID_TABLE: 3763 if not func.name in _CMD_ID_TABLE:
3030 self.Error("Command %s not in _CMD_ID_TABLE" % func.name) 3764 self.Error("Command %s not in _CMD_ID_TABLE" % func.name)
3031 file.Write(" %-60s /* %d */ \\\n" % 3765 file.Write(" %-60s /* %d */ \\\n" %
3032 ("OP(%s)" % func.name, _CMD_ID_TABLE[func.name])) 3766 ("OP(%s)" % func.name, _CMD_ID_TABLE[func.name]))
3033 file.Write("\n") 3767 file.Write("\n")
3034 3768
3035 file.Write("enum CommandId {\n") 3769 file.Write("enum CommandId {\n")
3036 file.Write(" kStartPoint = cmd::kLastCommonId, " 3770 file.Write(" kStartPoint = cmd::kLastCommonId, "
3037 "// All GLES2 commands start after this.\n") 3771 "// All GLES2 commands start after this.\n")
3038 file.Write("#define GLES2_CMD_OP(name) k ## name,\n") 3772 file.Write("#define GLES2_CMD_OP(name) k ## name,\n")
3039 file.Write(" GLES2_COMMAND_LIST(GLES2_CMD_OP)\n") 3773 file.Write(" GLES2_COMMAND_LIST(GLES2_CMD_OP)\n")
3040 file.Write("#undef GLES2_CMD_OP\n") 3774 file.Write("#undef GLES2_CMD_OP\n")
3041 file.Write(" kNumCommands\n") 3775 file.Write(" kNumCommands\n")
3042 file.Write("};\n") 3776 file.Write("};\n")
3043 file.Write("\n") 3777 file.Write("\n")
3044 file.Close() 3778 file.Close()
3045 3779
3046 def WriteFormat(self, filename): 3780 def WriteFormat(self, filename):
3047 """Writes the command buffer format""" 3781 """Writes the command buffer format"""
3048 file = CWriter(filename) 3782 file = CHeaderWriter(filename)
3049 self.WriteHeader(file)
3050
3051 for func in self.functions: 3783 for func in self.functions:
3052 func.WriteStruct(file) 3784 func.WriteStruct(file)
3053
3054 file.Write("\n") 3785 file.Write("\n")
3055 file.Close() 3786 file.Close()
3056 3787
3057 def WriteFormatTest(self, filename): 3788 def WriteFormatTest(self, filename):
3058 """Writes the command buffer format test.""" 3789 """Writes the command buffer format test."""
3059 file = CWriter(filename) 3790 file = CHeaderWriter(
3060 self.WriteHeader(file) 3791 filename,
3061 file.Write("// This file contains unit tests for gles2 commmands\n") 3792 "// This file contains unit tests for gles2 commmands\n"
3062 file.Write("// It is included by gles2_cmd_format_test.cc\n") 3793 "// It is included by gles2_cmd_format_test.cc\n"
3063 file.Write("\n") 3794 "\n")
3064 3795
3065 for func in self.functions: 3796 for func in self.functions:
3066 func.WriteFormatTest(file) 3797 func.WriteFormatTest(file)
3067 3798
3068 file.Close() 3799 file.Close()
3069 3800
3070 def WriteCommandIdTest(self, filename): 3801 def WriteCommandIdTest(self, filename):
3071 """Writes the command id test.""" 3802 """Writes the command id test."""
3072 file = CWriter(filename) 3803 file = CHeaderWriter(
3073 file.Write("// This file contains unit tests for gles2 commmand ids\n") 3804 filename,
3074 file.Write("\n") 3805 "// This file contains unit tests for gles2 commmand ids\n")
3075 3806
3076 file.Write("// *** These IDs MUST NOT CHANGE!!! ***\n") 3807 file.Write("// *** These IDs MUST NOT CHANGE!!! ***\n")
3077 file.Write("// Changing them will break all client programs.\n") 3808 file.Write("// Changing them will break all client programs.\n")
3078 file.Write("TEST(GLES2CommandIdTest, CommandIdsMatch) {\n") 3809 file.Write("TEST(GLES2CommandIdTest, CommandIdsMatch) {\n")
3079 for func in self.functions: 3810 for func in self.functions:
3080 if not func.name in _CMD_ID_TABLE: 3811 if not func.name in _CMD_ID_TABLE:
3081 self.Error("Command %s not in _CMD_ID_TABLE" % func.name) 3812 self.Error("Command %s not in _CMD_ID_TABLE" % func.name)
3082 file.Write(" COMPILE_ASSERT(%s::kCmdId == %d,\n" % 3813 file.Write(" COMPILE_ASSERT(%s::kCmdId == %d,\n" %
3083 (func.name, _CMD_ID_TABLE[func.name])) 3814 (func.name, _CMD_ID_TABLE[func.name]))
3084 file.Write(" GLES2_%s_kCmdId_mismatch);\n" % func.name) 3815 file.Write(" GLES2_%s_kCmdId_mismatch);\n" % func.name)
3085 3816
3086 file.Write("}\n") 3817 file.Write("}\n")
3087 file.Write("\n") 3818 file.Write("\n")
3088 file.Close() 3819 file.Close()
3089 3820
3090 def WriteCmdHelperHeader(self, filename): 3821 def WriteCmdHelperHeader(self, filename):
3091 """Writes the gles2 command helper.""" 3822 """Writes the gles2 command helper."""
3092 file = CWriter(filename) 3823 file = CHeaderWriter(filename)
3093 3824
3094 for func in self.functions: 3825 for func in self.functions:
3095 func.WriteCmdHelper(file) 3826 func.WriteCmdHelper(file)
3096 3827
3097 file.Close() 3828 file.Close()
3098 3829
3099 def WriteServiceImplementation(self, filename): 3830 def WriteServiceImplementation(self, filename):
3100 """Writes the service decorder implementation.""" 3831 """Writes the service decorder implementation."""
3101 file = CWriter(filename) 3832 file = CHeaderWriter(
3102 self.WriteHeader(file) 3833 filename,
3103 file.Write("// It is included by gles2_cmd_decoder.cc\n") 3834 "// It is included by gles2_cmd_decoder.cc\n")
3104 file.Write("\n")
3105 3835
3106 for func in self.functions: 3836 for func in self.functions:
3107 func.WriteServiceImplementation(file) 3837 func.WriteServiceImplementation(file)
3108 3838
3109 file.Close() 3839 file.Close()
3110 3840
3841 def WriteServiceUnitTests(self, filename):
3842 """Writes the service decorder unit tests."""
3843 file = CHeaderWriter(
3844 filename,
3845 "// It is included by gles2_cmd_decoder_unittest.cc\n")
3846
3847 for func in self.functions:
3848 func.WriteServiceUnitTest(file)
3849
3850 file.Close()
3851
3852
3111 def WriteGLES2CLibImplementation(self, filename): 3853 def WriteGLES2CLibImplementation(self, filename):
3112 """Writes the GLES2 c lib implementation.""" 3854 """Writes the GLES2 c lib implementation."""
3113 file = CWriter(filename) 3855 file = CHeaderWriter(
3114 self.WriteHeader(file) 3856 filename,
3115 file.Write("\n") 3857 "// These functions emluate GLES2 over command buffers.\n")
3116 file.Write("// These functions emluate GLES2 over command buffers.\n")
3117 file.Write("\n")
3118 file.Write("\n")
3119 3858
3120 for func in self.original_functions: 3859 for func in self.original_functions:
3121 file.Write("%s GLES2%s(%s) {\n" % 3860 file.Write("%s GLES2%s(%s) {\n" %
3122 (func.return_type, func.name, 3861 (func.return_type, func.name,
3123 func.MakeTypedOriginalArgString(""))) 3862 func.MakeTypedOriginalArgString("")))
3124 return_string = "return " 3863 return_string = "return "
3125 if func.return_type == "void": 3864 if func.return_type == "void":
3126 return_string = "" 3865 return_string = ""
3127 file.Write(" %sgles2::GetGLContext()->%s(%s);\n" % 3866 file.Write(" %sgles2::GetGLContext()->%s(%s);\n" %
3128 (return_string, func.original_name, 3867 (return_string, func.original_name,
3129 func.MakeOriginalArgString(""))) 3868 func.MakeOriginalArgString("")))
3130 file.Write("}\n") 3869 file.Write("}\n")
3131 3870
3132 file.Write("\n") 3871 file.Write("\n")
3133 3872
3134 file.Close() 3873 file.Close()
3135 3874
3136 def WriteGLES2ImplementationHeader(self, filename): 3875 def WriteGLES2ImplementationHeader(self, filename):
3137 """Writes the GLES2 helper header.""" 3876 """Writes the GLES2 helper header."""
3138 file = CWriter(filename) 3877 file = CHeaderWriter(
3139 self.WriteHeader(file) 3878 filename,
3140 file.Write( 3879 "// This file is included by gles2_implementation.h to declare the\n"
3141 "// This file is included by gles2_implementation.h to declare the\n") 3880 "// GL api functions.\n")
3142 file.Write("// GL api functions.\n")
3143 for func in self.original_functions: 3881 for func in self.original_functions:
3144 func.WriteGLES2ImplementationHeader(file) 3882 func.WriteGLES2ImplementationHeader(file)
3145 file.Close() 3883 file.Close()
3146 3884
3147 def WriteGLES2ImplementationImpl(self, filename): 3885 def WriteGLES2ImplementationImpl(self, filename):
3148 """Writes the gles2 helper implementation.""" 3886 """Writes the gles2 helper implementation."""
3149 file = CWriter(filename) 3887 file = CHeaderWriter(
3150 self.WriteLicense(file) 3888 filename,
3151 file.Write("\n") 3889 "// A class to emluate GLES2 over command buffers.\n")
3152 file.Write("// A class to emluate GLES2 over command buffers.\n")
3153 file.Write("\n")
3154 file.Write( 3890 file.Write(
3155 "#include \"gpu/command_buffer/client/gles2_implementation.h\"\n") 3891 "#include \"gpu/command_buffer/client/gles2_implementation.h\"\n")
3156 file.Write("\n")
3157 self.WriteNamespaceOpen(file) 3892 self.WriteNamespaceOpen(file)
3158 for func in self.original_functions: 3893 for func in self.original_functions:
3159 func.WriteGLES2ImplementationImpl(file) 3894 func.WriteGLES2ImplementationImpl(file)
3160 file.Write("\n") 3895 file.Write("\n")
3161 3896
3162 self.WriteNamespaceClose(file) 3897 self.WriteNamespaceClose(file)
3163 file.Close() 3898 file.Close()
3164 3899
3165 def WriteServiceUtilsHeader(self, filename): 3900 def WriteServiceUtilsHeader(self, filename):
3166 """Writes the gles2 auto generated utility header.""" 3901 """Writes the gles2 auto generated utility header."""
3167 file = CWriter(filename) 3902 file = CHeaderWriter(filename)
3168 self.WriteHeader(file)
3169 file.Write("\n")
3170 for enum in _ENUM_LISTS: 3903 for enum in _ENUM_LISTS:
3171 file.Write("bool ValidateGLenum%s(GLenum value);\n" % enum) 3904 file.Write("bool Validate%s%s(GLenum value);\n" % (_ENUM_LISTS[enum]['type '], enum))
3172 file.Write("\n") 3905 file.Write("\n")
3173 file.Close() 3906 file.Close()
3174 3907
3175 def WriteServiceUtilsImplementation(self, filename): 3908 def WriteServiceUtilsImplementation(self, filename):
3176 """Writes the gles2 auto generated utility implementation.""" 3909 """Writes the gles2 auto generated utility implementation."""
3177 file = CWriter(filename) 3910 file = CHeaderWriter(filename)
3178 self.WriteHeader(file)
3179 file.Write("\n")
3180 for enum in _ENUM_LISTS: 3911 for enum in _ENUM_LISTS:
3181 file.Write("bool ValidateGLenum%s(GLenum value) {\n" % enum) 3912 file.Write("bool Validate%s%s(GLenum value) {\n" % (_ENUM_LISTS[enum]['typ e'], enum))
3182 file.Write(" switch (value) {\n") 3913 file.Write(" switch (value) {\n")
3183 for value in _ENUM_LISTS[enum]: 3914 for value in _ENUM_LISTS[enum]['valid']:
3184 file.Write(" case %s:\n" % value) 3915 file.Write(" case %s:\n" % value)
3185 file.Write(" return true;\n") 3916 file.Write(" return true;\n")
3186 file.Write(" default:\n") 3917 file.Write(" default:\n")
3187 file.Write(" return false;\n") 3918 file.Write(" return false;\n")
3188 file.Write(" }\n") 3919 file.Write(" }\n")
3189 file.Write("}\n") 3920 file.Write("}\n")
3190 file.Write("\n") 3921 file.Write("\n")
3191 file.Close() 3922 file.Close()
3192 3923
3193 3924
(...skipping 14 matching lines...) Expand all
3208 3939
3209 gen = GLGenerator(options.verbose) 3940 gen = GLGenerator(options.verbose)
3210 gen.ParseGLH("common/GLES2/gl2.h") 3941 gen.ParseGLH("common/GLES2/gl2.h")
3211 gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") 3942 gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h")
3212 gen.WriteFormat("common/gles2_cmd_format_autogen.h") 3943 gen.WriteFormat("common/gles2_cmd_format_autogen.h")
3213 gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") 3944 gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h")
3214 gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") 3945 gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h")
3215 gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") 3946 gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h")
3216 gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") 3947 gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h")
3217 gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") 3948 gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h")
3949 gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_autogen.h")
3218 gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") 3950 gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h")
3219 gen.WriteServiceUtilsImplementation( 3951 gen.WriteServiceUtilsImplementation(
3220 "service/gles2_cmd_validation_implementation_autogen.h") 3952 "service/gles2_cmd_validation_implementation_autogen.h")
3221 3953
3222 if options.generate_implementation_templates: 3954 if options.generate_implementation_templates:
3223 gen.WriteGLES2ImplementationImpl("client/gles2_implementation_gen.h") 3955 gen.WriteGLES2ImplementationImpl("client/gles2_implementation_gen.h")
3224 3956
3225 if options.generate_command_id_tests: 3957 if options.generate_command_id_tests:
3226 gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") 3958 gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h")
3227 3959
3228 if gen.errors > 0: 3960 if gen.errors > 0:
3229 print "%d errors" % gen.errors 3961 print "%d errors" % gen.errors
3230 sys.exit(1) 3962 sys.exit(1)
3231 3963
3232 if __name__ == '__main__': 3964 if __name__ == '__main__':
3233 main(sys.argv[1:]) 3965 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/client/gles2_c_lib_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698