[Mesa-dev] [PATCH 14/15] i965/vs: Always store pull constant offsets in GRFs on Gen8.

Paul Berry stereotype441 at gmail.com
Sat Nov 30 10:40:40 PST 2013


On 12 November 2013 17:51, Kenneth Graunke <kenneth at whitecape.org> wrote:

> We need to SEND from a GRF, and we can only obtain those prior to
> register allocation.
>
> This allows us to do pull constant loads without the MRF hack.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> index a036e2d..5f0d0b4 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> @@ -1582,7 +1582,13 @@ vec4_visitor::visit(ir_expression *ir)
>        src_reg surf_index =
>           src_reg(prog_data->base.binding_table.ubo_start +
> uniform_block->value.u[0]);
>        if (const_offset_ir) {
> -         offset = src_reg(const_offset / 16);
> +         if (brw->gen >= 8) {
> +            /* Put the offset in a GRF; we can't SEND from immediates. */
> +            offset = src_reg(this, glsl_type::int_type);
> +            emit(MOV(dst_reg(offset), src_reg(const_offset / 16)));
> +         } else {
> +            offset = src_reg(const_offset / 16);
> +         }
>        } else {
>           offset = src_reg(this, glsl_type::uint_type);
>           emit(SHR(dst_reg(offset), op[1], src_reg(4)));
> @@ -2983,6 +2989,11 @@
> vec4_visitor::get_pull_constant_offset(vec4_instruction *inst,
>        }
>
>        return index;
> +   } else if (brw->gen >= 8) {
> +      /* Put the offset in a GRF; we can't SEND from immediates. */
> +      src_reg offset = src_reg(this, glsl_type::int_type);
> +      emit_before(inst, MOV(dst_reg(offset), src_reg(reg_offset)));
> +      return offset;
>     } else {
>        int message_header_scale = brw->gen < 6 ? 16 : 1;
>        return src_reg(reg_offset * message_header_scale);
> --
> 1.8.3.2
>

Looking at the docs, it appears to me that SENDs from immediates have never
been allowed.  Is it possible that they have been working just by luck?
Maybe we should make this change apply regardless of brw->gen.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131130/6f84b80c/attachment.html>


More information about the mesa-dev mailing list