mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Leave offset empty for array and struct derefs.
This commit is contained in:
parent
7c1c2e6cc4
commit
315966dc21
Notes:
Alexandre Julliard
2023-02-22 21:51:16 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/66
@ -125,6 +125,7 @@ static struct hlsl_ir_node *new_offset_instr_from_deref(struct hlsl_ctx *ctx, st
|
|||||||
static void replace_deref_path_with_offset(struct hlsl_ctx *ctx, struct hlsl_deref *deref,
|
static void replace_deref_path_with_offset(struct hlsl_ctx *ctx, struct hlsl_deref *deref,
|
||||||
struct hlsl_ir_node *instr)
|
struct hlsl_ir_node *instr)
|
||||||
{
|
{
|
||||||
|
const struct hlsl_type *type;
|
||||||
struct hlsl_ir_node *offset;
|
struct hlsl_ir_node *offset;
|
||||||
struct hlsl_block block;
|
struct hlsl_block block;
|
||||||
|
|
||||||
@ -134,6 +135,16 @@ static void replace_deref_path_with_offset(struct hlsl_ctx *ctx, struct hlsl_der
|
|||||||
/* register offsets shouldn't be used before this point is reached. */
|
/* register offsets shouldn't be used before this point is reached. */
|
||||||
assert(!deref->offset.node);
|
assert(!deref->offset.node);
|
||||||
|
|
||||||
|
type = hlsl_deref_get_type(ctx, deref);
|
||||||
|
|
||||||
|
/* Instructions that directly refer to structs or arrays (instead of single-register components)
|
||||||
|
* are removed later by dce. So it is not a problem to just cleanup their derefs. */
|
||||||
|
if (type->type == HLSL_CLASS_STRUCT || type->type == HLSL_CLASS_ARRAY)
|
||||||
|
{
|
||||||
|
hlsl_cleanup_deref(deref);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(offset = new_offset_instr_from_deref(ctx, &block, deref, &instr->loc)))
|
if (!(offset = new_offset_instr_from_deref(ctx, &block, deref, &instr->loc)))
|
||||||
return;
|
return;
|
||||||
list_move_before(&instr->entry, &block.instrs);
|
list_move_before(&instr->entry, &block.instrs);
|
||||||
|
Loading…
Reference in New Issue
Block a user