[Mesa-dev] [PATCH v2 14/23] glsl: include streamId when reading/printing emit-vertex and end-primitive IR.

Iago Toral Quiroga itoral at igalia.com
Wed Jun 18 02:51:41 PDT 2014


---
 src/glsl/ir_print_visitor.cpp | 13 +++++++++----
 src/glsl/ir_reader.cpp        | 22 ++++++++++++++++++----
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index c4a6f9c..dcb53b3 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -560,13 +560,18 @@ ir_print_visitor::visit(ir_loop_jump *ir)
 }
 
 void
-ir_print_visitor::visit(ir_emit_vertex *)
+ir_print_visitor::visit(ir_emit_vertex *ir)
 {
-   fprintf(f, "(emit-vertex)");
+   fprintf(f, "(emit-vertex ");
+   ir->stream->accept(this);
+   fprintf(f, ")\n");
 }
 
 void
-ir_print_visitor::visit(ir_end_primitive *)
+ir_print_visitor::visit(ir_end_primitive *ir)
 {
-   fprintf(f, "(end-primitive)");
+   fprintf(f, "(end-primitive ");
+   ir->stream->accept(this);
+   fprintf(f, ")\n");
+
 }
diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp
index 28923f3..ba166eb 100644
--- a/src/glsl/ir_reader.cpp
+++ b/src/glsl/ir_reader.cpp
@@ -1109,10 +1109,17 @@ ir_reader::read_texture(s_expression *expr)
 ir_emit_vertex *
 ir_reader::read_emit_vertex(s_expression *expr)
 {
-   s_pattern pat[] = { "emit-vertex" };
+   s_expression *s_stream = NULL;
+
+   s_pattern pat[] = { "emit-vertex", s_stream };
 
    if (MATCH(expr, pat)) {
-      return new(mem_ctx) ir_emit_vertex();
+      ir_rvalue *stream = read_dereference(s_stream);
+      if (stream == NULL) {
+         ir_read_error(NULL, "when reading stream info in emit-vertex");
+         return NULL;
+      }
+      return new(mem_ctx) ir_emit_vertex(stream);
    }
    ir_read_error(NULL, "when reading emit-vertex");
    return NULL;
@@ -1121,10 +1128,17 @@ ir_reader::read_emit_vertex(s_expression *expr)
 ir_end_primitive *
 ir_reader::read_end_primitive(s_expression *expr)
 {
-   s_pattern pat[] = { "end-primitive" };
+   s_expression *s_stream = NULL;
+
+   s_pattern pat[] = { "end-primitive", s_stream };
 
    if (MATCH(expr, pat)) {
-      return new(mem_ctx) ir_end_primitive();
+      ir_rvalue *stream = read_dereference(s_stream);
+      if (stream == NULL) {
+         ir_read_error(NULL, "when reading stream info in end-primitive");
+         return NULL;
+      }
+      return new(mem_ctx) ir_end_primitive(stream);
    }
    ir_read_error(NULL, "when reading end-primitive");
    return NULL;
-- 
1.9.1



More information about the mesa-dev mailing list