Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/hlsl.h:
struct hlsl_type { + /* Linked list entry to store this hlsl_type in the context's linked list of hlsl_types. */ struct list entry; + /* Search tree entry to store this hlsl_type in the context's search tree of types. The type's + * name is used as key. */ struct rb_entry scope_entry; + /* These fields indicate to which category of hlsl_types this hlsl_type belongs. + * If type is HLSL_CLASS_OBJECT, base_type is used to indicate a subcategory of the type. + * If type is numeric, base_type is used to indicate the type of its components. + * base_type is not used when type is HLSL_CLASS_STRUCT or HLSL_CLASS_ARRAY. */ enum hlsl_type_class type; enum hlsl_base_type base_type; + /* Sampling dimension of the hlsl_type, in case it is a resource type, e.g. a texture or + * sampler. */ enum hlsl_sampler_dim sampler_dim; In general I think that it's useful if comments like this spell out the precise rules, because there is good chance that that's what you'll look for if you read it. Something like: If `base_type` is `HLSL_TYPE_SAMPLER` then these are the allowed values: ...; if `base_type` is `HLSL_TYPE_TEXTURE` then these are the allowed values: ...; etc.
-- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/38#note_12047