Francisco Jerez <curroje...@riseup.net> writes:

> This seems rather silly and would lead to memory corruption if the
> size of a VGRF was allowed to be zero.
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
> b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 960ea54..eafd676 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -1565,16 +1565,12 @@ fs_visitor::split_virtual_grfs()
>  
>     int reg = 0;
>     for (int i = 0; i < num_vars; i++) {
> +      int offset = 0;
> +
>        /* The first one should always be 0 as a quick sanity check. */
>        assert(split_points[reg] == false);
>  

For correctness I've also changed this assertion locally to read
"reg_count == reg || split_points[reg] == false".

> -      /* j = 0 case */
> -      new_reg_offset[reg] = 0;
> -      reg++;
> -      int offset = 1;
> -
> -      /* j > 0 case */
> -      for (unsigned j = 1; j < alloc.sizes[i]; j++) {
> +      for (unsigned j = 0; j < alloc.sizes[i]; j++) {
>           /* If this is a split point, reset the offset to 0 and allocate a
>            * new virtual GRF for the previous offset many registers
>            */
> -- 
> 2.4.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Attachment: signature.asc
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to