vkd3d-shader/hlsl: Make HLSL_TYPE_TECHNIQUE into a separate class.

This commit is contained in:
Zebediah Figura 2024-02-06 17:15:48 -06:00 committed by Alexandre Julliard
parent 3c8c7426df
commit 76971d811e
Notes: Alexandre Julliard 2024-04-23 22:58:08 +02: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/811
6 changed files with 18 additions and 10 deletions

View File

@ -1519,6 +1519,7 @@ D3DXPARAMETER_CLASS hlsl_sm1_class(const struct hlsl_type *type)
return D3DXPC_OBJECT;
case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS:
case HLSL_CLASS_TECHNIQUE:
case HLSL_CLASS_UAV:
case HLSL_CLASS_VOID:
break;
@ -1618,6 +1619,7 @@ D3DXPARAMETER_TYPE hlsl_sm1_base_type(const struct hlsl_type *type)
case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS:
case HLSL_CLASS_TECHNIQUE:
case HLSL_CLASS_UAV:
case HLSL_CLASS_VOID:
break;

View File

@ -222,7 +222,7 @@ static bool technique_matches_version(const struct hlsl_ir_var *var, const struc
{
const struct hlsl_type *type = var->data_type;
if (type->base_type != HLSL_TYPE_TECHNIQUE)
if (type->class != HLSL_CLASS_TECHNIQUE)
return false;
return type->e.version >= fx->min_technique_version && type->e.version <= fx->max_technique_version;
@ -439,6 +439,7 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
case HLSL_CLASS_ARRAY:
case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS:
case HLSL_CLASS_TECHNIQUE:
vkd3d_unreachable();
case HLSL_CLASS_SAMPLER:
@ -839,6 +840,7 @@ static bool is_type_supported_fx_2(struct hlsl_ctx *ctx, const struct hlsl_type
case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS:
case HLSL_CLASS_TECHNIQUE:
/* This cannot appear as an extern variable. */
break;
}

View File

@ -367,6 +367,7 @@ static void hlsl_type_calculate_reg_size(struct hlsl_ctx *ctx, struct hlsl_type
case HLSL_CLASS_OBJECT:
case HLSL_CLASS_PASS:
case HLSL_CLASS_STRING:
case HLSL_CLASS_TECHNIQUE:
case HLSL_CLASS_VOID:
break;
}
@ -443,6 +444,7 @@ static bool type_is_single_component(const struct hlsl_type *type)
case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS:
case HLSL_CLASS_TECHNIQUE:
case HLSL_CLASS_VOID:
break;
}
@ -575,6 +577,7 @@ unsigned int hlsl_type_get_component_offset(struct hlsl_ctx *ctx, struct hlsl_ty
case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS:
case HLSL_CLASS_TECHNIQUE:
case HLSL_CLASS_VOID:
vkd3d_unreachable();
}
@ -949,6 +952,7 @@ unsigned int hlsl_type_component_count(const struct hlsl_type *type)
case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS:
case HLSL_CLASS_TECHNIQUE:
case HLSL_CLASS_VOID:
break;
}
@ -1005,9 +1009,9 @@ bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2
if (t1->class == HLSL_CLASS_ARRAY)
return t1->e.array.elements_count == t2->e.array.elements_count
&& hlsl_types_are_equal(t1->e.array.type, t2->e.array.type);
if (t1->class == HLSL_CLASS_OBJECT)
if (t1->class == HLSL_CLASS_TECHNIQUE)
{
if (t1->base_type == HLSL_TYPE_TECHNIQUE && t1->e.version != t2->e.version)
if (t1->e.version != t2->e.version)
return false;
}
@ -1097,9 +1101,8 @@ struct hlsl_type *hlsl_type_clone(struct hlsl_ctx *ctx, struct hlsl_type *old,
type->e.resource.format = old->e.resource.format;
break;
case HLSL_CLASS_OBJECT:
if (type->base_type == HLSL_TYPE_TECHNIQUE)
type->e.version = old->e.version;
case HLSL_CLASS_TECHNIQUE:
type->e.version = old->e.version;
break;
default:
@ -2368,6 +2371,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
case HLSL_CLASS_PASS:
case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_STRING:
case HLSL_CLASS_TECHNIQUE:
case HLSL_CLASS_VOID:
break;
}
@ -3672,7 +3676,7 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
for (i = 0; i < ARRAY_SIZE(technique_types); ++i)
{
type = hlsl_new_type(ctx, technique_types[i].name, HLSL_CLASS_OBJECT, HLSL_TYPE_TECHNIQUE, 1, 1);
type = hlsl_new_simple_type(ctx, technique_types[i].name, HLSL_CLASS_TECHNIQUE);
type->e.version = technique_types[i].version;
hlsl_scope_add_type(ctx->globals, type);
}

View File

@ -83,6 +83,7 @@ enum hlsl_type_class
HLSL_CLASS_PASS,
HLSL_CLASS_SAMPLER,
HLSL_CLASS_STRING,
HLSL_CLASS_TECHNIQUE,
HLSL_CLASS_TEXTURE,
HLSL_CLASS_UAV,
HLSL_CLASS_VOID,
@ -101,7 +102,6 @@ enum hlsl_base_type
HLSL_TYPE_VERTEXSHADER,
HLSL_TYPE_RENDERTARGETVIEW,
HLSL_TYPE_DEPTHSTENCILVIEW,
HLSL_TYPE_TECHNIQUE,
};
enum hlsl_sampler_dim
@ -145,8 +145,6 @@ struct hlsl_type
enum hlsl_type_class class;
/* If class is <= HLSL_CLASS_LAST_NUMERIC, then base_type is <= HLSL_TYPE_LAST_SCALAR.
* If class is HLSL_CLASS_OBJECT, then base_type is > HLSL_TYPE_LAST_SCALAR.
* If class is HLSL_CLASS_OBJECT and base_type is HLSL_TYPE_TECHNIQUE, additional version
* field is used to distinguish between technique types.
* Otherwise, base_type is not used. */
enum hlsl_base_type base_type;

View File

@ -1641,6 +1641,7 @@ static bool copy_propagation_transform_load(struct hlsl_ctx *ctx,
case HLSL_CLASS_EFFECT_GROUP:
case HLSL_CLASS_PASS:
case HLSL_CLASS_STRING:
case HLSL_CLASS_TECHNIQUE:
case HLSL_CLASS_VOID:
vkd3d_unreachable();
}

View File

@ -3012,6 +3012,7 @@ static D3D_SHADER_VARIABLE_CLASS sm4_class(const struct hlsl_type *type)
case HLSL_CLASS_PASS:
case HLSL_CLASS_SAMPLER:
case HLSL_CLASS_STRING:
case HLSL_CLASS_TECHNIQUE:
case HLSL_CLASS_TEXTURE:
case HLSL_CLASS_UAV:
case HLSL_CLASS_VOID: