diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index ff74a1182..9af4b9894 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -234,6 +234,8 @@ struct hlsl_type /* Offset where the type's description starts in the output bytecode, in bytes. */ size_t bytecode_offset; + bool is_typedef; + uint32_t is_minimum_precision : 1; }; diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 48200cb7f..5aee1e701 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1183,6 +1183,7 @@ static bool add_typedef(struct hlsl_ctx *ctx, struct hlsl_type *const orig_type, vkd3d_free((void *)type->name); type->name = v->name; + type->is_typedef = true; ret = hlsl_scope_add_type(ctx->cur_scope, type); if (!ret) @@ -8219,7 +8220,7 @@ type_no_void: | KW_STRUCT TYPE_IDENTIFIER { $$ = hlsl_get_type(ctx->cur_scope, $2, true, true); - if ($$->class != HLSL_CLASS_STRUCT) + if ($$->class != HLSL_CLASS_STRUCT || $$->is_typedef) hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_REDEFINED, "\"%s\" is not a structure.", $2); vkd3d_free($2); } diff --git a/tests/hlsl/struct-syntax.shader_test b/tests/hlsl/struct-syntax.shader_test index 4262a86d3..80448d822 100644 --- a/tests/hlsl/struct-syntax.shader_test +++ b/tests/hlsl/struct-syntax.shader_test @@ -33,7 +33,7 @@ return 0; } -[pixel shader fail todo(sm<6)] +[pixel shader fail] struct apple { float4 f;