Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/hlsl_codegen.c:
- if (!(var = hlsl_get_var(ctx->globals, name->buffer)))
- {
struct hlsl_type *data_type = hlsl_new_texture_type(ctx, sample->sampling_dim,
ctx->builtin_types.vector[HLSL_TYPE_FLOAT][4 - 1], 0);
unsigned int array_dims = sample->resource.path_len - path_len_to_sampler_array;
/* Create (possibly multi-dimensional) texture array type with the same dims as the sampler array. */
for (i = 0; i < array_dims; ++i)
{
struct hlsl_type *arr_type = sampler_array_type;
for (k = 1; k < array_dims - i; ++k)
{
assert(arr_type->class == HLSL_CLASS_ARRAY);
arr_type = arr_type->e.array.type;
}
If I am not mistaken, it makes sense to add another `assert(arr_type->class == HLSL_CLASS_ARRAY);` after the loop.