summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/swr_loader.cpp
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2017-07-07 13:38:22 -0500
committerTim Rowley <[email protected]>2017-07-19 15:12:07 -0500
commitf42186b01dbc78357ace1bf47feb69696471b580 (patch)
treee9ecf1895f7e77b10e97cb44b5b33579479cea3b /src/gallium/drivers/swr/swr_loader.cpp
parent131b9f644cbe70728ba02878483e22459400bcb4 (diff)
configure/swr: configurable swr architectures
Allow configuration of the SWR architecture depend libraries we build for with --with-swr-archs. Maintains current behavior by defaulting to avx,avx2. Scons changes made to make it still build and work, but without the changes for configuring which architectures. v2: * add missing comma for swr_archs default * check that at least one architecture is enabled * modify loader logic to make it clearer how to add archs Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/swr_loader.cpp')
-rw-r--r--src/gallium/drivers/swr/swr_loader.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/gallium/drivers/swr/swr_loader.cpp b/src/gallium/drivers/swr/swr_loader.cpp
index d56fb0e59fb..4aa850a6b8d 100644
--- a/src/gallium/drivers/swr/swr_loader.cpp
+++ b/src/gallium/drivers/swr/swr_loader.cpp
@@ -31,22 +31,38 @@
struct pipe_screen *
swr_create_screen(struct sw_winsys *winsys)
{
- char filename[256];
+ char filename[256] = { 0 };
fprintf(stderr, "SWR detected ");
util_dl_library *pLibrary = nullptr;
util_cpu_detect();
- if (util_cpu_caps.has_avx2) {
- fprintf(stderr, "AVX2\n");
+
+ if (!strlen(filename) && util_cpu_caps.has_avx2) {
+#if HAVE_SWR_AVX2
+ fprintf(stderr, "AVX2 ");
sprintf(filename, "%s%s%s", UTIL_DL_PREFIX, "swrAVX2", UTIL_DL_EXT);
- } else if (util_cpu_caps.has_avx) {
- fprintf(stderr, "AVX\n");
+#else
+ fprintf(stderr, "AVX2 (not built) ");
+#endif
+ }
+
+ if (!strlen(filename) && util_cpu_caps.has_avx) {
+#if HAVE_SWR_AVX
+ fprintf(stderr, "AVX ");
sprintf(filename, "%s%s%s", UTIL_DL_PREFIX, "swrAVX", UTIL_DL_EXT);
- } else {
- fprintf(stderr, "no AVX/AVX2 support. Aborting!\n");
+#else
+ fprintf(stderr, "AVX (not built) ");
+#endif
+ }
+
+ if (!strlen(filename)) {
+ fprintf(stderr, "- no appropriate swr architecture library. Aborting!\n");
exit(-1);
+ } else {
+ fprintf(stderr, "\n");
}
+
pLibrary = util_dl_open(filename);
if (!pLibrary) {