misc: Add create_info struct to CreateInstance()

Allows extnesion or layer enablement at CreateInstance
Khronos Bug 13637
This commit is contained in:
Jon Ashburn 2015-04-04 14:52:07 -06:00 committed by Chia-I Wu
parent fde66ffad6
commit 6c5c011aae
5 changed files with 36 additions and 14 deletions

View File

@ -858,9 +858,8 @@ extern uint32_t loader_activate_layers(XGL_PHYSICAL_GPU gpu, const XGL_DEVICE_CR
}
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 @@ LOADER_EXPORT XGL_RESULT XGLAPI xglCreateInstance(
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)
{

View File

@ -93,8 +93,14 @@ protected:
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);

View File

@ -98,8 +98,14 @@ protected:
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 @@ TEST(Initialization, xglEnumerateGpus) {
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 @@ TEST(Initialization, xglEnumerateGpus) {
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);

View File

@ -57,8 +57,14 @@ XglRenderFramework::~XglRenderFramework()
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);

3
xgl.py
View File

@ -218,8 +218,7 @@ core = Extension(
],
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",