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 ||
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
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");
#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 *