clover/platform: move versioning to core object.
This reads the env var once at constructor time and stores it in the platform object. Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7520>
This commit is contained in:
@@ -62,10 +62,7 @@ clover::GetPlatformInfo(cl_platform_id d_platform, cl_platform_info param,
|
||||
break;
|
||||
|
||||
case CL_PLATFORM_VERSION: {
|
||||
static const std::string version_string =
|
||||
debug_get_option("CLOVER_PLATFORM_VERSION_OVERRIDE", "1.1");
|
||||
|
||||
buf.as_string() = "OpenCL " + version_string + " Mesa " PACKAGE_VERSION MESA_GIT_SHA1;
|
||||
buf.as_string() = "OpenCL " + platform.platform_version_as_string() + " Mesa " PACKAGE_VERSION MESA_GIT_SHA1;
|
||||
break;
|
||||
}
|
||||
case CL_PLATFORM_NAME:
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
//
|
||||
|
||||
#include "core/platform.hpp"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
using namespace clover;
|
||||
|
||||
@@ -28,6 +29,10 @@ platform::platform() : adaptor_range(evals(), devs) {
|
||||
int n = pipe_loader_probe(NULL, 0);
|
||||
std::vector<pipe_loader_device *> ldevs(n);
|
||||
|
||||
unsigned major = 1, minor = 1;
|
||||
debug_get_version_option("CLOVER_PLATFORM_VERSION_OVERRIDE", &major, &minor);
|
||||
version = CL_MAKE_VERSION(major, minor, 0);
|
||||
|
||||
pipe_loader_probe(&ldevs.front(), n);
|
||||
|
||||
for (pipe_loader_device *ldev : ldevs) {
|
||||
@@ -44,3 +49,11 @@ std::string
|
||||
platform::supported_extensions_as_string() const {
|
||||
return "cl_khr_icd";
|
||||
}
|
||||
|
||||
std::string
|
||||
platform::platform_version_as_string() const {
|
||||
static const std::string version_string =
|
||||
std::to_string(CL_VERSION_MAJOR(version)) + "." +
|
||||
std::to_string(CL_VERSION_MINOR(version));
|
||||
return version_string;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,9 @@ namespace clover {
|
||||
|
||||
std::string supported_extensions_as_string() const;
|
||||
|
||||
std::string platform_version_as_string() const;
|
||||
protected:
|
||||
cl_version version;
|
||||
std::vector<intrusive_ref<device>> devs;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user