layers: indirect GPA in dispatch table
authorMike Stroyan <mike@LunarG.com>
Wed, 8 Apr 2015 16:31:48 +0000 (10:31 -0600)
committerChia-I Wu <olv@lunarg.com>
Thu, 16 Apr 2015 09:48:21 +0000 (17:48 +0800)
layer_initialize_dispatch_table was using gpa pointer without lookup.
That could put the loader GPA function in for the lowest dispatch table
instead of the icd GPA function.
Use the same return from GPA call for GPA itself.
There was code fixing up GPA dispatch in draw_state.cpp and mem_tracker.cpp.
Remove that now that layer_initialize_dispatch_table does the right thing.

layers/draw_state.cpp
layers/mem_tracker.cpp
vk-generate.py

index 18e2738..1fe60c3 100644 (file)
@@ -1426,9 +1426,6 @@ static void initDrawState(void)
 
     layer_initialize_dispatch_table(&nextTable, fpNextGPA, (VkPhysicalGpu) pCurObj->nextObject);
 
-    PFN_vkGetProcAddr fpGetProcAddr = (PFN_vkGetProcAddr)fpNextGPA((VkPhysicalGpu) pCurObj->nextObject, (char *) "vkGetProcAddr");
-    nextTable.GetProcAddr = fpGetProcAddr;
-
     if (!globalLockInitialized)
     {
         // TODO/TBD: Need to delete this mutex sometime.  How???  One
index 967272a..b6a46b3 100644 (file)
@@ -817,9 +817,6 @@ static void initMemTracker(void)
 
     layer_initialize_dispatch_table(&nextTable, fpNextGPA, (VkPhysicalGpu) pCurObj->nextObject);
 
-    PFN_vkGetProcAddr fpGetProcAddr = (PFN_vkGetProcAddr)fpNextGPA((VkPhysicalGpu) pCurObj->nextObject, (char *) "vkGetProcAddr");
-    nextTable.GetProcAddr = fpGetProcAddr;
-
     if (!globalLockInitialized)
     {
         // TODO/TBD: Need to delete this mutex sometime.  How???  One
index 92bac91..120d7b4 100755 (executable)
@@ -220,10 +220,7 @@ class DispatchTableOpsSubcommand(Subcommand):
         for proto in self.protos:
             if 'WsiX11AssociateConnection' == proto.name:
                 stmts.append("#if defined(__linux__) || defined(XCB_NVIDIA)")
-            if proto.name == "GetProcAddr":
-                stmts.append("table->%s = gpa; /* direct assignment */" %
-                        proto.name)
-            elif self.is_dispatchable_object_first_param(proto) or proto.name == "CreateInstance":
+            if self.is_dispatchable_object_first_param(proto) or proto.name == "CreateInstance":
                 stmts.append("table->%s = (PFN_vk%s) gpa(gpu, \"vk%s\");" %
                         (proto.name, proto.name, proto.name))
             else: