spirv_to_dxil: expose version number

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12227>
This commit is contained in:
Michael Tang 2021-08-05 12:55:19 -07:00
parent bc3c71b87a
commit 92b0cf8e77
4 changed files with 24 additions and 4 deletions

View File

@ -21,10 +21,13 @@
libspirv_to_dxil = both_libraries(
'spirv_to_dxil',
files(
'spirv_to_dxil.c',
'spirv_to_dxil.h',
),
[
files(
'spirv_to_dxil.c',
'spirv_to_dxil.h',
),
sha1_h,
],
vs_module_defs : 'spirv_to_dxil.def',
dependencies : [idep_nir, idep_libdxil_compiler],
include_directories : [inc_include, inc_src, inc_compiler, inc_gallium],

View File

@ -28,6 +28,8 @@
#include "spirv/nir_spirv.h"
#include "util/blob.h"
#include "git_sha1.h"
bool
spirv_to_dxil(const uint32_t *words, size_t word_count,
struct dxil_spirv_specialization *specializations,
@ -173,3 +175,14 @@ spirv_to_dxil_free(void* buffer)
{
free(buffer);
}
uint64_t
spirv_to_dxil_get_version()
{
const char sha1[] = MESA_GIT_SHA1;
const char* dash = strchr(sha1, '-');
if (dash) {
return strtoull(dash + 1, NULL, 16);
}
return 0;
}

View File

@ -1,3 +1,4 @@
EXPORTS
spirv_to_dxil
spirv_to_dxil_free
spirv_to_dxil_get_version

View File

@ -95,6 +95,9 @@ spirv_to_dxil(const uint32_t* words,
void
spirv_to_dxil_free(void* buffer);
uint64_t
spirv_to_dxil_get_version();
#ifdef __cplusplus
}
#endif