[Mesa-dev] [PATCH v2 22/30] i965/vec4: handle doubles in type_size_vec4()

Francisco Jerez currojerez at riseup.net
Sat May 14 00:34:37 UTC 2016


Samuel Iglesias Gonsálvez <siglesias at igalia.com> writes:

> From: Iago Toral Quiroga <itoral at igalia.com>
>
> The scalar backend uses this to check URB input sizes.
> ---
>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> index 507f2ee..a0e18c6 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> @@ -587,16 +587,20 @@ type_size_vec4(const struct glsl_type *type)
>     case GLSL_TYPE_INT:
>     case GLSL_TYPE_FLOAT:
>     case GLSL_TYPE_BOOL:
> +   case GLSL_TYPE_DOUBLE:
>        if (type->is_matrix()) {
> -	 return type->matrix_columns;
> +         const glsl_type *col_type = type->column_type();
> +         unsigned col_slots = col_type->is_dual_slot_double() ? 2 : 1;
> +         return type->matrix_columns * col_slots;
>        } else {
>  	 /* Regardless of size of vector, it gets a vec4. This is bad
>  	  * packing for things like floats, but otherwise arrays become a
>  	  * mess.  Hopefully a later pass over the code can pack scalars
>  	  * down if appropriate.
>  	  */
> -	 return 1;
> +         return type->is_dual_slot_double() ? 2 : 1;
>        }
> +      break;

Redundant break after return -- With that cleaned up:

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

>     case GLSL_TYPE_ARRAY:
>        assert(type->length > 0);
>        return type_size_vec4(type->fields.array) * type->length;
> @@ -619,7 +623,6 @@ type_size_vec4(const struct glsl_type *type)
>     case GLSL_TYPE_IMAGE:
>        return DIV_ROUND_UP(BRW_IMAGE_PARAM_SIZE, 4);
>     case GLSL_TYPE_VOID:
> -   case GLSL_TYPE_DOUBLE:
>     case GLSL_TYPE_ERROR:
>     case GLSL_TYPE_INTERFACE:
>     case GLSL_TYPE_FUNCTION:
> -- 
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160513/7812d5ba/attachment.sig>


More information about the mesa-dev mailing list