[PATCH] d3dx9: Move object initialization into a separate function.

Matteo Bruni matteo.mystral at gmail.com
Tue Oct 8 18:12:31 CDT 2013


Hi Rico,

2013/10/8 Rico Schüller <kgbricola at web.de>:
> Hi,
>
> this moves the object initialization into a separate function, so it could
> be used for strings and resources. It also removes the STATE_TYPE as we
> could distinguish the types at the object level.
>
> 1. When an object has a destination, it points to another shader variable.
> This was state ST_PARAMETER.
>
> 2. If a variable has something in data, it is fxlc, shader (preshader) or a
> string. This was state ST_CONSTANT and ST_FXLC.
>
> 3. If it has both (destination and data), it points to an array of shader
> variables. The name is in the destination, the index could be calculated
> with the data. This will be added in a later patch.
>

There's still the issue of distinguishing between ST_CONSTANT and
ST_FXLC, checking object_id and type might cover that though.

> Also saving the destination parameter in the object gains some speed when we
> need to access the variable as we don't need to run get_parameter_by_name()
> each time we need the variable ...
>

I'm not sure storing additional info into the objects is the right
thing to do. Take a look at the D3DXFX_NOT_CLONEABLE flag from
http://msdn.microsoft.com/en-us/library/windows/desktop/bb172855%28v=vs.85%29.aspx.
Notice that GetPassDesc() doesn't return the shader data if the object
was created with the flag. What I've been thinking is that it simply
can't because the original shader data, stored in an object, were
freed after parsing.
While nothing forces us to do the same (except probably avoiding to
use more memory than strictly necessary) I think it's better not to
put additional stuff into the objects or generally assume that the
objects are still available after parsing. That means creating the
shaders and the strings at parse time or right after that and storing
any additional required information (e.g. preshader) in the parameter.

So, directly storing the referenced parameter is a good idea but I'd
prefer that pointer to be in d3dx_parameter.

> Cheers
> Rico
>
> ---
>  dlls/d3dx9_36/effect.c | 98
> ++++++++++++++++++--------------------------------
>  1 Datei geändert, 34 Zeilen hinzugefügt(+), 64 Zeilen entfernt(-)
>

Cheers,
Matteo



More information about the wine-devel mailing list