Re: [Mesa-dev] [RFC PATCH 10/12] glsl: add AoA support for an inteface with unsized array members
On Sun, Mar 22, 2015 at 2:09 AM, Timothy Arceri t_arc...@yahoo.com.au wrote: On Sat, 2015-03-21 at 19:57 -0400, Ilia Mirkin wrote: On Sat, Mar 21, 2015 at 5:49 AM, Timothy Arceri t_arc...@yahoo.com.au wrote: Add support for setting the max access of an unsized member of an interface array of arrays. For example ifc[j][k].foo[i] where foo is unsized. --- src/glsl/ast_array_index.cpp | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp index ecef651..481bba8 100644 --- a/src/glsl/ast_array_index.cpp +++ b/src/glsl/ast_array_index.cpp @@ -64,21 +64,29 @@ update_max_array_access(ir_rvalue *ir, int idx, YYLTYPE *loc, } } else if (ir_dereference_record *deref_record = ir-as_dereference_record()) { - /* There are two possibilities we need to consider: + /* There are three possibilities we need to consider: * * - Accessing an element of an array that is a member of a named * interface block (e.g. ifc.foo[i]) * * - Accessing an element of an array that is a member of a named * interface block array (e.g. ifc[j].foo[i]). + * + * - Accessing an element of an array that is a member of a named + * interface block array of arrays (e.g. ifc[j][k].foo[i]). */ ir_dereference_variable *deref_var = deref_record-record-as_dereference_variable(); if (deref_var == NULL) { - if (ir_dereference_array *deref_array = - deref_record-record-as_dereference_array()) { -deref_var = deref_array-array-as_dereference_variable(); + ir_dereference_array *deref_array = +deref_record-record-as_dereference_array(); + ir_dereference_array *deref_array_prev = NULL; + while (deref_array != NULL) { +deref_array_prev = deref_array; +deref_array = deref_array-array-as_dereference_array(); } + if (deref_array_prev != NULL) +deref_var = deref_array_prev-array-as_dereference_variable(); Hm... what will this variable be? An interface, or a dereference_array? I'm guessing the latter, but the code below wants the deref_var-var to be an interface. Is that still going to work? (Don't know the code well enough... so just asking the question.) We are going from the inside out like this: ifc[j][k] ifc[j] ifc So we should end up at the interface which is where the max_array_access information is stored. Also can you just do -array-as_dereference_array() / -as_dereference_variable() like that and expect it to work? I'd think only one of those would ever return non-null, but you end up doing both on the value pointed at by deref_array_prev-array... Yeah the last deref_array-array-as_dereference_array() call is expected to return null which is how we know that there are no more arrays and its time to exit the loop and call as_dereference_variable() Duh, of course. My bad :) } if (deref_var != NULL) { -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [RFC PATCH 10/12] glsl: add AoA support for an inteface with unsized array members
On Sat, 2015-03-21 at 19:57 -0400, Ilia Mirkin wrote: On Sat, Mar 21, 2015 at 5:49 AM, Timothy Arceri t_arc...@yahoo.com.au wrote: Add support for setting the max access of an unsized member of an interface array of arrays. For example ifc[j][k].foo[i] where foo is unsized. --- src/glsl/ast_array_index.cpp | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp index ecef651..481bba8 100644 --- a/src/glsl/ast_array_index.cpp +++ b/src/glsl/ast_array_index.cpp @@ -64,21 +64,29 @@ update_max_array_access(ir_rvalue *ir, int idx, YYLTYPE *loc, } } else if (ir_dereference_record *deref_record = ir-as_dereference_record()) { - /* There are two possibilities we need to consider: + /* There are three possibilities we need to consider: * * - Accessing an element of an array that is a member of a named * interface block (e.g. ifc.foo[i]) * * - Accessing an element of an array that is a member of a named * interface block array (e.g. ifc[j].foo[i]). + * + * - Accessing an element of an array that is a member of a named + * interface block array of arrays (e.g. ifc[j][k].foo[i]). */ ir_dereference_variable *deref_var = deref_record-record-as_dereference_variable(); if (deref_var == NULL) { - if (ir_dereference_array *deref_array = - deref_record-record-as_dereference_array()) { -deref_var = deref_array-array-as_dereference_variable(); + ir_dereference_array *deref_array = +deref_record-record-as_dereference_array(); + ir_dereference_array *deref_array_prev = NULL; + while (deref_array != NULL) { +deref_array_prev = deref_array; +deref_array = deref_array-array-as_dereference_array(); } + if (deref_array_prev != NULL) +deref_var = deref_array_prev-array-as_dereference_variable(); Hm... what will this variable be? An interface, or a dereference_array? I'm guessing the latter, but the code below wants the deref_var-var to be an interface. Is that still going to work? (Don't know the code well enough... so just asking the question.) We are going from the inside out like this: ifc[j][k] ifc[j] ifc So we should end up at the interface which is where the max_array_access information is stored. Also can you just do -array-as_dereference_array() / -as_dereference_variable() like that and expect it to work? I'd think only one of those would ever return non-null, but you end up doing both on the value pointed at by deref_array_prev-array... Yeah the last deref_array-array-as_dereference_array() call is expected to return null which is how we know that there are no more arrays and its time to exit the loop and call as_dereference_variable() } if (deref_var != NULL) { -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [RFC PATCH 10/12] glsl: add AoA support for an inteface with unsized array members
On Sat, Mar 21, 2015 at 5:49 AM, Timothy Arceri t_arc...@yahoo.com.au wrote: Add support for setting the max access of an unsized member of an interface array of arrays. For example ifc[j][k].foo[i] where foo is unsized. --- src/glsl/ast_array_index.cpp | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp index ecef651..481bba8 100644 --- a/src/glsl/ast_array_index.cpp +++ b/src/glsl/ast_array_index.cpp @@ -64,21 +64,29 @@ update_max_array_access(ir_rvalue *ir, int idx, YYLTYPE *loc, } } else if (ir_dereference_record *deref_record = ir-as_dereference_record()) { - /* There are two possibilities we need to consider: + /* There are three possibilities we need to consider: * * - Accessing an element of an array that is a member of a named * interface block (e.g. ifc.foo[i]) * * - Accessing an element of an array that is a member of a named * interface block array (e.g. ifc[j].foo[i]). + * + * - Accessing an element of an array that is a member of a named + * interface block array of arrays (e.g. ifc[j][k].foo[i]). */ ir_dereference_variable *deref_var = deref_record-record-as_dereference_variable(); if (deref_var == NULL) { - if (ir_dereference_array *deref_array = - deref_record-record-as_dereference_array()) { -deref_var = deref_array-array-as_dereference_variable(); + ir_dereference_array *deref_array = +deref_record-record-as_dereference_array(); + ir_dereference_array *deref_array_prev = NULL; + while (deref_array != NULL) { +deref_array_prev = deref_array; +deref_array = deref_array-array-as_dereference_array(); } + if (deref_array_prev != NULL) +deref_var = deref_array_prev-array-as_dereference_variable(); Hm... what will this variable be? An interface, or a dereference_array? I'm guessing the latter, but the code below wants the deref_var-var to be an interface. Is that still going to work? (Don't know the code well enough... so just asking the question.) Also can you just do -array-as_dereference_array() / -as_dereference_variable() like that and expect it to work? I'd think only one of those would ever return non-null, but you end up doing both on the value pointed at by deref_array_prev-array... } if (deref_var != NULL) { -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev