layers: simplify initLayerTable()

Generate xgl_dispatch_table_helper.h with

 $ ./xgl-generate.py dispatch-table-ops layer

and make use of layer_initialize_dispatch_table() in initLayerTable().

There should be no functional difference with this change.
This commit is contained in:
Chia-I Wu 2015-01-04 23:11:43 +08:00 committed by Courtney Goeltzenleuchter
parent dc157d4c72
commit 8069bb503c
2 changed files with 3 additions and 5 deletions

1
.gitignore vendored
View File

@ -14,6 +14,7 @@ tests/xgl_image_tests
tests/xgl_render_tests tests/xgl_render_tests
tests/xglbase tests/xglbase
tests/xglinfo tests/xglinfo
layers/xgl_dispatch_table_helper.h
layers/xgl_enum_string_helper.h layers/xgl_enum_string_helper.h
layers/xgl_struct_string_helper.h layers/xgl_struct_string_helper.h
layers/xgl_struct_wrappers.cpp layers/xgl_struct_wrappers.cpp

View File

@ -585,17 +585,14 @@ class Subcommand(object):
return "\n".join(func_body) return "\n".join(func_body)
def _generate_layer_dispatch_table(self, prefix='xgl'): def _generate_layer_dispatch_table(self, prefix='xgl'):
func_body = [] func_body = ["#include \"xgl_dispatch_table_helper.h\""]
func_body.append('static void initLayerTable()\n' func_body.append('static void initLayerTable()\n'
'{\n' '{\n'
' GetProcAddrType fpNextGPA;\n' ' GetProcAddrType fpNextGPA;\n'
' fpNextGPA = pCurObj->pGPA;\n' ' fpNextGPA = pCurObj->pGPA;\n'
' assert(fpNextGPA);\n'); ' assert(fpNextGPA);\n');
for name in xgl.proto_names: func_body.append(" layer_initialize_dispatch_table(&nextTable, fpNextGPA, (XGL_PHYSICAL_GPU) pCurObj->nextObject);")
func_body.append(' %sType fp%s = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "%s%s");\n'
' nextTable.%s = fp%s;' % (name, name, prefix, name, name, name))
func_body.append("}\n") func_body.append("}\n")
return "\n".join(func_body) return "\n".join(func_body)