[v4 3/6] d3dx9: implement fxlc constants (expressions) in effect.

Paul Gofman gofmanp at gmail.com
Mon Mar 21 04:18:50 CDT 2016


On 03/19/2016 02:28 AM, Paul Gofman wrote:
> On 03/19/2016 12:56 AM, Matteo Bruni wrote:
>>> +    while (param->member_count && param->element_count)
>>> +    {
>>> +        if (param->element_count > 1)
>>> +        {
>>> +            FIXME("Unexpected param having both elements and members.\n");
>>> +            return D3DERR_INVALIDCALL;
>>> +        }
>>> +        param = &param->members[0];
>>> +    }
>> I don't quite understand what you're trying to do here but it doesn't
>> look right.
>>
> That is related to the strange case I met in the real world effect data
> when the parameter has structure class, element_count 1, member_count >
> 1. As I understood from the pre-existing effect parsing code,
> element_count 1 together with member_count > 0 (and > 1) is legal. When
> element_count is 1, and member_count > 1, members contain an "array" of
> 1 element, which is actual struct parameter with element_count = 0 and
> member_count is the same as in parent weird parameter. It is what
> existing d3dx9_parse_effect_typedef understands (element_count is taking
> precedence over member_count). I could not reproduce this struct
> representation compiling effect from fxc code yet, but seen it in real
> world effect. CTAB structure in the shader which correspond to used that
> strange struct parameter does not have this weirdness and has element
> count 0, so I cannot match CTAB parameter to effect parameter without
> going a level deeper in effect parameter.
>
> The existing effect parsing code clearly assumes that if both
> element_count > 0 and member_count > 0, element_count is taking
> precedence (that is, members array has element_count elements). I am not
> sure if it considers illegal element_count > 1 and member_count > 0, but
> I do not know currently how to treat this (if it is ever possible) as
> did not see such an example, so currently this is a FIXME in the code
> (which will hopefully never happen).
>
>
I reproduced this uneven case in a test, this corresponds to an array of
structs having the size of 1. Unlike this case, the case when array of
structs is greater in size does not have any "weirdness" but result in
member_count > 0, and element_count > 0, and so far causes the error in
the current code. I am adding array tests to the test scenario (struct
array of size 1 and 2, and "usual" array of size 1 and 2), and changing
this place to match all the cases correctly.





More information about the wine-devel mailing list