vkd3d-shader/hlsl: Avoid using HLSL_CLASS_OBJECT without checking the base type.

As the diffstat shows, HLSL_CLASS_OBJECT does not really have much in common.
Resource types (TEXTURE, SAMPLER, UAV) sometimes behave similarly to each other,
but do not generally behave similarly to effect-specific types (string, shader,
state, view). Most consumers of HLSL_CLASS_OBJECT subsequently check the base
type anyway.

Hence we want to replace HLSL_TYPE_* with individual classes for object types.
As a first step, change the last few places that only check HLSL_CLASS_OBJECT.
This commit is contained in:
Zebediah Figura
2024-01-26 17:29:54 -06:00
committed by Alexandre Julliard
parent 269cdad7b9
commit 0e3377a1be
Notes: Alexandre Julliard 2024-04-09 15:45:34 -05:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/757
4 changed files with 11 additions and 22 deletions

View File

@@ -1570,7 +1570,10 @@ bool hlsl_index_is_noncontiguous(struct hlsl_ir_index *index)
bool hlsl_index_is_resource_access(struct hlsl_ir_index *index)
{
return index->val.node->data_type->class == HLSL_CLASS_OBJECT;
const struct hlsl_type *type = index->val.node->data_type;
return type->class == HLSL_CLASS_OBJECT
&& (type->base_type == HLSL_TYPE_TEXTURE || type->base_type == HLSL_TYPE_UAV);
}
bool hlsl_index_chain_has_resource_access(struct hlsl_ir_index *index)