From: Jon Ashburn Date: Thu, 29 Jan 2015 22:47:01 +0000 (-0700) Subject: demos: Convert to using Instancing API rather than xglInitAndEnumerateGpus() X-Git-Tag: submit/tizen/20181227.054638~6168 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=93cfc4364ca15d7b02b408504a1c958d9017bdc4;p=platform%2Fupstream%2FVulkan-Tools.git demos: Convert to using Instancing API rather than xglInitAndEnumerateGpus() --- diff --git a/demos/cube.c b/demos/cube.c index 56b62c10..a9639716 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -193,6 +193,7 @@ struct demo { xcb_connection_t *connection; xcb_screen_t *screen; + XGL_INSTANCE inst; XGL_PHYSICAL_GPU gpu; XGL_DEVICE device; XGL_QUEUE queue; @@ -1478,7 +1479,9 @@ static void demo_init_xgl(struct demo *demo) uint32_t gpu_count; uint32_t i; - err = xglInitAndEnumerateGpus(&app, NULL, 1, &gpu_count, &demo->gpu); + err = xglCreateInstance(&app, NULL, &demo->inst); + assert(!err); + err = xglEnumerateGpus(demo->inst, 1, &gpu_count, &demo->gpu); assert(!err && gpu_count == 1); for (i = 0; i < device.extensionCount; i++) { @@ -1580,6 +1583,7 @@ static void demo_cleanup(struct demo *demo) } xglDestroyDevice(demo->device); + xglDestroyInstance(demo->inst); xcb_destroy_window(demo->connection, demo->window); xcb_disconnect(demo->connection); diff --git a/demos/tri.c b/demos/tri.c index 12051740..929d1585 100644 --- a/demos/tri.c +++ b/demos/tri.c @@ -24,6 +24,7 @@ struct demo { xcb_connection_t *connection; xcb_screen_t *screen; + XGL_INSTANCE inst; XGL_PHYSICAL_GPU gpu; XGL_DEVICE device; XGL_QUEUE queue; @@ -1033,7 +1034,9 @@ static void demo_init_xgl(struct demo *demo) uint32_t gpu_count; uint32_t i; - err = xglInitAndEnumerateGpus(&app, NULL, 1, &gpu_count, &demo->gpu); + err = xglCreateInstance(&app, NULL, &demo->inst); + assert(!err); + err = xglEnumerateGpus(demo->inst, 1, &gpu_count, &demo->gpu); assert(!err && gpu_count == 1); for (i = 0; i < device.extensionCount; i++) { @@ -1124,6 +1127,7 @@ static void demo_cleanup(struct demo *demo) } xglDestroyDevice(demo->device); + xglDestroyInstance(demo->inst); xcb_destroy_window(demo->connection, demo->window); xcb_disconnect(demo->connection); diff --git a/demos/xglinfo.c b/demos/xglinfo.c index bfe55a5e..dedb9ba6 100644 --- a/demos/xglinfo.c +++ b/demos/xglinfo.c @@ -654,11 +654,14 @@ int main(int argc, char **argv) }; struct app_gpu gpus[MAX_GPUS]; XGL_PHYSICAL_GPU objs[MAX_GPUS]; + XGL_INSTANCE inst; uint32_t gpu_count, i; XGL_RESULT err; - err = xglInitAndEnumerateGpus(&app_info, NULL, - MAX_GPUS, &gpu_count, objs); + err = xglCreateInstance(&app_info, NULL, &inst); + if (err) + ERR_EXIT(err); + err = xglEnumerateGpus(inst, MAX_GPUS, &gpu_count, objs); if (err) ERR_EXIT(err); @@ -673,7 +676,7 @@ int main(int argc, char **argv) for (i = 0; i < gpu_count; i++) app_gpu_destroy(&gpus[i]); - xglInitAndEnumerateGpus(&app_info, NULL, 0, &gpu_count, NULL); + xglDestroyInstance(inst); return 0; } diff --git a/loader/loader.c b/loader/loader.c index acb430f4..343fb142 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -907,7 +907,7 @@ LOADER_EXPORT XGL_RESULT XGLAPI xglEnumerateGpus( { struct loader_instance *ptr_instance = (struct loader_instance *) instance; struct loader_icd *icd; - XGL_UINT count = 0; + uint32_t count = 0; XGL_RESULT res; //in spirit of XGL don't error check on the instance parameter @@ -916,7 +916,7 @@ LOADER_EXPORT XGL_RESULT XGLAPI xglEnumerateGpus( XGL_PHYSICAL_GPU gpus[XGL_MAX_PHYSICAL_GPUS]; XGL_BASE_LAYER_OBJECT * wrapped_gpus; xglGetProcAddrType get_proc_addr = icd->scanned_icds->GetProcAddr; - XGL_UINT n, max = maxGpus - count; + uint32_t n, max = maxGpus - count; if (max > XGL_MAX_PHYSICAL_GPUS) { max = XGL_MAX_PHYSICAL_GPUS;