summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2015-03-19 18:25:30 +0200
committerFrancisco Jerez <currojerez@riseup.net>2015-03-23 14:09:33 +0200
commit24073b2cd7c15d989a40c1b7bc30e8be200ff328 (patch)
treef7b99ae13699d1d11dcf77d75e670f873d60aabd /src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
parent18dc59c21295a2a4acf4b69cb7e7ea502c8dd8c8 (diff)
downloadexternal_mesa3d-24073b2cd7c15d989a40c1b7bc30e8be200ff328.zip
external_mesa3d-24073b2cd7c15d989a40c1b7bc30e8be200ff328.tar.gz
external_mesa3d-24073b2cd7c15d989a40c1b7bc30e8be200ff328.tar.bz2
i965/vec4: Fix broken saturate mask check in copy propagation.
try_copy_propagate() was checking the bit of the saturate mask for the arg-th component of the source to decide whether the whole source should be saturated (WTF?). We need to swizzle the original saturate mask and check that for all enabled channels the saturate flag is either set or unset, as we cannot saturate a subset of destination components only. Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
index a1050bb..73b4f53 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -330,10 +330,17 @@ try_copy_propagate(struct brw_context *brw, vec4_instruction *inst,
if (value.equals(inst->src[arg]))
return false;
- /* Limit saturate propagation only to SEL with src1 bounded within 1.0 and 1.0
- * otherwise, skip copy propagate altogether
- */
- if (entry->saturatemask & (1 << arg)) {
+ const unsigned dst_saturate_mask = inst->dst.writemask &
+ brw_apply_swizzle_to_mask(inst->src[arg].swizzle, entry->saturatemask);
+
+ if (dst_saturate_mask) {
+ /* We either saturate all or nothing. */
+ if (dst_saturate_mask != inst->dst.writemask)
+ return false;
+
+ /* Limit saturate propagation only to SEL with src1 bounded within 1.0
+ * and 1.0 otherwise, skip copy propagate altogether
+ */
switch(inst->opcode) {
case BRW_OPCODE_SEL:
if (inst->src[1].file != IMM ||