aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Ashburn <jon@lunarg.com>2015-01-29 15:47:01 -0700
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-02-04 17:58:10 -0700
commit93cfc4364ca15d7b02b408504a1c958d9017bdc4 (patch)
treedbe31004dc9dcd59d44397e543e961295da9ad8e
parent10a7eddd1cf35039e62a3ce40a726ff0d143ca62 (diff)
downloadusermoji-93cfc4364ca15d7b02b408504a1c958d9017bdc4.tar.xz
demos: Convert to using Instancing API rather than xglInitAndEnumerateGpus()
-rw-r--r--demos/cube.c6
-rw-r--r--demos/tri.c6
-rw-r--r--demos/xglinfo.c9
-rw-r--r--loader/loader.c4
4 files changed, 18 insertions, 7 deletions
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;