[PATCH vkd3d 4/8] tests: Add additional subtests to implicit array initialization.

Giovanni Mascellani gmascellani at codeweavers.com
Tue May 3 05:30:14 CDT 2022


Hi,

Il 03/05/22 11:57, Giovanni Mascellani ha scritto:
> +[pixel shader fail]
> +// Implicit size array without initializer
> +float4 main() : sv_target
> +{
> +    float4 arr[];
> +    arr[0] = float4(1, 2, 3, 4);
> +    arr[1] = float4(5, 6, 7, 8);
> +    return arr[0];
> +}

While this is not wrong, I'd suggest to make tests meant to fail more 
minimal, so they are as specific as possible. In this case, for example, 
if our compile accepted "float4 arr[]" and then failed on actually 
accessing the array, the test wouldn't help us detect the mistake. 
Instead, I'd just write something like:
---
float4 arr[];
return 0.0;
---
so that it's clear that the line "float4 arr[]" itself must be 
considered an error, not anything else.

The general principle is: in a test meant to fail, try to avoid adding 
any language feature that is not the specific one meant to be 
demonstrated failing.

The same applies to a few other tests.

> +[pixel shader fail]
> +// Implicit size array as a typedef
> +float4 main() : sv_target
> +{
> +    float2 arr1[4] = {1, 2, 3, 4, 5, 6, 7, 8};
> +    float4 arr2[2] = (float2 []) arr1;
> +    return arr2[1];
> +}

There is no typedef here. Just a cast.

Thanks, Giovanni.



More information about the wine-devel mailing list