[PATCH 5/5] d3dcompiler: Parse variable declarations.

Matteo Bruni matteo.mystral at gmail.com
Tue Jun 5 07:48:43 CDT 2012

2012/6/5 Matteo Bruni <matteo.mystral at gmail.com>:
> 2012/6/5 Rico Schüller <kgbricola at web.de>:
>> Am 05.06.2012 13:08, schrieb Matteo Bruni:
>>> 2012/6/5 Stefan Dösinger<stefandoesinger at gmx.at>:
>>>> Am Montag, 4. Juni 2012, 17:58:24 schrieb Matteo Bruni:
>>>>> +struct hlsl_type
>>>>> +{
>>>>> ...
>>>>> +    unsigned int dimx;
>>>>> +    unsigned int dimy;
>>>>> ...
>>>>> +};
>>>> One thing I noticed when I wrote my compiler was that a float1x1 is not
>>>> the
>>>> same as a float1 or float. I did not implement this difference nor do I
>>>> know
>>>> if any games depend on it.
>>>> (That's no reason to hold up this patch, just something to keep in mind
>>>> for
>>>> further work)
>>> Yeah, I noticed that too, but it doesn't seem to make much of a
>>> difference in practice. Of course, if later on it shows that it
>>> actually matters for something relevant, I'll change things
>>> accordingly.
>> For the effect interface, it makes a difference. See
>> http://source.winehq.org/git/wine.git/blob/90f93e3819dcaa0cea16bd297fa69a359fb6b517:/dlls/d3dx9_36/tests/effect.c#l320
>> and
>> http://source.winehq.org/git/wine.git/blob/90f93e3819dcaa0cea16bd297fa69a359fb6b517:/dlls/d3dx9_36/tests/effect.c#l501
>> . The difference is the type D3DXPC_SCALAR vs D3DXPC_VECTOR vs
>> D3DXPC_MATRIX_ROWS and of course some different handling, see
>> http://source.winehq.org/git/wine.git/blob/90f93e3819dcaa0cea16bd297fa69a359fb6b517:/dlls/d3dx9_36/tests/effect.c#l1191
>> . A test may help to check how variables in shaders are handled.
>> Cheers
>> Rico

Oops, I misclicked on the send button, sorry for the spam...

I just did a quick test. It looks like that the actual generated code
does not change but the constant table is affected by the
scalar/vector/matrix type similarly to the effect interface stuff.
Since the compiler seems to preserve the type of the constant, I guess
in general this may matter, after all...

So I presume I'll add another field to the hlsl_type structure in the
near future to keep track of the scalar/vector/matrix type or
something like that. Anyway this patch is not affected by this detail,
so I think it is still good to go.

BTW, thanks for the comments :)

More information about the wine-devel mailing list