Re: [Mesa-dev] [PATCH 2/2] nir: Print the components referenced for split or packed shader in/outs.
Timothy Arceriwrites: > On 20/10/17 20:52, Timothy Arceri wrote: >> >> >> On 20/10/17 17:33, Timothy Arceri wrote: >>> On 18/10/17 07:52, Eric Anholt wrote: Having 4 variables all called "gl_in_TexCoord0@n" isn't very informative, much better to see: decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0 (VARYING_SLOT_VAR0.x, 1, 0) decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0@0 (VARYING_SLOT_VAR0.y, 1, 0) decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0@1 (VARYING_SLOT_VAR0.z, 1, 0) decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0@2 (VARYING_SLOT_VAR0.w, 1, 0) --- src/compiler/nir/nir_print.c | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index f4811fe8bc11..df7a2057bfb9 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -447,7 +447,30 @@ print_var_decl(nir_variable *var, print_state *state) loc = buf; } - fprintf(fp, " (%s, %u, %u)%s", loc, var->data.driver_location, var->data.binding, + /* For shader I/O vars that have been split to components or packed, + * print the fractional location within the input/output. + */ + unsigned int num_components = glsl_get_components(var->type); >>> >>> This needs to be: >>> >>> glsl_without_array(glsl_get_components(var->type)); >> >> Sorry I mean: >> >> glsl_get_components(glsl_without_array(var->type)); >> >>> + const char *components = NULL; + char components_local[6] = {'.' /* the rest is 0-filled */}; + switch (var->data.mode) { + case nir_var_shader_in: + case nir_var_shader_out: + if (num_components != 4) { > > Also maybe: > > if (num_components != 4 && num_components != 0) > > To avoid adding the '.' to structs for now. I like both your changes. Merged. signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] nir: Print the components referenced for split or packed shader in/outs.
On 20/10/17 20:52, Timothy Arceri wrote: On 20/10/17 17:33, Timothy Arceri wrote: On 18/10/17 07:52, Eric Anholt wrote: Having 4 variables all called "gl_in_TexCoord0@n" isn't very informative, much better to see: decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0 (VARYING_SLOT_VAR0.x, 1, 0) decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0@0 (VARYING_SLOT_VAR0.y, 1, 0) decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0@1 (VARYING_SLOT_VAR0.z, 1, 0) decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0@2 (VARYING_SLOT_VAR0.w, 1, 0) --- src/compiler/nir/nir_print.c | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index f4811fe8bc11..df7a2057bfb9 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -447,7 +447,30 @@ print_var_decl(nir_variable *var, print_state *state) loc = buf; } - fprintf(fp, " (%s, %u, %u)%s", loc, var->data.driver_location, var->data.binding, + /* For shader I/O vars that have been split to components or packed, + * print the fractional location within the input/output. + */ + unsigned int num_components = glsl_get_components(var->type); This needs to be: glsl_without_array(glsl_get_components(var->type)); Sorry I mean: glsl_get_components(glsl_without_array(var->type)); + const char *components = NULL; + char components_local[6] = {'.' /* the rest is 0-filled */}; + switch (var->data.mode) { + case nir_var_shader_in: + case nir_var_shader_out: + if (num_components != 4) { Also maybe: if (num_components != 4 && num_components != 0) To avoid adding the '.' to structs for now. + const char *xyzw = "xyzw"; + for (int i = 0; i < num_components; i++) + components_local[i + 1] = xyzw[i + var->data.location_frac]; + + components = components_local; + } + break; + default: + break; + } + + fprintf(fp, " (%s%s, %u, %u)%s", loc, + components ? components : "", + var->data.driver_location, var->data.binding, var->data.compact ? " compact" : ""); } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] nir: Print the components referenced for split or packed shader in/outs.
On 20/10/17 17:33, Timothy Arceri wrote: On 18/10/17 07:52, Eric Anholt wrote: Having 4 variables all called "gl_in_TexCoord0@n" isn't very informative, much better to see: decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0 (VARYING_SLOT_VAR0.x, 1, 0) decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0@0 (VARYING_SLOT_VAR0.y, 1, 0) decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0@1 (VARYING_SLOT_VAR0.z, 1, 0) decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0@2 (VARYING_SLOT_VAR0.w, 1, 0) --- src/compiler/nir/nir_print.c | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index f4811fe8bc11..df7a2057bfb9 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -447,7 +447,30 @@ print_var_decl(nir_variable *var, print_state *state) loc = buf; } - fprintf(fp, " (%s, %u, %u)%s", loc, var->data.driver_location, var->data.binding, + /* For shader I/O vars that have been split to components or packed, + * print the fractional location within the input/output. + */ + unsigned int num_components = glsl_get_components(var->type); This needs to be: glsl_without_array(glsl_get_components(var->type)); Sorry I mean: glsl_get_components(glsl_without_array(var->type)); + const char *components = NULL; + char components_local[6] = {'.' /* the rest is 0-filled */}; + switch (var->data.mode) { + case nir_var_shader_in: + case nir_var_shader_out: + if (num_components != 4) { + const char *xyzw = "xyzw"; + for (int i = 0; i < num_components; i++) + components_local[i + 1] = xyzw[i + var->data.location_frac]; + + components = components_local; + } + break; + default: + break; + } + + fprintf(fp, " (%s%s, %u, %u)%s", loc, + components ? components : "", + var->data.driver_location, var->data.binding, var->data.compact ? " compact" : ""); } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] nir: Print the components referenced for split or packed shader in/outs.
On 18/10/17 07:52, Eric Anholt wrote: Having 4 variables all called "gl_in_TexCoord0@n" isn't very informative, much better to see: decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0 (VARYING_SLOT_VAR0.x, 1, 0) decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0@0 (VARYING_SLOT_VAR0.y, 1, 0) decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0@1 (VARYING_SLOT_VAR0.z, 1, 0) decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0@2 (VARYING_SLOT_VAR0.w, 1, 0) --- src/compiler/nir/nir_print.c | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index f4811fe8bc11..df7a2057bfb9 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -447,7 +447,30 @@ print_var_decl(nir_variable *var, print_state *state) loc = buf; } - fprintf(fp, " (%s, %u, %u)%s", loc, var->data.driver_location, var->data.binding, + /* For shader I/O vars that have been split to components or packed, + * print the fractional location within the input/output. + */ + unsigned int num_components = glsl_get_components(var->type); This needs to be: glsl_without_array(glsl_get_components(var->type)); + const char *components = NULL; + char components_local[6] = {'.' /* the rest is 0-filled */}; + switch (var->data.mode) { + case nir_var_shader_in: + case nir_var_shader_out: + if (num_components != 4) { +const char *xyzw = "xyzw"; +for (int i = 0; i < num_components; i++) + components_local[i + 1] = xyzw[i + var->data.location_frac]; + +components = components_local; + } + break; + default: + break; + } + + fprintf(fp, " (%s%s, %u, %u)%s", loc, + components ? components : "", + var->data.driver_location, var->data.binding, var->data.compact ? " compact" : ""); } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] nir: Print the components referenced for split or packed shader in/outs.
Having 4 variables all called "gl_in_TexCoord0@n" isn't very informative, much better to see: decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0 (VARYING_SLOT_VAR0.x, 1, 0) decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0@0 (VARYING_SLOT_VAR0.y, 1, 0) decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0@1 (VARYING_SLOT_VAR0.z, 1, 0) decl_var shader_in INTERP_MODE_NONE float gl_in_TexCoord0@2 (VARYING_SLOT_VAR0.w, 1, 0) --- src/compiler/nir/nir_print.c | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index f4811fe8bc11..df7a2057bfb9 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -447,7 +447,30 @@ print_var_decl(nir_variable *var, print_state *state) loc = buf; } - fprintf(fp, " (%s, %u, %u)%s", loc, var->data.driver_location, var->data.binding, + /* For shader I/O vars that have been split to components or packed, + * print the fractional location within the input/output. + */ + unsigned int num_components = glsl_get_components(var->type); + const char *components = NULL; + char components_local[6] = {'.' /* the rest is 0-filled */}; + switch (var->data.mode) { + case nir_var_shader_in: + case nir_var_shader_out: + if (num_components != 4) { +const char *xyzw = "xyzw"; +for (int i = 0; i < num_components; i++) + components_local[i + 1] = xyzw[i + var->data.location_frac]; + +components = components_local; + } + break; + default: + break; + } + + fprintf(fp, " (%s%s, %u, %u)%s", loc, + components ? components : "", + var->data.driver_location, var->data.binding, var->data.compact ? " compact" : ""); } -- 2.14.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev