Factor out platform checks into platform.h header This functionality will be used in compositortest.cc in the next commit. BUG=none TEST=none Change-Id: Ifcb9f91d4da914a0bb519514464a599d8cbce957 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/glbench/+/5416276 Commit-Queue: ChromeOS Auto Retry <chromeos-auto-retry@chromeos-bot.iam.gserviceaccount.com> Auto-Submit: Matt Turner <msturner@google.com> Tested-by: Matt Turner <msturner@google.com> Reviewed-by: Ilja Friedel <ihf@chromium.org>
diff --git a/src/platform.h b/src/platform.h new file mode 100644 index 0000000..0229aa7 --- /dev/null +++ b/src/platform.h
@@ -0,0 +1,17 @@ +// Copyright 2024 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BENCH_GL_PLATFORM_H_ +#define BENCH_GL_PLATFORM_H_ + +#define ID_PLATFORM_GLX 1 +#define ID_PLATFORM_X11_EGL 2 +#define ID_PLATFORM_NULL 3 + +#define CONCAT(a, b) a##b +#define PLATFORM_ID(x) CONCAT(ID_, x) +#define PLATFORM_ENUM(x) CONCAT(WAFFLE_, x) +#define THIS_IS(x) PLATFORM_ID(x) == PLATFORM_ID(PLATFORM) + +#endif // BENCH_GL_PLATFORM_H_
diff --git a/src/waffle_stuff.cc b/src/waffle_stuff.cc index 3f7c7a7..d162c35 100644 --- a/src/waffle_stuff.cc +++ b/src/waffle_stuff.cc
@@ -8,6 +8,7 @@ #include <stdio.h> #include "main.h" +#include "platform.h" #include "utils.h" #include "waffle_stuff.h" @@ -28,15 +29,6 @@ #define GL_API WAFFLE_CONTEXT_OPENGL_ES2 #endif -#define ID_PLATFORM_GLX 1 -#define ID_PLATFORM_X11_EGL 2 -#define ID_PLATFORM_NULL 3 - -#define CONCAT(a, b) a##b -#define PLATFORM_ID(x) CONCAT(ID_, x) -#define PLATFORM_ENUM(x) CONCAT(WAFFLE_, x) -#define THIS_IS(x) PLATFORM_ID(x) == PLATFORM_ID(PLATFORM) - #if THIS_IS(PLATFORM_GLX) #include "waffle_glx.h" #elif THIS_IS(PLATFORM_X11_EGL)