From c2c44dba7a0ece017f672e13b71bea4519d5f4a5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 13 Dec 2018 11:15:07 -0800 Subject: [PATCH] nir: Print the format of image variables. This helps a lot when debugging image load/store lowering on large testcases. Unfortunately the Mesa enum name stuff is under src/mesa and we can't get at it from the compiler. Reviewed-by: Jason Ekstrand --- src/compiler/nir/nir_print.c | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index 920008468a6..7485fe06c3f 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -441,6 +441,53 @@ print_var_decl(nir_variable *var, print_state *state) const char *const wonly = (access & ACCESS_NON_READABLE) ? "writeonly " : ""; fprintf(fp, "%s%s%s%s%s", coher, volat, restr, ronly, wonly); +#define FORMAT_CASE(x) case x: fprintf(stderr, #x " "); break + switch (var->data.image.format) { + FORMAT_CASE(GL_RGBA32F); + FORMAT_CASE(GL_RGBA32UI); + FORMAT_CASE(GL_RGBA32I); + FORMAT_CASE(GL_R32F); + FORMAT_CASE(GL_R32UI); + FORMAT_CASE(GL_R32I); + FORMAT_CASE(GL_RG32F); + FORMAT_CASE(GL_RG32UI); + FORMAT_CASE(GL_RG32I); + FORMAT_CASE(GL_R8); + FORMAT_CASE(GL_RG8); + FORMAT_CASE(GL_RGBA8); + FORMAT_CASE(GL_R8_SNORM); + FORMAT_CASE(GL_RG8_SNORM); + FORMAT_CASE(GL_RGBA8_SNORM); + FORMAT_CASE(GL_R16); + FORMAT_CASE(GL_RG16); + FORMAT_CASE(GL_RGBA16); + FORMAT_CASE(GL_R16_SNORM); + FORMAT_CASE(GL_RG16_SNORM); + FORMAT_CASE(GL_RGBA16_SNORM); + FORMAT_CASE(GL_R16F); + FORMAT_CASE(GL_RG16F); + FORMAT_CASE(GL_RGBA16F); + FORMAT_CASE(GL_R8UI); + FORMAT_CASE(GL_R8I); + FORMAT_CASE(GL_RG8UI); + FORMAT_CASE(GL_RG8I); + FORMAT_CASE(GL_RGBA8UI); + FORMAT_CASE(GL_RGBA8I); + FORMAT_CASE(GL_R16UI); + FORMAT_CASE(GL_R16I); + FORMAT_CASE(GL_RG16UI); + FORMAT_CASE(GL_RG16I); + FORMAT_CASE(GL_RGBA16UI); + FORMAT_CASE(GL_RGBA16I); + FORMAT_CASE(GL_R11F_G11F_B10F); + FORMAT_CASE(GL_RGB9_E5); + FORMAT_CASE(GL_RGB10_A2); + FORMAT_CASE(GL_RGB10_A2UI); + default: /* Including the normal GL_NONE */ + break; + } +#undef FORMAT_CASE + fprintf(fp, "%s %s", glsl_get_type_name(var->type), get_var_name(var, state)); -- 2.30.2