vkd3d-shader/hlsl: Avoid hard-coding array sizes in hlsl_type_to_string().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Joshua Ashton 2021-11-08 21:39:27 -06:00 committed by Alexandre Julliard
parent ae4ff17b18
commit a55c51a2b7

View File

@ -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",