Re: [Mesa-dev] [PATCH] nir: Don't print swizzles when there are more than 4 components

2017-10-28 Thread Eric Anholt
Jason Ekstrand  writes:

> On October 27, 2017 18:21:45 Matt Turner  wrote:
>
>> ... as can happen with various types like mat4, or else we'll smash the
>> stack writing past the end of components_local[].
>
> Ugh... Ideally, I think you'd want without_matrix() because a matrix is 
> just an array as far as interfaces go.  That said, I think this probably 
> fine for now.  R-b.

Oh, I thought I was getting the components-in-the-vectors, but needing
without_array should have tipped me off.


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] nir: Don't print swizzles when there are more than 4 components

2017-10-27 Thread Jason Ekstrand

On October 27, 2017 18:21:45 Matt Turner  wrote:


... as can happen with various types like mat4, or else we'll smash the
stack writing past the end of components_local[].


Ugh... Ideally, I think you'd want without_matrix() because a matrix is 
just an array as far as interfaces go.  That said, I think this probably 
fine for now.  R-b.


Tim, if you'd like to fix it for all the "fun" cases, that would he nice.



Fixes: 5a0d3e1129b7 ("nir: Print the components referenced for split or
  packed shader in/outs.")
---
Reproduce with INTEL_DEBUG=vs and
generated_tests/spec/arb_vertex_attrib_64bit/execution/vs_in/vs-input-float_mat4-position-double_double.shader_test

We could probably print better swizzles for dvecs too, which have more than
four components. Exercise to the reader :)

 src/compiler/nir/nir_print.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 4b7ad5c6ba..fcc8025346 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -457,7 +457,7 @@ print_var_decl(nir_variable *var, print_state *state)
   switch (var->data.mode) {
   case nir_var_shader_in:
   case nir_var_shader_out:
- if (num_components != 4 && num_components != 0) {
+ if (num_components < 4 && num_components != 0) {
 const char *xyzw = "xyzw";
 for (int i = 0; i < num_components; i++)
components_local[i + 1] = xyzw[i + var->data.location_frac];
--
2.13.6

___
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