nir: Add a first_line parameter to gather_debug_info

Useful when the file contains multiple shaders.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29298>
This commit is contained in:
Konstantin Seurer
2024-08-25 14:17:24 +02:00
committed by Marge Bot
parent 736c8c6f23
commit f2c204daf0
2 changed files with 6 additions and 3 deletions
+4 -1
View File
@@ -5232,7 +5232,10 @@ char *nir_shader_as_str(nir_shader *nir, void *mem_ctx);
char *nir_shader_as_str_annotated(nir_shader *nir, struct hash_table *annotations, void *mem_ctx);
char *nir_instr_as_str(const nir_instr *instr, void *mem_ctx);
char *nir_shader_gather_debug_info(nir_shader *shader, const char *filename);
/** Adds debug information to the shader. The line numbers point to
* the corresponding lines in the printed NIR, starting first_line;
*/
char *nir_shader_gather_debug_info(nir_shader *shader, const char *filename, uint32_t first_line);
/** Shallow clone of a single instruction. */
nir_instr *nir_instr_clone(nir_shader *s, const nir_instr *orig);
+2 -2
View File
@@ -2832,7 +2832,7 @@ nir_log_shader_annotated_tagged(enum mesa_log_level level, const char *tag,
}
char *
nir_shader_gather_debug_info(nir_shader *shader, const char *filename)
nir_shader_gather_debug_info(nir_shader *shader, const char *filename, uint32_t first_line)
{
uint32_t instr_count = 0;
nir_foreach_function_impl(impl, shader) {
@@ -2869,7 +2869,7 @@ nir_shader_gather_debug_info(nir_shader *shader, const char *filename)
char *str = _nir_shader_as_str_annotated(shader, NULL, NULL, debug_info);
uint32_t line = 1;
uint32_t line = first_line;
uint32_t character_index = 0;
for (uint32_t i = 0; i < instr_count; i++) {