From a55c51a2b7a82e1d019ee834180ea7edd50d9356 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Mon, 8 Nov 2021 21:39:27 -0600 Subject: [PATCH] vkd3d-shader/hlsl: Avoid hard-coding array sizes in hlsl_type_to_string(). Signed-off-by: Zebediah Figura Signed-off-by: Henri Verbeet Signed-off-by: Giovanni Mascellani Signed-off-by: Matteo Bruni Signed-off-by: Alexandre Julliard --- libs/vkd3d-shader/hlsl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index c71eac3f..1eee4278 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -854,14 +854,14 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru { struct vkd3d_string_buffer *string; - static const char base_types[HLSL_TYPE_LAST_SCALAR + 1][7] = + static const char *const base_types[] = { - "float", - "half", - "double", - "int", - "uint", - "bool", + [HLSL_TYPE_FLOAT] = "float", + [HLSL_TYPE_HALF] = "half", + [HLSL_TYPE_DOUBLE] = "double", + [HLSL_TYPE_INT] = "int", + [HLSL_TYPE_UINT] = "uint", + [HLSL_TYPE_BOOL] = "bool", }; if (!(string = hlsl_get_string_buffer(ctx))) @@ -915,7 +915,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru case HLSL_CLASS_OBJECT: { - static const char dimensions[5][HLSL_SAMPLER_DIM_MAX + 1] = + static const char *const dimensions[] = { [HLSL_SAMPLER_DIM_1D] = "1D", [HLSL_SAMPLER_DIM_2D] = "2D",