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

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

Issue 169603002: Add initial support for NV_path_rendering extension to gpu command buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 8 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 'expected': 'kViewportWidth', 472 'expected': 'kViewportWidth',
473 }, 473 },
474 { 474 {
475 'name': 'viewport_height', 475 'name': 'viewport_height',
476 'type': 'GLsizei', 476 'type': 'GLsizei',
477 'default': '1', 477 'default': '1',
478 'expected': 'kViewportHeight', 478 'expected': 'kViewportHeight',
479 }, 479 },
480 ], 480 ],
481 }, 481 },
482 'MatrixMode': {
483 'type': 'Normal',
484 'func': 'MatrixMode',
485 'enum': 'GL_MATRIX_MODE',
486 'extension_flag': 'nv_path_rendering',
487 'states': [
488 {
489 'name': 'matrix_mode',
490 'type': 'GLenum',
491 'default': 'GL_MODELVIEW',
492 }
493 ],
494 },
482 } 495 }
483 496
484 # This is a list of enum names and their valid values. It is used to map 497 # This is a list of enum names and their valid values. It is used to map
485 # GLenum arguments to a specific set of valid values. 498 # GLenum arguments to a specific set of valid values.
486 _ENUM_LISTS = { 499 _ENUM_LISTS = {
487 'BlitFilter': { 500 'BlitFilter': {
488 'type': 'GLenum', 501 'type': 'GLenum',
489 'valid': [ 502 'valid': [
490 'GL_NEAREST', 503 'GL_NEAREST',
491 'GL_LINEAR', 504 'GL_LINEAR',
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 }, 811 },
799 'FrameBufferParameter': { 812 'FrameBufferParameter': {
800 'type': 'GLenum', 813 'type': 'GLenum',
801 'valid': [ 814 'valid': [
802 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE', 815 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE',
803 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME', 816 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME',
804 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL', 817 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL',
805 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE', 818 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE',
806 ], 819 ],
807 }, 820 },
821 'MatrixMode': {
822 'type': 'GLenum',
823 'valid': [
824 'GL_PROJECTION',
825 'GL_MODELVIEW',
826 ],
827 },
808 'ProgramParameter': { 828 'ProgramParameter': {
809 'type': 'GLenum', 829 'type': 'GLenum',
810 'valid': [ 830 'valid': [
811 'GL_DELETE_STATUS', 831 'GL_DELETE_STATUS',
812 'GL_LINK_STATUS', 832 'GL_LINK_STATUS',
813 'GL_VALIDATE_STATUS', 833 'GL_VALIDATE_STATUS',
814 'GL_INFO_LOG_LENGTH', 834 'GL_INFO_LOG_LENGTH',
815 'GL_ATTACHED_SHADERS', 835 'GL_ATTACHED_SHADERS',
816 'GL_ACTIVE_ATTRIBUTES', 836 'GL_ACTIVE_ATTRIBUTES',
817 'GL_ACTIVE_ATTRIBUTE_MAX_LENGTH', 837 'GL_ACTIVE_ATTRIBUTE_MAX_LENGTH',
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after
2531 'extension': True, 2551 'extension': True,
2532 'chromium': True, 2552 'chromium': True,
2533 'trace_level': 1, 2553 'trace_level': 1,
2534 }, 2554 },
2535 'DiscardBackbufferCHROMIUM': { 2555 'DiscardBackbufferCHROMIUM': {
2536 'type': 'Custom', 2556 'type': 'Custom',
2537 'impl_func': True, 2557 'impl_func': True,
2538 'extension': True, 2558 'extension': True,
2539 'chromium': True, 2559 'chromium': True,
2540 }, 2560 },
2561 'MatrixMode': {
2562 'type': 'StateSet',
2563 'state': 'MatrixMode',
2564 'extension': True,
2565 },
2566 'LoadMatrixf': {
2567 'type': 'PUT',
2568 'count': 16,
2569 'data_type': 'GLfloat',
2570 'valid_args': {
2571 0: '1.1',
2572 },
2573 'extension': True,
2574 },
jbauman 2014/04/11 22:25:25 LoadIdentity (CHROMIUM) should be added here and s
Kimmo Kinnunen 2014/04/15 16:16:58 Done.
2541 } 2575 }
2542 2576
2543 2577
2544 def Grouper(n, iterable, fillvalue=None): 2578 def Grouper(n, iterable, fillvalue=None):
2545 """Collect data into fixed-length chunks or blocks""" 2579 """Collect data into fixed-length chunks or blocks"""
2546 args = [iter(iterable)] * n 2580 args = [iter(iterable)] * n
2547 return itertools.izip_longest(fillvalue=fillvalue, *args) 2581 return itertools.izip_longest(fillvalue=fillvalue, *args)
2548 2582
2549 2583
2550 def SplitWords(input_string): 2584 def SplitWords(input_string):
(...skipping 23 matching lines...) Expand all
2574 """Makes a lower-case identifier from words. 2608 """Makes a lower-case identifier from words.
2575 2609
2576 Args: 2610 Args:
2577 words: a list of lower-case words. 2611 words: a list of lower-case words.
2578 2612
2579 Returns: 2613 Returns:
2580 the lower-case identifier. 2614 the lower-case identifier.
2581 """ 2615 """
2582 return '_'.join(words) 2616 return '_'.join(words)
2583 2617
2584
2585 def ToUnderscore(input_string): 2618 def ToUnderscore(input_string):
2586 """converts CamelCase to camel_case.""" 2619 """converts CamelCase to camel_case."""
2587 words = SplitWords(input_string) 2620 words = SplitWords(input_string)
2588 return Lower(words) 2621 return Lower(words)
2589 2622
2623 def MakeListPrefixString(iterable_or_str):
2624 """Return a string which is comma-separted concatenation of the
2625 strings in the iterable_or_str. if iterable_or_str is a string,
2626 return it with a comma appended."""
2627 if isinstance(iterable_or_str, basestring):
2628 result = iterable_or_str
2629 else:
2630 result = ", ".join(iterable_or_str)
2631 if not result:
2632 return ""
2633 return result + ", "
2590 2634
2591 class CWriter(object): 2635 class CWriter(object):
2592 """Writes to a file formatting it for Google's style guidelines.""" 2636 """Writes to a file formatting it for Google's style guidelines."""
2593 2637
2594 def __init__(self, filename): 2638 def __init__(self, filename):
2595 self.filename = filename 2639 self.filename = filename
2596 self.file_num = 0 2640 self.file_num = 0
2597 self.content = [] 2641 self.content = []
2598 2642
2599 def SetFileNum(self, num): 2643 def SetFileNum(self, num):
(...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after
4706 """ 4750 """
4707 self.WriteInvalidUnitTest(func, file, invalid_test, extra) 4751 self.WriteInvalidUnitTest(func, file, invalid_test, extra)
4708 4752
4709 def WriteImmediateServiceUnitTest(self, func, file): 4753 def WriteImmediateServiceUnitTest(self, func, file):
4710 """Writes the service unit test for a command.""" 4754 """Writes the service unit test for a command."""
4711 valid_test = """ 4755 valid_test = """
4712 TEST_F(%(test_name)s, %(name)sValidArgs) { 4756 TEST_F(%(test_name)s, %(name)sValidArgs) {
4713 cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>(); 4757 cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>();
4714 SpecializedSetup<cmds::%(name)s, 0>(true); 4758 SpecializedSetup<cmds::%(name)s, 0>(true);
4715 %(data_type)s temp[%(data_count)s] = { %(data_value)s, }; 4759 %(data_type)s temp[%(data_count)s] = { %(data_value)s, };
4716 cmd.Init(%(gl_args)s, &temp[0]); 4760 cmd.Init(%(gl_args)s&temp[0]);
4717 EXPECT_CALL( 4761 EXPECT_CALL(
4718 *gl_, 4762 *gl_,
4719 %(gl_func_name)s(%(gl_args)s, %(data_ref)sreinterpret_cast< 4763 %(gl_func_name)s(%(gl_args)s%(data_ref)sreinterpret_cast<
4720 %(data_type)s*>(ImmediateDataAddress(&cmd)))); 4764 %(data_type)s*>(ImmediateDataAddress(&cmd))));
4721 EXPECT_EQ(error::kNoError, 4765 EXPECT_EQ(error::kNoError,
4722 ExecuteImmediateCmd(cmd, sizeof(temp))); 4766 ExecuteImmediateCmd(cmd, sizeof(temp)));
4723 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 4767 EXPECT_EQ(GL_NO_ERROR, GetGLError());
4724 } 4768 }
4725 """ 4769 """
4726 gl_arg_strings = [] 4770 gl_arg_strings = []
4727 gl_any_strings = [] 4771 gl_any_strings = []
4728 for count, arg in enumerate(func.GetOriginalArgs()[0:-1]): 4772 for count, arg in enumerate(func.GetOriginalArgs()[0:-1]):
4729 gl_arg_strings.append(arg.GetValidGLArg(func, count, 0)) 4773 gl_arg_strings.append(arg.GetValidGLArg(func, count, 0))
4730 gl_any_strings.append("_") 4774 gl_any_strings.append("_")
4775
4776 gl_any_strings.append("_")
4731 extra = { 4777 extra = {
4732 'data_ref': ("*" if func.GetInfo('first_element_only') else ""), 4778 'data_ref': ("*" if func.GetInfo('first_element_only') else ""),
4733 'data_type': func.GetInfo('data_type'), 4779 'data_type': func.GetInfo('data_type'),
4734 'data_count': func.GetInfo('count'), 4780 'data_count': func.GetInfo('count'),
4735 'data_value': func.GetInfo('data_value') or '0', 4781 'data_value': func.GetInfo('data_value') or '0',
4736 'gl_args': ", ".join(gl_arg_strings), 4782 'gl_args': MakeListPrefixString(gl_arg_strings),
4737 'gl_any_args': ", ".join(gl_any_strings), 4783 'gl_any_args': ", ".join(gl_any_strings),
4738 } 4784 }
4739 self.WriteValidUnitTest(func, file, valid_test, extra) 4785 self.WriteValidUnitTest(func, file, valid_test, extra)
4740 4786
4741 invalid_test = """ 4787 invalid_test = """
4742 TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { 4788 TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
4743 cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>(); 4789 cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>();
4744 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_any_args)s, _)).Times(0); 4790 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_any_args)s)).Times(0);
4745 SpecializedSetup<cmds::%(name)s, 0>(false); 4791 SpecializedSetup<cmds::%(name)s, 0>(false);
4746 %(data_type)s temp[%(data_count)s] = { %(data_value)s, }; 4792 %(data_type)s temp[%(data_count)s] = { %(data_value)s, };
4747 cmd.Init(%(all_but_last_args)s, &temp[0]); 4793 cmd.Init(%(all_but_last_args)s, &temp[0]);
4748 EXPECT_EQ(error::%(parse_result)s, 4794 EXPECT_EQ(error::%(parse_result)s,
4749 ExecuteImmediateCmd(cmd, sizeof(temp)));%(gl_error_test)s 4795 ExecuteImmediateCmd(cmd, sizeof(temp)));%(gl_error_test)s
4750 } 4796 }
4751 """ 4797 """
4752 self.WriteInvalidUnitTest(func, file, invalid_test, extra) 4798 self.WriteInvalidUnitTest(func, file, invalid_test, extra)
4753 4799
4754 def WriteGetDataSizeCode(self, func, file): 4800 def WriteGetDataSizeCode(self, func, file):
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
4797 %(type)s data[%(count)d] = {0}; 4843 %(type)s data[%(count)d] = {0};
4798 struct Cmds { 4844 struct Cmds {
4799 cmds::%(name)sImmediate cmd; 4845 cmds::%(name)sImmediate cmd;
4800 %(type)s data[%(count)d]; 4846 %(type)s data[%(count)d];
4801 }; 4847 };
4802 4848
4803 for (int jj = 0; jj < %(count)d; ++jj) { 4849 for (int jj = 0; jj < %(count)d; ++jj) {
4804 data[jj] = static_cast<%(type)s>(jj); 4850 data[jj] = static_cast<%(type)s>(jj);
4805 } 4851 }
4806 Cmds expected; 4852 Cmds expected;
4807 expected.cmd.Init(%(cmd_args)s, &data[0]); 4853 expected.cmd.Init(%(cmd_args)s&data[0]);
4808 gl_->%(name)s(%(args)s, &data[0]); 4854 gl_->%(name)s(%(args)s&data[0]);
4809 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); 4855 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
4810 } 4856 }
4811 """ 4857 """
4812 cmd_arg_strings = [] 4858 cmd_arg_strings = []
4813 for count, arg in enumerate(func.GetCmdArgs()[0:-2]): 4859 for count, arg in enumerate(func.GetCmdArgs()[0:-2]):
4814 cmd_arg_strings.append(arg.GetValidClientSideCmdArg(func, count, 0)) 4860 cmd_arg_strings.append(arg.GetValidClientSideCmdArg(func, count, 0))
4815 gl_arg_strings = [] 4861 gl_arg_strings = []
4816 for count, arg in enumerate(func.GetOriginalArgs()[0:-1]): 4862 for count, arg in enumerate(func.GetOriginalArgs()[0:-1]):
4817 gl_arg_strings.append(arg.GetValidClientSideArg(func, count, 0)) 4863 gl_arg_strings.append(arg.GetValidClientSideArg(func, count, 0))
4818 file.Write(code % { 4864 file.Write(code % {
4819 'name': func.name, 4865 'name': func.name,
4820 'type': func.GetInfo('data_type'), 4866 'type': func.GetInfo('data_type'),
4821 'count': func.GetInfo('count'), 4867 'count': func.GetInfo('count'),
4822 'args': ", ".join(gl_arg_strings), 4868 'args': MakeListPrefixString(gl_arg_strings),
4823 'cmd_args': ", ".join(cmd_arg_strings), 4869 'cmd_args': MakeListPrefixString(cmd_arg_strings),
4824 }) 4870 })
4825 4871
4826 def WriteImmediateCmdComputeSize(self, func, file): 4872 def WriteImmediateCmdComputeSize(self, func, file):
4827 """Overrriden from TypeHandler.""" 4873 """Overrriden from TypeHandler."""
4828 file.Write(" static uint32 ComputeDataSize() {\n") 4874 file.Write(" static uint32 ComputeDataSize() {\n")
4829 file.Write(" return static_cast<uint32>(\n") 4875 file.Write(" return static_cast<uint32>(\n")
4830 file.Write(" sizeof(%s) * %d); // NOLINT\n" % 4876 file.Write(" sizeof(%s) * %d); // NOLINT\n" %
4831 (func.info.data_type, func.info.count)) 4877 (func.info.data_type, func.info.count))
4832 file.Write(" }\n") 4878 file.Write(" }\n")
4833 file.Write("\n") 4879 file.Write("\n")
4834 file.Write(" static uint32 ComputeSize() {\n") 4880 file.Write(" static uint32 ComputeSize() {\n")
4835 file.Write(" return static_cast<uint32>(\n") 4881 file.Write(" return static_cast<uint32>(\n")
4836 file.Write( 4882 file.Write(
4837 " sizeof(ValueType) + ComputeDataSize()); // NOLINT\n") 4883 " sizeof(ValueType) + ComputeDataSize()); // NOLINT\n")
4838 file.Write(" }\n") 4884 file.Write(" }\n")
4839 file.Write("\n") 4885 file.Write("\n")
4840 4886
4841 def WriteImmediateCmdSetHeader(self, func, file): 4887 def WriteImmediateCmdSetHeader(self, func, file):
4842 """Overrriden from TypeHandler.""" 4888 """Overrriden from TypeHandler."""
4843 file.Write(" void SetHeader() {\n") 4889 file.Write(" void SetHeader() {\n")
4844 file.Write( 4890 file.Write(
4845 " header.SetCmdByTotalSize<ValueType>(ComputeSize());\n") 4891 " header.SetCmdByTotalSize<ValueType>(ComputeSize());\n")
4846 file.Write(" }\n") 4892 file.Write(" }\n")
4847 file.Write("\n") 4893 file.Write("\n")
4848 4894
4849 def WriteImmediateCmdInit(self, func, file): 4895 def WriteImmediateCmdInit(self, func, file):
4850 """Overrriden from TypeHandler.""" 4896 """Overrriden from TypeHandler."""
4897 gl_args = func.MakeTypedCmdArgString("_")
4851 last_arg = func.GetLastOriginalArg() 4898 last_arg = func.GetLastOriginalArg()
4852 file.Write(" void Init(%s, %s _%s) {\n" % 4899 file.Write(" void Init(%s%s _%s) {\n" %
4853 (func.MakeTypedCmdArgString("_"), 4900 (MakeListPrefixString(gl_args), last_arg.type, last_arg.name))
4854 last_arg.type, last_arg.name))
4855 file.Write(" SetHeader();\n") 4901 file.Write(" SetHeader();\n")
4856 args = func.GetCmdArgs() 4902 args = func.GetCmdArgs()
4857 for arg in args: 4903 for arg in args:
4858 file.Write(" %s = _%s;\n" % (arg.name, arg.name)) 4904 file.Write(" %s = _%s;\n" % (arg.name, arg.name))
4859 file.Write(" memcpy(ImmediateDataAddress(this),\n") 4905 file.Write(" memcpy(ImmediateDataAddress(this),\n")
4860 file.Write(" _%s, ComputeDataSize());\n" % last_arg.name) 4906 file.Write(" _%s, ComputeDataSize());\n" % last_arg.name)
4861 file.Write(" }\n") 4907 file.Write(" }\n")
4862 file.Write("\n") 4908 file.Write("\n")
4863 4909
4864 def WriteImmediateCmdSet(self, func, file): 4910 def WriteImmediateCmdSet(self, func, file):
4865 """Overrriden from TypeHandler.""" 4911 """Overrriden from TypeHandler."""
4866 last_arg = func.GetLastOriginalArg() 4912 last_arg = func.GetLastOriginalArg()
4867 copy_args = func.MakeCmdArgString("_", False) 4913 copy_args = func.MakeCmdArgString("_", False)
4868 file.Write(" void* Set(void* cmd%s, %s _%s) {\n" % 4914 file.Write(" void* Set(void* cmd%s, %s _%s) {\n" %
4869 (func.MakeTypedCmdArgString("_", True), 4915 (func.MakeTypedCmdArgString("_", True),
4870 last_arg.type, last_arg.name)) 4916 last_arg.type, last_arg.name))
4871 file.Write(" static_cast<ValueType*>(cmd)->Init(%s, _%s);\n" % 4917 file.Write(" static_cast<ValueType*>(cmd)->Init(%s_%s);\n" %
4872 (copy_args, last_arg.name)) 4918 (MakeListPrefixString(copy_args), last_arg.name))
4873 file.Write(" const uint32 size = ComputeSize();\n") 4919 file.Write(" const uint32 size = ComputeSize();\n")
4874 file.Write(" return NextImmediateCmdAddressTotalSize<ValueType>(" 4920 file.Write(" return NextImmediateCmdAddressTotalSize<ValueType>("
4875 "cmd, size);\n") 4921 "cmd, size);\n")
4876 file.Write(" }\n") 4922 file.Write(" }\n")
4877 file.Write("\n") 4923 file.Write("\n")
4878 4924
4879 def WriteImmediateCmdHelper(self, func, file): 4925 def WriteImmediateCmdHelper(self, func, file):
4880 """Overrriden from TypeHandler.""" 4926 """Overrriden from TypeHandler."""
4881 code = """ void %(name)s(%(typed_args)s) { 4927 code = """ void %(name)s(%(typed_args)s) {
4882 const uint32 size = gles2::cmds::%(name)s::ComputeSize(); 4928 const uint32 size = gles2::cmds::%(name)s::ComputeSize();
(...skipping 2302 matching lines...) Expand 10 before | Expand all | Expand 10 after
7185 for item in state['states']: 7231 for item in state['states']:
7186 if 'extension_flag' in item: 7232 if 'extension_flag' in item:
7187 file.Write(" if (feature_info_->feature_flags().%s)\n " % 7233 file.Write(" if (feature_info_->feature_flags().%s)\n " %
7188 item['extension_flag']) 7234 item['extension_flag'])
7189 file.Write(" gl%s(%s, %s);\n" % 7235 file.Write(" gl%s(%s, %s);\n" %
7190 (state['func'], item['enum'], item['name'])) 7236 (state['func'], item['enum'], item['name']))
7191 else: 7237 else:
7192 args = [] 7238 args = []
7193 for item in state['states']: 7239 for item in state['states']:
7194 args.append('%s' % item['name']) 7240 args.append('%s' % item['name'])
7241 if 'extension_flag' in state:
7242 file.Write(" if (feature_info_->feature_flags().%s)\n " %
7243 state['extension_flag'])
7195 file.Write(" gl%s(%s);\n" % (state['func'], ", ".join(args))) 7244 file.Write(" gl%s(%s);\n" % (state['func'], ", ".join(args)))
7196 file.Write("}\n") 7245 file.Write("}\n")
7197 7246
7198 file.Write("""bool ContextState::GetEnabled(GLenum cap) const { 7247 file.Write("""bool ContextState::GetEnabled(GLenum cap) const {
7199 switch (cap) { 7248 switch (cap) {
7200 """) 7249 """)
7201 for capability in _CAPABILITY_FLAGS: 7250 for capability in _CAPABILITY_FLAGS:
7202 file.Write(" case GL_%s:\n" % capability['name'].upper()) 7251 file.Write(" case GL_%s:\n" % capability['name'].upper())
7203 file.Write(" return enable_flags.%s;\n" % capability['name']) 7252 file.Write(" return enable_flags.%s;\n" % capability['name'])
7204 file.Write(""" default: 7253 file.Write(""" default:
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
7358 elif state['type'] == 'NamedParameter': 7407 elif state['type'] == 'NamedParameter':
7359 for item in state['states']: 7408 for item in state['states']:
7360 if 'extension_flag' in item: 7409 if 'extension_flag' in item:
7361 continue 7410 continue
7362 file.Write( 7411 file.Write(
7363 " EXPECT_CALL(*gl_, %s(%s, %s))\n" % 7412 " EXPECT_CALL(*gl_, %s(%s, %s))\n" %
7364 (state['func'], item['enum'], item['default'])) 7413 (state['func'], item['enum'], item['default']))
7365 file.Write(" .Times(1)\n") 7414 file.Write(" .Times(1)\n")
7366 file.Write(" .RetiresOnSaturation();\n") 7415 file.Write(" .RetiresOnSaturation();\n")
7367 else: 7416 else:
7417 if 'extension_flag' in state:
7418 continue
7368 args = [] 7419 args = []
7369 for item in state['states']: 7420 for item in state['states']:
7370 if 'expected' in item: 7421 if 'expected' in item:
7371 args.append(item['expected']) 7422 args.append(item['expected'])
7372 else: 7423 else:
7373 args.append(item['default']) 7424 args.append(item['default'])
7374 file.Write(" EXPECT_CALL(*gl_, %s(%s))\n" % 7425 file.Write(" EXPECT_CALL(*gl_, %s(%s))\n" %
7375 (state['func'], ", ".join(args))) 7426 (state['func'], ", ".join(args)))
7376 file.Write(" .Times(1)\n") 7427 file.Write(" .Times(1)\n")
7377 file.Write(" .RetiresOnSaturation();\n") 7428 file.Write(" .RetiresOnSaturation();\n")
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
7803 "empty. Use this if you want the result stored under gen.") 7854 "empty. Use this if you want the result stored under gen.")
7804 parser.add_option( 7855 parser.add_option(
7805 "-v", "--verbose", action="store_true", 7856 "-v", "--verbose", action="store_true",
7806 help="prints more output.") 7857 help="prints more output.")
7807 7858
7808 (options, args) = parser.parse_args(args=argv) 7859 (options, args) = parser.parse_args(args=argv)
7809 7860
7810 # Add in states and capabilites to GLState 7861 # Add in states and capabilites to GLState
7811 for state_name in sorted(_STATES.keys()): 7862 for state_name in sorted(_STATES.keys()):
7812 state = _STATES[state_name] 7863 state = _STATES[state_name]
7864 if 'extension_flag' in state:
7865 continue
7813 if 'enum' in state: 7866 if 'enum' in state:
7814 _ENUM_LISTS['GLState']['valid'].append(state['enum']) 7867 _ENUM_LISTS['GLState']['valid'].append(state['enum'])
7815 else: 7868 else:
7816 for item in state['states']: 7869 for item in state['states']:
7817 if 'extension_flag' in item: 7870 if 'extension_flag' in item:
7818 continue 7871 continue
7819 _ENUM_LISTS['GLState']['valid'].append(item['enum']) 7872 _ENUM_LISTS['GLState']['valid'].append(item['enum'])
7820 for capability in _CAPABILITY_FLAGS: 7873 for capability in _CAPABILITY_FLAGS:
7821 _ENUM_LISTS['GLState']['valid'].append("GL_%s" % capability['name'].upper()) 7874 _ENUM_LISTS['GLState']['valid'].append("GL_%s" % capability['name'].upper())
7822 7875
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
7906 "ppapi/shared_impl/ppb_opengles2_shared.cc"]) 7959 "ppapi/shared_impl/ppb_opengles2_shared.cc"])
7907 7960
7908 if gen.errors > 0: 7961 if gen.errors > 0:
7909 print "%d errors" % gen.errors 7962 print "%d errors" % gen.errors
7910 return 1 7963 return 1
7911 return 0 7964 return 0
7912 7965
7913 7966
7914 if __name__ == '__main__': 7967 if __name__ == '__main__':
7915 sys.exit(main(sys.argv[1:])) 7968 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698