mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Add a scope for technique variables.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
0a6d842ed1
commit
e1dca9b27a
Notes:
Alexandre Julliard
2024-01-15 23:02:43 +01:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/560
@ -1096,8 +1096,8 @@ static bool add_func_parameter(struct hlsl_ctx *ctx, struct hlsl_func_parameters
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool add_technique(struct hlsl_ctx *ctx, const char *name, const char *typename,
|
static bool add_technique(struct hlsl_ctx *ctx, const char *name, struct hlsl_scope *scope,
|
||||||
const struct vkd3d_shader_location *loc)
|
const char *typename, const struct vkd3d_shader_location *loc)
|
||||||
{
|
{
|
||||||
struct hlsl_ir_var *var;
|
struct hlsl_ir_var *var;
|
||||||
struct hlsl_type *type;
|
struct hlsl_type *type;
|
||||||
@ -1105,6 +1105,7 @@ static bool add_technique(struct hlsl_ctx *ctx, const char *name, const char *ty
|
|||||||
type = hlsl_get_type(ctx->globals, typename, false, false);
|
type = hlsl_get_type(ctx->globals, typename, false, false);
|
||||||
if (!(var = hlsl_new_var(ctx, name, type, loc, NULL, 0, NULL)))
|
if (!(var = hlsl_new_var(ctx, name, type, loc, NULL, 0, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
var->scope = scope;
|
||||||
|
|
||||||
if (!hlsl_add_var(ctx, var, false))
|
if (!hlsl_add_var(ctx, var, false))
|
||||||
{
|
{
|
||||||
@ -5155,35 +5156,52 @@ name_opt:
|
|||||||
}
|
}
|
||||||
| any_identifier
|
| any_identifier
|
||||||
|
|
||||||
|
pass:
|
||||||
|
KW_PASS name_opt '{' '}'
|
||||||
|
|
||||||
pass_list:
|
pass_list:
|
||||||
%empty
|
pass
|
||||||
|
| pass_list pass
|
||||||
|
|
||||||
|
passes:
|
||||||
|
scope_start
|
||||||
|
| scope_start pass_list
|
||||||
|
|
||||||
technique9:
|
technique9:
|
||||||
KW_TECHNIQUE name_opt '{' pass_list '}'
|
KW_TECHNIQUE name_opt '{' passes '}'
|
||||||
{
|
{
|
||||||
if (!add_technique(ctx, $2, "technique", &@1))
|
struct hlsl_scope *scope = ctx->cur_scope;
|
||||||
|
hlsl_pop_scope(ctx);
|
||||||
|
|
||||||
|
if (!add_technique(ctx, $2, scope, "technique", &@1))
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
technique10:
|
technique10:
|
||||||
KW_TECHNIQUE10 name_opt '{' pass_list '}'
|
KW_TECHNIQUE10 name_opt '{' passes '}'
|
||||||
{
|
{
|
||||||
|
struct hlsl_scope *scope = ctx->cur_scope;
|
||||||
|
hlsl_pop_scope(ctx);
|
||||||
|
|
||||||
if (ctx->profile->type == VKD3D_SHADER_TYPE_EFFECT && ctx->profile->major_version == 2)
|
if (ctx->profile->type == VKD3D_SHADER_TYPE_EFFECT && ctx->profile->major_version == 2)
|
||||||
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX,
|
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX,
|
||||||
"The 'technique10' keyword is invalid for this profile.");
|
"The 'technique10' keyword is invalid for this profile.");
|
||||||
|
|
||||||
if (!add_technique(ctx, $2, "technique10", &@1))
|
if (!add_technique(ctx, $2, scope, "technique10", &@1))
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
technique11:
|
technique11:
|
||||||
KW_TECHNIQUE11 name_opt '{' pass_list '}'
|
KW_TECHNIQUE11 name_opt '{' passes '}'
|
||||||
{
|
{
|
||||||
|
struct hlsl_scope *scope = ctx->cur_scope;
|
||||||
|
hlsl_pop_scope(ctx);
|
||||||
|
|
||||||
if (ctx->profile->type == VKD3D_SHADER_TYPE_EFFECT && ctx->profile->major_version == 2)
|
if (ctx->profile->type == VKD3D_SHADER_TYPE_EFFECT && ctx->profile->major_version == 2)
|
||||||
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX,
|
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX,
|
||||||
"The 'technique11' keyword is invalid for this profile.");
|
"The 'technique11' keyword is invalid for this profile.");
|
||||||
|
|
||||||
if (!add_technique(ctx, $2, "technique11", &@1))
|
if (!add_technique(ctx, $2, scope, "technique11", &@1))
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user