mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Add passes variables to the techniques.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
fe8881747b
commit
e72f8f9a30
Notes:
Alexandre Julliard
2024-01-23 23:03:22 +01:00
Approved-by: Zebediah Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/565
@ -3366,6 +3366,7 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
|
||||
{"vector", HLSL_CLASS_VECTOR, HLSL_TYPE_FLOAT, 4, 1},
|
||||
{"matrix", HLSL_CLASS_MATRIX, HLSL_TYPE_FLOAT, 4, 4},
|
||||
{"fxgroup", HLSL_CLASS_OBJECT, HLSL_TYPE_EFFECT_GROUP, 1, 1},
|
||||
{"pass", HLSL_CLASS_OBJECT, HLSL_TYPE_PASS, 1, 1},
|
||||
{"STRING", HLSL_CLASS_OBJECT, HLSL_TYPE_STRING, 1, 1},
|
||||
{"TEXTURE", HLSL_CLASS_OBJECT, HLSL_TYPE_TEXTURE, 1, 1},
|
||||
{"PIXELSHADER", HLSL_CLASS_OBJECT, HLSL_TYPE_PIXELSHADER, 1, 1},
|
||||
|
@ -95,6 +95,7 @@ enum hlsl_base_type
|
||||
HLSL_TYPE_UAV,
|
||||
HLSL_TYPE_PIXELSHADER,
|
||||
HLSL_TYPE_VERTEXSHADER,
|
||||
HLSL_TYPE_PASS,
|
||||
HLSL_TYPE_TECHNIQUE,
|
||||
HLSL_TYPE_EFFECT_GROUP,
|
||||
HLSL_TYPE_STRING,
|
||||
|
@ -1096,6 +1096,29 @@ static bool add_func_parameter(struct hlsl_ctx *ctx, struct hlsl_func_parameters
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool add_pass(struct hlsl_ctx *ctx, const char *name, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_ir_var *var;
|
||||
struct hlsl_type *type;
|
||||
|
||||
type = hlsl_get_type(ctx->globals, "pass", false, false);
|
||||
if (!(var = hlsl_new_var(ctx, name, type, loc, NULL, 0, NULL)))
|
||||
return false;
|
||||
|
||||
if (!hlsl_add_var(ctx, var, false))
|
||||
{
|
||||
struct hlsl_ir_var *old = hlsl_get_var(ctx->cur_scope, var->name);
|
||||
|
||||
hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_REDEFINED,
|
||||
"Identifier \"%s\" was already declared in this scope.", var->name);
|
||||
hlsl_note(ctx, &old->loc, VKD3D_SHADER_LOG_ERROR, "\"%s\" was previously declared here.", old->name);
|
||||
hlsl_free_var(var);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool add_technique(struct hlsl_ctx *ctx, const char *name, struct hlsl_scope *scope,
|
||||
const char *typename, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
@ -5245,6 +5268,10 @@ name_opt:
|
||||
|
||||
pass:
|
||||
KW_PASS name_opt '{' '}'
|
||||
{
|
||||
if (!add_pass(ctx, $2, &@1))
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
annotations_list:
|
||||
variables_def_typed ';'
|
||||
|
Loading…
Reference in New Issue
Block a user