[v5 2/3] d3dx9: Get rid of constant's length checking for matrix in set_constants().

Matteo Bruni matteo.mystral at gmail.com
Tue Jun 27 13:34:33 CDT 2017


2017-06-22 15:11 GMT+02:00 Paul Gofman <gofmanp at gmail.com>:
> When count in const_upload_info is calculated precisely (considering actual
> constant set length), boolean matrix setting fall in direct copy path, unless
> transpose is required. The case of incomplete last row for matrix should be
> handled in set_constants() for transposed boolean constant only.
>
> Signed-off-by: Paul Gofman <gofmanp at gmail.com>
> ---
> v5:
>     - added check for constant size not exceeding parameter size. The check for
>       non array, non struct constants should be sufficient as the dimensions of
>       arrays and structs are derived from const_set data and register counts
>       from constant description is not used for them.

I don't understand what you mean here.

> @@ -1417,6 +1433,16 @@ static HRESULT init_set_constants_param(struct d3dx_const_tab *const_tab, ID3DXC
>              && !info.transpose && info.minor == info.major_stride
>              && info.count == get_offset_reg(const_set.table, const_set.register_count)
>              && info.count * sizeof(unsigned int) <= param->bytes;
> +    if (info.minor_remainder && !const_set.direct_copy && !info.transpose)
> +        FIXME("Incomplete last row for not transposed matrix which cannot be directly copied, parameter %s.\n",
> +                debugstr_a(param->name));
> +
> +    if (info.major_count > info.major
> +            || (info.major_count == info.major && info.minor_remainder))
> +    {
> +        WARN("Constant dimensions exceed parameter size.\n");
> +        return D3DERR_INVALIDCALL;
> +    }

It seems to me that this catches all the problematic cases.



More information about the wine-devel mailing list