Index: gpu/command_buffer/build_gles2_cmd_buffer.py |
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py |
index 1754704ebb9588cea1bb681328766847e3a3e868..d9544926e902cd03e8cadb5abdad18e74d0264ee 100755 |
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py |
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py |
@@ -479,6 +479,19 @@ _STATES = { |
}, |
], |
}, |
+ 'MatrixMode': { |
+ 'type': 'Normal', |
+ 'func': 'MatrixMode', |
+ 'enum': 'GL_MATRIX_MODE', |
+ 'extension_flag': 'nv_path_rendering', |
+ 'states': [ |
+ { |
+ 'name': 'matrix_mode', |
+ 'type': 'GLenum', |
+ 'default': 'GL_MODELVIEW', |
+ } |
+ ], |
+ }, |
} |
# This is a list of enum names and their valid values. It is used to map |
@@ -805,6 +818,13 @@ _ENUM_LISTS = { |
'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE', |
], |
}, |
+ 'MatrixMode': { |
+ 'type': 'GLenum', |
+ 'valid': [ |
+ 'GL_PROJECTION', |
+ 'GL_MODELVIEW', |
+ ], |
+ }, |
'ProgramParameter': { |
'type': 'GLenum', |
'valid': [ |
@@ -2538,6 +2558,20 @@ _FUNCTION_INFO = { |
'extension': True, |
'chromium': True, |
}, |
+ 'MatrixMode': { |
+ 'type': 'StateSet', |
+ 'state': 'MatrixMode', |
+ 'extension': True, |
+ }, |
+ 'LoadMatrixf': { |
+ 'type': 'PUT', |
+ 'count': 16, |
+ 'data_type': 'GLfloat', |
+ 'valid_args': { |
+ 0: '1.1', |
+ }, |
+ 'extension': True, |
+ }, |
jbauman
2014/04/11 22:25:25
LoadIdentity (CHROMIUM) should be added here and s
Kimmo Kinnunen
2014/04/15 16:16:58
Done.
|
} |
@@ -2581,12 +2615,22 @@ def Lower(words): |
""" |
return '_'.join(words) |
- |
def ToUnderscore(input_string): |
"""converts CamelCase to camel_case.""" |
words = SplitWords(input_string) |
return Lower(words) |
+def MakeListPrefixString(iterable_or_str): |
+ """Return a string which is comma-separted concatenation of the |
+ strings in the iterable_or_str. if iterable_or_str is a string, |
+ return it with a comma appended.""" |
+ if isinstance(iterable_or_str, basestring): |
+ result = iterable_or_str |
+ else: |
+ result = ", ".join(iterable_or_str) |
+ if not result: |
+ return "" |
+ return result + ", " |
class CWriter(object): |
"""Writes to a file formatting it for Google's style guidelines.""" |
@@ -4713,10 +4757,10 @@ TEST_F(%(test_name)s, %(name)sValidArgs) { |
cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>(); |
SpecializedSetup<cmds::%(name)s, 0>(true); |
%(data_type)s temp[%(data_count)s] = { %(data_value)s, }; |
- cmd.Init(%(gl_args)s, &temp[0]); |
+ cmd.Init(%(gl_args)s&temp[0]); |
EXPECT_CALL( |
*gl_, |
- %(gl_func_name)s(%(gl_args)s, %(data_ref)sreinterpret_cast< |
+ %(gl_func_name)s(%(gl_args)s%(data_ref)sreinterpret_cast< |
%(data_type)s*>(ImmediateDataAddress(&cmd)))); |
EXPECT_EQ(error::kNoError, |
ExecuteImmediateCmd(cmd, sizeof(temp))); |
@@ -4728,12 +4772,14 @@ TEST_F(%(test_name)s, %(name)sValidArgs) { |
for count, arg in enumerate(func.GetOriginalArgs()[0:-1]): |
gl_arg_strings.append(arg.GetValidGLArg(func, count, 0)) |
gl_any_strings.append("_") |
+ |
+ gl_any_strings.append("_") |
extra = { |
'data_ref': ("*" if func.GetInfo('first_element_only') else ""), |
'data_type': func.GetInfo('data_type'), |
'data_count': func.GetInfo('count'), |
'data_value': func.GetInfo('data_value') or '0', |
- 'gl_args': ", ".join(gl_arg_strings), |
+ 'gl_args': MakeListPrefixString(gl_arg_strings), |
'gl_any_args': ", ".join(gl_any_strings), |
} |
self.WriteValidUnitTest(func, file, valid_test, extra) |
@@ -4741,7 +4787,7 @@ TEST_F(%(test_name)s, %(name)sValidArgs) { |
invalid_test = """ |
TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { |
cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>(); |
- EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_any_args)s, _)).Times(0); |
+ EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_any_args)s)).Times(0); |
SpecializedSetup<cmds::%(name)s, 0>(false); |
%(data_type)s temp[%(data_count)s] = { %(data_value)s, }; |
cmd.Init(%(all_but_last_args)s, &temp[0]); |
@@ -4804,8 +4850,8 @@ TEST_F(GLES2ImplementationTest, %(name)s) { |
data[jj] = static_cast<%(type)s>(jj); |
} |
Cmds expected; |
- expected.cmd.Init(%(cmd_args)s, &data[0]); |
- gl_->%(name)s(%(args)s, &data[0]); |
+ expected.cmd.Init(%(cmd_args)s&data[0]); |
+ gl_->%(name)s(%(args)s&data[0]); |
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
} |
""" |
@@ -4819,8 +4865,8 @@ TEST_F(GLES2ImplementationTest, %(name)s) { |
'name': func.name, |
'type': func.GetInfo('data_type'), |
'count': func.GetInfo('count'), |
- 'args': ", ".join(gl_arg_strings), |
- 'cmd_args': ", ".join(cmd_arg_strings), |
+ 'args': MakeListPrefixString(gl_arg_strings), |
+ 'cmd_args': MakeListPrefixString(cmd_arg_strings), |
}) |
def WriteImmediateCmdComputeSize(self, func, file): |
@@ -4848,10 +4894,10 @@ TEST_F(GLES2ImplementationTest, %(name)s) { |
def WriteImmediateCmdInit(self, func, file): |
"""Overrriden from TypeHandler.""" |
+ gl_args = func.MakeTypedCmdArgString("_") |
last_arg = func.GetLastOriginalArg() |
- file.Write(" void Init(%s, %s _%s) {\n" % |
- (func.MakeTypedCmdArgString("_"), |
- last_arg.type, last_arg.name)) |
+ file.Write(" void Init(%s%s _%s) {\n" % |
+ (MakeListPrefixString(gl_args), last_arg.type, last_arg.name)) |
file.Write(" SetHeader();\n") |
args = func.GetCmdArgs() |
for arg in args: |
@@ -4868,8 +4914,8 @@ TEST_F(GLES2ImplementationTest, %(name)s) { |
file.Write(" void* Set(void* cmd%s, %s _%s) {\n" % |
(func.MakeTypedCmdArgString("_", True), |
last_arg.type, last_arg.name)) |
- file.Write(" static_cast<ValueType*>(cmd)->Init(%s, _%s);\n" % |
- (copy_args, last_arg.name)) |
+ file.Write(" static_cast<ValueType*>(cmd)->Init(%s_%s);\n" % |
+ (MakeListPrefixString(copy_args), last_arg.name)) |
file.Write(" const uint32 size = ComputeSize();\n") |
file.Write(" return NextImmediateCmdAddressTotalSize<ValueType>(" |
"cmd, size);\n") |
@@ -7192,6 +7238,9 @@ void ContextState::InitState() const { |
args = [] |
for item in state['states']: |
args.append('%s' % item['name']) |
+ if 'extension_flag' in state: |
+ file.Write(" if (feature_info_->feature_flags().%s)\n " % |
+ state['extension_flag']) |
file.Write(" gl%s(%s);\n" % (state['func'], ", ".join(args))) |
file.Write("}\n") |
@@ -7365,6 +7414,8 @@ void GLES2DecoderTestBase::SetupInitStateExpectations() { |
file.Write(" .Times(1)\n") |
file.Write(" .RetiresOnSaturation();\n") |
else: |
+ if 'extension_flag' in state: |
+ continue |
args = [] |
for item in state['states']: |
if 'expected' in item: |
@@ -7810,6 +7861,8 @@ def main(argv): |
# Add in states and capabilites to GLState |
for state_name in sorted(_STATES.keys()): |
state = _STATES[state_name] |
+ if 'extension_flag' in state: |
+ continue |
if 'enum' in state: |
_ENUM_LISTS['GLState']['valid'].append(state['enum']) |
else: |