[PATCH vkd3d 03/12] vkd3d-shader/hlsl: Introduce hlsl_free_deref().

Francisco Casas fcasas at codeweavers.com
Tue Jul 5 11:44:13 CDT 2022



On 05-07-22 06:49, Henri Verbeet wrote:
> On Tue, 5 Jul 2022 at 12:11, Giovanni Mascellani
> <gmascellani at codeweavers.com> wrote:
>> Il 01/07/22 23:24, Francisco Casas ha scritto:
>>> +void hlsl_free_deref(struct hlsl_deref *deref)
>>> +{
>>> +    hlsl_src_remove(&deref->offset);
>>> +}
>>> +
>>
>> Again, mostly a nitpick, but personally when a function is called "free"
>> and receives a pointer, I assume that it will free the pointer itself
>> (after perhaps doing cleanup). Here there is the cleanup, but the
>> pointer is not freed, so I would rename to "hlsl_unlink_deref", for
>> example. Not sure if others agree with my sentiment.
> 
> The convention we had been using in wined3d and vkd3d for a while now
> is <object>_destroy() for functions that free the underlying storage,
> and <object>_cleanup() for functions that don't. Similarly, we have
> <object>_create() for functions that allocate storage, and
> <object>_init() for functions that don't. I'm not sure the HLSL
> compiler necessarily follows that convention though.
> 

Okay, so, I am going for 'cleanup_deref'.

I will rename it to 'hlsl_cleanup_deref' once it starts to be used 
outside hlsl.c and thus, cannot continue being static (Zeb's suggestion) 
in order to follow the convention.

This renaming adds a little noise to

vkd3d-shader/hlsl: Replace register offsets with index paths in parse code.



More information about the wine-devel mailing list