Re: [v5 3/8] d3dx9: Implement preshader parsing.
2016-03-21 14:55 GMT+01:00 Paul Gofman <gofmanp(a)gmail.com>:
Signed-off-by: Paul Gofman <gofmanp(a)gmail.com>
+enum PRES_VALUE_TYPE
Please use lowercase for type names.
+#define OFFSET2REG(table, offset) ((offset) / table_info[table].reg_component_count)
I think this could be a function instead, that's usually preferred to macros when possible. Not sure about the name, maybe get_reg_offset().
+static HRESULT regstore_alloc_table(struct d3dx_regstore *rs, unsigned int table) +{ + unsigned int sz;
Nitpick, I would just spell out "size", it's pretty short anyway.
+static void regstore_set_values(struct d3dx_regstore *rs, unsigned int table, void *data, + unsigned int start_offset, unsigned int count) +{ + unsigned int reg_idx; + + if (!count) + return; + + memcpy((BYTE *)rs->tables[table] + start_offset * table_info[table].component_size, + data, count * table_info[table].component_size); + for (reg_idx = OFFSET2REG(table, start_offset); reg_idx <= OFFSET2REG(table, start_offset + count - 1); + ++reg_idx) + rs->table_value_set[table][reg_idx / PRES_BITMASK_BLOCK_SIZE] |= + 1u << (reg_idx % PRES_BITMASK_BLOCK_SIZE);
This might be optimized, enabling each bit one by one doesn't seem very efficient.
+} + +static void dump_bytecode(void *data, unsigned int size) +{ + unsigned int *bytecode = (unsigned int *)data; + unsigned int i, j, n; + + size /= 4;
Nitpick, sizeof(*bytecode).
participants (1)
-
Matteo Bruni