diff --git a/docs/envvars.rst b/docs/envvars.rst index 8c2ce3a6f7c..0a7e8e617cc 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -730,6 +730,10 @@ Gallium environment variables control default visibility, defaults to true. +.. envvar:: GALLIUM_HUD_OPACITY + + control background opacity as an integer percentage (1-100), defaults to 66%. + .. envvar:: GALLIUM_HUD_TOGGLE_SIGNAL toggle visibility via user specified signal. Especially useful to diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index 0d5229952f6..f5b11c42509 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -71,11 +71,13 @@ #define HUD_DEFAULT_VISIBILITY TRUE #define HUD_DEFAULT_SCALE 1 #define HUD_DEFAULT_ROTATION 0 +#define HUD_DEFAULT_OPACITY 66 /* Control the visibility of all HUD contexts */ static boolean huds_visible = HUD_DEFAULT_VISIBILITY; static int hud_scale = HUD_DEFAULT_SCALE; static int hud_rotate = HUD_DEFAULT_ROTATION; +static float hud_opacity = HUD_DEFAULT_OPACITY / 100.0f; #if DETECT_OS_UNIX static void @@ -593,7 +595,7 @@ hud_draw_results(struct hud_context *hud, struct pipe_resource *tex) hud->constants.color[0] = 0; hud->constants.color[1] = 0; hud->constants.color[2] = 0; - hud->constants.color[3] = 0.666f; + hud->constants.color[3] = hud_opacity; hud->constants.translate[0] = 0; hud->constants.translate[1] = 0; hud->constants.scale[0] = hud_scale; @@ -1936,6 +1938,7 @@ hud_create(struct cso_context *cso, struct hud_context *share, memset(&action, 0, sizeof(action)); #endif huds_visible = debug_get_bool_option("GALLIUM_HUD_VISIBLE", !emulate_libgl_show_fps); + hud_opacity = debug_get_num_option("GALLIUM_HUD_OPACITY", HUD_DEFAULT_OPACITY) / 100.0f; hud_scale = debug_get_num_option("GALLIUM_HUD_SCALE", HUD_DEFAULT_SCALE); hud_rotate = debug_get_num_option("GALLIUM_HUD_ROTATION", HUD_DEFAULT_ROTATION) % 360; if (hud_rotate < 0) {