From 05a7d15d6d0c7e2cdbf3d472d40535b50013ae5b Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Mon, 4 Nov 2019 18:26:52 +0000 Subject: [PATCH] graphics: Reduce duplication The GLESv2 and GL cases for _argv_for_graphics_test() are essentially the same, so take advantage of that. Signed-off-by: Simon McVittie <smcv@collabora.com> --- steam-runtime-tools/graphics.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/steam-runtime-tools/graphics.c b/steam-runtime-tools/graphics.c index c716503ca..4d8fda2d3 100644 --- a/steam-runtime-tools/graphics.c +++ b/steam-runtime-tools/graphics.c @@ -487,8 +487,11 @@ _argv_for_graphics_test (const char *helpers_path, g_ptr_array_add (argv, g_strdup ("10")); } - if (rendering_interface == SRT_RENDERING_INTERFACE_GL) + if (rendering_interface == SRT_RENDERING_INTERFACE_GL + || rendering_interface == SRT_RENDERING_INTERFACE_GLESV2) { + const char *api; + if (helpers_path != NULL) { g_ptr_array_add (argv, g_strdup_printf ("%s/%s-wflinfo", helpers_path, multiarch_tuple)); @@ -497,22 +500,14 @@ _argv_for_graphics_test (const char *helpers_path, { g_ptr_array_add (argv, g_strdup_printf ("%s-wflinfo", multiarch_tuple)); } - g_ptr_array_add (argv, g_strdup_printf ("--platform=%s", platformstring)); - g_ptr_array_add (argv, g_strdup ("--api=gl")); - g_ptr_array_add (argv, g_strdup ("--format=json")); - } - else if (rendering_interface == SRT_RENDERING_INTERFACE_GLESV2) - { - if (helpers_path != NULL) - { - g_ptr_array_add (argv, g_strdup_printf ("%s/%s-wflinfo", helpers_path, multiarch_tuple)); - } + + if (rendering_interface == SRT_RENDERING_INTERFACE_GLESV2) + api = "gles2"; else - { - g_ptr_array_add (argv, g_strdup_printf ("%s-wflinfo", multiarch_tuple)); - } + api = "gl"; + g_ptr_array_add (argv, g_strdup_printf ("--platform=%s", platformstring)); - g_ptr_array_add (argv, g_strdup ("--api=gles2")); + g_ptr_array_add (argv, g_strdup_printf ("--api=%s", api)); g_ptr_array_add (argv, g_strdup ("--format=json")); } else if (rendering_interface == SRT_RENDERING_INTERFACE_VULKAN) -- GitLab