OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """code generator for GLES2 command buffers.""" | 6 """code generator for GLES2 command buffers.""" |
7 | 7 |
8 import itertools | 8 import itertools |
9 import os | 9 import os |
10 import os.path | 10 import os.path |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1173 'gen_func': 'GenRenderbuffersEXT', | 1173 'gen_func': 'GenRenderbuffersEXT', |
1174 }, | 1174 }, |
1175 'BindTexture': { | 1175 'BindTexture': { |
1176 'type': 'Bind', | 1176 'type': 'Bind', |
1177 'decoder_func': 'DoBindTexture', | 1177 'decoder_func': 'DoBindTexture', |
1178 'gen_func': 'GenTextures', | 1178 'gen_func': 'GenTextures', |
1179 # TODO(gman): remove this once client side caching works. | 1179 # TODO(gman): remove this once client side caching works. |
1180 'client_test': False, | 1180 'client_test': False, |
1181 }, | 1181 }, |
1182 'BlitFramebufferEXT': { | 1182 'BlitFramebufferEXT': { |
1183 'decoder_func': 'DoBlitFramebufferEXT', | 1183 'type': 'ManualService', |
1184 'unit_test': False, | 1184 'unit_test': False, |
1185 'extension': True, | 1185 'extension': True, |
1186 'pepper_interface': 'FramebufferBlit', | 1186 'pepper_interface': 'FramebufferBlit', |
greggman
2012/11/30 02:49:01
Would be better to add add a couple of flags here?
piman
2012/11/30 04:52:34
Done.
| |
1187 }, | 1187 }, |
1188 'BufferData': { | 1188 'BufferData': { |
1189 'type': 'Manual', | 1189 'type': 'Manual', |
1190 'immediate': True, | 1190 'immediate': True, |
1191 'client_test': False, | 1191 'client_test': False, |
1192 }, | 1192 }, |
1193 'BufferSubData': { | 1193 'BufferSubData': { |
1194 'type': 'Data', | 1194 'type': 'Data', |
1195 'client_test': False, | 1195 'client_test': False, |
1196 'decoder_func': 'DoBufferSubData', | 1196 'decoder_func': 'DoBufferSubData', |
1197 }, | 1197 }, |
1198 'CheckFramebufferStatus': { | 1198 'CheckFramebufferStatus': { |
1199 'type': 'Is', | 1199 'type': 'Is', |
1200 'decoder_func': 'DoCheckFramebufferStatus', | 1200 'decoder_func': 'DoCheckFramebufferStatus', |
1201 'gl_test_func': 'glCheckFramebufferStatusEXT', | 1201 'gl_test_func': 'glCheckFramebufferStatusEXT', |
1202 'error_value': 'GL_FRAMEBUFFER_UNSUPPORTED', | 1202 'error_value': 'GL_FRAMEBUFFER_UNSUPPORTED', |
1203 'result': ['GLenum'], | 1203 'result': ['GLenum'], |
1204 }, | 1204 }, |
1205 'Clear': { | 1205 'Clear': { |
1206 'type': 'Manual', | 1206 'type': 'ManualService', |
1207 'cmd_args': 'GLbitfield mask' | |
1208 }, | 1207 }, |
1209 'ClearColor': { | 1208 'ClearColor': { |
1210 'type': 'StateSet', | 1209 'type': 'StateSet', |
1211 'state': 'ClearColor', | 1210 'state': 'ClearColor', |
1212 }, | 1211 }, |
1213 'ClearDepthf': { | 1212 'ClearDepthf': { |
1214 'type': 'StateSet', | 1213 'type': 'StateSet', |
1215 'state': 'ClearDepthf', | 1214 'state': 'ClearDepthf', |
1216 'decoder_func': 'glClearDepth', | 1215 'decoder_func': 'glClearDepth', |
1217 'gl_test_func': 'glClearDepth', | 1216 'gl_test_func': 'glClearDepth', |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1254 'type': 'Manual', | 1253 'type': 'Manual', |
1255 'immediate': True, | 1254 'immediate': True, |
1256 'bucket': True, | 1255 'bucket': True, |
1257 }, | 1256 }, |
1258 'CompressedTexSubImage2D': { | 1257 'CompressedTexSubImage2D': { |
1259 'type': 'Data', | 1258 'type': 'Data', |
1260 'bucket': True, | 1259 'bucket': True, |
1261 'decoder_func': 'DoCompressedTexSubImage2D', | 1260 'decoder_func': 'DoCompressedTexSubImage2D', |
1262 }, | 1261 }, |
1263 'CopyTexImage2D': { | 1262 'CopyTexImage2D': { |
1264 'decoder_func': 'DoCopyTexImage2D', | 1263 'type': 'ManualService', |
1265 'unit_test': False, | 1264 'unit_test': False, |
1266 }, | 1265 }, |
1267 'CopyTexSubImage2D': { | 1266 'CopyTexSubImage2D': { |
1268 'decoder_func': 'DoCopyTexSubImage2D', | 1267 'type': 'ManualService', |
1269 }, | 1268 }, |
1270 'CreateProgram': { | 1269 'CreateProgram': { |
1271 'type': 'Create', | 1270 'type': 'Create', |
1272 'client_test': False, | 1271 'client_test': False, |
1273 }, | 1272 }, |
1274 'CreateShader': { | 1273 'CreateShader': { |
1275 'type': 'Create', | 1274 'type': 'Create', |
1276 'client_test': False, | 1275 'client_test': False, |
1277 }, | 1276 }, |
1278 'BlendColor': { | 1277 'BlendColor': { |
(...skipping 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3239 | 3238 |
3240 def WriteImmediateCmdGetTotalSize(self, func, file): | 3239 def WriteImmediateCmdGetTotalSize(self, func, file): |
3241 """Overrriden from TypeHandler.""" | 3240 """Overrriden from TypeHandler.""" |
3242 # TODO(gman): Move this data to _FUNCTION_INFO? | 3241 # TODO(gman): Move this data to _FUNCTION_INFO? |
3243 if func.name == 'ShaderSourceImmediate': | 3242 if func.name == 'ShaderSourceImmediate': |
3244 file.Write(" uint32 total_size = ComputeSize(_data_size);\n") | 3243 file.Write(" uint32 total_size = ComputeSize(_data_size);\n") |
3245 else: | 3244 else: |
3246 CustomHandler.WriteImmediateCmdGetTotalSize(self, func, file) | 3245 CustomHandler.WriteImmediateCmdGetTotalSize(self, func, file) |
3247 | 3246 |
3248 | 3247 |
3248 class ManualServiceHandler(TypeHandler): | |
3249 """Handler for commands that are auto-generated but for the service side.""" | |
3250 | |
3251 def __init__(self): | |
3252 TypeHandler.__init__(self) | |
3253 | |
3254 def WriteServiceImplementation(self, func, file): | |
3255 """Overrriden from TypeHandler.""" | |
3256 pass | |
3257 | |
3258 def WriteImmediateServiceImplementation(self, func, file): | |
3259 """Overrriden from TypeHandler.""" | |
3260 pass | |
3261 | |
3262 def WriteBucketServiceImplementation(self, func, file): | |
3263 """Overrriden from TypeHandler.""" | |
3264 pass | |
3265 | |
3266 | |
3249 class DataHandler(TypeHandler): | 3267 class DataHandler(TypeHandler): |
3250 """Handler for glBufferData, glBufferSubData, glTexImage2D, glTexSubImage2D, | 3268 """Handler for glBufferData, glBufferSubData, glTexImage2D, glTexSubImage2D, |
3251 glCompressedTexImage2D, glCompressedTexImageSub2D.""" | 3269 glCompressedTexImage2D, glCompressedTexImageSub2D.""" |
3252 def __init__(self): | 3270 def __init__(self): |
3253 TypeHandler.__init__(self) | 3271 TypeHandler.__init__(self) |
3254 | 3272 |
3255 def InitFunction(self, func): | 3273 def InitFunction(self, func): |
3256 """Overrriden from TypeHandler.""" | 3274 """Overrriden from TypeHandler.""" |
3257 if func.name == 'CompressedTexSubImage2DBucket': | 3275 if func.name == 'CompressedTexSubImage2DBucket': |
3258 func.cmd_args = func.cmd_args[:-1] | 3276 func.cmd_args = func.cmd_args[:-1] |
(...skipping 3148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6407 'Data': DataHandler(), | 6425 'Data': DataHandler(), |
6408 'Delete': DeleteHandler(), | 6426 'Delete': DeleteHandler(), |
6409 'DELn': DELnHandler(), | 6427 'DELn': DELnHandler(), |
6410 'GENn': GENnHandler(), | 6428 'GENn': GENnHandler(), |
6411 'GETn': GETnHandler(), | 6429 'GETn': GETnHandler(), |
6412 'GLchar': GLcharHandler(), | 6430 'GLchar': GLcharHandler(), |
6413 'GLcharN': GLcharNHandler(), | 6431 'GLcharN': GLcharNHandler(), |
6414 'HandWritten': HandWrittenHandler(), | 6432 'HandWritten': HandWrittenHandler(), |
6415 'Is': IsHandler(), | 6433 'Is': IsHandler(), |
6416 'Manual': ManualHandler(), | 6434 'Manual': ManualHandler(), |
6435 'ManualService': ManualServiceHandler(), | |
6417 'PUT': PUTHandler(), | 6436 'PUT': PUTHandler(), |
6418 'PUTn': PUTnHandler(), | 6437 'PUTn': PUTnHandler(), |
6419 'PUTXn': PUTXnHandler(), | 6438 'PUTXn': PUTXnHandler(), |
6420 'StateSet': StateSetHandler(), | 6439 'StateSet': StateSetHandler(), |
6421 'StateSetRGBAlpha': StateSetRGBAlphaHandler(), | 6440 'StateSetRGBAlpha': StateSetRGBAlphaHandler(), |
6422 'StateSetFrontBack': StateSetFrontBackHandler(), | 6441 'StateSetFrontBack': StateSetFrontBackHandler(), |
6423 'StateSetFrontBackSeparate': StateSetFrontBackSeparateHandler(), | 6442 'StateSetFrontBackSeparate': StateSetFrontBackSeparateHandler(), |
6424 'STRn': STRnHandler(), | 6443 'STRn': STRnHandler(), |
6425 'Todo': TodoHandler(), | 6444 'Todo': TodoHandler(), |
6426 } | 6445 } |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7425 gen.WriteGLES2Header("../../third_party/khronos/GLES2/gl2chromium.h") | 7444 gen.WriteGLES2Header("../../third_party/khronos/GLES2/gl2chromium.h") |
7426 | 7445 |
7427 if gen.errors > 0: | 7446 if gen.errors > 0: |
7428 print "%d errors" % gen.errors | 7447 print "%d errors" % gen.errors |
7429 return 1 | 7448 return 1 |
7430 return 0 | 7449 return 0 |
7431 | 7450 |
7432 | 7451 |
7433 if __name__ == '__main__': | 7452 if __name__ == '__main__': |
7434 sys.exit(main(sys.argv[1:])) | 7453 sys.exit(main(sys.argv[1:])) |
OLD | NEW |