Commit f2a78926 by Jamie Madill Committed by Commit Bot

Symbol Table: Error on duplicate group keys.

This prevents newer group keys from overwriting old ones. Prevents bugs from creeping in like happened during texture buffer development. Bug: angleproject:3573 Change-Id: Iea69cac988e2cf4802a9f64c54cb694d32f1d3e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2521238Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent b59437cb
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
"src/compiler/translator/builtin_variables.json": "src/compiler/translator/builtin_variables.json":
"98d347a6ed181eca3d89bfd73193d787", "98d347a6ed181eca3d89bfd73193d787",
"src/compiler/translator/gen_builtin_symbols.py": "src/compiler/translator/gen_builtin_symbols.py":
"a538e53475983ae9643afd5b36056347", "03bdb7260ac347f4be968229a6a97aab",
"src/compiler/translator/tree_util/BuiltIn_ESSL_autogen.h": "src/compiler/translator/tree_util/BuiltIn_ESSL_autogen.h":
"359670b3327789b173bb961e3c66a19f", "359670b3327789b173bb961e3c66a19f",
"src/compiler/translator/tree_util/BuiltIn_complete_autogen.h": "src/compiler/translator/tree_util/BuiltIn_complete_autogen.h":
......
...@@ -1036,7 +1036,6 @@ def get_parsed_functions(functions_txt_filename, essl_only): ...@@ -1036,7 +1036,6 @@ def get_parsed_functions(functions_txt_filename, essl_only):
default_metadata = {} default_metadata = {}
for line in lines: for line in lines:
fun_match = fun_re.match(line)
if line.startswith('GROUP BEGIN '): if line.startswith('GROUP BEGIN '):
group_rest = line[12:].strip() group_rest = line[12:].strip()
group_parts = group_rest.split(' ', 1) group_parts = group_rest.split(' ', 1)
...@@ -1054,6 +1053,8 @@ def get_parsed_functions(functions_txt_filename, essl_only): ...@@ -1054,6 +1053,8 @@ def get_parsed_functions(functions_txt_filename, essl_only):
group_stack.pop() group_stack.pop()
is_top_level_group = (len(group_stack) == 0) is_top_level_group = (len(group_stack) == 0)
if is_top_level_group: if is_top_level_group:
if current_group['name'] in parsed_functions:
raise Exception('GROUP END: Duplicate group name "%s"' % current_group['name'])
parsed_functions[current_group['name']] = current_group parsed_functions[current_group['name']] = current_group
default_metadata = {} default_metadata = {}
else: else:
...@@ -1062,24 +1063,26 @@ def get_parsed_functions(functions_txt_filename, essl_only): ...@@ -1062,24 +1063,26 @@ def get_parsed_functions(functions_txt_filename, essl_only):
elif line.startswith('DEFAULT METADATA'): elif line.startswith('DEFAULT METADATA'):
line_rest = line[16:].strip() line_rest = line[16:].strip()
default_metadata = json.loads(line_rest) default_metadata = json.loads(line_rest)
elif fun_match: else:
return_type = fun_match.group(1) fun_match = fun_re.match(line)
name = fun_match.group(2) if fun_match:
parameters = fun_match.group(3) return_type = fun_match.group(1)
function_props = { name = fun_match.group(2)
'name': name, parameters = fun_match.group(3)
'returnType': TType(return_type), function_props = {
'parameters': parse_function_parameters(parameters) 'name': name,
} 'returnType': TType(return_type),
function_props.update(default_metadata) 'parameters': parse_function_parameters(parameters)
if essl_only: }
# Skip GLSL-only functions function_props.update(default_metadata)
if 'essl_level' in function_props: if essl_only:
# Skip GLSL-only functions
if 'essl_level' in function_props:
group_stack[-1]['functions'].append(function_props)
else:
group_stack[-1]['functions'].append(function_props) group_stack[-1]['functions'].append(function_props)
else: else:
group_stack[-1]['functions'].append(function_props) raise Exception('Unexpected function input line: ' + line)
else:
raise Exception('Unexpected function input line: ' + line)
return parsed_functions return parsed_functions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment