summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2016-05-19 21:32:14 -0700
committerFrancisco Jerez <currojerez@riseup.net>2016-05-27 23:19:20 -0700
commit0bc5ad8d1997fe33dd43bb476c67163039f065ff (patch)
tree9890dfe867e6b9d3695e951f5e89edc2ff40c64d /src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
parent52cc80d85945f14d4556eb5df5b269338adf8299 (diff)
downloadexternal_mesa3d-0bc5ad8d1997fe33dd43bb476c67163039f065ff.zip
external_mesa3d-0bc5ad8d1997fe33dd43bb476c67163039f065ff.tar.gz
external_mesa3d-0bc5ad8d1997fe33dd43bb476c67163039f065ff.tar.bz2
i965/fs: Avoid constant propagation when the type sizes don't match.
The case where the source type of the instruction is smaller than the immediate type could be handled by calculating the portion of the immediate read by the instruction (assuming that the source channels are aligned with the destination channels of the copy) and then representing the same value as an immediate of the source type (assuming such an immediate type exists), but the code below doesn't do that, so just bail for the moment. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index ceaaf5f..6aec506 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -538,6 +538,14 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry)
entry->dst, entry->regs_written))
continue;
+ /* If the type sizes don't match each channel of the instruction is
+ * either extracting a portion of the constant (which could be handled
+ * with some effort but the code below doesn't) or reading multiple
+ * channels of the source at once.
+ */
+ if (type_sz(inst->src[i].type) != type_sz(entry->dst.type))
+ continue;
+
fs_reg val = entry->src;
val.type = inst->src[i].type;