zink: Fix win32 build

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8957>
This commit is contained in:
Michel Zou 2021-02-10 14:27:52 +01:00 committed by Marge Bot
parent 60cd7ff7f7
commit aea36ee05e
1 changed files with 12 additions and 1 deletions

View File

@ -1247,7 +1247,11 @@ zink_create_screen(struct sw_winsys *winsys)
* luck!
*/
gallium_driver = getenv("GALLIUM_DRIVER");
#ifdef _WIN32
_putenv("GALLIUM_DRIVER=llvmpipe");
#else
setenv("GALLIUM_DRIVER", "llvmpipe", 1);
#endif
}
#endif
@ -1256,9 +1260,16 @@ zink_create_screen(struct sw_winsys *winsys)
ret->winsys = winsys;
#ifdef ZINK_WITH_SWRAST_VK
if (gallium_driver)
if (gallium_driver) {
#ifdef _WIN32
char envstr[64] = "";
snprintf(envstr, 64, "GALLIUM_DRIVER=%s", gallium_driver);
_putenv(envstr);
#else
setenv("GALLIUM_DRIVER", gallium_driver, 1);
#endif
}
#endif
return &ret->base;
}