[PATCH 8/8] d3dx9: Use local dirty flags for shared parameters.

Matteo Bruni matteo.mystral at gmail.com
Fri Apr 21 12:12:35 CDT 2017


2017-04-20 13:26 GMT+02:00 Paul Gofman <gofmanp at gmail.com>:

As I somewhat hinted at in the previous patch, this one should
probably be merged with 7/8. It did help to keep them separated for
the first review pass though :)

> diff --git a/dlls/d3dx9_36/d3dx9_private.h b/dlls/d3dx9_36/d3dx9_private.h
> index d6d4280..f9cbf7c 100644
> --- a/dlls/d3dx9_36/d3dx9_private.h
> +++ b/dlls/d3dx9_36/d3dx9_private.h
> @@ -222,15 +222,14 @@ struct d3dx_parameter
>      {
>          struct d3dx_parameter *referenced_param;
>          struct d3dx_parameter *shared_param;
> +        struct d3dx_parameter **shared_param_list;

This name is a bit confusing given that it is an array of (pointers
to) matching parameters from different effects and shared_param is a
pointer to the shared pool parameter. It becomes less of an issue if
the new field moves to the separate shared parameter structure I
mentioned. Maybe just call it "parameters"?

> @@ -3193,7 +3196,16 @@ static void d3dx_pool_sync_shared_parameter(struct ID3DXEffectPoolImpl *pool, st
>          param_set_data_pointer(param, (unsigned char *)pool->parameters[i]->data, FALSE, TRUE);
>      }
>      new_refcount = InterlockedIncrement(&pool->parameters[i]->shared_refcount);
> +    if (new_refcount == 1)
> +        pool->parameters[i]->shared_param_list = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
> +                sizeof(*pool->parameters[i]->shared_param_list));
> +    else
> +        pool->parameters[i]->shared_param_list = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
> +                pool->parameters[i]->shared_param_list,
> +                sizeof(*pool->parameters[i]->shared_param_list) * new_refcount);

It's probably better to make an initial allocation for > 1 elements
and then expand by doubling the size, as usual with this kind of
stuff.



More information about the wine-devel mailing list