From: Zebediah Figura Subject: [PATCH vkd3d 4/5] vkd3d-shader: Store the register type for reservations as a char. Message-Id: <20210601024114.23330-4-zfigura@codeweavers.com> Date: Mon, 31 May 2021 21:41:13 -0500 In-Reply-To: <20210601024114.23330-1-zfigura@codeweavers.com> References: <20210601024114.23330-1-zfigura@codeweavers.com> Essentially because the meaning of 'b' differs between SM1-3 and SM4+. Signed-off-by: Zebediah Figura --- libs/vkd3d-shader/hlsl.h | 2 +- libs/vkd3d-shader/hlsl.y | 22 +--------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 4fe90a91..906d864d 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -212,7 +212,7 @@ struct hlsl_src struct hlsl_reg_reservation { - enum vkd3d_shader_register_type type; + char type; DWORD regnum; }; diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index cab46aee..d8ad1f98 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -782,29 +782,9 @@ static bool add_func_parameter(struct hlsl_ctx *ctx, struct list *list, static struct hlsl_reg_reservation *parse_reg_reservation(struct hlsl_ctx *ctx, const char *reg_string) { - enum vkd3d_shader_register_type type; struct hlsl_reg_reservation *reg_res; DWORD regnum = 0; - switch (reg_string[0]) - { - case 'c': - type = VKD3DSPR_CONST; - break; - case 'i': - type = VKD3DSPR_CONSTINT; - break; - case 'b': - type = VKD3DSPR_CONSTBOOL; - break; - case 's': - type = VKD3DSPR_SAMPLER; - break; - default: - FIXME("Unsupported register type.\n"); - return NULL; - } - if (!sscanf(reg_string + 1, "%u", ®num)) { FIXME("Unsupported register reservation syntax.\n"); @@ -813,7 +793,7 @@ static struct hlsl_reg_reservation *parse_reg_reservation(struct hlsl_ctx *ctx, if (!(reg_res = hlsl_alloc(ctx, sizeof(*reg_res)))) return NULL; - reg_res->type = type; + reg_res->type = reg_string[0]; reg_res->regnum = regnum; return reg_res; } -- 2.31.1