Modify xcb_nvidia/nulldrv to also support nulldrv.
authorIan Elliott <ian@LunarG.com>
Thu, 19 Feb 2015 21:26:19 +0000 (14:26 -0700)
committerCourtney Goeltzenleuchter <courtney@LunarG.com>
Tue, 3 Mar 2015 00:21:09 +0000 (17:21 -0700)
This allows LunarG and others without the NVIDIA XGL driver to use the nulldrv
on Windows.

demos/xcb_nvidia.cpp
icd/nulldrv/XGL_nulldrv.def
icd/nulldrv/nulldrv.c

index 1e8f5bc..5ecd088 100644 (file)
@@ -41,6 +41,11 @@ xcb_connection_t * xcb_connect(const char *displayname, int *screenp)
     xglNvidia += "\\xgl_nvidia.dll";
     HMODULE module = LoadLibrary(xglNvidia.c_str());
     if (!module) {
+        std::string xglNulldrv = getenv("LIBXGL_DRIVERS_PATH");
+        xglNulldrv += "\\xgl_nulldrv.dll";
+        module = LoadLibrary(xglNulldrv.c_str());
+    }
+    if (!module) {
         return 0;
     }
 
index bd4b499..1f5d715 100644 (file)
@@ -30,3 +30,7 @@ EXPORTS
    xglCreateInstance
    xglEnumerateGpus
    xglDestroyInstance
+   xcbCreateWindow
+   xcbDestroyWindow
+   xcbGetMessage
+   xcbQueuePresent
index 71dcf1c..8df3d8d 100644 (file)
@@ -2029,3 +2029,29 @@ ICD_EXPORT void XGLAPI xglCmdEndRenderPass(
 {
     NULLDRV_LOG_FUNC;
 }
+
+ICD_EXPORT void* xcbCreateWindow(
+    uint16_t         width,
+    uint16_t         height)
+{
+    static uint32_t  window;  // Kludge to the max
+    NULLDRV_LOG_FUNC;
+    return &window;
+}
+
+// May not be needed, if we stub out stuf in tri.c
+ICD_EXPORT void xcbDestroyWindow()
+{
+    NULLDRV_LOG_FUNC;
+}
+
+ICD_EXPORT int xcbGetMessage(void *msg)
+{
+    NULLDRV_LOG_FUNC;
+    return 0;
+}
+
+ICD_EXPORT XGL_RESULT xcbQueuePresent(void *queue, void *image, void* fence)
+{
+    return XGL_SUCCESS;
+}