layers: Update GetExtensionSupport() to handle queries for layer name

Layers now support loader querying their layer name via GetExtensionSupport
in addition to EnumerateLayers.
Also fixed bugs in ObjectTracker and DrawState to add the extensions they
support in the GetExtensionSupport queries.

Conflicts:
	xgl-layer-generate.py
diff --git a/layers/basic.cpp b/layers/basic.cpp
index 2f3deac..627dc87 100644
--- a/layers/basic.cpp
+++ b/layers/basic.cpp
@@ -63,23 +63,33 @@
 
 XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetExtensionSupport(XGL_PHYSICAL_GPU gpu, const char* pExtName)
 {
-    XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
     XGL_RESULT result;
-    XGL_LAYER_DISPATCH_TABLE* pTable = initLayerTable(gpuw);
+    XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
 
-    printf("At start of wrapped xglGetExtensionSupport() call w/ gpu: %p\n", (void*)gpu);
+    /* This entrypoint is NOT going to init it's own dispatch table since loader calls here early */
     if (!strncmp(pExtName, "xglLayerExtension1", strlen("xglLayerExtension1")))
+    {
         result = XGL_SUCCESS;
-    else
+    } else if (!strncmp(pExtName, "Basic", strlen("Basic")))
+    {
+        result = XGL_SUCCESS;
+    } else if (!tableMap.empty() && (tableMap.find(gpuw) != tableMap.end()))
+    {
+        printf("At start of wrapped xglGetExtensionSupport() call w/ gpu: %p\n", (void*)gpu);
+        XGL_LAYER_DISPATCH_TABLE* pTable = tableMap[gpuw];
         result = pTable->GetExtensionSupport((XGL_PHYSICAL_GPU)gpuw->nextObject, pExtName);
-    printf("Completed wrapped xglGetExtensionSupport() call w/ gpu: %p\n", (void*)gpu);
+        printf("Completed wrapped xglGetExtensionSupport() call w/ gpu: %p\n", (void*)gpu);
+    } else
+    {
+        result = XGL_ERROR_INVALID_EXTENSION;
+    }
     return result;
 }
 
 XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDevice(XGL_PHYSICAL_GPU gpu, const XGL_DEVICE_CREATE_INFO* pCreateInfo, XGL_DEVICE* pDevice)
 {
     XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
-    XGL_LAYER_DISPATCH_TABLE* pTable = initLayerTable(gpuw);
+    XGL_LAYER_DISPATCH_TABLE* pTable = tableMap[gpuw];
 
     printf("At start of wrapped xglCreateDevice() call w/ gpu: %p\n", (void*)gpu);
     XGL_RESULT result = pTable->CreateDevice((XGL_PHYSICAL_GPU)gpuw->nextObject, pCreateInfo, pDevice);
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index c239119..503c08a 100644
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -1514,6 +1514,25 @@
     return result;
 }
 
+XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetExtensionSupport(XGL_PHYSICAL_GPU gpu, const char* pExtName)
+{
+    XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
+    XGL_RESULT result;
+    /* This entrypoint is NOT going to init its own dispatch table since loader calls here early */
+    if (!strcmp(pExtName, "DrawState") || !strcmp(pExtName, "drawStateDumpDotFile") ||
+        !strcmp(pExtName, "drawStateDumpCommandBufferDotFile") || !strcmp(pExtName, "drawStateDumpPngFile"))
+    {
+        result = XGL_SUCCESS;
+    } else if (nextTable.GetExtensionSupport != NULL)
+    {
+        result = nextTable.GetExtensionSupport((XGL_PHYSICAL_GPU)gpuw->nextObject, pExtName);
+    } else
+    {
+        result = XGL_ERROR_INVALID_EXTENSION;
+    }
+    return result;
+}
+
 XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglEnumerateLayers(XGL_PHYSICAL_GPU gpu, size_t maxLayerCount, size_t maxStringSize, size_t* pOutLayerCount, char* const* pOutLayers, void* pReserved)
 {
     if (gpu != NULL)
@@ -2741,6 +2760,8 @@
         return (void*) xglCreateDevice;
     if (!strcmp(funcName, "xglDestroyDevice"))
         return (void*) xglDestroyDevice;
+    if (!strcmp(funcName, "xglGetExtensionSupport"))
+        return (void*) xglGetExtensionSupport;
     if (!strcmp(funcName, "xglEnumerateLayers"))
         return (void*) xglEnumerateLayers;
     if (!strcmp(funcName, "xglQueueSubmit"))
diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp
index a6bc088..5b47bfc 100644
--- a/layers/mem_tracker.cpp
+++ b/layers/mem_tracker.cpp
@@ -865,6 +865,24 @@
     return result;
 }
 
+XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetExtensionSupport(XGL_PHYSICAL_GPU gpu, const char* pExtName)
+{
+    XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
+    XGL_RESULT result;
+    /* This entrypoint is NOT going to init its own dispatch table since loader calls here early */
+    if (!strcmp(pExtName, "MemTracker"))
+    {
+        result = XGL_SUCCESS;
+    } else if (nextTable.GetExtensionSupport != NULL)
+    {
+        result = nextTable.GetExtensionSupport((XGL_PHYSICAL_GPU)gpuw->nextObject, pExtName);
+    } else
+    {
+        result = XGL_ERROR_INVALID_EXTENSION;
+    }
+    return result;
+}
+
 XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglEnumerateLayers(XGL_PHYSICAL_GPU gpu, size_t maxLayerCount,
     size_t maxStringSize, size_t* pOutLayerCount, char* const* pOutLayers, void* pReserved)
 {
@@ -1900,6 +1918,8 @@
         return (void*) xglCreateDevice;
     if (!strcmp(funcName, "xglDestroyDevice"))
         return (void*) xglDestroyDevice;
+    if (!strcmp(funcName, "xglGetExtensionSupport"))
+        return (void*) xglGetExtensionSupport;
     if (!strcmp(funcName, "xglEnumerateLayers"))
         return (void*) xglEnumerateLayers;
     if (!strcmp(funcName, "xglQueueSubmit"))
diff --git a/layers/multi.cpp b/layers/multi.cpp
index 3a5e4fc..f8c2bc9 100644
--- a/layers/multi.cpp
+++ b/layers/multi.cpp
@@ -132,6 +132,8 @@
         return (void *) multi1CreateGraphicsPipeline;
     else if (!strncmp("xglStorePipeline", pName, sizeof ("xglStorePipeline")))
         return (void *) multi1StorePipeline;
+    else if (!strncmp("xglGetExtensionSupport", pName, sizeof ("xglGetExtensionSupport")))
+        return (void *) xglGetExtensionSupport;
     else {
         if (gpuw->pGPA == NULL)
             return NULL;
@@ -232,6 +234,8 @@
         return (void *) multi2CreateCommandBuffer;
     else if (!strncmp("xglBeginCommandBuffer", pName, sizeof ("xglBeginCommandBuffer")))
         return (void *) multi2BeginCommandBuffer;
+    else if (!strncmp("xglGetExtensionSupport", pName, sizeof ("xglGetExtensionSupport")))
+        return (void *) xglGetExtensionSupport;
     else {
         if (gpuw->pGPA == NULL)
             return NULL;
@@ -255,6 +259,33 @@
     return XGL_SUCCESS;
 }
 
+XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetExtensionSupport(XGL_PHYSICAL_GPU gpu, const char* pExtName)
+{
+    XGL_RESULT result;
+    XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
+
+    /* This entrypoint is NOT going to init it's own dispatch table since loader calls here early */
+    if (!strncmp(pExtName, "multi1", strlen("multi1")))
+    {
+        result = XGL_SUCCESS;
+    } else if (!strncmp(pExtName, "multi2", strlen("multi2")))
+    {
+        result = XGL_SUCCESS;
+    } else if (!tableMap1.empty() && (tableMap1.find(gpuw) != tableMap1.end()))
+    {
+        XGL_LAYER_DISPATCH_TABLE* pTable = tableMap1[gpuw];
+        result = pTable->GetExtensionSupport((XGL_PHYSICAL_GPU)gpuw->nextObject, pExtName);
+    } else if (!tableMap2.empty() && (tableMap2.find(gpuw) != tableMap2.end()))
+    {
+        XGL_LAYER_DISPATCH_TABLE* pTable = tableMap2[gpuw];
+        result = pTable->GetExtensionSupport((XGL_PHYSICAL_GPU)gpuw->nextObject, pExtName);
+    } else
+    {
+        result = XGL_ERROR_INVALID_EXTENSION;
+    }
+    return result;
+}
+
 XGL_LAYER_EXPORT void * XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const char* pName)
 {
     // to find each layers GPA routine Loader will search via "<layerName>GetProcAddr"