Hello,
May 3, 2022 7:14 AM, "Giovanni Mascellani" gmascellani@codeweavers.com wrote:
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"?
You are right!
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?
Huh, yes, it is.
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".
Thanks.
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.
For simplicity I will leave as it is for now. But we could introduce the check as another condition in the 'else if'.
Thanks, Giovanni.