diff options
author | Eric Anholt <[email protected]> | 2014-08-18 11:23:04 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-08-18 15:27:43 -0700 |
commit | 489350e5701a4a0855e622fa12fbf3700101c5d7 (patch) | |
tree | aefc1a596eb3a032c346e2b38571530a6afc0e88 /src/gallium/drivers | |
parent | 37992a4e390bad9f7d83ce29bb7d01ad01bfc13c (diff) |
vc4: Fix handling of non-XYZW swizzles in color outputs.
The SWIZZLE_1 of the winsys destination was dereffing off the end of the
array, which surprisingly often worked out (since nobody reads the
rendered value anyway, so whatever junk was referenced in the QIR didn't
matter), but shader dumping would sometimes segfault.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_program.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index a072043b38d..f64bc06f907 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -967,12 +967,12 @@ emit_frag_end(struct tgsi_to_qir *trans) blend_color[3] = qir_uniform_f(trans, 0.5); } - struct qreg swizzled_outputs[4] = { - blend_color[format_desc->swizzle[0]], - blend_color[format_desc->swizzle[1]], - blend_color[format_desc->swizzle[2]], - blend_color[format_desc->swizzle[3]], - }; + struct qreg swizzled_outputs[4]; + for (int i = 0; i < 4; i++) { + swizzled_outputs[i] = + get_swizzled_channel(trans, blend_color, + format_desc->swizzle[i]); + } if (trans->fs_key->depth_enabled) { qir_emit(c, qir_inst(QOP_TLB_PASSTHROUGH_Z_WRITE, c->undef, |