On Sun, Mar 22, 2015 at 6:49 PM, Jordan Justen
<jordan.l.jus...@intel.com> wrote:
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp 
> b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> index 2b1b72f..5cde8f5 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> @@ -3146,7 +3146,32 @@ fs_visitor::visit(ir_end_primitive *)
>  void
>  fs_visitor::visit(ir_barrier *)
>  {
> -   assert(!"Not implemented!");
> +   emit_barrier();
> +}
> +
> +void
> +fs_visitor::emit_barrier()
> +{
> +   assert(brw->gen >= 7);
> +
> +   /* We are getting the barrier ID from the compute shader header */
> +   assert(stage == MESA_SHADER_COMPUTE);
> +
> +   fs_reg payload = fs_reg(GRF, alloc.allocate(1), BRW_REGISTER_TYPE_UD);
> +
> +   /* Clear the message payload */
> +   fs_inst *inst = emit(MOV(payload, fs_reg(0u)));
> +   inst->force_writemask_all = true;
> +
> +   /* Copy bits 27:24 of r0.2 (barrier id) to the message payload reg.2 */
> +   struct fs_reg r0_2 = fs_reg(retype(brw_vec1_grf(0, 2), 
> BRW_REGISTER_TYPE_UD));

I was going to say that you needed to line wrap this, but you can just
remove 'struct' to reduce the line length.

> +   inst = emit(AND(component(payload, 2), r0_2, fs_reg(0x0f000000u)));
> +   inst->force_writemask_all = true;
> +
> +   /* Emit a gateway "barrier" message using the payload we set up, followed
> +    * by a wait instruction.
> +    */
> +   emit(SHADER_OPCODE_BARRIER, reg_undef, payload);
>  }
>
>  void
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to