diff options
author | Eric Anholt <[email protected]> | 2015-01-08 18:32:29 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2015-01-10 13:54:12 +1300 |
commit | 72cb6619cb75a92901d372d687505a747a384571 (patch) | |
tree | 90568090fa72cec2f3c6aa78cd274dd5453cece0 /src/gallium/drivers/vc4/vc4_program.c | |
parent | 3093bfacf042516cd2a0fa2346da1e9df5f321ec (diff) |
vc4: Restructure color packing as a series of channel replacements.
I'm using this in some WIP commits for doing blending in 8888 instead of
vec4. But it also gives us these results immediately, thanks to allowing
more uniforms/immediates in the arguments:
total instructions in shared programs: 41027 -> 40960 (-0.16%)
instructions in affected programs: 4381 -> 4314 (-1.53%)
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_program.c')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_program.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index bba02ca93f2..6bad1560b2f 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -1843,32 +1843,22 @@ emit_frag_end(struct vc4_compile *c) qir_TLB_Z_WRITE(c, z); } - bool color_written = false; + struct qreg packed_color = c->undef; for (int i = 0; i < 4; i++) { - if (swizzled_outputs[i].file != QFILE_NULL) - color_written = true; - } - - struct qreg packed_color; - if (color_written) { - /* Fill in any undefined colors. The simulator will assertion - * fail if we read something that wasn't written, and I don't - * know what hardware does. - */ - for (int i = 0; i < 4; i++) { - if (swizzled_outputs[i].file == QFILE_NULL) - swizzled_outputs[i] = qir_uniform_f(c, 0.0); + if (swizzled_outputs[i].file == QFILE_NULL) + continue; + if (packed_color.file == QFILE_NULL) { + packed_color = qir_PACK_8888_F(c, swizzled_outputs[i]); + } else { + packed_color = qir_PACK_8_F(c, + packed_color, + swizzled_outputs[i], + i); } - packed_color = qir_get_temp(c); - qir_emit(c, qir_inst4(QOP_PACK_COLORS, packed_color, - swizzled_outputs[0], - swizzled_outputs[1], - swizzled_outputs[2], - swizzled_outputs[3])); - } else { - packed_color = qir_uniform_ui(c, 0); } + if (packed_color.file == QFILE_NULL) + packed_color = qir_uniform_ui(c, 0); if (c->fs_key->logicop_func != PIPE_LOGICOP_COPY) { packed_color = vc4_logicop(c, packed_color, packed_dst_color); |