[PATCH v3 8/9] d3dx9: Implement recording parameters to parameter block.

Paul Gofman gofmanp at gmail.com
Mon Nov 18 10:17:39 CST 2019

On 11/18/19 19:02, Matteo Bruni wrote:
> On Thu, Nov 14, 2019 at 3:45 PM Paul Gofman <gofmanp at gmail.com> wrote:
>> +static void *parameter_get_update_data(struct d3dx_effect *effect, struct d3dx_parameter *param,
>> +        unsigned int bytes, BOOL value_changed)
>> +{
>> +    assert(bytes <= param->bytes);
>> +
>> +    if (value_changed && !effect->current_parameter_block)
>> +        set_dirty(param);
>> +
>> +    return effect->current_parameter_block ? record_parameter(effect, param, bytes) : param->data;
>> +}
> I'm not entirely satisfied with this function (or possibly just its
> name). What's a bit annoying is that this sometimes it has a side
> effect (setting the parameter dirty), which is something one wouldn't
> normally expect from a "get". I don't think I have good suggestions
> though. It does have a vague resemblance to the
> texture_bind_and_dirtify() function in wined3d, so maybe simply call
> it param_get_and_flag_data() or something like that?

I suppose having a single function is much better than calling
set_dirty() explicitly each time in addition to this one, given how many
places this is needed in. Yes, I see that ..get..() name with the side
effect is not very nice, I will change to param_get_and_flag_data().

More information about the wine-devel mailing list