2016-03-21 14:55 GMT+01:00 Paul Gofman gofmanp@gmail.com:
+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] &
(1ul << (reg_idx % PRES_BITMASK_BLOCK_SIZE));
+}
Actually you don't want "ul" here, just "u".
+static void regstore_set_float(struct d3dx_regstore *rs, unsigned int table, unsigned int offset, float v) +{
- BYTE *p;
- unsigned int reg_idx;
- p = (BYTE *)rs->tables[table] + table_info[table].component_size * offset;
- switch (table_info[table].type)
- {
case PRES_VT_FLOAT : *(float *)p = v; break;
case PRES_VT_DOUBLE: *(double *)p = v; break;
case PRES_VT_INT : *(int *)p = roundf(v); break;
case PRES_VT_BOOL : *(BOOL *)p = !!v; break;
- }
- reg_idx = OFFSET2REG(table, offset);
- rs->table_value_set[table][reg_idx / PRES_BITMASK_BLOCK_SIZE] |=
1ul << (reg_idx % PRES_BITMASK_BLOCK_SIZE);
Same here.
+static HRESULT set_constants_param(struct d3dx_regstore *rs, struct d3dx_const_tab *const_tab,
D3DXHANDLE hc, struct d3dx_parameter *param)
+{
- ID3DXConstantTable *ctab = const_tab->ctab;
- D3DXCONSTANT_DESC desc;
- unsigned int const_count, param_count, i, j, n, table, start_offset;
- unsigned int nminor, nmajor, major_stride, inp_ind;
Nitpick, also rename nmajor/nminor to major_size or just major (resp. minor). inp_ind also feels like it has room for improvement, although I don't have any good suggestion.
+#define ARGS_ARRAY_SIZE 8 +static HRESULT execute_preshader(struct d3dx_preshader *pres) +{
- unsigned int i, j, k;
- float args[ARGS_ARRAY_SIZE];
Doesn't this need to be double to preserve the precision of the immediate operands / literals? I guess that means the regstore should also be able to return doubles.