[v2 2/3] d3dx9: Use magic number instead of parameter tables for parameter handles.

Matteo Bruni matteo.mystral at gmail.com
Thu Apr 13 12:55:22 CDT 2017


2017-04-11 15:58 GMT+02:00 Paul Gofman <gofmanp at gmail.com>:
> Signed-off-by: Paul Gofman <gofmanp at gmail.com>

>  static struct d3dx_parameter *get_valid_parameter(struct d3dx9_base_effect *base, D3DXHANDLE parameter)
>  {
> -    struct d3dx_parameter **handle_param = (struct d3dx_parameter **)parameter;
> +    struct d3dx_parameter *handle_param = (struct d3dx_parameter *)parameter;
>
> -    if (handle_param >= base->param_table.table && handle_param < base->param_table.table + base->param_table.count)
> -        return *handle_param;
> +    if (handle_param && !strncmp(handle_param->magic_string, parameter_magic_string,
> +            sizeof(parameter_magic_string)))
> +        return handle_param;
>
>      return get_parameter_by_name(base, NULL, parameter);
>  }

Not new and somewhat separate from the patch, although it gets "more
interesting" with the new handles scheme: we should probably avoid the
call to get_parameter_by_name() if the effect was created with the
D3DXFX_LARGEADDRESSAWARE flag, returning NULL instead. Worth a test I
think.



More information about the wine-devel mailing list