[Mesa-dev] [PATCH 2/6] glsl: add ir reader support for ir_barrier

Marek Olšák maraeo at gmail.com
Sun Jun 14 11:22:05 PDT 2015


From: Chris Forbes <chrisf at ijw.co.nz>

Picked from the tessellation branch.
---
 src/glsl/ir_reader.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp
index fd318c0..4eae413 100644
--- a/src/glsl/ir_reader.cpp
+++ b/src/glsl/ir_reader.cpp
@@ -63,6 +63,7 @@ private:
    ir_texture *read_texture(s_expression *);
    ir_emit_vertex *read_emit_vertex(s_expression *);
    ir_end_primitive *read_end_primitive(s_expression *);
+   ir_barrier *read_barrier(s_expression *);
 
    ir_dereference *read_dereference(s_expression *);
    ir_dereference_variable *read_var_ref(s_expression *);
@@ -375,6 +376,8 @@ ir_reader::read_instruction(s_expression *expr, ir_loop *loop_ctx)
       inst = read_emit_vertex(list);
    } else if (strcmp(tag->value(), "end-primitive") == 0) {
       inst = read_end_primitive(list);
+   } else if (strcmp(tag->value(), "barrier") == 0) {
+      inst = read_barrier(list);
    } else {
       inst = read_rvalue(list);
       if (inst == NULL)
@@ -1142,3 +1145,15 @@ ir_reader::read_end_primitive(s_expression *expr)
    ir_read_error(NULL, "when reading end-primitive");
    return NULL;
 }
+
+ir_barrier *
+ir_reader::read_barrier(s_expression *expr)
+{
+   s_pattern pat[] = { "barrier" };
+
+   if (MATCH(expr, pat)) {
+      return new(mem_ctx) ir_barrier();
+   }
+   ir_read_error(NULL, "when reading barrier");
+   return NULL;
+}
-- 
2.1.0



More information about the mesa-dev mailing list