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

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

Issue 7099007: Enforce RGB even on buggy drivers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add checks for reading GL_ALPHA_BITS etc. Created 9 years, 6 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/service/framebuffer_manager.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) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 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 GLES2 command buffers.""" 7 """code generator for GLES2 command buffers."""
8 8
9 import os 9 import os
10 import os.path 10 import os.path
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 'decoder_func': 'DoCheckFramebufferStatus', 1127 'decoder_func': 'DoCheckFramebufferStatus',
1128 'gl_test_func': 'glCheckFramebufferStatusEXT', 1128 'gl_test_func': 'glCheckFramebufferStatusEXT',
1129 'result': ['GLenum'], 1129 'result': ['GLenum'],
1130 }, 1130 },
1131 'Clear': {'decoder_func': 'DoClear'}, 1131 'Clear': {'decoder_func': 'DoClear'},
1132 'ClearColor': {'decoder_func': 'DoClearColor'}, 1132 'ClearColor': {'decoder_func': 'DoClearColor'},
1133 'ClearDepthf': { 1133 'ClearDepthf': {
1134 'decoder_func': 'DoClearDepthf', 1134 'decoder_func': 'DoClearDepthf',
1135 'gl_test_func': 'glClearDepth', 1135 'gl_test_func': 'glClearDepth',
1136 }, 1136 },
1137 'ColorMask': {'decoder_func': 'DoColorMask'}, 1137 'ColorMask': {'decoder_func': 'DoColorMask', 'expectation': False},
1138 'ClearStencil': {'decoder_func': 'DoClearStencil'}, 1138 'ClearStencil': {'decoder_func': 'DoClearStencil'},
1139 'CommandBufferEnableCHROMIUM': { 1139 'CommandBufferEnableCHROMIUM': {
1140 'type': 'Custom', 1140 'type': 'Custom',
1141 'immediate': False, 1141 'immediate': False,
1142 'decoder_func': 'DoCommandBufferEnableCHROMIUM', 1142 'decoder_func': 'DoCommandBufferEnableCHROMIUM',
1143 'expectation': False, 1143 'expectation': False,
1144 'cmd_args': 'GLuint bucket_id, GLint* result', 1144 'cmd_args': 'GLuint bucket_id, GLint* result',
1145 'result': ['GLint'], 1145 'result': ['GLint'],
1146 'extension': True, 1146 'extension': True,
1147 'chromium': True, 1147 'chromium': True,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 'type': 'Custom', 1185 'type': 'Custom',
1186 'decoder_func': 'DoDeleteSharedIdsCHROMIUM', 1186 'decoder_func': 'DoDeleteSharedIdsCHROMIUM',
1187 'impl_func': False, 1187 'impl_func': False,
1188 'expectation': False, 1188 'expectation': False,
1189 'immediate': False, 1189 'immediate': False,
1190 'extension': True, 1190 'extension': True,
1191 'chromium': True, 1191 'chromium': True,
1192 }, 1192 },
1193 'DeleteTextures': {'type': 'DELn'}, 1193 'DeleteTextures': {'type': 'DELn'},
1194 'DepthRangef': {'decoder_func': 'glDepthRange'}, 1194 'DepthRangef': {'decoder_func': 'glDepthRange'},
1195 'DepthMask': {'decoder_func': 'DoDepthMask'}, 1195 'DepthMask': {'decoder_func': 'DoDepthMask', 'expectation': False},
1196 'DetachShader': {'decoder_func': 'DoDetachShader'}, 1196 'DetachShader': {'decoder_func': 'DoDetachShader'},
1197 'Disable': { 1197 'Disable': {
1198 'decoder_func': 'DoDisable', 1198 'decoder_func': 'DoDisable',
1199 }, 1199 },
1200 'DisableVertexAttribArray': { 1200 'DisableVertexAttribArray': {
1201 'decoder_func': 'DoDisableVertexAttribArray', 1201 'decoder_func': 'DoDisableVertexAttribArray',
1202 'impl_decl': False, 1202 'impl_decl': False,
1203 }, 1203 },
1204 'DrawArrays': { 1204 'DrawArrays': {
1205 'decoder_func': 'DoDrawArrays', 1205 'decoder_func': 'DoDrawArrays',
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 }, 1500 },
1501 'ShaderBinary': {'type': 'Custom'}, 1501 'ShaderBinary': {'type': 'Custom'},
1502 'ShaderSource': { 1502 'ShaderSource': {
1503 'type': 'Manual', 1503 'type': 'Manual',
1504 'immediate': True, 1504 'immediate': True,
1505 'bucket': True, 1505 'bucket': True,
1506 'needs_size': True, 1506 'needs_size': True,
1507 'cmd_args': 1507 'cmd_args':
1508 'GLuint shader, const char* data', 1508 'GLuint shader, const char* data',
1509 }, 1509 },
1510 'StencilMask': {'decoder_func': 'DoStencilMask'}, 1510 'StencilMask': {'decoder_func': 'DoStencilMask', 'expectation': False},
1511 'StencilMaskSeparate': {'decoder_func': 'DoStencilMaskSeparate'}, 1511 'StencilMaskSeparate': {
1512 'decoder_func': 'DoStencilMaskSeparate',
1513 'expectation': False,
1514 },
1512 'SwapBuffers': { 1515 'SwapBuffers': {
1513 'type': 'Custom', 1516 'type': 'Custom',
1514 'impl_func': False, 1517 'impl_func': False,
1515 'unit_test': False, 1518 'unit_test': False,
1516 'extension': True, 1519 'extension': True,
1517 }, 1520 },
1518 'TexImage2D': {'type': 'Manual', 'immediate': True}, 1521 'TexImage2D': {'type': 'Manual', 'immediate': True},
1519 'TexParameterf': { 1522 'TexParameterf': {
1520 'decoder_func': 'DoTexParameterf', 1523 'decoder_func': 'DoTexParameterf',
1521 'valid_args': { 1524 'valid_args': {
(...skipping 2742 matching lines...) Expand 10 before | Expand all | Expand 10 after
4264 pass 4267 pass
4265 4268
4266 def GetImmediateVersion(self): 4269 def GetImmediateVersion(self):
4267 """Gets the immediate version of this argument.""" 4270 """Gets the immediate version of this argument."""
4268 return self 4271 return self
4269 4272
4270 def GetBucketVersion(self): 4273 def GetBucketVersion(self):
4271 """Gets the bucket version of this argument.""" 4274 """Gets the bucket version of this argument."""
4272 return self 4275 return self
4273 4276
4277
4278 class BoolArgument(Argument):
4279 """class for GLboolean"""
4280
4281 def __init__(self, name, type):
4282 Argument.__init__(self, name, 'GLboolean')
4283
4284 def GetValidArg(self, func, offset, index):
4285 """Gets a valid value for this argument."""
4286 return 'true'
4287
4288 def GetValidGLArg(self, func, offset, index):
4289 """Gets a valid GL value for this argument."""
4290 return 'true'
4291
4292
4274 class DataSizeArgument(Argument): 4293 class DataSizeArgument(Argument):
4275 """class for data_size which Bucket commands do not need.""" 4294 """class for data_size which Bucket commands do not need."""
4276 4295
4277 def __init__(self, name): 4296 def __init__(self, name):
4278 Argument.__init__(self, name, "uint32") 4297 Argument.__init__(self, name, "uint32")
4279 4298
4280 def GetBucketVersion(self): 4299 def GetBucketVersion(self):
4281 return None 4300 return None
4282 4301
4283 4302
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4328 """overridden from SizeArgument.""" 4347 """overridden from SizeArgument."""
4329 pass 4348 pass
4330 #file.Write(" if (%s < 0) {\n" % self.name) 4349 #file.Write(" if (%s < 0) {\n" % self.name)
4331 #file.Write(" SetGLError(GL_INVALID_VALUE, \"gl%s: %s < 0\");\n" % 4350 #file.Write(" SetGLError(GL_INVALID_VALUE, \"gl%s: %s < 0\");\n" %
4332 # (func.original_name, self.name)) 4351 # (func.original_name, self.name))
4333 #file.Write(" return error::kNoError;\n") 4352 #file.Write(" return error::kNoError;\n")
4334 #file.Write(" }\n") 4353 #file.Write(" }\n")
4335 4354
4336 4355
4337 class EnumBaseArgument(Argument): 4356 class EnumBaseArgument(Argument):
4338 """Base class for EnumArgument, IntArgument and BoolArgument""" 4357 """Base class for EnumArgument, IntArgument and ValidatedBoolArgument"""
4339 4358
4340 def __init__(self, name, gl_type, type, gl_error): 4359 def __init__(self, name, gl_type, type, gl_error):
4341 Argument.__init__(self, name, gl_type) 4360 Argument.__init__(self, name, gl_type)
4342 4361
4343 self.local_type = type 4362 self.local_type = type
4344 self.gl_error = gl_error 4363 self.gl_error = gl_error
4345 name = type[len(gl_type):] 4364 name = type[len(gl_type):]
4346 self.type_name = name 4365 self.type_name = name
4347 self.enum_info = _ENUM_LISTS[name] 4366 self.enum_info = _ENUM_LISTS[name]
4348 4367
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
4398 """A class for a GLint argument that can only except specific values. 4417 """A class for a GLint argument that can only except specific values.
4399 4418
4400 For example glTexImage2D takes a GLint for its internalformat 4419 For example glTexImage2D takes a GLint for its internalformat
4401 argument instead of a GLenum. 4420 argument instead of a GLenum.
4402 """ 4421 """
4403 4422
4404 def __init__(self, name, type): 4423 def __init__(self, name, type):
4405 EnumBaseArgument.__init__(self, name, "GLint", type, "GL_INVALID_VALUE") 4424 EnumBaseArgument.__init__(self, name, "GLint", type, "GL_INVALID_VALUE")
4406 4425
4407 4426
4408 class BoolArgument(EnumBaseArgument): 4427 class ValidatedBoolArgument(EnumBaseArgument):
4409 """A class for a GLboolean argument that can only except specific values. 4428 """A class for a GLboolean argument that can only except specific values.
4410 4429
4411 For example glUniformMatrix takes a GLboolean for it's transpose but it 4430 For example glUniformMatrix takes a GLboolean for it's transpose but it
4412 must be false. 4431 must be false.
4413 """ 4432 """
4414 4433
4415 def __init__(self, name, type): 4434 def __init__(self, name, type):
4416 EnumBaseArgument.__init__(self, name, "GLboolean", type, "GL_INVALID_VALUE") 4435 EnumBaseArgument.__init__(self, name, "GLboolean", type, "GL_INVALID_VALUE")
4417 4436
4418 4437
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
5052 # Is this a resource argument? Must come after pointer check. 5071 # Is this a resource argument? Must come after pointer check.
5053 elif arg_parts[0].startswith('GLidBind'): 5072 elif arg_parts[0].startswith('GLidBind'):
5054 return ResourceIdBindArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) 5073 return ResourceIdBindArgument(arg_parts[-1], " ".join(arg_parts[0:-1]))
5055 elif arg_parts[0].startswith('GLidZero'): 5074 elif arg_parts[0].startswith('GLidZero'):
5056 return ResourceIdZeroArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) 5075 return ResourceIdZeroArgument(arg_parts[-1], " ".join(arg_parts[0:-1]))
5057 elif arg_parts[0].startswith('GLid'): 5076 elif arg_parts[0].startswith('GLid'):
5058 return ResourceIdArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) 5077 return ResourceIdArgument(arg_parts[-1], " ".join(arg_parts[0:-1]))
5059 elif arg_parts[0].startswith('GLenum') and len(arg_parts[0]) > 6: 5078 elif arg_parts[0].startswith('GLenum') and len(arg_parts[0]) > 6:
5060 return EnumArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) 5079 return EnumArgument(arg_parts[-1], " ".join(arg_parts[0:-1]))
5061 elif arg_parts[0].startswith('GLboolean') and len(arg_parts[0]) > 9: 5080 elif arg_parts[0].startswith('GLboolean') and len(arg_parts[0]) > 9:
5081 return ValidatedBoolArgument(arg_parts[-1], " ".join(arg_parts[0:-1]))
5082 elif arg_parts[0].startswith('GLboolean'):
5062 return BoolArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) 5083 return BoolArgument(arg_parts[-1], " ".join(arg_parts[0:-1]))
5063 elif (arg_parts[0].startswith('GLint') and len(arg_parts[0]) > 5 and 5084 elif (arg_parts[0].startswith('GLint') and len(arg_parts[0]) > 5 and
5064 not arg_parts[0].startswith('GLintptr')): 5085 not arg_parts[0].startswith('GLintptr')):
5065 return IntArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) 5086 return IntArgument(arg_parts[-1], " ".join(arg_parts[0:-1]))
5066 elif (arg_parts[0].startswith('GLsizeiNotNegative') or 5087 elif (arg_parts[0].startswith('GLsizeiNotNegative') or
5067 arg_parts[0].startswith('GLintptrNotNegative')): 5088 arg_parts[0].startswith('GLintptrNotNegative')):
5068 return SizeNotNegativeArgument(arg_parts[-1], 5089 return SizeNotNegativeArgument(arg_parts[-1],
5069 " ".join(arg_parts[0:-1]), 5090 " ".join(arg_parts[0:-1]),
5070 arg_parts[0][0:-11]) 5091 arg_parts[0][0:-11])
5071 elif arg_parts[0].startswith('GLsize'): 5092 elif arg_parts[0].startswith('GLsize'):
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
5790 5811
5791 if options.generate_docs: 5812 if options.generate_docs:
5792 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") 5813 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h")
5793 5814
5794 if gen.errors > 0: 5815 if gen.errors > 0:
5795 print "%d errors" % gen.errors 5816 print "%d errors" % gen.errors
5796 sys.exit(1) 5817 sys.exit(1)
5797 5818
5798 if __name__ == '__main__': 5819 if __name__ == '__main__':
5799 main(sys.argv[1:]) 5820 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/framebuffer_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698