[PATCH v2 3/4] d3dx9: Handle short parameter in d3dx_set_shader_const_state().

Matteo Bruni matteo.mystral at gmail.com
Thu Feb 14 17:43:17 CST 2019


On Wed, Feb 13, 2019 at 7:05 PM Paul Gofman <gofmanp at gmail.com> wrote:
> @@ -2927,28 +2933,61 @@ static HRESULT d3dx_set_shader_const_state(struct ID3DXEffectImpl *effect, enum
>          FIXME("Unexpected param type %u.\n", param->type);
>          return D3DERR_INVALIDCALL;
>      }
> -    if (param->bytes % const_tbl[op].elem_size != 0)
> +
> +    if (param->bytes % const_tbl[op].elem_size)
>      {
> -        FIXME("Unexpected param size %u, rows %u, cols %u.\n", param->bytes, param->rows, param->columns);
> -        return D3DERR_INVALIDCALL;
> +        TRACE("Parameter size %u, rows %u, cols %u.\n", param->bytes, param->rows, param->columns);
> +
> +        if (++element_count > 1)
> +        {
> +            WARN("Setting %u elements.\n", element_count);
> +            buffer = HeapAlloc(GetProcessHeap(), 0, const_tbl[op].elem_size * element_count);

I think using heap_calloc() here (and heap_free() below) would be a
bit better. You could then also, in theory, skip the memset() for the
heap case; not sure if that's an improvement though.



More information about the wine-devel mailing list