From 117a0d4d5e919d2b76f5820a2848c64b5e3fecb9 Mon Sep 17 00:00:00 2001 From: Jon Ashburn Date: Wed, 11 Feb 2015 12:40:00 -0700 Subject: [PATCH] loader: Update README.md to instancing API and C++ ICDs --- loader/README.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/loader/README.md b/loader/README.md index 5e81eee..fe01297 100644 --- a/loader/README.md +++ b/loader/README.md @@ -23,15 +23,24 @@ LIBXGL\_LAYER\_NAMES colon separate list of layer names to be activated. Examp LIBXGL\_LAYER\_NAMES=MemTracker:DrawState ## Interface to driver (ICD) -- xglInitAndEnumerateGpus exported +- xglEnumerateGpus exported +- xglCreateInstance exported +- xglDestroyInstance exported - xglGetProcAddr exported and returns valid function pointers for all the XGL API entrypoints - all objects created by ICD can be cast to (XGL\_LAYER\_DISPATCH\_TABLE **) where the loader will replace the first entry with a pointer to the dispatch table which is owned by the loader. This implies two things for ICD drivers: 1. the ICD must return a pointer for the opaque object handle - 2. this pointer points to a structure with the first entry being a pointer. + 2. this pointer points to a regular C structure with the first entry being a pointer. + Note: for any C++ ICD's that implement XGL objects directly as C++ classes. + The C++ compiler may put a vtable at offset zero if your class is virtual. + In this case use a regular C structure as follows for your C++ objects: +``` + struct { + void *reservedForLoader; + myObjectClass myObj; + } xglObj; +``` - the ICD may or may not implement a dispatch table -- ICD entrypoints can be named anything including the offcial xgl name such as xglCreateDevice(). However, beware of inter -posing by dynamic OS library loaders if the offical names are used. On Linux, -if offical names are used, the ICD library must be linked with -Bsymbolic +- ICD entrypoints can be named anything including the offcial xgl name such as xglCreateDevice(). However, beware of interposing by dynamic OS library loaders if the offical names are used. On Linux, if offical names are used, the ICD library must be linked with -Bsymbolic -- 2.7.4