mirror of
https://gitee.com/openharmony/third_party_vulkan-loader
synced 2024-11-30 02:41:01 +00:00
misc: Add create_info struct to CreateInstance()
Allows extnesion or layer enablement at CreateInstance Khronos Bug 13637
This commit is contained in:
parent
fde66ffad6
commit
6c5c011aae
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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
3
xgl.py
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user