Skip to content

Commit

Permalink
spirv: Use attributes register list for fixup locations
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Aug 27, 2024
1 parent fd72f3c commit bbb9c43
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions profiles/mojoshader_profile_spirv.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,12 +785,13 @@ static uint32 spv_access_uniform(Context *ctx, SpirvTypeIdx sti_ptr, RegisterTyp
return id_access;
} // spv_access_uniform

static void spv_add_attrib_fixup(Context *ctx, MOJOSHADER_usage usage, unsigned int index, unsigned int type_offset, unsigned int opcode_offset)
static void spv_add_attrib_fixup(Context *ctx, RegisterList *r, unsigned int type_offset, unsigned int opcode_offset)
{
uint32* next_types;
uint32* next_opcodes;

#define TYPE_LOAD_OFFSET ctx->spirv.patch_table.attrib_type_load_offsets[usage][index]
assert(r != NULL);
#define TYPE_LOAD_OFFSET ctx->spirv.patch_table.attrib_type_load_offsets[r->usage][r->index]

next_types = (uint32*) Malloc(ctx, sizeof(uint32) * (TYPE_LOAD_OFFSET.num_loads + 1));
next_opcodes = (uint32*) Malloc(ctx, sizeof(uint32) * (TYPE_LOAD_OFFSET.num_loads + 1));
Expand Down Expand Up @@ -877,8 +878,7 @@ static SpirvResult spv_loadreg(Context *ctx, RegisterList *r)
// - OpLoad's type id, to change the input type
// - OpCopyObject's opcode, to change to OpConvert if needed
spv_add_attrib_fixup(ctx,
r->usage,
r->index,
reglist_find(&ctx->attributes, r->regtype, r->regnum),
(buffer_size(ctx->mainline) >> 2) - 7,
(buffer_size(ctx->mainline) >> 2) - 4);
} // if
Expand Down

0 comments on commit bbb9c43

Please sign in to comment.