misc: Add create_info struct to CreateInstance()

Allows extnesion or layer enablement at CreateInstance
Khronos Bug 13637
diff --git a/include/xgl.h b/include/xgl.h
index 92fb1cc..28c32d0 100644
--- a/include/xgl.h
+++ b/include/xgl.h
@@ -1056,9 +1056,9 @@
     XGL_STRUCTURE_TYPE_UPDATE_AS_COPY                       = 53,
     XGL_STRUCTURE_TYPE_MEMORY_ALLOC_BUFFER_INFO             = 54,
     XGL_STRUCTURE_TYPE_MEMORY_ALLOC_IMAGE_INFO              = 55,
-
+    XGL_STRUCTURE_TYPE_INSTANCE_CREATE_INFO                 = 56,
     XGL_STRUCTURE_TYPE_BEGIN_RANGE                          = XGL_STRUCTURE_TYPE_APPLICATION_INFO,
-    XGL_STRUCTURE_TYPE_END_RANGE                            = XGL_STRUCTURE_TYPE_MEMORY_ALLOC_IMAGE_INFO,
+    XGL_STRUCTURE_TYPE_END_RANGE                            = XGL_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
     XGL_NUM_STRUCTURE_TYPE                                  = (XGL_STRUCTURE_TYPE_END_RANGE - XGL_STRUCTURE_TYPE_BEGIN_RANGE + 1),
     XGL_MAX_ENUM(_XGL_STRUCTURE_TYPE)
 } XGL_STRUCTURE_TYPE;
@@ -1411,6 +1411,17 @@
     XGL_FLAGS                               flags;                      // XGL_DEVICE_CREATE_FLAGS
 } XGL_DEVICE_CREATE_INFO;
 
+typedef struct _XGL_INSTANCE_CREATE_INFO
+{
+    XGL_STRUCTURE_TYPE                      sType;                      // Should be XGL_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
+    const void*                             pNext;                      // Pointer to next structure
+    const XGL_APPLICATION_INFO*             pAppInfo;
+    const XGL_ALLOC_CALLBACKS*              pAllocCb;
+    uint32_t                                extensionCount;
+    const char*const*                       ppEnabledExtensionNames;    // layer or extension name to be enabled
+} XGL_INSTANCE_CREATE_INFO;
+
+// can be added to XGL_DEVICE_CREATE_INFO or XGL_INSTANCE_CREATE_INFO via pNext
 typedef struct _XGL_LAYER_CREATE_INFO
 {
     XGL_STRUCTURE_TYPE                      sType;                      // Should be XGL_STRUCTURE_TYPE_LAYER_CREATE_INFO
@@ -2252,7 +2263,7 @@
 
 // ------------------------------------------------------------------------------------------------
 // API functions
-typedef XGL_RESULT (XGLAPI *xglCreateInstanceType)(const XGL_APPLICATION_INFO* pAppInfo, const XGL_ALLOC_CALLBACKS* pAllocCb, XGL_INSTANCE* pInstance);
+typedef XGL_RESULT (XGLAPI *xglCreateInstanceType)(const XGL_INSTANCE_CREATE_INFO* pCreateInfo, XGL_INSTANCE* pInstance);
 typedef XGL_RESULT (XGLAPI *xglDestroyInstanceType)(XGL_INSTANCE instance);
 typedef XGL_RESULT (XGLAPI *xglEnumerateGpusType)(XGL_INSTANCE instance, uint32_t maxGpus, uint32_t* pGpuCount, XGL_PHYSICAL_GPU* pGpus);
 typedef XGL_RESULT (XGLAPI *xglGetGpuInfoType)(XGL_PHYSICAL_GPU gpu, XGL_PHYSICAL_GPU_INFO_TYPE infoType, size_t* pDataSize, void* pData);
@@ -2372,8 +2383,7 @@
 // GPU initialization
 
 XGL_RESULT XGLAPI xglCreateInstance(
-    const XGL_APPLICATION_INFO*                 pAppInfo,
-    const XGL_ALLOC_CALLBACKS*                  pAllocCb,
+    const XGL_INSTANCE_CREATE_INFO*             pCreateInfo,
     XGL_INSTANCE*                               pInstance);
 
 XGL_RESULT XGLAPI xglDestroyInstance(
diff --git a/layers/glave_snapshot.c b/layers/glave_snapshot.c
index 3af9744..e757f2b 100644
--- a/layers/glave_snapshot.c
+++ b/layers/glave_snapshot.c
@@ -463,11 +463,11 @@
 //=============================================================================
 // vulkan entrypoints
 //=============================================================================
-XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateInstance(const XGL_APPLICATION_INFO* pAppInfo, const XGL_ALLOC_CALLBACKS* pAllocCb, XGL_INSTANCE* pInstance)
+XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateInstance(const XGL_INSTANCE_CREATE_INFO* pCreateInfo, XGL_INSTANCE* pInstance)
 {
-    XGL_RESULT result = nextTable.CreateInstance(pAppInfo, pAllocCb, pInstance);
+    XGL_RESULT result = nextTable.CreateInstance(pCreateInfo, pInstance);
     loader_platform_thread_lock_mutex(&objLock);
-
+    snapshot_insert_object(&s_delta, *pInstance, XGL_OBJECT_TYPE_INSTANCE);
     loader_platform_thread_unlock_mutex(&objLock);
     return result;
 }
diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp
index 6da0f0c..ebfe65f 100644
--- a/layers/param_checker.cpp
+++ b/layers/param_checker.cpp
@@ -123,10 +123,10 @@
     }
 }
 
-XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateInstance(const XGL_APPLICATION_INFO* pAppInfo, const XGL_ALLOC_CALLBACKS* pAllocCb, XGL_INSTANCE* pInstance)
+XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateInstance(const XGL_INSTANCE_CREATE_INFO* pCreateInfo, XGL_INSTANCE* pInstance)
 {
-    PreCreateInstance(pAppInfo, pAllocCb);
-    XGL_RESULT result = nextTable.CreateInstance(pAppInfo, pAllocCb, pInstance);
+    PreCreateInstance(pCreateInfo->pAppInfo, pCreateInfo->pAllocCb);
+    XGL_RESULT result = nextTable.CreateInstance(pCreateInfo, pInstance);
     PostCreateInstance(result, pInstance);
     return result;
 }
diff --git a/loader/loader.c b/loader/loader.c
index 556c2b3..7ea486a 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -858,9 +858,8 @@
 }
 
 LOADER_EXPORT XGL_RESULT XGLAPI xglCreateInstance(
-        const XGL_APPLICATION_INFO*                 pAppInfo,
-        const XGL_ALLOC_CALLBACKS*                  pAllocCb,
-        XGL_INSTANCE*                               pInstance)
+        const XGL_INSTANCE_CREATE_INFO*         pCreateInfo,
+        XGL_INSTANCE*                           pInstance)
 {
     static LOADER_PLATFORM_THREAD_ONCE_DECLARATION(once_icd);
     static LOADER_PLATFORM_THREAD_ONCE_DECLARATION(once_layer);
@@ -888,7 +887,7 @@
     while (scanned_icds) {
         icd = loader_icd_add(ptr_instance, scanned_icds);
         if (icd) {
-            res = scanned_icds->CreateInstance(pAppInfo, pAllocCb,
+            res = scanned_icds->CreateInstance(pCreateInfo,
                                            &(scanned_icds->instance));
             if (res != XGL_SUCCESS)
             {
diff --git a/tests/image_tests.cpp b/tests/image_tests.cpp
index 1a5fcfd..c4cc58e 100644
--- a/tests/image_tests.cpp
+++ b/tests/image_tests.cpp
@@ -93,8 +93,14 @@
         this->app_info.pEngineName = "unittest";
         this->app_info.engineVersion = 1;
         this->app_info.apiVersion = XGL_API_VERSION;
-
-        err = xglCreateInstance(&app_info, NULL, &this->inst);
+        XGL_INSTANCE_CREATE_INFO inst_info = {};
+        inst_info.sType = XGL_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
+        inst_info.pNext = NULL;
+        inst_info.pAppInfo = &app_info;
+        inst_info.pAllocCb = NULL;
+        inst_info.extensionCount = 0;
+        inst_info.ppEnabledExtensionNames = NULL;
+        err = xglCreateInstance(&inst_info, &this->inst);
         ASSERT_XGL_SUCCESS(err);
         err = xglEnumerateGpus(this->inst, XGL_MAX_PHYSICAL_GPUS,
                                &this->gpu_count, objs);
diff --git a/tests/init.cpp b/tests/init.cpp
index 8d07ae1..72779af 100644
--- a/tests/init.cpp
+++ b/tests/init.cpp
@@ -98,8 +98,14 @@
         this->app_info.pEngineName = "unittest";
         this->app_info.engineVersion = 1;
         this->app_info.apiVersion = XGL_API_VERSION;
-
-        err = xglCreateInstance(&app_info, NULL, &inst);
+        XGL_INSTANCE_CREATE_INFO inst_info = {};
+        inst_info.sType = XGL_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
+        inst_info.pNext = NULL;
+        inst_info.pAppInfo = &app_info;
+        inst_info.pAllocCb = NULL;
+        inst_info.extensionCount = 0;
+        inst_info.ppEnabledExtensionNames = NULL;
+        err = xglCreateInstance(&inst_info, &inst);
         ASSERT_XGL_SUCCESS(err);
         err = xglEnumerateGpus(inst, XGL_MAX_PHYSICAL_GPUS, &this->gpu_count,
                                objs);
@@ -137,7 +143,13 @@
     char *layers[16];
     size_t layer_count;
     char layer_buf[16][256];
-
+    XGL_INSTANCE_CREATE_INFO inst_info = {};
+    inst_info.sType = XGL_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
+    inst_info.pNext = NULL;
+    inst_info.pAppInfo = &app_info;
+    inst_info.pAllocCb = NULL;
+    inst_info.extensionCount = 0;
+    inst_info.ppEnabledExtensionNames = NULL;
     app_info.sType = XGL_STRUCTURE_TYPE_APPLICATION_INFO;
     app_info.pNext = NULL;
     app_info.pAppName = "base";
@@ -146,7 +158,7 @@
     app_info.engineVersion = 1;
     app_info.apiVersion = XGL_API_VERSION;
 
-    err = xglCreateInstance(&app_info, NULL, &inst);
+    err = xglCreateInstance(&inst_info, &inst);
     ASSERT_XGL_SUCCESS(err);
     err = xglEnumerateGpus(inst, XGL_MAX_PHYSICAL_GPUS, &gpu_count, objs);
     ASSERT_XGL_SUCCESS(err);
diff --git a/tests/test_environment.cpp b/tests/test_environment.cpp
index b73ae2d..812a050 100644
--- a/tests/test_environment.cpp
+++ b/tests/test_environment.cpp
@@ -51,8 +51,14 @@
 
     uint32_t count;
     XGL_RESULT err;
-
-    err = xglCreateInstance(&app_, NULL, &inst);
+    XGL_INSTANCE_CREATE_INFO inst_info = {};
+    inst_info.sType = XGL_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
+    inst_info.pNext = NULL;
+    inst_info.pAppInfo = &app_;
+    inst_info.pAllocCb = NULL;
+    inst_info.extensionCount = 0;
+    inst_info.ppEnabledExtensionNames = NULL;
+    err = xglCreateInstance(&inst_info, &inst);
     ASSERT_EQ(XGL_SUCCESS, err);
     err = xglEnumerateGpus(inst, ARRAY_SIZE(gpus), &count, gpus);
     ASSERT_EQ(XGL_SUCCESS, err);
@@ -76,8 +82,15 @@
     const xcb_setup_t *setup;
     xcb_screen_iterator_t iter;
     int scr;
+    XGL_INSTANCE_CREATE_INFO instInfo = {};
+    instInfo.sType = XGL_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
+    instInfo.pNext = NULL;
+    instInfo.pAppInfo = &app_;
+    instInfo.pAllocCb = NULL;
+    instInfo.extensionCount = 0;
+    instInfo.ppEnabledExtensionNames = NULL;
 
-    err = xglCreateInstance(&app_, NULL, &inst);
+    err = xglCreateInstance(&instInfo, &inst);
     ASSERT_EQ(XGL_SUCCESS, err);
     err = xglEnumerateGpus(inst, ARRAY_SIZE(gpus), &count, gpus);
     ASSERT_EQ(XGL_SUCCESS, err);
diff --git a/tests/xglrenderframework.cpp b/tests/xglrenderframework.cpp
index b88a3ed..620b229 100644
--- a/tests/xglrenderframework.cpp
+++ b/tests/xglrenderframework.cpp
@@ -57,8 +57,14 @@
 void XglRenderFramework::InitFramework()
 {
     XGL_RESULT err;
-
-    err = xglCreateInstance(&app_info, NULL, &this->inst);
+    XGL_INSTANCE_CREATE_INFO instInfo = {};
+    instInfo.sType = XGL_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
+    instInfo.pNext = NULL;
+    instInfo.pAppInfo = &app_info;
+    instInfo.pAllocCb = NULL;
+    instInfo.extensionCount = 0;
+    instInfo.ppEnabledExtensionNames = NULL;
+    err = xglCreateInstance(&instInfo, &this->inst);
     ASSERT_XGL_SUCCESS(err);
     err = xglEnumerateGpus(inst, XGL_MAX_PHYSICAL_GPUS, &this->gpu_count,
                            objs);
diff --git a/xgl.py b/xgl.py
index 1b372f0..3a2d728 100644
--- a/xgl.py
+++ b/xgl.py
@@ -218,8 +218,7 @@
     ],
     protos=[
         Proto("XGL_RESULT", "CreateInstance",
-            [Param("const XGL_APPLICATION_INFO*", "pAppInfo"),
-             Param("const XGL_ALLOC_CALLBACKS*", "pAllocCb"),
+            [Param("const XGL_INSTANCE_CREATE_INFO*", "pCreateInfo"),
              Param("XGL_INSTANCE*", "pInstance")]),
 
         Proto("XGL_RESULT", "DestroyInstance",