From 3c8c7426dfd533010808f3e812c2ce27d6755c4c Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Tue, 6 Feb 2024 17:08:01 -0600 Subject: [PATCH] vkd3d-shader/hlsl: Make HLSL_TYPE_PASS into a separate class. --- libs/vkd3d-shader/d3dbc.c | 2 ++ libs/vkd3d-shader/fx.c | 2 ++ libs/vkd3d-shader/hlsl.c | 7 ++++++- libs/vkd3d-shader/hlsl.h | 2 +- libs/vkd3d-shader/hlsl_codegen.c | 1 + libs/vkd3d-shader/tpf.c | 1 + 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c index 971db6b3..4ce15b13 100644 --- a/libs/vkd3d-shader/d3dbc.c +++ b/libs/vkd3d-shader/d3dbc.c @@ -1518,6 +1518,7 @@ D3DXPARAMETER_CLASS hlsl_sm1_class(const struct hlsl_type *type) case HLSL_CLASS_TEXTURE: return D3DXPC_OBJECT; case HLSL_CLASS_EFFECT_GROUP: + case HLSL_CLASS_PASS: case HLSL_CLASS_UAV: case HLSL_CLASS_VOID: break; @@ -1616,6 +1617,7 @@ D3DXPARAMETER_TYPE hlsl_sm1_base_type(const struct hlsl_type *type) return D3DXPT_STRING; case HLSL_CLASS_EFFECT_GROUP: + case HLSL_CLASS_PASS: case HLSL_CLASS_UAV: case HLSL_CLASS_VOID: break; diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index d2218a50..78d827d7 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -438,6 +438,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: vkd3d_unreachable(); case HLSL_CLASS_SAMPLER: @@ -837,6 +838,7 @@ static bool is_type_supported_fx_2(struct hlsl_ctx *ctx, const struct hlsl_type return false; case HLSL_CLASS_EFFECT_GROUP: + case HLSL_CLASS_PASS: /* This cannot appear as an extern variable. */ break; } diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index a835c185..a355f210 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -365,6 +365,7 @@ static void hlsl_type_calculate_reg_size(struct hlsl_ctx *ctx, struct hlsl_type case HLSL_CLASS_EFFECT_GROUP: case HLSL_CLASS_OBJECT: + case HLSL_CLASS_PASS: case HLSL_CLASS_STRING: case HLSL_CLASS_VOID: break; @@ -441,6 +442,7 @@ static bool type_is_single_component(const struct hlsl_type *type) return false; case HLSL_CLASS_EFFECT_GROUP: + case HLSL_CLASS_PASS: case HLSL_CLASS_VOID: break; } @@ -572,6 +574,7 @@ unsigned int hlsl_type_get_component_offset(struct hlsl_ctx *ctx, struct hlsl_ty break; case HLSL_CLASS_EFFECT_GROUP: + case HLSL_CLASS_PASS: case HLSL_CLASS_VOID: vkd3d_unreachable(); } @@ -945,6 +948,7 @@ unsigned int hlsl_type_component_count(const struct hlsl_type *type) return 1; case HLSL_CLASS_EFFECT_GROUP: + case HLSL_CLASS_PASS: case HLSL_CLASS_VOID: break; } @@ -2361,6 +2365,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru case HLSL_CLASS_EFFECT_GROUP: case HLSL_CLASS_OBJECT: + case HLSL_CLASS_PASS: case HLSL_CLASS_SAMPLER: case HLSL_CLASS_STRING: case HLSL_CLASS_VOID: @@ -3538,7 +3543,6 @@ static void declare_predefined_types(struct hlsl_ctx *ctx) {"dword", HLSL_CLASS_SCALAR, HLSL_TYPE_UINT, 1, 1}, {"vector", HLSL_CLASS_VECTOR, HLSL_TYPE_FLOAT, 4, 1}, {"matrix", HLSL_CLASS_MATRIX, HLSL_TYPE_FLOAT, 4, 4}, - {"pass", HLSL_CLASS_OBJECT, HLSL_TYPE_PASS, 1, 1}, {"pixelshader", HLSL_CLASS_OBJECT, HLSL_TYPE_PIXELSHADER, 1, 1}, {"vertexshader", HLSL_CLASS_OBJECT, HLSL_TYPE_VERTEXSHADER, 1, 1}, {"RenderTargetView",HLSL_CLASS_OBJECT, HLSL_TYPE_RENDERTARGETVIEW, 1, 1}, @@ -3655,6 +3659,7 @@ static void declare_predefined_types(struct hlsl_ctx *ctx) ctx->builtin_types.Void = hlsl_new_simple_type(ctx, "void", HLSL_CLASS_VOID); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "fxgroup", HLSL_CLASS_EFFECT_GROUP)); + hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "pass", HLSL_CLASS_PASS)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "STRING", HLSL_CLASS_STRING)); hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "texture", HLSL_CLASS_TEXTURE)); diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index e38963ae..4f7adf62 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -80,6 +80,7 @@ enum hlsl_type_class HLSL_CLASS_ARRAY, HLSL_CLASS_OBJECT, HLSL_CLASS_EFFECT_GROUP, + HLSL_CLASS_PASS, HLSL_CLASS_SAMPLER, HLSL_CLASS_STRING, HLSL_CLASS_TEXTURE, @@ -98,7 +99,6 @@ enum hlsl_base_type HLSL_TYPE_LAST_SCALAR = HLSL_TYPE_BOOL, HLSL_TYPE_PIXELSHADER, HLSL_TYPE_VERTEXSHADER, - HLSL_TYPE_PASS, HLSL_TYPE_RENDERTARGETVIEW, HLSL_TYPE_DEPTHSTENCILVIEW, HLSL_TYPE_TECHNIQUE, diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index cba58080..9afabcf5 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -1639,6 +1639,7 @@ static bool copy_propagation_transform_load(struct hlsl_ctx *ctx, return false; case HLSL_CLASS_EFFECT_GROUP: + case HLSL_CLASS_PASS: case HLSL_CLASS_STRING: case HLSL_CLASS_VOID: vkd3d_unreachable(); diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index 9bc4e488..b933c246 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -3009,6 +3009,7 @@ static D3D_SHADER_VARIABLE_CLASS sm4_class(const struct hlsl_type *type) case HLSL_CLASS_EFFECT_GROUP: case HLSL_CLASS_STRUCT: case HLSL_CLASS_OBJECT: + case HLSL_CLASS_PASS: case HLSL_CLASS_SAMPLER: case HLSL_CLASS_STRING: case HLSL_CLASS_TEXTURE: