mirror of
https://gitee.com/openharmony/third_party_vulkan-loader
synced 2024-11-27 01:11:22 +00:00
layers: use generated layer_intercept_proc()
Call layer_intercept_proc() from xglGetProcAddr() in DrawState, MemTracker, and generated layers. There should be no functional difference with this change.
This commit is contained in:
parent
84a850aae0
commit
83a6b79fde
1
.gitignore
vendored
1
.gitignore
vendored
@ -16,6 +16,7 @@ tests/xglbase
|
||||
tests/xglinfo
|
||||
layers/xgl_dispatch_table_helper.h
|
||||
layers/xgl_enum_string_helper.h
|
||||
layers/xgl_generic_intercept_proc_helper.h
|
||||
layers/xgl_struct_string_helper.h
|
||||
layers/xgl_struct_wrappers.cpp
|
||||
layers/xgl_struct_wrappers.h
|
||||
|
@ -550,33 +550,25 @@ class Subcommand(object):
|
||||
|
||||
return "\n".join(exts)
|
||||
|
||||
def _generate_layer_gpa_function(self, prefix="xgl", extensions=[]):
|
||||
func_body = []
|
||||
def _generate_layer_gpa_function(self, extensions=[]):
|
||||
func_body = ["#include \"xgl_generic_intercept_proc_helper.h\""]
|
||||
func_body.append("XGL_LAYER_EXPORT XGL_VOID* XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* funcName)\n"
|
||||
"{\n"
|
||||
" XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;\n"
|
||||
" void* addr;\n"
|
||||
" if (gpu == NULL)\n"
|
||||
" return NULL;\n"
|
||||
" pCurObj = gpuw;\n"
|
||||
" pthread_once(&tabOnce, initLayerTable);\n\n"
|
||||
' if (!strncmp("xglGetProcAddr", funcName, sizeof("xglGetProcAddr")))\n'
|
||||
' return xglGetProcAddr;')
|
||||
" addr = layer_intercept_proc(funcName);\n"
|
||||
" if (addr)\n"
|
||||
" return addr;")
|
||||
|
||||
if 0 != len(extensions):
|
||||
for ext_name in extensions:
|
||||
func_body.append(' else if (!strncmp("%s", funcName, sizeof("%s")))\n'
|
||||
' return %s;' % (ext_name, ext_name, ext_name))
|
||||
for name in xgl.proto_names:
|
||||
if name == "GetProcAddr":
|
||||
continue
|
||||
if name == "InitAndEnumerateGpus":
|
||||
func_body.append(' else if (!strncmp("%s%s", funcName, sizeof("%s%s")))\n'
|
||||
' return nextTable.%s;' % (prefix, name, prefix, name, name))
|
||||
else:
|
||||
func_body.append(' else if (!strncmp("%s%s", funcName, sizeof("%s%s")))\n'
|
||||
' return %s%s;' % (prefix, name, prefix, name, prefix, name))
|
||||
|
||||
func_body.append(" else {\n"
|
||||
" XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;\n"
|
||||
" if (gpuw->pGPA == NULL)\n"
|
||||
" return NULL;\n"
|
||||
" return gpuw->pGPA(gpuw->nextObject, funcName);\n"
|
||||
|
Loading…
Reference in New Issue
Block a user