diff options
Diffstat (limited to 'ir3test.c')
-rw-r--r-- | ir3test.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -80,9 +80,25 @@ static void shader_run(struct ir3_shader *shader, float *outputs, float *regs) { static uint32_t dwords[64 * 1024]; + static float actual_consts[ARRAY_SIZE(consts)]; uint32_t regs_count, half_regs_count; unsigned i; + /* shadow the consts used by all shaders, and overlay correct + * immediate values, so that we can compare before/after shaders + * if one uses immediates encoded in instructions or immediates + * at a different const regs (ie. sysval const changes, etc) + */ + + memcpy(actual_consts, consts, sizeof(consts)); + for (i = 0; i < shader->consts_count; i++) { + struct ir3_const *c = shader->consts[i]; + actual_consts[c->cstart->num + 0] = uif(c->val[0]); + actual_consts[c->cstart->num + 1] = uif(c->val[1]); + actual_consts[c->cstart->num + 2] = uif(c->val[2]); + actual_consts[c->cstart->num + 3] = uif(c->val[3]); + } + ir3_shader_assemble(shader, dwords, ARRAY_SIZE(dwords), info); assert(((info->max_const + 1) * 4) < ARRAY_SIZE(consts)); @@ -102,7 +118,7 @@ static void shader_run(struct ir3_shader *shader, } ir3_emu_run(dwords, shader->instrs_count, - consts, (info->max_const + 1) * 4, + actual_consts, (info->max_const + 1) * 4, regs, regs_count, half_regs_count); /* copy output values back from registers: */ |