mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Turn hlsl_state_block_entry arguments into hlsl_src.
This allows to apply passes that replace instructions in hlsl_state_block_entry.instrs. Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
cefd6f9de6
commit
68483d070f
Notes:
Alexandre Julliard
2024-05-08 22:49:51 +02:00
Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Elizabeth Figura (@zfigura) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/802
@ -136,7 +136,11 @@ struct hlsl_ir_var *hlsl_get_var(struct hlsl_scope *scope, const char *name)
|
||||
|
||||
static void free_state_block_entry(struct hlsl_state_block_entry *entry)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
vkd3d_free(entry->name);
|
||||
for (i = 0; i < entry->args_count; ++i)
|
||||
hlsl_src_remove(&entry->args[i]);
|
||||
vkd3d_free(entry->args);
|
||||
hlsl_block_cleanup(entry->instrs);
|
||||
vkd3d_free(entry->instrs);
|
||||
|
@ -483,7 +483,7 @@ struct hlsl_state_block_entry
|
||||
struct hlsl_block *instrs;
|
||||
|
||||
/* For assignments, arguments of the rhs initializer. */
|
||||
struct hlsl_ir_node **args;
|
||||
struct hlsl_src *args;
|
||||
unsigned int args_count;
|
||||
};
|
||||
|
||||
|
@ -6912,6 +6912,7 @@ state_block:
|
||||
| state_block stateblock_lhs_identifier state_block_index_opt '=' complex_initializer ';'
|
||||
{
|
||||
struct hlsl_state_block_entry *entry;
|
||||
unsigned int i;
|
||||
|
||||
if (!(entry = hlsl_alloc(ctx, sizeof(*entry))))
|
||||
YYABORT;
|
||||
@ -6921,8 +6922,13 @@ state_block:
|
||||
entry->lhs_index = $3.index;
|
||||
|
||||
entry->instrs = $5.instrs;
|
||||
entry->args = $5.args;
|
||||
|
||||
entry->args_count = $5.args_count;
|
||||
if (!(entry->args = hlsl_alloc(ctx, sizeof(*entry->args) * entry->args_count)))
|
||||
YYABORT;
|
||||
for (i = 0; i < entry->args_count; ++i)
|
||||
hlsl_src_from_node(&entry->args[i], $5.args[i]);
|
||||
vkd3d_free($5.args);
|
||||
|
||||
$$ = $1;
|
||||
state_block_add_entry($$, entry);
|
||||
|
Loading…
Reference in New Issue
Block a user