On 05-07-22 06:49, Henri Verbeet wrote:
On Tue, 5 Jul 2022 at 12:11, Giovanni Mascellani gmascellani@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.