diff options
author | Jason Ekstrand <[email protected]> | 2017-08-16 16:38:56 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-12-04 09:21:09 -0800 |
commit | 591a07632c913cadb1802196c0a50480b354d73c (patch) | |
tree | 9b93f4ca85268bd826b826c5bc0aac61388e0050 /src/compiler/spirv | |
parent | 16dfdeefc8469c9bb8770bab763fd943b62f875d (diff) |
spirv: Do something useful with OpSource
We may as well log the source language and file name.
Reviewed-by: Tapani Pälli <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index a918985daab..676153dace1 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -2753,7 +2753,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: |