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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 }, | 354 }, |
355 { | 355 { |
356 'name': 'hint_fragment_shader_derivative', | 356 'name': 'hint_fragment_shader_derivative', |
357 'type': 'GLenum', | 357 'type': 'GLenum', |
358 'enum': 'GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES', | 358 'enum': 'GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES', |
359 'default': 'GL_DONT_CARE', | 359 'default': 'GL_DONT_CARE', |
360 'extension_flag': 'oes_standard_derivatives' | 360 'extension_flag': 'oes_standard_derivatives' |
361 } | 361 } |
362 ], | 362 ], |
363 }, | 363 }, |
| 364 'PixelStore': { |
| 365 'type': 'NamedParameter', |
| 366 'func': 'PixelStorei', |
| 367 'states': [ |
| 368 { |
| 369 'name': 'pack_alignment', |
| 370 'type': 'GLint', |
| 371 'enum': 'GL_PACK_ALIGNMENT', |
| 372 'default': '4' |
| 373 }, |
| 374 { |
| 375 'name': 'unpack_alignment', |
| 376 'type': 'GLint', |
| 377 'enum': 'GL_UNPACK_ALIGNMENT', |
| 378 'default': '4' |
| 379 } |
| 380 ], |
| 381 }, |
364 # TODO: Consider implemenenting these states | 382 # TODO: Consider implemenenting these states |
365 # GL_ACTIVE_TEXTURE, | 383 # GL_ACTIVE_TEXTURE |
366 # GL_PACK_ALIGNMENT, | |
367 # GL_UNPACK_ALIGNMENT | |
368 'LineWidth': { | 384 'LineWidth': { |
369 'type': 'Normal', | 385 'type': 'Normal', |
370 'func': 'LineWidth', | 386 'func': 'LineWidth', |
371 'enum': 'GL_LINE_WIDTH', | 387 'enum': 'GL_LINE_WIDTH', |
372 'states': [ | 388 'states': [ |
373 { | 389 { |
374 'name': 'line_width', | 390 'name': 'line_width', |
375 'type': 'GLfloat', | 391 'type': 'GLfloat', |
376 'default': '1.0f', | 392 'default': '1.0f', |
377 'range_checks': [{'check': "<= 0.0f", 'test_value': "0.0f"}], | 393 'range_checks': [{'check': "<= 0.0f", 'test_value': "0.0f"}], |
(...skipping 6646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7024 file.Close() | 7040 file.Close() |
7025 | 7041 |
7026 def WriteContextStateGetters(self, file, class_name): | 7042 def WriteContextStateGetters(self, file, class_name): |
7027 """Writes the state getters.""" | 7043 """Writes the state getters.""" |
7028 for gl_type in ["GLint", "GLfloat"]: | 7044 for gl_type in ["GLint", "GLfloat"]: |
7029 file.Write(""" | 7045 file.Write(""" |
7030 bool %s::GetStateAs%s( | 7046 bool %s::GetStateAs%s( |
7031 GLenum pname, %s* params, GLsizei* num_written) const { | 7047 GLenum pname, %s* params, GLsizei* num_written) const { |
7032 switch (pname) { | 7048 switch (pname) { |
7033 """ % (class_name, gl_type, gl_type)) | 7049 """ % (class_name, gl_type, gl_type)) |
7034 for state_name in _STATES.keys(): | 7050 for state_name in sorted(_STATES.keys()): |
7035 state = _STATES[state_name] | 7051 state = _STATES[state_name] |
7036 if 'enum' in state: | 7052 if 'enum' in state: |
7037 file.Write(" case %s:\n" % state['enum']) | 7053 file.Write(" case %s:\n" % state['enum']) |
7038 file.Write(" *num_written = %d;\n" % len(state['states'])) | 7054 file.Write(" *num_written = %d;\n" % len(state['states'])) |
7039 file.Write(" if (params) {\n") | 7055 file.Write(" if (params) {\n") |
7040 for ndx,item in enumerate(state['states']): | 7056 for ndx,item in enumerate(state['states']): |
7041 file.Write(" params[%d] = static_cast<%s>(%s);\n" % | 7057 file.Write(" params[%d] = static_cast<%s>(%s);\n" % |
7042 (ndx, gl_type, item['name'])) | 7058 (ndx, gl_type, item['name'])) |
7043 file.Write(" }\n") | 7059 file.Write(" }\n") |
7044 file.Write(" return true;\n") | 7060 file.Write(" return true;\n") |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7768 gen.WriteGLES2Header("../GLES2/gl2chromium_autogen.h") | 7784 gen.WriteGLES2Header("../GLES2/gl2chromium_autogen.h") |
7769 | 7785 |
7770 if gen.errors > 0: | 7786 if gen.errors > 0: |
7771 print "%d errors" % gen.errors | 7787 print "%d errors" % gen.errors |
7772 return 1 | 7788 return 1 |
7773 return 0 | 7789 return 0 |
7774 | 7790 |
7775 | 7791 |
7776 if __name__ == '__main__': | 7792 if __name__ == '__main__': |
7777 sys.exit(main(sys.argv[1:])) | 7793 sys.exit(main(sys.argv[1:])) |
OLD | NEW |