[Mesa-dev] [PATCH 5/9] spirv: Do something useful with OpSource
Jason Ekstrand
jason at jlekstrand.net
Thu Aug 17 17:22:19 UTC 2017
We may as well log the source language and file name.
---
src/compiler/spirv/spirv_to_nir.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 6174ec7..e59f2b2 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -2749,7 +2749,27 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
const uint32_t *w, unsigned count)
{
switch (opcode) {
- case SpvOpSource:
+ case SpvOpSource: {
+ const char *lang;
+ switch (w[1]) {
+ default:
+ case SpvSourceLanguageUnknown: lang = "unknown"; break;
+ case SpvSourceLanguageESSL: lang = "ESSL"; break;
+ case SpvSourceLanguageGLSL: lang = "GLSL"; break;
+ case SpvSourceLanguageOpenCL_C: lang = "OpenCL C"; break;
+ case SpvSourceLanguageOpenCL_CPP: lang = "OpenCL C++"; break;
+ case SpvSourceLanguageHLSL: lang = "HLSL"; break;
+ }
+
+ uint32_t version = w[2];
+
+ const char *file =
+ (count > 3) ? vtn_value(b, w[3], vtn_value_type_string)->str : "";
+
+ vtn_info("Parsing SPIR-V from %s %u source file %s", lang, version, file);
+ break;
+ }
+
case SpvOpSourceExtension:
case SpvOpSourceContinued:
case SpvOpExtension:
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list