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

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

Issue 2482673002: fix --show-composited-layer-borders on Mac (Closed)
Patch Set: small fix Created 4 years, 1 month 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
« no previous file with comments | « no previous file | gpu/command_buffer/service/context_state.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/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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 'default': '0', 494 'default': '0',
495 'es3': True, 495 'es3': True,
496 'manual': True, 496 'manual': True,
497 } 497 }
498 ], 498 ],
499 }, 499 },
500 # TODO: Consider implemenenting these states 500 # TODO: Consider implemenenting these states
501 # GL_ACTIVE_TEXTURE 501 # GL_ACTIVE_TEXTURE
502 'LineWidth': { 502 'LineWidth': {
503 'type': 'Normal', 503 'type': 'Normal',
504 'func': 'LineWidth', 504 'custom_function' : True,
505 'func': 'DoLineWidth',
505 'enum': 'GL_LINE_WIDTH', 506 'enum': 'GL_LINE_WIDTH',
506 'states': [ 507 'states': [
507 { 508 {
508 'name': 'line_width', 509 'name': 'line_width',
509 'type': 'GLfloat', 510 'type': 'GLfloat',
510 'default': '1.0f', 511 'default': '1.0f',
511 'range_checks': [{'check': "<= 0.0f", 'test_value': "0.0f"}], 512 'range_checks': [{'check': "<= 0.0f", 'test_value': "0.0f"}],
512 'nan_check': True, 513 'nan_check': True,
513 }], 514 }],
514 }, 515 },
(...skipping 9751 matching lines...) Expand 10 before | Expand all | Expand 10 after
10266 for place, item in enumerate(state['states']): 10267 for place, item in enumerate(state['states']):
10267 item_name = CachedStateName(item) 10268 item_name = CachedStateName(item)
10268 args.append('%s' % item_name) 10269 args.append('%s' % item_name)
10269 if test_prev: 10270 if test_prev:
10270 if place > 0: 10271 if place > 0:
10271 f.write(' ||\n') 10272 f.write(' ||\n')
10272 f.write("(%s != prev_state->%s)" % 10273 f.write("(%s != prev_state->%s)" %
10273 (item_name, item_name)) 10274 (item_name, item_name))
10274 if test_prev: 10275 if test_prev:
10275 f.write(" )\n") 10276 f.write(" )\n")
10276 f.write(" gl%s(%s);\n" % (state['func'], ", ".join(args))) 10277 if 'custom_function' in state:
10278 f.write(" %s(%s);\n" % (state['func'], ", ".join(args)))
10279 else:
10280 f.write(" gl%s(%s);\n" % (state['func'], ", ".join(args)))
10277 10281
10278 f.write(" if (prev_state) {") 10282 f.write(" if (prev_state) {")
10279 WriteStates(True) 10283 WriteStates(True)
10280 f.write(" } else {") 10284 f.write(" } else {")
10281 WriteStates(False) 10285 WriteStates(False)
10282 f.write(" }") 10286 f.write(" }")
10283 f.write(" InitStateManual(prev_state);") 10287 f.write(" InitStateManual(prev_state);")
10284 f.write("}\n") 10288 f.write("}\n")
10285 10289
10286 f.write("""bool ContextState::GetEnabled(GLenum cap) const { 10290 f.write("""bool ContextState::GetEnabled(GLenum cap) const {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
10522 state['extension_flag']) 10526 state['extension_flag'])
10523 f.write(" ") 10527 f.write(" ")
10524 args = [] 10528 args = []
10525 for item in state['states']: 10529 for item in state['states']:
10526 if 'expected' in item: 10530 if 'expected' in item:
10527 args.append(item['expected']) 10531 args.append(item['expected'])
10528 else: 10532 else:
10529 args.append(item['default']) 10533 args.append(item['default'])
10530 # TODO: Currently we do not check array values. 10534 # TODO: Currently we do not check array values.
10531 args = ["_" if isinstance(arg, list) else arg for arg in args] 10535 args = ["_" if isinstance(arg, list) else arg for arg in args]
10532 f.write(" EXPECT_CALL(*gl_, %s(%s))\n" % 10536 if 'custom_function' in state:
10533 (state['func'], ", ".join(args))) 10537 f.write(" SetupInitStateManualExpectationsFor%s(%s);\n" %
10534 f.write(" .Times(1)\n") 10538 (state['func'], ", ".join(args)))
10535 f.write(" .RetiresOnSaturation();\n") 10539 else:
10540 f.write(" EXPECT_CALL(*gl_, %s(%s))\n" %
10541 (state['func'], ", ".join(args)))
10542 f.write(" .Times(1)\n")
10543 f.write(" .RetiresOnSaturation();\n")
10536 if 'extension_flag' in state: 10544 if 'extension_flag' in state:
10537 f.write(" }\n") 10545 f.write(" }\n")
10538 f.write(" SetupInitStateManualExpectations(es3_capable);\n") 10546 f.write(" SetupInitStateManualExpectations(es3_capable);\n")
10539 f.write("}\n") 10547 f.write("}\n")
10540 self.generated_cpp_filenames.append(filename) 10548 self.generated_cpp_filenames.append(filename)
10541 10549
10542 def WriteServiceUnitTestsForExtensions(self, filename): 10550 def WriteServiceUnitTestsForExtensions(self, filename):
10543 """Writes the service decorder unit tests for functions with extension_flag. 10551 """Writes the service decorder unit tests for functions with extension_flag.
10544 10552
10545 The functions are special in that they need a specific unit test 10553 The functions are special in that they need a specific unit test
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
11175 Format(gen.generated_cpp_filenames) 11183 Format(gen.generated_cpp_filenames)
11176 11184
11177 if gen.errors > 0: 11185 if gen.errors > 0:
11178 print "%d errors" % gen.errors 11186 print "%d errors" % gen.errors
11179 return 1 11187 return 1
11180 return 0 11188 return 0
11181 11189
11182 11190
11183 if __name__ == '__main__': 11191 if __name__ == '__main__':
11184 sys.exit(main(sys.argv[1:])) 11192 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/context_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698