[v10 1/4] d3dx9: Implement fxlc constants (expressions) in effect.

Paul Gofman gofmanp at gmail.com
Mon Apr 11 12:05:08 CDT 2016


On 04/11/2016 07:52 PM, Matteo Bruni wrote:
> 2016-04-07 17:41 GMT+02:00 Paul Gofman <gofmanp at gmail.com>:
>
>
>> +static HRESULT set_constants_param(struct d3dx_regstore *rs, struct d3dx_const_tab *const_tab,
>> +        D3DXHANDLE hc, struct d3dx_parameter *param)
>> +{
>> +    ID3DXConstantTable *ctab = const_tab->ctab;
>> +    D3DXCONSTANT_DESC desc;
>> +    unsigned int const_count, param_count, i, j, n, table, start_offset;
>> +    unsigned int minor, major, major_stride, param_offset;
>> +    BOOL transpose, get_element;
>> +
>> +    ID3DXConstantTable_GetConstantDesc(ctab, hc, &desc, &const_count);
> This isn't correct, although it currently works. const_count is
> supposed to be an inout parameter for GetConstantDesc() (you could
> potentially have multiple instances of the same constant in different
> register sets). The current implementation of GetConstantDesc()
> doesn't check the parameter and blindly returns only the first
> descriptor, also setting const_count to 1 (actually the following
> descriptors aren't even parsed currently by the constant table code
> IIRC) so this ends up working, although that's a bug and at some point
> it might get fixed which would in turn break this.
> Also it's a bit of an "overload" to use the same variable here and as
> the count of constant elements / members in the following lines, it's
> probably nicer to use two separate variables.
>
> BTW you're using GetConstantDesc() correctly in get_constants_desc().
>
I was looking into GetConstantsDesc() implementation to get the idea how
constants count can be > 1 there, and saw there that the count is
ultimately 1, that's why left it like that. Do you think it is OK just
to set count to 1 prior to the call? As I get MSDN text for this count >
1 is possible only for samplers and we should not get here for samplers
anyway.





More information about the wine-devel mailing list