aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2014-08-27 11:32:08 -0700
committerJordan Justen <[email protected]>2015-06-12 15:12:40 -0700
commitf7ef8ec9d8f56b77029534952628c3204c4d5f63 (patch)
tree2bc0d2234d10f0a63b53687016d8b92fae8d42b3 /src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
parent7953c000731ec1310fdbb5d8a13720fe0cdbf6f4 (diff)
i965/fs: Implement support for ir_barrier
Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_visitor.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_visitor.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 588966b66f1..4770838b26f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -1953,6 +1953,29 @@ fs_visitor::emit_cs_terminate()
inst->eot = true;
}
+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 = bld.exec_all().MOV(payload, fs_reg(0u));
+
+ /* Copy bits 27:24 of r0.2 (barrier id) to the message payload reg.2 */
+ fs_reg r0_2 = fs_reg(retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_UD));
+ inst = bld.exec_all().AND(component(payload, 2), r0_2, fs_reg(0x0f000000u));
+
+ /* Emit a gateway "barrier" message using the payload we set up, followed
+ * by a wait instruction.
+ */
+ bld.exec_all().emit(SHADER_OPCODE_BARRIER, reg_undef, payload);
+}
+
fs_visitor::fs_visitor(struct brw_context *brw,
void *mem_ctx,
gl_shader_stage stage,