mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Mark vars that require non-constant dereferences.
This commit is contained in:
parent
313df300ad
commit
83c313ecc6
Notes:
Alexandre Julliard
2023-10-31 22:38:12 +01:00
Approved-by: Giovanni Mascellani (@giomasce) 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/396
@ -425,6 +425,9 @@ struct hlsl_ir_var
|
||||
* It may be less than the allocation size, e.g. for texture arrays. */
|
||||
unsigned int bind_count[HLSL_REGSET_LAST_OBJECT + 1];
|
||||
|
||||
/* Whether the shader performs dereferences with non-constant offsets in the variable. */
|
||||
bool indexable;
|
||||
|
||||
uint32_t is_input_semantic : 1;
|
||||
uint32_t is_output_semantic : 1;
|
||||
uint32_t is_uniform : 1;
|
||||
|
@ -3210,6 +3210,19 @@ static void dump_function(struct rb_entry *entry, void *context)
|
||||
rb_for_each_entry(&func->overloads, dump_function_decl, ctx);
|
||||
}
|
||||
|
||||
static bool mark_indexable_vars(struct hlsl_ctx *ctx, struct hlsl_deref *deref,
|
||||
struct hlsl_ir_node *instr)
|
||||
{
|
||||
if (!deref->rel_offset.node)
|
||||
return false;
|
||||
|
||||
assert(deref->var);
|
||||
assert(deref->rel_offset.node->type != HLSL_IR_CONSTANT);
|
||||
deref->var->indexable = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static char get_regset_name(enum hlsl_regset regset)
|
||||
{
|
||||
switch (regset)
|
||||
@ -4812,6 +4825,8 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry
|
||||
if (TRACE_ON())
|
||||
rb_for_each_entry(&ctx->functions, dump_function, ctx);
|
||||
|
||||
transform_derefs(ctx, mark_indexable_vars, body);
|
||||
|
||||
calculate_resource_register_counts(ctx);
|
||||
|
||||
allocate_register_reservations(ctx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user