Commit c0d4d21f authored by Pierre Moreau's avatar Pierre Moreau

clover/spirv: Use cl_version for SPIR-V versions (v2)

v2: Explicitly construct the cl_name_version object.
Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
Reviewed-by: Francisco Jerez's avatarFrancisco Jerez <currojerez@riseup.net>
Signed-off-by: Pierre Moreau's avatarPierre Moreau <dev@pmoreau.org>
Part-of: <mesa/mesa!2078>
parent 42fe8089
......@@ -352,8 +352,9 @@ namespace {
SPIRV::TranslatorOpts
get_spirv_translator_options(const device &dev) {
const auto supported_versions = clover::spirv::supported_versions();
const auto max_supported = clover::spirv::to_spirv_version_encoding(supported_versions.back().version);
const auto maximum_spirv_version =
std::min(static_cast<SPIRV::VersionNumber>(supported_versions.back()),
std::min(static_cast<SPIRV::VersionNumber>(max_supported),
SPIRV::VersionNumber::MaximumVersion);
SPIRV::TranslatorOpts::ExtensionsStatusMap spirv_extensions;
......
......@@ -49,12 +49,6 @@ using namespace clover;
#ifdef HAVE_CLOVER_SPIRV
namespace {
uint32_t
make_spirv_version(uint8_t major, uint8_t minor) {
return (static_cast<uint32_t>(major) << 16u) |
(static_cast<uint32_t>(minor) << 8u);
}
template<typename T>
T get(const char *source, size_t index) {
const uint32_t *word_ptr = reinterpret_cast<const uint32_t *>(source);
......@@ -886,9 +880,9 @@ clover::spirv::supported_extensions() {
};
}
std::vector<uint32_t>
std::vector<cl_name_version>
clover::spirv::supported_versions() {
return { make_spirv_version(1u, 0u) };
return { cl_name_version { CL_MAKE_VERSION(1u, 0u, 0u), "SPIR-V" } };
}
cl_version
......@@ -949,7 +943,7 @@ clover::spirv::supported_extensions() {
return {};
}
std::vector<uint32_t>
std::vector<cl_name_version>
clover::spirv::supported_versions() {
return {};
}
......
......@@ -68,7 +68,7 @@ namespace clover {
// Returns a vector (sorted in increasing order) of supported SPIR-V
// versions.
std::vector<uint32_t> supported_versions();
std::vector<cl_name_version> supported_versions();
// Converts a version number from SPIR-V's encoding to OpenCL's one.
cl_version to_opencl_version_encoding(uint32_t version);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment