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

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

Issue 1028333002: Chromium -> Mojo roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 {'name': 'blend'}, 75 {'name': 'blend'},
76 {'name': 'cull_face'}, 76 {'name': 'cull_face'},
77 {'name': 'depth_test', 'state_flag': 'framebuffer_state_.clear_state_dirty'}, 77 {'name': 'depth_test', 'state_flag': 'framebuffer_state_.clear_state_dirty'},
78 {'name': 'dither', 'default': True}, 78 {'name': 'dither', 'default': True},
79 {'name': 'polygon_offset_fill'}, 79 {'name': 'polygon_offset_fill'},
80 {'name': 'sample_alpha_to_coverage'}, 80 {'name': 'sample_alpha_to_coverage'},
81 {'name': 'sample_coverage'}, 81 {'name': 'sample_coverage'},
82 {'name': 'scissor_test'}, 82 {'name': 'scissor_test'},
83 {'name': 'stencil_test', 83 {'name': 'stencil_test',
84 'state_flag': 'framebuffer_state_.clear_state_dirty'}, 84 'state_flag': 'framebuffer_state_.clear_state_dirty'},
85 {'name': 'rasterizer_discard', 'es3': True},
85 ] 86 ]
86 87
87 _STATES = { 88 _STATES = {
88 'ClearColor': { 89 'ClearColor': {
89 'type': 'Normal', 90 'type': 'Normal',
90 'func': 'ClearColor', 91 'func': 'ClearColor',
91 'enum': 'GL_COLOR_CLEAR_VALUE', 92 'enum': 'GL_COLOR_CLEAR_VALUE',
92 'states': [ 93 'states': [
93 {'name': 'color_clear_red', 'type': 'GLfloat', 'default': '0.0f'}, 94 {'name': 'color_clear_red', 'type': 'GLfloat', 'default': '0.0f'},
94 {'name': 'color_clear_green', 'type': 'GLfloat', 'default': '0.0f'}, 95 {'name': 'color_clear_green', 'type': 'GLfloat', 'default': '0.0f'},
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 'GL_DST_ALPHA', 892 'GL_DST_ALPHA',
892 'GL_ONE_MINUS_DST_ALPHA', 893 'GL_ONE_MINUS_DST_ALPHA',
893 'GL_CONSTANT_COLOR', 894 'GL_CONSTANT_COLOR',
894 'GL_ONE_MINUS_CONSTANT_COLOR', 895 'GL_ONE_MINUS_CONSTANT_COLOR',
895 'GL_CONSTANT_ALPHA', 896 'GL_CONSTANT_ALPHA',
896 'GL_ONE_MINUS_CONSTANT_ALPHA', 897 'GL_ONE_MINUS_CONSTANT_ALPHA',
897 ], 898 ],
898 }, 899 },
899 'Capability': { 900 'Capability': {
900 'type': 'GLenum', 901 'type': 'GLenum',
901 'valid': ["GL_%s" % cap['name'].upper() for cap in _CAPABILITY_FLAGS], 902 'valid': ["GL_%s" % cap['name'].upper() for cap in _CAPABILITY_FLAGS
903 if 'es3' not in cap or cap['es3'] != True],
904 'valid_es3': ["GL_%s" % cap['name'].upper() for cap in _CAPABILITY_FLAGS
905 if 'es3' in cap and cap['es3'] == True],
902 'invalid': [ 906 'invalid': [
903 'GL_CLIP_PLANE0', 907 'GL_CLIP_PLANE0',
904 'GL_POINT_SPRITE', 908 'GL_POINT_SPRITE',
905 ], 909 ],
906 }, 910 },
907 'DrawMode': { 911 'DrawMode': {
908 'type': 'GLenum', 912 'type': 'GLenum',
909 'valid': [ 913 'valid': [
910 'GL_POINTS', 914 'GL_POINTS',
911 'GL_LINE_STRIP', 915 'GL_LINE_STRIP',
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after
2669 }, 2673 },
2670 'MapBufferSubDataCHROMIUM': { 2674 'MapBufferSubDataCHROMIUM': {
2671 'gen_cmd': False, 2675 'gen_cmd': False,
2672 'extension': True, 2676 'extension': True,
2673 'chromium': True, 2677 'chromium': True,
2674 'client_test': False, 2678 'client_test': False,
2675 'pepper_interface': 'ChromiumMapSub', 2679 'pepper_interface': 'ChromiumMapSub',
2676 }, 2680 },
2677 'MapTexSubImage2DCHROMIUM': { 2681 'MapTexSubImage2DCHROMIUM': {
2678 'gen_cmd': False, 2682 'gen_cmd': False,
2679 'extension': True, 2683 'extension': "CHROMIUM_sub_image",
2680 'chromium': True, 2684 'chromium': True,
2681 'client_test': False, 2685 'client_test': False,
2682 'pepper_interface': 'ChromiumMapSub', 2686 'pepper_interface': 'ChromiumMapSub',
2683 }, 2687 },
2684 'MapBufferRange': { 2688 'MapBufferRange': {
2685 'type': 'Custom', 2689 'type': 'Custom',
2686 'data_transfer_methods': ['shm'], 2690 'data_transfer_methods': ['shm'],
2687 'cmd_args': 'GLenumBufferTarget target, GLintptrNotNegative offset, ' 2691 'cmd_args': 'GLenumBufferTarget target, GLintptrNotNegative offset, '
2688 'GLsizeiptr size, GLbitfieldMapBufferAccess access, ' 2692 'GLsizeiptr size, GLbitfieldMapBufferAccess access, '
2689 'uint32_t data_shm_id, uint32_t data_shm_offset, ' 2693 'uint32_t data_shm_id, uint32_t data_shm_offset, '
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
3075 'chromium': True, 3079 'chromium': True,
3076 'client_test': False, 3080 'client_test': False,
3077 'pepper_interface': 'ChromiumMapSub', 3081 'pepper_interface': 'ChromiumMapSub',
3078 }, 3082 },
3079 'UnmapBuffer': { 3083 'UnmapBuffer': {
3080 'type': 'Custom', 3084 'type': 'Custom',
3081 'unsafe': True, 3085 'unsafe': True,
3082 }, 3086 },
3083 'UnmapTexSubImage2DCHROMIUM': { 3087 'UnmapTexSubImage2DCHROMIUM': {
3084 'gen_cmd': False, 3088 'gen_cmd': False,
3085 'extension': True, 3089 'extension': "CHROMIUM_sub_image",
3086 'chromium': True, 3090 'chromium': True,
3087 'client_test': False, 3091 'client_test': False,
3088 'pepper_interface': 'ChromiumMapSub', 3092 'pepper_interface': 'ChromiumMapSub',
3089 }, 3093 },
3090 'UseProgram': { 3094 'UseProgram': {
3091 'type': 'Bind', 3095 'type': 'Bind',
3092 'decoder_func': 'DoUseProgram', 3096 'decoder_func': 'DoUseProgram',
3093 }, 3097 },
3094 'ValidateProgram': {'decoder_func': 'DoValidateProgram'}, 3098 'ValidateProgram': {'decoder_func': 'DoValidateProgram'},
3095 'VertexAttrib1f': {'decoder_func': 'DoVertexAttrib1f'}, 3099 'VertexAttrib1f': {'decoder_func': 'DoVertexAttrib1f'},
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
3258 'pepper_interface': 'InstancedArrays', 3262 'pepper_interface': 'InstancedArrays',
3259 }, 3263 },
3260 'GenQueriesEXT': { 3264 'GenQueriesEXT': {
3261 'type': 'GENn', 3265 'type': 'GENn',
3262 'gl_test_func': 'glGenQueriesARB', 3266 'gl_test_func': 'glGenQueriesARB',
3263 'resource_type': 'Query', 3267 'resource_type': 'Query',
3264 'resource_types': 'Queries', 3268 'resource_types': 'Queries',
3265 'unit_test': False, 3269 'unit_test': False,
3266 'pepper_interface': 'Query', 3270 'pepper_interface': 'Query',
3267 'not_shared': 'True', 3271 'not_shared': 'True',
3272 'extension': "occlusion_query_EXT",
3268 }, 3273 },
3269 'DeleteQueriesEXT': { 3274 'DeleteQueriesEXT': {
3270 'type': 'DELn', 3275 'type': 'DELn',
3271 'gl_test_func': 'glDeleteQueriesARB', 3276 'gl_test_func': 'glDeleteQueriesARB',
3272 'resource_type': 'Query', 3277 'resource_type': 'Query',
3273 'resource_types': 'Queries', 3278 'resource_types': 'Queries',
3274 'unit_test': False, 3279 'unit_test': False,
3275 'pepper_interface': 'Query', 3280 'pepper_interface': 'Query',
3281 'extension': "occlusion_query_EXT",
3276 }, 3282 },
3277 'IsQueryEXT': { 3283 'IsQueryEXT': {
3278 'gen_cmd': False, 3284 'gen_cmd': False,
3279 'client_test': False, 3285 'client_test': False,
3280 'pepper_interface': 'Query', 3286 'pepper_interface': 'Query',
3287 'extension': "occlusion_query_EXT",
3281 }, 3288 },
3282 'BeginQueryEXT': { 3289 'BeginQueryEXT': {
3283 'type': 'Manual', 3290 'type': 'Manual',
3284 'cmd_args': 'GLenumQueryTarget target, GLidQuery id, void* sync_data', 3291 'cmd_args': 'GLenumQueryTarget target, GLidQuery id, void* sync_data',
3285 'data_transfer_methods': ['shm'], 3292 'data_transfer_methods': ['shm'],
3286 'gl_test_func': 'glBeginQuery', 3293 'gl_test_func': 'glBeginQuery',
3287 'pepper_interface': 'Query', 3294 'pepper_interface': 'Query',
3295 'extension': "occlusion_query_EXT",
3288 }, 3296 },
3289 'BeginTransformFeedback': { 3297 'BeginTransformFeedback': {
3290 'unsafe': True, 3298 'unsafe': True,
3291 }, 3299 },
3292 'EndQueryEXT': { 3300 'EndQueryEXT': {
3293 'type': 'Manual', 3301 'type': 'Manual',
3294 'cmd_args': 'GLenumQueryTarget target, GLuint submit_count', 3302 'cmd_args': 'GLenumQueryTarget target, GLuint submit_count',
3295 'gl_test_func': 'glEndnQuery', 3303 'gl_test_func': 'glEndnQuery',
3296 'client_test': False, 3304 'client_test': False,
3297 'pepper_interface': 'Query', 3305 'pepper_interface': 'Query',
3306 'extension': "occlusion_query_EXT",
3298 }, 3307 },
3299 'EndTransformFeedback': { 3308 'EndTransformFeedback': {
3300 'unsafe': True, 3309 'unsafe': True,
3301 }, 3310 },
3302 'GetQueryivEXT': { 3311 'GetQueryivEXT': {
3303 'gen_cmd': False, 3312 'gen_cmd': False,
3304 'client_test': False, 3313 'client_test': False,
3305 'gl_test_func': 'glGetQueryiv', 3314 'gl_test_func': 'glGetQueryiv',
3306 'pepper_interface': 'Query', 3315 'pepper_interface': 'Query',
3316 'extension': "occlusion_query_EXT",
3307 }, 3317 },
3308 'GetQueryObjectuivEXT': { 3318 'GetQueryObjectuivEXT': {
3309 'gen_cmd': False, 3319 'gen_cmd': False,
3310 'client_test': False, 3320 'client_test': False,
3311 'gl_test_func': 'glGetQueryObjectuiv', 3321 'gl_test_func': 'glGetQueryObjectuiv',
3312 'pepper_interface': 'Query', 3322 'pepper_interface': 'Query',
3323 'extension': "occlusion_query_EXT",
3313 }, 3324 },
3314 'BindUniformLocationCHROMIUM': { 3325 'BindUniformLocationCHROMIUM': {
3315 'type': 'GLchar', 3326 'type': 'GLchar',
3316 'extension': True, 3327 'extension': True,
3317 'data_transfer_methods': ['bucket'], 3328 'data_transfer_methods': ['bucket'],
3318 'needs_size': True, 3329 'needs_size': True,
3319 'gl_test_func': 'DoBindUniformLocationCHROMIUM', 3330 'gl_test_func': 'DoBindUniformLocationCHROMIUM',
3320 }, 3331 },
3321 'InsertEventMarkerEXT': { 3332 'InsertEventMarkerEXT': {
3322 'type': 'GLcharN', 3333 'type': 'GLcharN',
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3389 'ShallowFinishCHROMIUM': { 3400 'ShallowFinishCHROMIUM': {
3390 'impl_func': False, 3401 'impl_func': False,
3391 'gen_cmd': False, 3402 'gen_cmd': False,
3392 'extension': True, 3403 'extension': True,
3393 'chromium': True, 3404 'chromium': True,
3394 'client_test': False, 3405 'client_test': False,
3395 }, 3406 },
3396 'ShallowFlushCHROMIUM': { 3407 'ShallowFlushCHROMIUM': {
3397 'impl_func': False, 3408 'impl_func': False,
3398 'gen_cmd': False, 3409 'gen_cmd': False,
3399 'extension': True, 3410 'extension': "CHROMIUM_miscellaneous",
3400 'chromium': True, 3411 'chromium': True,
3401 'client_test': False, 3412 'client_test': False,
3402 }, 3413 },
3403 'OrderingBarrierCHROMIUM': { 3414 'OrderingBarrierCHROMIUM': {
3404 'impl_func': False, 3415 'impl_func': False,
3405 'gen_cmd': False, 3416 'gen_cmd': False,
3406 'extension': True, 3417 'extension': True,
3407 'chromium': True, 3418 'chromium': True,
3408 'client_test': False, 3419 'client_test': False,
3409 }, 3420 },
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
4191 self.WriteClientGLReturnLog(func, file) 4202 self.WriteClientGLReturnLog(func, file)
4192 file.Write("}\n") 4203 file.Write("}\n")
4193 file.Write("\n") 4204 file.Write("\n")
4194 4205
4195 def WriteGLES2InterfaceHeader(self, func, file): 4206 def WriteGLES2InterfaceHeader(self, func, file):
4196 """Writes the GLES2 Interface.""" 4207 """Writes the GLES2 Interface."""
4197 file.Write("virtual %s %s(%s) = 0;\n" % 4208 file.Write("virtual %s %s(%s) = 0;\n" %
4198 (func.return_type, func.original_name, 4209 (func.return_type, func.original_name,
4199 func.MakeTypedOriginalArgString(""))) 4210 func.MakeTypedOriginalArgString("")))
4200 4211
4212 def WriteMojoGLES2ImplHeader(self, func, file):
4213 """Writes the Mojo GLES2 implementation header."""
4214 file.Write("%s %s(%s) override;\n" %
4215 (func.return_type, func.original_name,
4216 func.MakeTypedOriginalArgString("")))
4217
4218 def WriteMojoGLES2Impl(self, func, file):
4219 """Writes the Mojo GLES2 implementation."""
4220 file.Write("%s MojoGLES2Impl::%s(%s) {\n" %
4221 (func.return_type, func.original_name,
4222 func.MakeTypedOriginalArgString("")))
4223 # TODO(alhaad): Add Mojo C thunk for each of the following methods and
4224 # remove this.
4225 func_list = ["GenQueriesEXT", "BeginQueryEXT", "MapTexSubImage2DCHROMIUM",
4226 "UnmapTexSubImage2DCHROMIUM", "DeleteQueriesEXT",
4227 "EndQueryEXT", "GetQueryObjectuivEXT", "ShallowFlushCHROMIUM"]
4228 if func.original_name in func_list:
4229 file.Write("return static_cast<gpu::gles2::GLES2Interface*>"
4230 "(MojoGLES2GetGLES2Interface(context_))->" +
4231 func.original_name + "(" + func.MakeOriginalArgString("") +
4232 ");")
4233 file.Write("}")
4234 return
4235
4236 extensions = ["CHROMIUM_sync_point", "CHROMIUM_texture_mailbox"]
4237 if func.IsCoreGLFunction() or func.GetInfo("extension") in extensions:
4238 file.Write("MojoGLES2MakeCurrent(context_);");
4239 func_return = "gl" + func.original_name + "(" + \
4240 func.MakeOriginalArgString("") + ");"
4241 if func.return_type == "void":
4242 file.Write(func_return);
4243 else:
4244 file.Write("return " + func_return);
4245 else:
4246 file.Write("NOTREACHED() << \"Unimplemented %s.\";\n" %
4247 func.original_name);
4248 if func.return_type != "void":
4249 file.Write("return 0;")
4250 file.Write("}")
4251
4201 def WriteGLES2InterfaceStub(self, func, file): 4252 def WriteGLES2InterfaceStub(self, func, file):
4202 """Writes the GLES2 Interface stub declaration.""" 4253 """Writes the GLES2 Interface stub declaration."""
4203 file.Write("%s %s(%s) override;\n" % 4254 file.Write("%s %s(%s) override;\n" %
4204 (func.return_type, func.original_name, 4255 (func.return_type, func.original_name,
4205 func.MakeTypedOriginalArgString(""))) 4256 func.MakeTypedOriginalArgString("")))
4206 4257
4207 def WriteGLES2InterfaceStubImpl(self, func, file): 4258 def WriteGLES2InterfaceStubImpl(self, func, file):
4208 """Writes the GLES2 Interface stub declaration.""" 4259 """Writes the GLES2 Interface stub declaration."""
4209 args = func.GetOriginalArgs() 4260 args = func.GetOriginalArgs()
4210 arg_string = ", ".join( 4261 arg_string = ", ".join(
(...skipping 4689 matching lines...) Expand 10 before | Expand all | Expand 10 after
8900 self.type_handler.WriteServiceUnitTest(self, file, *extras) 8951 self.type_handler.WriteServiceUnitTest(self, file, *extras)
8901 8952
8902 def WriteGLES2CLibImplementation(self, file): 8953 def WriteGLES2CLibImplementation(self, file):
8903 """Writes the GLES2 C Lib Implemention.""" 8954 """Writes the GLES2 C Lib Implemention."""
8904 self.type_handler.WriteGLES2CLibImplementation(self, file) 8955 self.type_handler.WriteGLES2CLibImplementation(self, file)
8905 8956
8906 def WriteGLES2InterfaceHeader(self, file): 8957 def WriteGLES2InterfaceHeader(self, file):
8907 """Writes the GLES2 Interface declaration.""" 8958 """Writes the GLES2 Interface declaration."""
8908 self.type_handler.WriteGLES2InterfaceHeader(self, file) 8959 self.type_handler.WriteGLES2InterfaceHeader(self, file)
8909 8960
8961 def WriteMojoGLES2ImplHeader(self, file):
8962 """Writes the Mojo GLES2 implementation header declaration."""
8963 self.type_handler.WriteMojoGLES2ImplHeader(self, file)
8964
8965 def WriteMojoGLES2Impl(self, file):
8966 """Writes the Mojo GLES2 implementation declaration."""
8967 self.type_handler.WriteMojoGLES2Impl(self, file)
8968
8910 def WriteGLES2InterfaceStub(self, file): 8969 def WriteGLES2InterfaceStub(self, file):
8911 """Writes the GLES2 Interface Stub declaration.""" 8970 """Writes the GLES2 Interface Stub declaration."""
8912 self.type_handler.WriteGLES2InterfaceStub(self, file) 8971 self.type_handler.WriteGLES2InterfaceStub(self, file)
8913 8972
8914 def WriteGLES2InterfaceStubImpl(self, file): 8973 def WriteGLES2InterfaceStubImpl(self, file):
8915 """Writes the GLES2 Interface Stub declaration.""" 8974 """Writes the GLES2 Interface Stub declaration."""
8916 self.type_handler.WriteGLES2InterfaceStubImpl(self, file) 8975 self.type_handler.WriteGLES2InterfaceStubImpl(self, file)
8917 8976
8918 def WriteGLES2ImplementationHeader(self, file): 8977 def WriteGLES2ImplementationHeader(self, file):
8919 """Writes the GLES2 Implemention declaration.""" 8978 """Writes the GLES2 Implemention declaration."""
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
9527 if isinstance(item['default'], list): 9586 if isinstance(item['default'], list):
9528 for ndx, value in enumerate(item['default']): 9587 for ndx, value in enumerate(item['default']):
9529 file.Write(" cached_%s[%d] = %s;\n" % (item['name'], ndx, value)) 9588 file.Write(" cached_%s[%d] = %s;\n" % (item['name'], ndx, value))
9530 else: 9589 else:
9531 file.Write(" cached_%s = %s;\n" % (item['name'], item['default'])) 9590 file.Write(" cached_%s = %s;\n" % (item['name'], item['default']))
9532 file.Write("}\n") 9591 file.Write("}\n")
9533 9592
9534 file.Write(""" 9593 file.Write("""
9535 void ContextState::InitCapabilities(const ContextState* prev_state) const { 9594 void ContextState::InitCapabilities(const ContextState* prev_state) const {
9536 """) 9595 """)
9537 def WriteCapabilities(test_prev): 9596 def WriteCapabilities(test_prev, es3_caps):
9538 for capability in _CAPABILITY_FLAGS: 9597 for capability in _CAPABILITY_FLAGS:
9539 capability_name = capability['name'] 9598 capability_name = capability['name']
9599 capability_es3 = 'es3' in capability and capability['es3'] == True
9600 if capability_es3 and not es3_caps or not capability_es3 and es3_caps:
9601 continue
9540 if test_prev: 9602 if test_prev:
9541 file.Write(""" if (prev_state->enable_flags.cached_%s != 9603 file.Write(""" if (prev_state->enable_flags.cached_%s !=
9542 enable_flags.cached_%s)\n""" % 9604 enable_flags.cached_%s) {\n""" %
9543 (capability_name, capability_name)) 9605 (capability_name, capability_name))
9544 file.Write(" EnableDisable(GL_%s, enable_flags.cached_%s);\n" % 9606 file.Write(" EnableDisable(GL_%s, enable_flags.cached_%s);\n" %
9545 (capability_name.upper(), capability_name)) 9607 (capability_name.upper(), capability_name))
9608 if test_prev:
9609 file.Write(" }")
9546 9610
9547 file.Write(" if (prev_state) {") 9611 file.Write(" if (prev_state) {")
9548 WriteCapabilities(True) 9612 WriteCapabilities(True, False)
9613 file.Write(" if (feature_info_->IsES3Capable()) {\n")
9614 WriteCapabilities(True, True)
9615 file.Write(" }\n")
9549 file.Write(" } else {") 9616 file.Write(" } else {")
9550 WriteCapabilities(False) 9617 WriteCapabilities(False, False)
9618 file.Write(" if (feature_info_->IsES3Capable()) {\n")
9619 WriteCapabilities(False, True)
9620 file.Write(" }\n")
9551 file.Write(" }") 9621 file.Write(" }")
9552 9622
9553 file.Write("""} 9623 file.Write("""}
9554 9624
9555 void ContextState::InitState(const ContextState *prev_state) const { 9625 void ContextState::InitState(const ContextState *prev_state) const {
9556 """) 9626 """)
9557 9627
9558 def WriteStates(test_prev): 9628 def WriteStates(test_prev):
9559 # We need to sort the keys so the expectations match 9629 # We need to sort the keys so the expectations match
9560 for state_name in sorted(_STATES.keys()): 9630 for state_name in sorted(_STATES.keys()):
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
9776 else: 9846 else:
9777 func.WriteServiceUnitTest(file, { 9847 func.WriteServiceUnitTest(file, {
9778 'test_name': test_name 9848 'test_name': test_name
9779 }) 9849 })
9780 file.Close() 9850 file.Close()
9781 self.generated_cpp_filenames.append(file.filename) 9851 self.generated_cpp_filenames.append(file.filename)
9782 file = CHeaderWriter( 9852 file = CHeaderWriter(
9783 filename % 0, 9853 filename % 0,
9784 "// It is included by gles2_cmd_decoder_unittest_base.cc\n") 9854 "// It is included by gles2_cmd_decoder_unittest_base.cc\n")
9785 file.Write( 9855 file.Write(
9786 """void GLES2DecoderTestBase::SetupInitCapabilitiesExpectations() { 9856 """void GLES2DecoderTestBase::SetupInitCapabilitiesExpectations(
9787 """) 9857 bool es3_capable) {""")
9788 for capability in _CAPABILITY_FLAGS: 9858 for capability in _CAPABILITY_FLAGS:
9789 file.Write(" ExpectEnableDisable(GL_%s, %s);\n" % 9859 capability_es3 = 'es3' in capability and capability['es3'] == True
9790 (capability['name'].upper(), 9860 if not capability_es3:
9791 ('false', 'true')['default' in capability])) 9861 file.Write(" ExpectEnableDisable(GL_%s, %s);\n" %
9792 file.Write("""} 9862 (capability['name'].upper(),
9863 ('false', 'true')['default' in capability]))
9864
9865 file.Write(" if (es3_capable) {")
9866 for capability in _CAPABILITY_FLAGS:
9867 capability_es3 = 'es3' in capability and capability['es3'] == True
9868 if capability_es3:
9869 file.Write(" ExpectEnableDisable(GL_%s, %s);\n" %
9870 (capability['name'].upper(),
9871 ('false', 'true')['default' in capability]))
9872 file.Write(""" }
9873 }
9793 9874
9794 void GLES2DecoderTestBase::SetupInitStateExpectations() { 9875 void GLES2DecoderTestBase::SetupInitStateExpectations() {
9795 """) 9876 """)
9796 9877
9797 # We need to sort the keys so the expectations match 9878 # We need to sort the keys so the expectations match
9798 for state_name in sorted(_STATES.keys()): 9879 for state_name in sorted(_STATES.keys()):
9799 state = _STATES[state_name] 9880 state = _STATES[state_name]
9800 if state['type'] == 'FrontBack': 9881 if state['type'] == 'FrontBack':
9801 num_states = len(state['states']) 9882 num_states = len(state['states'])
9802 for ndx, group in enumerate(Grouper(num_states / 2, state['states'])): 9883 for ndx, group in enumerate(Grouper(num_states / 2, state['states'])):
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
9923 """Writes the GLES2 interface header.""" 10004 """Writes the GLES2 interface header."""
9924 file = CHeaderWriter( 10005 file = CHeaderWriter(
9925 filename, 10006 filename,
9926 "// This file is included by gles2_interface.h to declare the\n" 10007 "// This file is included by gles2_interface.h to declare the\n"
9927 "// GL api functions.\n") 10008 "// GL api functions.\n")
9928 for func in self.original_functions: 10009 for func in self.original_functions:
9929 func.WriteGLES2InterfaceHeader(file) 10010 func.WriteGLES2InterfaceHeader(file)
9930 file.Close() 10011 file.Close()
9931 self.generated_cpp_filenames.append(file.filename) 10012 self.generated_cpp_filenames.append(file.filename)
9932 10013
10014 def WriteMojoGLES2ImplHeader(self, filename):
10015 """Writes the Mojo GLES2 implementation header."""
10016 file = CHeaderWriter(
10017 filename,
10018 "// This file is included by gles2_interface.h to declare the\n"
10019 "// GL api functions.\n")
10020
10021 code = """
10022 #include "gpu/command_buffer/client/gles2_interface.h"
10023 #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h"
10024
10025 namespace mojo {
10026
10027 class MojoGLES2Impl : public gpu::gles2::GLES2Interface {
10028 public:
10029 explicit MojoGLES2Impl(MojoGLES2Context context) {
10030 context_ = context;
10031 }
10032 ~MojoGLES2Impl() override {}
10033 """
10034 file.Write(code);
10035 for func in self.original_functions:
10036 func.WriteMojoGLES2ImplHeader(file)
10037 code = """
10038 private:
10039 MojoGLES2Context context_;
10040 };
10041
10042 } // namespace mojo
10043 """
10044 file.Write(code);
10045 file.Close()
10046 self.generated_cpp_filenames.append(file.filename)
10047
10048 def WriteMojoGLES2Impl(self, filename):
10049 """Writes the Mojo GLES2 implementation."""
10050 file = CWriter(filename)
10051 file.Write(_LICENSE)
10052 file.Write(_DO_NOT_EDIT_WARNING)
10053
10054 code = """
10055 #include "mojo/gpu/mojo_gles2_impl_autogen.h"
10056
10057 #include "base/logging.h"
10058 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sync_point.h"
10059 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_texture_mailbox.h"
10060 #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h"
10061
10062 namespace mojo {
10063
10064 """
10065 file.Write(code);
10066 for func in self.original_functions:
10067 func.WriteMojoGLES2Impl(file)
10068 code = """
10069
10070 } // namespace mojo
10071 """
10072 file.Write(code);
10073 file.Close()
10074 self.generated_cpp_filenames.append(file.filename)
10075
9933 def WriteGLES2InterfaceStub(self, filename): 10076 def WriteGLES2InterfaceStub(self, filename):
9934 """Writes the GLES2 interface stub header.""" 10077 """Writes the GLES2 interface stub header."""
9935 file = CHeaderWriter( 10078 file = CHeaderWriter(
9936 filename, 10079 filename,
9937 "// This file is included by gles2_interface_stub.h.\n") 10080 "// This file is included by gles2_interface_stub.h.\n")
9938 for func in self.original_functions: 10081 for func in self.original_functions:
9939 func.WriteGLES2InterfaceStub(file) 10082 func.WriteGLES2InterfaceStub(file)
9940 file.Close() 10083 file.Close()
9941 self.generated_cpp_filenames.append(file.filename) 10084 self.generated_cpp_filenames.append(file.filename)
9942 10085
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
10441 gen.WriteGLES2ToPPAPIBridge("ppapi/lib/gl/gles2/gles2.c") 10584 gen.WriteGLES2ToPPAPIBridge("ppapi/lib/gl/gles2/gles2.c")
10442 gen.WritePepperGLES2Implementation( 10585 gen.WritePepperGLES2Implementation(
10443 "ppapi/shared_impl/ppb_opengles2_shared.cc") 10586 "ppapi/shared_impl/ppb_opengles2_shared.cc")
10444 os.chdir(base_dir) 10587 os.chdir(base_dir)
10445 gen.WriteCommandIds("gpu/command_buffer/common/gles2_cmd_ids_autogen.h") 10588 gen.WriteCommandIds("gpu/command_buffer/common/gles2_cmd_ids_autogen.h")
10446 gen.WriteFormat("gpu/command_buffer/common/gles2_cmd_format_autogen.h") 10589 gen.WriteFormat("gpu/command_buffer/common/gles2_cmd_format_autogen.h")
10447 gen.WriteFormatTest( 10590 gen.WriteFormatTest(
10448 "gpu/command_buffer/common/gles2_cmd_format_test_autogen.h") 10591 "gpu/command_buffer/common/gles2_cmd_format_test_autogen.h")
10449 gen.WriteGLES2InterfaceHeader( 10592 gen.WriteGLES2InterfaceHeader(
10450 "gpu/command_buffer/client/gles2_interface_autogen.h") 10593 "gpu/command_buffer/client/gles2_interface_autogen.h")
10594 gen.WriteMojoGLES2ImplHeader(
10595 "mojo/gpu/mojo_gles2_impl_autogen.h")
10596 gen.WriteMojoGLES2Impl(
10597 "mojo/gpu/mojo_gles2_impl_autogen.cc")
10451 gen.WriteGLES2InterfaceStub( 10598 gen.WriteGLES2InterfaceStub(
10452 "gpu/command_buffer/client/gles2_interface_stub_autogen.h") 10599 "gpu/command_buffer/client/gles2_interface_stub_autogen.h")
10453 gen.WriteGLES2InterfaceStubImpl( 10600 gen.WriteGLES2InterfaceStubImpl(
10454 "gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h") 10601 "gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h")
10455 gen.WriteGLES2ImplementationHeader( 10602 gen.WriteGLES2ImplementationHeader(
10456 "gpu/command_buffer/client/gles2_implementation_autogen.h") 10603 "gpu/command_buffer/client/gles2_implementation_autogen.h")
10457 gen.WriteGLES2Implementation( 10604 gen.WriteGLES2Implementation(
10458 "gpu/command_buffer/client/gles2_implementation_impl_autogen.h") 10605 "gpu/command_buffer/client/gles2_implementation_impl_autogen.h")
10459 gen.WriteGLES2ImplementationUnitTests( 10606 gen.WriteGLES2ImplementationUnitTests(
10460 "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h") 10607 "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h")
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
10493 gen.WriteGLES2Header("gpu/GLES2/gl2chromium_autogen.h") 10640 gen.WriteGLES2Header("gpu/GLES2/gl2chromium_autogen.h")
10494 mojo_gles2_prefix = ("third_party/mojo/src/mojo/public/c/gles2/" 10641 mojo_gles2_prefix = ("third_party/mojo/src/mojo/public/c/gles2/"
10495 "gles2_call_visitor") 10642 "gles2_call_visitor")
10496 gen.WriteMojoGLCallVisitor(mojo_gles2_prefix + "_autogen.h") 10643 gen.WriteMojoGLCallVisitor(mojo_gles2_prefix + "_autogen.h")
10497 gen.WriteMojoGLCallVisitorForExtension( 10644 gen.WriteMojoGLCallVisitorForExtension(
10498 mojo_gles2_prefix + "_chromium_texture_mailbox_autogen.h", 10645 mojo_gles2_prefix + "_chromium_texture_mailbox_autogen.h",
10499 "CHROMIUM_texture_mailbox") 10646 "CHROMIUM_texture_mailbox")
10500 gen.WriteMojoGLCallVisitorForExtension( 10647 gen.WriteMojoGLCallVisitorForExtension(
10501 mojo_gles2_prefix + "_chromium_sync_point_autogen.h", 10648 mojo_gles2_prefix + "_chromium_sync_point_autogen.h",
10502 "CHROMIUM_sync_point") 10649 "CHROMIUM_sync_point")
10650 gen.WriteMojoGLCallVisitorForExtension(
10651 mojo_gles2_prefix + "_chromium_sub_image_autogen.h",
10652 "CHROMIUM_sub_image")
10653 gen.WriteMojoGLCallVisitorForExtension(
10654 mojo_gles2_prefix + "_chromium_miscellaneous_autogen.h",
10655 "CHROMIUM_miscellaneous")
10656 gen.WriteMojoGLCallVisitorForExtension(
10657 mojo_gles2_prefix + "_occlusion_query_ext_autogen.h",
10658 "occlusion_query_EXT")
10503 10659
10504 Format(gen.generated_cpp_filenames) 10660 Format(gen.generated_cpp_filenames)
10505 10661
10506 if gen.errors > 0: 10662 if gen.errors > 0:
10507 print "%d errors" % gen.errors 10663 print "%d errors" % gen.errors
10508 return 1 10664 return 1
10509 return 0 10665 return 0
10510 10666
10511 10667
10512 if __name__ == '__main__': 10668 if __name__ == '__main__':
10513 sys.exit(main(sys.argv[1:])) 10669 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « cc/trees/tree_synchronizer_unittest.cc ('k') | gpu/command_buffer/client/client_context_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698