diff options
-rw-r--r-- | src/compiler/nir/nir_print.c | 14 | ||||
-rw-r--r-- | src/compiler/nir_types.cpp | 30 | ||||
-rw-r--r-- | src/compiler/nir_types.h | 3 |
3 files changed, 11 insertions, 36 deletions
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index 9fa024ea783..35f64684d29 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -391,9 +391,8 @@ print_var_decl(nir_variable *var, print_state *state) const char *const wonly = (var->data.image.write_only) ? "writeonly " : ""; fprintf(fp, "%s%s%s%s%s", coher, volat, restr, ronly, wonly); - glsl_print_type(var->type, fp); - - fprintf(fp, " %s", get_var_name(var, state)); + fprintf(fp, "%s %s", glsl_get_type_name(var->type), + get_var_name(var, state)); if (var->data.mode == nir_var_shader_in || var->data.mode == nir_var_shader_out || @@ -457,8 +456,8 @@ static void print_arg(nir_variable *var, print_state *state) { FILE *fp = state->fp; - glsl_print_type(var->type, fp); - fprintf(fp, " %s", get_var_name(var, state)); + fprintf(fp, "%s %s", glsl_get_type_name(var->type), + get_var_name(var, state)); } static void @@ -1097,14 +1096,13 @@ print_function(nir_function *function, print_state *state) unreachable("Invalid parameter type"); } - glsl_print_type(function->params[i].type, fp); + fprintf(fp, "%s", glsl_get_type_name(function->params[i].type)); } if (function->return_type != NULL) { if (function->num_params != 0) fprintf(fp, ", "); - fprintf(fp, "returning "); - glsl_print_type(function->return_type, fp); + fprintf(fp, "returning %s", glsl_get_type_name(function->return_type)); } fprintf(fp, "\n"); diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp index f694a84e72c..d1458134c0a 100644 --- a/src/compiler/nir_types.cpp +++ b/src/compiler/nir_types.cpp @@ -28,32 +28,10 @@ #include "nir_types.h" #include "compiler/glsl/ir.h" -void -glsl_print_type(const glsl_type *type, FILE *fp) -{ - if (type->base_type == GLSL_TYPE_ARRAY) { - glsl_print_type(type->fields.array, fp); - fprintf(fp, "[%u]", type->length); - } else if ((type->base_type == GLSL_TYPE_STRUCT) - && !is_gl_identifier(type->name)) { - fprintf(fp, "%s@%p", type->name, (void *) type); - } else { - fprintf(fp, "%s", type->name); - } -} - -void -glsl_print_struct(const glsl_type *type, FILE *fp) -{ - assert(type->base_type == GLSL_TYPE_STRUCT); - - fprintf(fp, "struct {\n"); - for (unsigned i = 0; i < type->length; i++) { - fprintf(fp, "\t"); - glsl_print_type(type->fields.structure[i].type, fp); - fprintf(fp, " %s;\n", type->fields.structure[i].name); - } - fprintf(fp, "}\n"); +const char * +glsl_get_type_name(const glsl_type *type) +{ + return type->name; } const glsl_type * diff --git a/src/compiler/nir_types.h b/src/compiler/nir_types.h index 6b4f646b20b..854d64fd875 100644 --- a/src/compiler/nir_types.h +++ b/src/compiler/nir_types.h @@ -40,8 +40,7 @@ extern "C" { struct glsl_type; #endif -void glsl_print_type(const struct glsl_type *type, FILE *fp); -void glsl_print_struct(const struct glsl_type *type, FILE *fp); +const char *glsl_get_type_name(const struct glsl_type *type); const struct glsl_type *glsl_get_struct_field(const struct glsl_type *type, unsigned index); |