[Mesa-dev] [PATCH 11/20] i965/fs: Allow emit_uniformize() to broadcast a specific channel
Francisco Jerez
currojerez at riseup.net
Sat Jul 15 00:48:55 UTC 2017
Matt Turner <mattst88 at gmail.com> writes:
> This function will be used to implement read_invocation (by specifying a
> specific channel) and read_first_invocation (by not specifying a
> channel).
> ---
> src/intel/compiler/brw_fs_builder.h | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/src/intel/compiler/brw_fs_builder.h b/src/intel/compiler/brw_fs_builder.h
> index 87394bc17b..144ee54916 100644
> --- a/src/intel/compiler/brw_fs_builder.h
> +++ b/src/intel/compiler/brw_fs_builder.h
> @@ -393,7 +393,7 @@ namespace brw {
> * Copy any live channel from \p src to the first channel of the result.
> */
> src_reg
> - emit_uniformize(const src_reg &src) const
> + emit_uniformize(const src_reg &src, dst_reg chan_index = dst_reg()) const
> {
> /* FIXME: We use a vector chan_index and dst to allow constant and
> * copy propagration to move result all the way into the consuming
> @@ -403,10 +403,13 @@ namespace brw {
> * should go back to scalar destinations here.
> */
> const fs_builder ubld = exec_all();
> - const dst_reg chan_index = vgrf(BRW_REGISTER_TYPE_UD);
> const dst_reg dst = vgrf(src.type);
>
> - ubld.emit(SHADER_OPCODE_FIND_LIVE_CHANNEL, chan_index);
> + if (chan_index.file == BAD_FILE) {
> + chan_index = vgrf(BRW_REGISTER_TYPE_UD);
> + ubld.emit(SHADER_OPCODE_FIND_LIVE_CHANNEL, chan_index);
> + }
> +
I don't like re-using emit_uniformize() (which is supposed to give you
the value of a channel of the input it can prove live as the doxygen
comment explains), as a "fetch me the i-th channel of the source"
helper. I think what you want is just BROADCAST -- Why don't you just
emit the one BROADCAST instruction yourself?
> ubld.emit(SHADER_OPCODE_BROADCAST, dst, src, component(chan_index, 0));
>
> return src_reg(component(dst, 0));
> --
> 2.13.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170714/6912eedf/attachment.sig>
More information about the mesa-dev
mailing list