d3dx9: Factor out regstore_set_modified_reg() function.

Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2017-05-16 19:49:19 +03:00 committed by Alexandre Julliard
parent 454a2c5c21
commit b5784f926c
1 changed files with 24 additions and 11 deletions

View File

@ -265,21 +265,13 @@ static void regstore_free_tables(struct d3dx_regstore *rs)
}
}
static void regstore_set_values(struct d3dx_regstore *rs, unsigned int table, void *data,
unsigned int start_offset, unsigned int count)
static void regstore_set_modified_reg(struct d3dx_regstore *rs, unsigned int table,
unsigned int start, unsigned int end)
{
unsigned int block_idx, start, end, start_block, end_block;
unsigned int block_idx, start_block, end_block;
if (!count)
return;
memcpy((BYTE *)rs->tables[table] + start_offset * table_info[table].component_size,
data, count * table_info[table].component_size);
start = get_reg_offset(table, start_offset);
start_block = start / PRES_BITMASK_BLOCK_SIZE;
start -= start_block * PRES_BITMASK_BLOCK_SIZE;
end = get_reg_offset(table, start_offset + count - 1);
end_block = end / PRES_BITMASK_BLOCK_SIZE;
end = (end_block + 1) * PRES_BITMASK_BLOCK_SIZE - 1 - end;
@ -298,6 +290,27 @@ static void regstore_set_values(struct d3dx_regstore *rs, unsigned int table, vo
}
}
static void regstore_set_modified(struct d3dx_regstore *rs, unsigned int table,
unsigned int start_offset, unsigned int count)
{
if (!count)
return;
regstore_set_modified_reg(rs, table, get_reg_offset(table, start_offset),
get_reg_offset(table, start_offset + count - 1));
}
static void regstore_set_values(struct d3dx_regstore *rs, unsigned int table, void *data,
unsigned int start_offset, unsigned int count)
{
if (!count)
return;
memcpy((BYTE *)rs->tables[table] + start_offset * table_info[table].component_size,
data, count * table_info[table].component_size);
regstore_set_modified(rs, table, start_offset, count);
}
static unsigned int regstore_is_val_set_reg(struct d3dx_regstore *rs, unsigned int table, unsigned int reg_idx)
{
return rs->table_value_set[table][reg_idx / PRES_BITMASK_BLOCK_SIZE] &