[PATCH vkd3d 02/12] vkd3d-shader/hlsl: Pass field to add_record_load() via index.

Francisco Casas fcasas at codeweavers.com
Tue Jul 5 10:15:16 CDT 2022


On 05-07-22 06:38, Henri Verbeet wrote:
> On Tue, 5 Jul 2022 at 11:26, Giovanni Mascellani
> <gmascellani at codeweavers.com> wrote:
>> It's not a big deal, but this interface looks more complicated than it
>> should for such a simple thing. Maybe we could just return the field
>> index and the caller can dereference the array if needed?
> 
> Right, you should only ever need one or the other. (I.e., &fields[i] -
> fields == i)
> 

I can do it but I would have to return a magic value (I am thinking on 
-1) when the field is not found, given the current uses of 
get_struct_field().

Alternatively, I can change the return type to bool and return false 
when the field is not found. This seems better.

I can also split the function into a get_struct_field() and a 
has_struct_field(), but I don't like the idea.




More information about the wine-devel mailing list