mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Set default values for annotations variables.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
4d2ce385a7
commit
0f7ac0a054
Notes:
Henri Verbeet
2024-07-08 18:55:00 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/918
@ -388,6 +388,7 @@ struct hlsl_attribute
|
||||
#define HLSL_STORAGE_LINEAR 0x00010000
|
||||
#define HLSL_MODIFIER_SINGLE 0x00020000
|
||||
#define HLSL_MODIFIER_EXPORT 0x00040000
|
||||
#define HLSL_STORAGE_ANNOTATION 0x00080000
|
||||
|
||||
#define HLSL_TYPE_MODIFIERS_MASK (HLSL_MODIFIER_PRECISE | HLSL_MODIFIER_VOLATILE | \
|
||||
HLSL_MODIFIER_CONST | HLSL_MODIFIER_ROW_MAJOR | \
|
||||
@ -841,6 +842,8 @@ struct hlsl_scope
|
||||
bool loop;
|
||||
/* The scope was created for the switch statement. */
|
||||
bool _switch;
|
||||
/* The scope contains annotation variables. */
|
||||
bool annotations;
|
||||
};
|
||||
|
||||
struct hlsl_profile_info
|
||||
|
@ -2625,7 +2625,8 @@ static struct hlsl_block *initialize_vars(struct hlsl_ctx *ctx, struct list *var
|
||||
unsigned int size, k;
|
||||
|
||||
is_default_values_initializer = (ctx->cur_buffer != ctx->globals_buffer)
|
||||
|| (var->storage_modifiers & HLSL_STORAGE_UNIFORM);
|
||||
|| (var->storage_modifiers & HLSL_STORAGE_UNIFORM)
|
||||
|| ctx->cur_scope->annotations;
|
||||
|
||||
if (is_default_values_initializer)
|
||||
{
|
||||
@ -6058,19 +6059,31 @@ pass:
|
||||
|
||||
annotations_list:
|
||||
variables_def_typed ';'
|
||||
{
|
||||
struct hlsl_block *block;
|
||||
|
||||
block = initialize_vars(ctx, $1);
|
||||
destroy_block(block);
|
||||
}
|
||||
| annotations_list variables_def_typed ';'
|
||||
{
|
||||
struct hlsl_block *block;
|
||||
|
||||
block = initialize_vars(ctx, $2);
|
||||
destroy_block(block);
|
||||
}
|
||||
|
||||
annotations_opt:
|
||||
%empty
|
||||
{
|
||||
$$ = NULL;
|
||||
}
|
||||
| '<' scope_start '>'
|
||||
| '<' annotations_scope_start '>'
|
||||
{
|
||||
hlsl_pop_scope(ctx);
|
||||
$$ = NULL;
|
||||
}
|
||||
| '<' scope_start annotations_list '>'
|
||||
| '<' annotations_scope_start annotations_list '>'
|
||||
{
|
||||
struct hlsl_scope *scope = ctx->cur_scope;
|
||||
|
||||
@ -6598,6 +6611,13 @@ switch_scope_start:
|
||||
ctx->cur_scope->_switch = true;
|
||||
}
|
||||
|
||||
annotations_scope_start:
|
||||
%empty
|
||||
{
|
||||
hlsl_push_scope(ctx);
|
||||
ctx->cur_scope->annotations = true;
|
||||
}
|
||||
|
||||
var_identifier:
|
||||
VAR_IDENTIFIER
|
||||
| NEW_IDENTIFIER
|
||||
|
@ -70,7 +70,7 @@ technique10
|
||||
// Without initializer
|
||||
technique10 < int a; > {}
|
||||
|
||||
[effect fail todo]
|
||||
[effect fail]
|
||||
// Only numeric types and strings are allowed
|
||||
technique10 < DepthStencilState ds = { 0 }; > {}
|
||||
|
||||
@ -82,9 +82,9 @@ technique10 < struct s { int a; } var = { 2 }; > {}
|
||||
// Static modifier is not allowed
|
||||
technique10 < static int a = 5; > {}
|
||||
|
||||
[effect fail todo]
|
||||
[effect fail]
|
||||
// Initializer should not depend on other annotations
|
||||
technique10 < int a = 1, b = a; > {}
|
||||
|
||||
[effect fail todo]
|
||||
[effect fail]
|
||||
technique10 < int a = 1; int b = a; > {}
|
||||
|
Loading…
Reference in New Issue
Block a user