mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
spirv: Extract vtn_handle_debug_text() helper
This will be later used by gl_spirv handling.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22973>
(cherry picked from commit a32f97530a)
This commit is contained in:
parent
68f72a3ad2
commit
c4f39f0074
3 changed files with 54 additions and 32 deletions
|
|
@ -6502,7 +6502,7 @@
|
|||
"description": "spirv: Extract vtn_handle_debug_text() helper",
|
||||
"nominated": false,
|
||||
"nomination_type": null,
|
||||
"resolution": 4,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4452,28 +4452,13 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
|
|||
const uint32_t *w, unsigned count)
|
||||
{
|
||||
switch (opcode) {
|
||||
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);
|
||||
|
||||
b->source_lang = w[1];
|
||||
case SpvOpString:
|
||||
case SpvOpSource:
|
||||
case SpvOpSourceExtension:
|
||||
case SpvOpSourceContinued:
|
||||
case SpvOpModuleProcessed:
|
||||
vtn_handle_debug_text(b, opcode, w, count);
|
||||
break;
|
||||
}
|
||||
|
||||
case SpvOpExtension: {
|
||||
/* Implementing both NV_mesh_shader and EXT_mesh_shader
|
||||
|
|
@ -4485,11 +4470,6 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
|
|||
b->shader->info.mesh.nv = true;
|
||||
break;
|
||||
}
|
||||
case SpvOpSourceExtension:
|
||||
case SpvOpSourceContinued:
|
||||
case SpvOpModuleProcessed:
|
||||
/* Unhandled, but these are for debug so that's ok. */
|
||||
break;
|
||||
|
||||
case SpvOpCapability: {
|
||||
SpvCapability cap = w[1];
|
||||
|
|
@ -4971,11 +4951,6 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
|
|||
vtn_handle_entry_point(b, w, count);
|
||||
break;
|
||||
|
||||
case SpvOpString:
|
||||
vtn_push_value(b, w[1], vtn_value_type_string)->str =
|
||||
vtn_string_literal(b, &w[2], count - 2, NULL);
|
||||
break;
|
||||
|
||||
case SpvOpName:
|
||||
b->values[w[1]].name = vtn_string_literal(b, &w[2], count - 2, NULL);
|
||||
break;
|
||||
|
|
@ -5012,6 +4987,50 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
vtn_handle_debug_text(struct vtn_builder *b, SpvOp opcode,
|
||||
const uint32_t *w, unsigned count)
|
||||
{
|
||||
switch (opcode) {
|
||||
case SpvOpString:
|
||||
vtn_push_value(b, w[1], vtn_value_type_string)->str =
|
||||
vtn_string_literal(b, &w[2], count - 2, NULL);
|
||||
break;
|
||||
|
||||
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);
|
||||
|
||||
b->source_lang = w[1];
|
||||
break;
|
||||
}
|
||||
|
||||
case SpvOpSourceExtension:
|
||||
case SpvOpSourceContinued:
|
||||
case SpvOpModuleProcessed:
|
||||
/* Unhandled, but these are for debug so that's ok. */
|
||||
break;
|
||||
|
||||
default:
|
||||
unreachable("Unhandled opcode");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,
|
||||
const struct vtn_decoration *mode, UNUSED void *data)
|
||||
|
|
|
|||
|
|
@ -1015,6 +1015,9 @@ struct vtn_builder* vtn_create_builder(const uint32_t *words, size_t word_count,
|
|||
void vtn_handle_entry_point(struct vtn_builder *b, const uint32_t *w,
|
||||
unsigned count);
|
||||
|
||||
void vtn_handle_debug_text(struct vtn_builder *b, SpvOp opcode,
|
||||
const uint32_t *w, unsigned count);
|
||||
|
||||
void vtn_handle_decoration(struct vtn_builder *b, SpvOp opcode,
|
||||
const uint32_t *w, unsigned count);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue