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

Matteo Bruni matteo.mystral at gmail.com
Tue Mar 15 12:32:32 CDT 2016


2016-03-15 8:33 GMT+01:00 Paul Gofman <gofmanp at gmail.com>:
> On 03/15/2016 05:54 AM, Matteo Bruni wrote:
>>
>> +static float regstore_get_float(struct d3dx_regstore *rs, unsigned int table, unsigned int offset)
>> +{
>> +    BYTE *p;
>> +
>> +    p = (BYTE *)rs->tables[table] + table_info[table].value_size * offset;
>> +    switch (table_info[table].type)
>> +    {
>> +        case PRES_VT_FLOAT : return *(float *)p;
>> +        case PRES_VT_DOUBLE: return *(double *)p;
>> +        case PRES_VT_INT   : return *(int *)p;
>> +        case PRES_VT_BOOL  : return *(BOOL *)p ? 1.0f : -0.0f;
>> I guess that -0.0f comes from some test?
> No, I just saw a lot of constructs in preshader disassembly like "cmp
> r1.x, c0.x, 1.0, -0.0", somehow they like to put -0.0 for immediate
> constants for such sort of cmp, and was thinking of this when I was
> writing it. There is currently no usecase I know for preshader inputting
> booleans or ints, so I can't test this. So I think this just need to be
> changed to normal 0.0.
>>
>> +HRESULT d3dx_param_eval_get_shader_parameters(struct d3dx_param_eval *peval, struct d3dx_parameter ***param,
>> +        unsigned int *nparam, D3DXCONSTANT_DESC **cdesc)
>> +{
>> +    *nparam = peval->shader_inputs.ninputs;
>> +    *param = peval->shader_inputs.inputs_param;
>> +    *cdesc = peval->shader_inputs.inputs;
>> +    return D3D_OK;
>> +}
>> You don't use this function in this patch either. Also it doesn't seem
>> useful, it isn't an improvement to just assigning those three pointers
>> directly in the caller IMO.
>>
> I would like to remove this function but then I will need to put the
> param_eval structure into shared header file (now there is only a
> forward declaration). Is it OK?

Sure. Hopefully it doesn't bring too much stuff in from preshader.c
(but it's not a problem if it does, we don't need to hide preshader
internals from effect.c).



More information about the wine-devel mailing list