aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorChris Forbes <[email protected]>2014-09-07 19:24:15 +1200
committerJordan Justen <[email protected]>2015-06-12 15:12:39 -0700
commite7f628c2fc5ef42672e3281e224226c3d47b1bac (patch)
treeb997789e7f662e37ac6b89ca220275cc31244984 /src/glsl
parent86b4acb409a2103d6a12f83de7ec04af6cc05fec (diff)
glsl: Add ir node for barrier
v2: * Changes suggested by mattst88 [[email protected]: Add nir support] Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Ben Widawsky <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ir.h24
-rw-r--r--src/glsl/ir_hierarchical_visitor.cpp9
-rw-r--r--src/glsl/ir_hierarchical_visitor.h1
-rw-r--r--src/glsl/ir_hv_accept.cpp6
-rw-r--r--src/glsl/ir_print_visitor.cpp5
-rw-r--r--src/glsl/ir_print_visitor.h1
-rw-r--r--src/glsl/ir_visitor.h2
-rw-r--r--src/glsl/nir/glsl_to_nir.cpp7
8 files changed, 55 insertions, 0 deletions
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index fab1cd2d291..f9045553501 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -78,6 +78,7 @@ enum ir_node_type {
ir_type_discard,
ir_type_emit_vertex,
ir_type_end_primitive,
+ ir_type_barrier,
ir_type_max, /**< maximum ir_type enum number, for validation */
ir_type_unset = ir_type_max
};
@@ -2396,6 +2397,29 @@ public:
ir_rvalue *stream;
};
+/**
+ * IR instruction for tessellation control and compute shader barrier.
+ */
+class ir_barrier : public ir_instruction {
+public:
+ ir_barrier()
+ : ir_instruction(ir_type_barrier)
+ {
+ }
+
+ virtual void accept(ir_visitor *v)
+ {
+ v->visit(this);
+ }
+
+ virtual ir_barrier *clone(void *mem_ctx, struct hash_table *) const
+ {
+ return new(mem_ctx) ir_barrier();
+ }
+
+ virtual ir_visitor_status accept(ir_hierarchical_visitor *);
+};
+
/*@}*/
/**
diff --git a/src/glsl/ir_hierarchical_visitor.cpp b/src/glsl/ir_hierarchical_visitor.cpp
index adb629414a2..1d23a776643 100644
--- a/src/glsl/ir_hierarchical_visitor.cpp
+++ b/src/glsl/ir_hierarchical_visitor.cpp
@@ -80,6 +80,15 @@ ir_hierarchical_visitor::visit(ir_dereference_variable *ir)
}
ir_visitor_status
+ir_hierarchical_visitor::visit(ir_barrier *ir)
+{
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
+
+ return visit_continue;
+}
+
+ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_loop *ir)
{
if (this->callback_enter != NULL)
diff --git a/src/glsl/ir_hierarchical_visitor.h b/src/glsl/ir_hierarchical_visitor.h
index cac78698e73..28517b6e4f4 100644
--- a/src/glsl/ir_hierarchical_visitor.h
+++ b/src/glsl/ir_hierarchical_visitor.h
@@ -87,6 +87,7 @@ public:
virtual ir_visitor_status visit(class ir_variable *);
virtual ir_visitor_status visit(class ir_constant *);
virtual ir_visitor_status visit(class ir_loop_jump *);
+ virtual ir_visitor_status visit(class ir_barrier *);
/**
* ir_dereference_variable isn't technically a leaf, but it is treated as a
diff --git a/src/glsl/ir_hv_accept.cpp b/src/glsl/ir_hv_accept.cpp
index be5b3eaa00d..d3662cf5063 100644
--- a/src/glsl/ir_hv_accept.cpp
+++ b/src/glsl/ir_hv_accept.cpp
@@ -429,3 +429,9 @@ ir_end_primitive::accept(ir_hierarchical_visitor *v)
return (s == visit_stop) ? s : v->visit_leave(this);
}
+
+ir_visitor_status
+ir_barrier::accept(ir_hierarchical_visitor *v)
+{
+ return v->visit(this);
+}
diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index 01f52e85f4a..f5de6ac065b 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -573,5 +573,10 @@ ir_print_visitor::visit(ir_end_primitive *ir)
fprintf(f, "(end-primitive ");
ir->stream->accept(this);
fprintf(f, ")\n");
+}
+void
+ir_print_visitor::visit(ir_barrier *ir)
+{
+ fprintf(f, "(barrier)\n");
}
diff --git a/src/glsl/ir_print_visitor.h b/src/glsl/ir_print_visitor.h
index 98f041d1a7f..965e63ade8b 100644
--- a/src/glsl/ir_print_visitor.h
+++ b/src/glsl/ir_print_visitor.h
@@ -71,6 +71,7 @@ public:
virtual void visit(ir_loop_jump *);
virtual void visit(ir_emit_vertex *);
virtual void visit(ir_end_primitive *);
+ virtual void visit(ir_barrier *);
/*@}*/
private:
diff --git a/src/glsl/ir_visitor.h b/src/glsl/ir_visitor.h
index 40f96ffbca0..7c38481cd53 100644
--- a/src/glsl/ir_visitor.h
+++ b/src/glsl/ir_visitor.h
@@ -65,6 +65,7 @@ public:
virtual void visit(class ir_loop_jump *) = 0;
virtual void visit(class ir_emit_vertex *) = 0;
virtual void visit(class ir_end_primitive *) = 0;
+ virtual void visit(class ir_barrier *) = 0;
/*@}*/
};
@@ -85,6 +86,7 @@ public:
virtual void visit(class ir_call *) {}
virtual void visit(class ir_emit_vertex *) {}
virtual void visit(class ir_end_primitive *) {}
+ virtual void visit(class ir_barrier *) {}
};
#endif /* __cplusplus */
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index ad8cfad627b..3c7284e8ca5 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -65,6 +65,7 @@ public:
virtual void visit(ir_dereference_variable *);
virtual void visit(ir_dereference_record *);
virtual void visit(ir_dereference_array *);
+ virtual void visit(ir_barrier *);
void create_function(ir_function *ir);
@@ -1889,3 +1890,9 @@ nir_visitor::visit(ir_dereference_array *ir)
ralloc_steal(this->deref_tail, deref);
this->deref_tail = &deref->deref;
}
+
+void
+nir_visitor::visit(ir_barrier *ir)
+{
+ unreachable("Not implemented!");
+}