glx: turn LIBGL_ALLOW_SOFTWARE into a boolean
authorEric Engestrom <eric.engestrom@imgtec.com>
Fri, 8 Sep 2017 10:46:25 +0000 (11:46 +0100)
committerEric Engestrom <eric.engestrom@imgtec.com>
Tue, 12 Sep 2017 12:53:11 +0000 (13:53 +0100)
Instead of setting based on set/unset, allow users to use boolean values.
In the help string, use `ALLOW=true` instead of `ALLOW=1` as it's clearer IMO.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/glx/apple/apple_visual.c

index a4918239178189f1aa80363742cf18c2b35f6146..d8fd7b0cb3d4524b9b01400bb8ffee344c4b1755 100644 (file)
@@ -96,7 +96,7 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
       attr[numattr++] = kCGLPFARendererID;
       attr[numattr++] = kCGLRendererGenericFloatID;
    }
       attr[numattr++] = kCGLPFARendererID;
       attr[numattr++] = kCGLRendererGenericFloatID;
    }
-   else if (getenv("LIBGL_ALLOW_SOFTWARE") != NULL) {
+   else if (env_var_as_boolean("LIBGL_ALLOW_SOFTWARE", false)) {
       apple_glx_diagnostic
          ("Software rendering is not being excluded.  Not using kCGLPFAAccelerated.\n");
    }
       apple_glx_diagnostic
          ("Software rendering is not being excluded.  Not using kCGLPFAAccelerated.\n");
    }
@@ -190,7 +190,7 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
 
    if (!*pfobj) {
       snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__),
 
    if (!*pfobj) {
       snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__),
-               "No matching pixelformats found, perhaps try using LIBGL_ALLOW_SOFTWARE\n");
+               "No matching pixelformats found, perhaps try setting LIBGL_ALLOW_SOFTWARE=true\n");
       fprintf(stderr, "%s", __crashreporter_info_buff__);
       abort();
    }
       fprintf(stderr, "%s", __crashreporter_info_buff__);
       abort();
    }