[Mesa-dev] [PATCH 26/29] i965/fs: Import GLSL IR memory barrier intrinsic translation code.

Francisco Jerez currojerez at riseup.net
Sat May 2 08:29:53 PDT 2015


v2: Drop VEC4 suport.
---
 src/mesa/drivers/dri/i965/brw_fs.h           |  1 +
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index e4f3c25..3b9907e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -448,6 +448,7 @@ public:
 
    void visit_atomic_counter_intrinsic(const brw::fs_builder &bld, ir_call *ir);
    void visit_image_intrinsic(const brw::fs_builder &bld, ir_call *ir);
+   void visit_barrier_intrinsic(const brw::fs_builder &bld, ir_call *ir);
 
    const void *const key;
    const struct brw_sampler_prog_key_data *key_tex;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index f3e7ad1..82b9c6e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -3346,6 +3346,14 @@ fs_visitor::visit_image_intrinsic(const fs_builder &bld, ir_call *ir)
 }
 
 void
+fs_visitor::visit_barrier_intrinsic(const fs_builder &bld, ir_call *ir)
+{
+   const fs_reg dst = bld.half(0).vgrf(BRW_REGISTER_TYPE_UD, 2);
+   bld.emit(SHADER_OPCODE_MEMORY_FENCE, dst)
+      ->regs_written = 2;
+}
+
+void
 fs_visitor::visit(ir_call *ir)
 {
    const char *callee = ir->callee->function_name();
@@ -3374,6 +3382,9 @@ fs_visitor::visit(ir_call *ir)
               !strcmp("__intrinsic_image_atomic_comp_swap", callee)) {
       visit_image_intrinsic(bld, ir);
 
+   } else if (!strcmp("__intrinsic_memory_barrier", callee)) {
+      visit_barrier_intrinsic(bld, ir);
+
    } else {
       unreachable("Unsupported intrinsic.");
    }
-- 
2.3.5



More information about the mesa-dev mailing list