.engineVersion = 0,
.apiVersion = XGL_API_VERSION,
};
+ const XGL_INSTANCE_CREATE_INFO inst_info = {
+ .sType = XGL_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
+ .pNext = NULL,
+ .pAppInfo = &app,
+ .pAllocCb = NULL,
+ .extensionCount = 0,
+ .ppEnabledExtensionNames = NULL,
+ };
const XGL_WSI_X11_CONNECTION_INFO connection = {
.pConnection = demo->connection,
.root = demo->screen->root,
size_t data_size;
uint32_t queue_count;
- err = xglCreateInstance(&app, NULL, &demo->inst);
+ err = xglCreateInstance(&inst_info, &demo->inst);
if (err == XGL_ERROR_INCOMPATIBLE_DRIVER) {
printf("Cannot find a compatible Vulkan installable client driver "
"(ICD).\nExiting ...\n");
} else {
assert(!err);
}
+
err = xglEnumerateGpus(demo->inst, 1, &gpu_count, &demo->gpu);
assert(!err && gpu_count == 1);
.engineVersion = 0,
.apiVersion = XGL_API_VERSION,
};
+ const XGL_INSTANCE_CREATE_INFO inst_info = {
+ .sType = XGL_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
+ .pNext = NULL,
+ .pAppInfo = &app,
+ .pAllocCb = NULL,
+ .extensionCount = 0,
+ .ppEnabledExtensionNames = NULL,
+ };
const XGL_WSI_X11_CONNECTION_INFO connection = {
.pConnection = demo->connection,
.root = demo->screen->root,
size_t data_size;
uint32_t queue_count;
- err = xglCreateInstance(&app, NULL, &demo->inst);
+ err = xglCreateInstance(&inst_info, &demo->inst);
if (err == XGL_ERROR_INCOMPATIBLE_DRIVER) {
printf("Cannot find a compatible Vulkan installable client driver "
"(ICD).\nExiting ...\n");
} else {
assert(!err);
}
+
err = xglEnumerateGpus(demo->inst, 1, &gpu_count, &demo->gpu);
assert(!err && gpu_count == 1);
.engineVersion = 1,
.apiVersion = XGL_API_VERSION,
};
+ static const XGL_INSTANCE_CREATE_INFO inst_info = {
+ .sType = XGL_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
+ .pNext = NULL,
+ .pAppInfo = &app_info,
+ .pAllocCb = NULL,
+ .extensionCount = 0,
+ .ppEnabledExtensionNames = NULL,
+ };
struct app_gpu gpus[MAX_GPUS];
XGL_PHYSICAL_GPU objs[MAX_GPUS];
XGL_INSTANCE inst;
uint32_t gpu_count, i;
XGL_RESULT err;
- err = xglCreateInstance(&app_info, NULL, &inst);
+ err = xglCreateInstance(&inst_info, &inst);
if (err == XGL_ERROR_INCOMPATIBLE_DRIVER) {
printf("Cannot find a compatible Vulkan installable client driver "
"(ICD).\nExiting ...\n");
fflush(stdout);
exit(1);
} else if (err) {
+
ERR_EXIT(err);
}
err = xglEnumerateGpus(inst, MAX_GPUS, &gpu_count, objs);
}
ICD_EXPORT XGL_RESULT XGLAPI xglCreateInstance(
- const XGL_APPLICATION_INFO* pAppInfo,
- const XGL_ALLOC_CALLBACKS* pAllocCb,
+ const XGL_INSTANCE_CREATE_INFO* pCreateInfo,
XGL_INSTANCE* pInstance)
{
NULLDRV_LOG_FUNC;
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;
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
// ------------------------------------------------------------------------------------------------
// 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);
// 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(
//=============================================================================
// 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;
}
}
}
-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;
}
}
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);
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)
{
],
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",