nir: Delete open coded type printing.
glsl_print_type() prints arrays of arrays incorrectly. For example, a type with name float[3][7] would be printed as float[7][3]. (This is an array of length 3 containing arrays of 7 floats.) cdecl says that the type name is correct. glsl_print_type() doesn't really do anything above and beyond printing type->name, and glsl_print_struct() wasn't used at all. So, drop them. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
This commit is contained in:
@@ -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");
|
||||
|
@@ -28,32 +28,10 @@
|
||||
#include "nir_types.h"
|
||||
#include "compiler/glsl/ir.h"
|
||||
|
||||
void
|
||||
glsl_print_type(const glsl_type *type, FILE *fp)
|
||||
const char *
|
||||
glsl_get_type_name(const glsl_type *type)
|
||||
{
|
||||
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");
|
||||
return type->name;
|
||||
}
|
||||
|
||||
const glsl_type *
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user