diff options
author | Ian Elliott <ian@LunarG.com> | 2015-02-26 13:52:52 -0700 |
---|---|---|
committer | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-03-02 17:21:10 -0700 |
commit | b34547dbed9a0645ee189f77372d1b931390c2e7 (patch) | |
tree | e873021865e5ac94177cd1cbada11a0ef3b62903 /libs | |
parent | 8e8fba677d65d935beb6890b517341485edb4c01 (diff) |
xcb_nvidia: Hack in ability to use registry instead of getenv().
Trying to make it easy/quick to change between ICDs, which the registry allows.
Need to clean this up sometime.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/xcb_nvidia/xcb_nvidia.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libs/xcb_nvidia/xcb_nvidia.cpp b/libs/xcb_nvidia/xcb_nvidia.cpp index c4517e1b..17cb8d1c 100644 --- a/libs/xcb_nvidia/xcb_nvidia.cpp +++ b/libs/xcb_nvidia/xcb_nvidia.cpp @@ -43,6 +43,27 @@ xcb_connection_t * xcb_connect(const char *displayname, int *screenp) module = LoadLibrary(xglNulldrv.c_str()); } if (!module) { + // TODO: Adapted up the following code (copied from "loader.c"): +#define INITIAL_STR_LEN 1024 + char *registry_str = (char *) malloc(INITIAL_STR_LEN); + DWORD registry_len = INITIAL_STR_LEN; + DWORD registry_value_type; + LONG registry_return_value; + char *rtn_str = NULL; + size_t rtn_len; + + registry_return_value = RegGetValue(HKEY_LOCAL_MACHINE, "Software\\XGL", + "XGL_DRIVERS_PATH", + (RRF_RT_REG_SZ | RRF_ZEROONFAILURE), + ®istry_value_type, + (PVOID) registry_str, + ®istry_len); + rtn_len = registry_len + 16; + rtn_str = (char *) malloc(rtn_len); + _snprintf(rtn_str, rtn_len, "%s\\%s", registry_str, "xgl_nvidia.dll"); + module = LoadLibrary(rtn_str); + } + if (!module) { return 0; } |