Hi,
Il 03/05/22 11:57, Giovanni Mascellani ha scritto:
--- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -165,6 +165,8 @@ static void hlsl_type_calculate_reg_size(struct hlsl_ctx *ctx, struct hlsl_type { unsigned int element_size = type->e.array.type->reg_size;
if (type->e.array.elements_count == HLSL_ARRAY_ELEMENTS_COUNT_IMPLICIT)
type->reg_size = 0; if (is_sm4) type->reg_size = (type->e.array.elements_count - 1) * align(element_size, 4) + element_size; else
I guess "if (is_sm4)" should become an "else if"?
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 28b2ff1b..1dce223a 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -139,6 +139,7 @@ struct hlsl_type size_t bytecode_offset; };
- struct hlsl_semantic { const char *name;
I guess this is just a mistake?
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 44e4964f..eb96a4c2 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -789,7 +789,26 @@ static struct list *gen_struct_fields(struct hlsl_ctx *ctx,
field->type = type; for (i = 0; i < v->arrays.count; ++i)
{
if (v->arrays.sizes[i] == HLSL_ARRAY_ELEMENTS_COUNT_IMPLICIT)
{
if (i < v->arrays.count - 1)
{
hlsl_error(ctx, &v->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
"Inner array cannot be implicit.");
}
else if (type->type == HLSL_CLASS_OBJECT)
{
hlsl_fixme(ctx, &v->loc, "Unbounded resource arrays.");
}
else
{
hlsl_error(ctx, &v->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
"Implicit arrays not allowed in struct fieds.");
}
} field->type = hlsl_new_array_type(ctx, field->type, v->arrays.sizes[i]);
}
Minor typo: "fieds" instead of "fields".
It seems that unbounded texture arrays are not supported below shader model 5.1, so I wonder if the hlsl_fixme() should only be emitted when shader model >= 5.1. But maybe we can just ignore this point and leave it for when somebody will actually implement unbounded texture arrays.
Thanks, Giovanni.