diff options
author | Francisco Jerez <[email protected]> | 2015-03-20 14:16:09 +0200 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2015-05-04 17:44:17 +0300 |
commit | 046abc998c6951ea8a4aee0a2c1b832f6c877b73 (patch) | |
tree | 2ac6d41c8c3f788c9180e117170e7bdd9b4da342 /src/mesa | |
parent | 3da9f708d4f1375d674fae4d6c6eb06e4c8d9613 (diff) |
i965: Define helper function to copy an arbitrary live component from some register.
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 11 |
4 files changed, 28 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 5f4ff15ba4d..d0c0037f7a6 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -325,6 +325,8 @@ public: void emit_minmax(enum brw_conditional_mod conditionalmod, const fs_reg &dst, const fs_reg &src0, const fs_reg &src1); void emit_discard_jump(); + /** Copy any live channel from \p src to the first channel of \p dst. */ + void emit_uniformize(const fs_reg &dst, const fs_reg &src); bool try_emit_b2f_of_comparison(ir_expression *ir); bool try_emit_saturate(ir_expression *ir); bool try_emit_line(ir_expression *ir); diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 5e453a19f6b..fc05e77d32b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -335,6 +335,18 @@ fs_visitor::emit_minmax(enum brw_conditional_mod conditionalmod, const fs_reg &d } } +void +fs_visitor::emit_uniformize(const fs_reg &dst, const fs_reg &src) +{ + const fs_reg chan_index = vgrf(glsl_type::uint_type); + + emit(SHADER_OPCODE_FIND_LIVE_CHANNEL, component(chan_index, 0)) + ->force_writemask_all = true; + emit(SHADER_OPCODE_BROADCAST, component(dst, 0), + src, component(chan_index, 0)) + ->force_writemask_all = true; +} + bool fs_visitor::try_emit_saturate(ir_expression *ir) { diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h index 3f56c5cf03f..628c6313cc9 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.h +++ b/src/mesa/drivers/dri/i965/brw_vec4.h @@ -299,6 +299,9 @@ public: void emit_lrp(const dst_reg &dst, const src_reg &x, const src_reg &y, const src_reg &a); + /** Copy any live channel from \p src to the first channel of \p dst. */ + void emit_uniformize(const dst_reg &dst, const src_reg &src); + void emit_block_move(dst_reg *dst, src_reg *src, const struct glsl_type *type, brw_predicate predicate); diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index e6ff8702d0b..7e405ab6d62 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -1374,6 +1374,17 @@ vec4_visitor::emit_pull_constant_load_reg(dst_reg dst, } void +vec4_visitor::emit_uniformize(const dst_reg &dst, const src_reg &src) +{ + const src_reg chan_index(this, glsl_type::uint_type); + + emit(SHADER_OPCODE_FIND_LIVE_CHANNEL, dst_reg(chan_index)) + ->force_writemask_all = true; + emit(SHADER_OPCODE_BROADCAST, dst, src, chan_index) + ->force_writemask_all = true; +} + +void vec4_visitor::visit(ir_expression *ir) { unsigned int operand; |